]>
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 | ||
b68f7176 | 14 | #include "TG4Globals.h" |
15 | ||
16 | #include <globals.hh> | |
17 | ||
18 | #include <Rtypes.h> | |
19 | ||
e5967ab3 | 20 | class TG4IntMap; |
21 | class TG4NameMap; | |
22 | class TG4Limits; | |
23 | class TG4G3ControlVector; | |
b68f7176 | 24 | |
25 | class G4Material; | |
b68f7176 | 26 | class G4LogicalVolume; |
e4a64a3a | 27 | class G4UserLimits; |
b68f7176 | 28 | |
29 | class TG4GeometryServices | |
30 | { | |
31 | public: | |
e5967ab3 | 32 | TG4GeometryServices(TG4IntMap* mediumMap, TG4NameMap* nameMap); |
b68f7176 | 33 | // --> protected |
34 | // TG4GeometryServices(); | |
35 | // TG4GeometryServices(const TG4GeometryServices& right); | |
36 | virtual ~TG4GeometryServices(); | |
37 | ||
38 | // static access method | |
39 | static TG4GeometryServices* Instance(); | |
40 | ||
41 | // methods | |
e5967ab3 | 42 | // utilities |
b68f7176 | 43 | G4double* CreateG4doubleArray(Float_t* array, G4int size) const; |
44 | G4String CutName(const char* name) const; | |
e5967ab3 | 45 | G4String CutMaterialName(const char* name) const; |
46 | G4String G4ToG3VolumeName(const G4String& name) const; | |
47 | G4String GenerateLimitsName(G4int id, const G4String& medName, | |
48 | const G4String& matName) const; | |
49 | ||
b68f7176 | 50 | G4Material* MixMaterials(G4String name, G4double density, |
e5967ab3 | 51 | const TG4StringVector& matNames, |
52 | const TG4doubleVector& matWeights); | |
53 | // printing | |
54 | void PrintNameMap() const; | |
55 | void PrintLimits(const G4String& name) const; | |
56 | void PrintVolumeLimits(const G4String& volumeName) const; | |
57 | void PrintStatistics(G4bool open, G4bool close) const; | |
b68f7176 | 58 | |
59 | // get methods | |
e5967ab3 | 60 | // volumes |
b68f7176 | 61 | Int_t NofG3Volumes() const; |
62 | Int_t NofG4LogicalVolumes() const; | |
63 | Int_t NofG4PhysicalVolumes() const; | |
e5967ab3 | 64 | G4bool IsSpecialControls() const; |
b68f7176 | 65 | |
e5967ab3 | 66 | TG4Limits* GetLimits(G4UserLimits* limits) const; |
b68f7176 | 67 | const G4String& GetMapSecond(const G4String& name); |
68 | ||
e5967ab3 | 69 | G4LogicalVolume* FindLogicalVolume(const G4String& name, |
70 | G4bool silent = false) const; | |
71 | TG4Limits* FindLimits(const G4String& name, | |
72 | G4bool silent = false) const; | |
73 | ||
b68f7176 | 74 | // materials |
e5967ab3 | 75 | G4int GetMediumId(G4LogicalVolume* lv) const; |
b68f7176 | 76 | G4double GetEffA(G4Material* material) const; |
77 | G4double GetEffZ(G4Material* material) const; | |
e5967ab3 | 78 | G4Material* FindMaterial(G4double a, G4double z, G4double density) const; |
79 | G4Material* FindMaterial(G4double* a, G4double* z, G4double density, | |
80 | G4int nmat, G4double* wmat) const; | |
b68f7176 | 81 | |
82 | protected: | |
83 | TG4GeometryServices(); | |
84 | TG4GeometryServices(const TG4GeometryServices& right); | |
85 | ||
86 | // operators | |
87 | TG4GeometryServices& operator=(const TG4GeometryServices& right); | |
88 | ||
e5967ab3 | 89 | private: |
90 | // methods | |
91 | G4bool IsG3Volume(const G4String& lvName) const; | |
92 | G4bool CompareElement(G4double a, G4double z, const G4Element* elem) const; | |
93 | G4bool CompareMaterial(G4int nofElements, G4double density, | |
94 | const G4Material* material) const; | |
95 | G4double* ConvertAtomWeight(G4int nmat, G4double* a, G4double* wmat) const; | |
b68f7176 | 96 | |
e5967ab3 | 97 | // static data members |
98 | static TG4GeometryServices* fgInstance; //this instance | |
99 | static const G4double fgkAZTolerance; //A,Z tolerance | |
100 | static const G4double fgkDensityTolerance;//density tolerance (percentual) | |
101 | ||
b68f7176 | 102 | // data members |
e5967ab3 | 103 | TG4IntMap* fMediumMap; //map of volumes names to medias IDs |
104 | TG4NameMap* fNameMap; //map of volumes names to modules names | |
b68f7176 | 105 | }; |
106 | ||
107 | // inline methods | |
108 | inline TG4GeometryServices* TG4GeometryServices::Instance() | |
109 | { return fgInstance; } | |
110 | ||
111 | #endif //TG4_GEOMETRY_SERVICES_H | |
112 |