]>
Commit | Line | Data |
---|---|---|
b68f7176 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
e5967ab3 | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4GeometryServices | |
7 | // ------------------------- | |
b68f7176 | 8 | // The class provides service methods for accessing to Geant4 geometry, |
9 | // namely using AliMC volumes and materials identifiers. | |
10 | ||
11 | #ifndef TG4_GEOMETRY_SERVICES_H | |
12 | #define TG4_GEOMETRY_SERVICES_H | |
13 | ||
5b6ecd36 | 14 | #include "TG4Verbose.h" |
b68f7176 | 15 | #include "TG4Globals.h" |
16 | ||
17 | #include <globals.hh> | |
18 | ||
19 | #include <Rtypes.h> | |
20 | ||
e5967ab3 | 21 | class TG4IntMap; |
22 | class TG4NameMap; | |
23 | class TG4Limits; | |
24 | class TG4G3ControlVector; | |
b68f7176 | 25 | |
26 | class G4Material; | |
b68f7176 | 27 | class G4LogicalVolume; |
7220494a | 28 | class G4VPhysicalVolume; |
e4a64a3a | 29 | class G4UserLimits; |
b68f7176 | 30 | |
5b6ecd36 | 31 | class TG4GeometryServices : public TG4Verbose |
b68f7176 | 32 | { |
33 | public: | |
e5967ab3 | 34 | TG4GeometryServices(TG4IntMap* mediumMap, TG4NameMap* nameMap); |
b68f7176 | 35 | // --> protected |
36 | // TG4GeometryServices(); | |
37 | // TG4GeometryServices(const TG4GeometryServices& right); | |
38 | virtual ~TG4GeometryServices(); | |
39 | ||
40 | // static access method | |
41 | static TG4GeometryServices* Instance(); | |
42 | ||
43 | // methods | |
e5967ab3 | 44 | // utilities |
b68f7176 | 45 | G4double* CreateG4doubleArray(Float_t* array, G4int size) const; |
46 | G4String CutName(const char* name) const; | |
e5967ab3 | 47 | G4String CutMaterialName(const char* name) const; |
48 | G4String G4ToG3VolumeName(const G4String& name) const; | |
49 | G4String GenerateLimitsName(G4int id, const G4String& medName, | |
50 | const G4String& matName) const; | |
51 | ||
b68f7176 | 52 | G4Material* MixMaterials(G4String name, G4double density, |
e5967ab3 | 53 | const TG4StringVector& matNames, |
54 | const TG4doubleVector& matWeights); | |
55 | // printing | |
56 | void PrintNameMap() const; | |
57 | void PrintLimits(const G4String& name) const; | |
58 | void PrintVolumeLimits(const G4String& volumeName) const; | |
59 | void PrintStatistics(G4bool open, G4bool close) const; | |
b68f7176 | 60 | |
7220494a | 61 | // set methods |
62 | void SetWorld(G4VPhysicalVolume* world); | |
63 | ||
b68f7176 | 64 | // get methods |
e5967ab3 | 65 | // volumes |
b68f7176 | 66 | Int_t NofG3Volumes() const; |
67 | Int_t NofG4LogicalVolumes() const; | |
68 | Int_t NofG4PhysicalVolumes() const; | |
e5967ab3 | 69 | G4bool IsSpecialControls() const; |
7220494a | 70 | G4VPhysicalVolume* GetWorld() const; |
b68f7176 | 71 | |
e5967ab3 | 72 | TG4Limits* GetLimits(G4UserLimits* limits) const; |
b68f7176 | 73 | const G4String& GetMapSecond(const G4String& name); |
74 | ||
e5967ab3 | 75 | G4LogicalVolume* FindLogicalVolume(const G4String& name, |
76 | G4bool silent = false) const; | |
77 | TG4Limits* FindLimits(const G4String& name, | |
78 | G4bool silent = false) const; | |
79 | ||
b68f7176 | 80 | // materials |
e5967ab3 | 81 | G4int GetMediumId(G4LogicalVolume* lv) const; |
b68f7176 | 82 | G4double GetEffA(G4Material* material) const; |
83 | G4double GetEffZ(G4Material* material) const; | |
e5967ab3 | 84 | G4Material* FindMaterial(G4double a, G4double z, G4double density) const; |
85 | G4Material* FindMaterial(G4double* a, G4double* z, G4double density, | |
86 | G4int nmat, G4double* wmat) const; | |
b68f7176 | 87 | |
88 | protected: | |
89 | TG4GeometryServices(); | |
90 | TG4GeometryServices(const TG4GeometryServices& right); | |
91 | ||
92 | // operators | |
93 | TG4GeometryServices& operator=(const TG4GeometryServices& right); | |
94 | ||
e5967ab3 | 95 | private: |
96 | // methods | |
97 | G4bool IsG3Volume(const G4String& lvName) const; | |
98 | G4bool CompareElement(G4double a, G4double z, const G4Element* elem) const; | |
99 | G4bool CompareMaterial(G4int nofElements, G4double density, | |
100 | const G4Material* material) const; | |
101 | G4double* ConvertAtomWeight(G4int nmat, G4double* a, G4double* wmat) const; | |
b68f7176 | 102 | |
e5967ab3 | 103 | // static data members |
104 | static TG4GeometryServices* fgInstance; //this instance | |
105 | static const G4double fgkAZTolerance; //A,Z tolerance | |
106 | static const G4double fgkDensityTolerance;//density tolerance (percentual) | |
107 | ||
b68f7176 | 108 | // data members |
7220494a | 109 | TG4IntMap* fMediumMap; //map of volumes names to medias IDs |
110 | TG4NameMap* fNameMap; //map of volumes names to modules names | |
111 | G4VPhysicalVolume* fWorld; //top pgysical volume (world) | |
b68f7176 | 112 | }; |
113 | ||
114 | // inline methods | |
115 | inline TG4GeometryServices* TG4GeometryServices::Instance() | |
116 | { return fgInstance; } | |
117 | ||
7220494a | 118 | inline void TG4GeometryServices::SetWorld(G4VPhysicalVolume* world) |
119 | { fWorld = world; } | |
120 | ||
121 | inline G4VPhysicalVolume* TG4GeometryServices::GetWorld() const | |
122 | { return fWorld; } | |
123 | ||
b68f7176 | 124 | #endif //TG4_GEOMETRY_SERVICES_H |
125 |