Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4GeometryServices.h
Go to the documentation of this file.
1#ifndef TG4_GEOMETRY_SERVICES_H
2#define TG4_GEOMETRY_SERVICES_H
3
4//------------------------------------------------
5// The Geant4 Virtual Monte Carlo package
6// Copyright (C) 2007 - 2014 Ivana Hrivnacova
7// All rights reserved.
8//
9// For the licensing terms see geant4_vmc/LICENSE.
10// Contact: root-vmc@cern.ch
11//-------------------------------------------------
12
17
18#include "TG4Globals.h"
19#include "TG4MediumMap.h"
20#include "TG4OpSurfaceMap.h"
21#include "TG4Verbose.h"
22
23#include <G4OpticalSurface.hh>
24#include <G4SurfaceProperty.hh>
25#include <G4Transform3D.hh>
26#include <G4Version.hh>
27#include <globals.hh>
28
29#include <Rtypes.h>
30#include <TMCOptical.h>
31
32#include <map>
33
34class TG4MediumMap;
35class TG4NameMap;
36class TG4Limits;
37class TG4G3CutVector;
39
40class G4Material;
41class G4LogicalVolume;
42class G4VPhysicalVolume;
43class G4UserLimits;
44class G4OpticalSurface;
45
46class TGeoHMatrix;
47
55
57{
58 public:
60 virtual ~TG4GeometryServices();
61
62 // static access method
64
65 // methods
66 // utilities
67 G4double* CreateG4doubleArray(Float_t* array, G4int size, G4bool copyValues = true) const;
68 G4double* CreateG4doubleArray(Double_t* array, G4int size, G4bool copyValues = true) const;
69 G4String CutName(const char* name) const;
70 G4String CutMaterialName(const char* name) const;
71 G4String CutVolumePath(
72 const G4String& volumePath, G4String& volName, G4int& copyNo) const;
73 const G4String& UserVolumeName(const G4String& name) const;
74
75 G4OpticalSurfaceModel SurfaceModel(EMCOpSurfaceModel model) const;
76 G4SurfaceType SurfaceType(EMCOpSurfaceType surfType) const;
77 G4OpticalSurfaceFinish SurfaceFinish(EMCOpSurfaceFinish finish) const;
78 void Convert(const G4Transform3D& transform, TGeoHMatrix& matrix) const;
79
80 G4Material* MixMaterials(G4String name, G4double density,
81 const TG4StringVector& matNames, const TG4doubleVector& matWeights);
82 // printing
83 void PrintLimits(const G4String& name) const;
84 void PrintVolumeLimits(const G4String& volumeName) const;
85 void PrintStatistics(G4bool open, G4bool close) const;
86 void PrintLogicalVolumeStore() const;
87 void PrintPhysicalVolumeStore() const;
88 void PrintElementTable() const;
89 void PrintMaterials() const;
90 void PrintMaterialsProperties() const;
91 void PrintMedia() const;
92 void PrintCuts(const G4String& cutName) const;
93 void PrintControls(const G4String& controlName) const;
94
95 // set methods
96 void SetWorld(G4VPhysicalVolume* world);
97 void SetIsG3toG4(G4bool isG3toG4);
98 void SetG3toG4Separator(char separator);
99
100 // get methods
101 // volumes
102 Int_t NofG3Volumes() const;
103 Int_t NofG4LogicalVolumes() const;
104 Int_t NofG4PhysicalVolumes() const;
105 G4VPhysicalVolume* GetWorld() const;
106
107 TG4Limits* GetLimits(G4UserLimits* limits) const;
108 TG4Limits* GetLimits(G4UserLimits* limits, const TG4G3CutVector& cuts,
109 const TG4G3ControlVector& controls) const;
110
111 G4LogicalVolume* FindLogicalVolume(
112 const G4String& name, G4bool silent = false) const;
113 G4VPhysicalVolume* FindPhysicalVolume(
114 const G4String& name, G4int copyNo, G4bool silent = false) const;
115 G4VPhysicalVolume* FindDaughter(const G4String& name, G4int copyNo,
116 G4LogicalVolume* mlv, G4bool silent = false) const;
117 TG4Limits* FindLimits(const G4String& name, G4bool silent = false) const;
118 TG4Limits* FindLimits2(const G4String& name, G4bool silent = false) const;
119 TG4Limits* FindLimits(const G4Material*, G4bool silent = false) const;
120
121 // materials
122 G4int GetMediumId(G4LogicalVolume* lv) const;
123 G4double GetEffA(G4Material* material) const;
124 G4double GetEffZ(G4Material* material) const;
125 G4Material* FindMaterial(G4double a, G4double z, G4double density) const;
126 G4Material* FindMaterial(G4double* a, G4double* z, G4double density,
127 G4int nmat, G4double* wmat) const;
128
129 TG4MediumMap* GetMediumMap() const;
131
132 private:
137
138 // methods
139 G4bool IsG3Volume(const G4String& lvName) const;
140 G4bool CompareElement(G4double a, G4double z, const G4Element* elem) const;
141 G4bool CompareMaterial(
142 G4int nofElements, G4double density, const G4Material* material) const;
143 G4double* ConvertAtomWeight(G4int nmat, G4double* a, G4double* wmat) const;
144
145 // static data members
147 static G4String fgBuffer;
148 static const G4double fgkAZTolerance;
149 static const G4double fgkDensityTolerance;
150
151 //
152 // data members
153
155 G4bool fIsG3toG4;
156
159
162
164 G4VPhysicalVolume* fWorld;
165};
166
167// inline methods
168
174
175inline void TG4GeometryServices::SetWorld(G4VPhysicalVolume* world)
176{
178 fWorld = world;
179}
180
181inline void TG4GeometryServices::SetIsG3toG4(G4bool isG3toG4)
182{
184 fIsG3toG4 = isG3toG4;
185}
186
187inline G4VPhysicalVolume* TG4GeometryServices::GetWorld() const
188{
190 return fWorld;
191}
192
194{
196 return fMediumMap;
197}
198
204
205#endif // TG4_GEOMETRY_SERVICES_H
Definition of the TG4Globals class and basic container types.
Definition of the TG4MediumMap class.
Definition of the TG4OpSurfaceMap typedef.
Definition of the TG4Verbose class.
Vector of control process values with convenient set/get methods.
Vector of kinetic energy cut values with convenient set/get methods.
Services for accessing to Geant4 geometry.
void PrintControls(const G4String &controlName) const
G4VPhysicalVolume * GetWorld() const
G4String CutVolumePath(const G4String &volumePath, G4String &volName, G4int &copyNo) const
static const G4double fgkDensityTolerance
density tolerance (percentual)
static TG4GeometryServices * fgInstance
this instance
TG4OpSurfaceMap * fOpSurfaceMap
map of optical surfaces names to their objects
void PrintPhysicalVolumeStore() const
TG4MediumMap * fMediumMap
map of madia
TG4Limits * FindLimits(const G4String &name, G4bool silent=false) const
G4Material * FindMaterial(G4double a, G4double z, G4double density) const
G4OpticalSurfaceFinish SurfaceFinish(EMCOpSurfaceFinish finish) const
G4double * ConvertAtomWeight(G4int nmat, G4double *a, G4double *wmat) const
G4int GetMediumId(G4LogicalVolume *lv) const
G4Material * MixMaterials(G4String name, G4double density, const TG4StringVector &matNames, const TG4doubleVector &matWeights)
G4bool IsG3Volume(const G4String &lvName) const
G4double * CreateG4doubleArray(Float_t *array, G4int size, G4bool copyValues=true) const
void SetWorld(G4VPhysicalVolume *world)
TG4GeometryServices & operator=(const TG4GeometryServices &right)
Not implemented.
void PrintStatistics(G4bool open, G4bool close) const
G4LogicalVolume * FindLogicalVolume(const G4String &name, G4bool silent=false) const
const G4String & UserVolumeName(const G4String &name) const
G4String CutName(const char *name) const
static TG4GeometryServices * Instance()
G4SurfaceType SurfaceType(EMCOpSurfaceType surfType) const
TG4Limits * FindLimits2(const G4String &name, G4bool silent=false) const
G4bool CompareElement(G4double a, G4double z, const G4Element *elem) const
void PrintLimits(const G4String &name) const
void PrintMaterialsProperties() const
G4VPhysicalVolume * FindPhysicalVolume(const G4String &name, G4int copyNo, G4bool silent=false) const
TG4Limits * GetLimits(G4UserLimits *limits) const
G4bool fIsG3toG4
info if user geometry is defined via G3toG4
G4VPhysicalVolume * FindDaughter(const G4String &name, G4int copyNo, G4LogicalVolume *mlv, G4bool silent=false) const
void SetG3toG4Separator(char separator)
void SetIsG3toG4(G4bool isG3toG4)
G4VPhysicalVolume * fWorld
top physical volume (world)
static const G4double fgkAZTolerance
A,Z tolerance.
TG4GeometryServices(const TG4GeometryServices &right)
Not implemented.
G4double GetEffA(G4Material *material) const
G4bool CompareMaterial(G4int nofElements, G4double density, const G4Material *material) const
G4String CutMaterialName(const char *name) const
void PrintVolumeLimits(const G4String &volumeName) const
G4OpticalSurfaceModel SurfaceModel(EMCOpSurfaceModel model) const
TG4MediumMap * GetMediumMap() const
void PrintCuts(const G4String &cutName) const
TG4OpSurfaceMap * GetOpSurfaceMap() const
void Convert(const G4Transform3D &transform, TGeoHMatrix &matrix) const
G4double GetEffZ(G4Material *material) const
static G4String fgBuffer
string buffer
Extended G4UserLimits class.
Definition TG4Limits.h:38
The map of media to logical volumes.
The map container for associated names.
Definition TG4NameMap.h:31
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
std::map< G4String, G4OpticalSurface * > TG4OpSurfaceMap
The map between optical surfaces names and their objects.
std::vector< G4String > TG4StringVector
Definition TG4Globals.h:49
std::vector< G4double > TG4doubleVector
Definition TG4Globals.h:45