2 #ifndef REST_TRESTGEANT4GEOMETRYINFO_H
3 #define REST_TRESTGEANT4GEOMETRYINFO_H
12 class G4VPhysicalVolume;
18 bool fIsAssembly =
false;
20 std::map<Int_t, TString> fVolumeNameMap = {};
21 std::map<TString, Int_t> fVolumeNameReverseMap = {};
23 void PopulateFromGeant4World(
const G4VPhysicalVolume*);
25 inline void InitializeOnDetectorConstruction(
const TString& gdmlFilename,
26 const G4VPhysicalVolume* world) {
27 PopulateFromGdml(gdmlFilename);
28 PopulateFromGeant4World(world);
33 std::vector<TString> fGdmlNewPhysicalNames;
34 std::vector<TString> fGdmlLogicalNames;
36 std::map<TString, TString>
37 fGeant4PhysicalNameToNewPhysicalNameMap;
41 std::map<TString, TString> fPhysicalToLogicalVolumeMap;
42 std::map<TString, std::vector<TString> > fLogicalToPhysicalMap;
44 std::map<TString, TString> fLogicalToMaterialMap;
45 std::map<TString, TVector3> fPhysicalToPositionInWorldMap;
50 void PopulateFromGdml(
const TString&);
52 TString GetAlternativeNameFromGeant4PhysicalName(
const TString&)
const;
53 TString GetGeant4PhysicalNameFromAlternativeName(
const TString&)
const;
55 std::vector<TString> GetAllLogicalVolumes()
const;
56 std::vector<TString> GetAllPhysicalVolumes()
const;
57 std::vector<TString> GetAllAlternativePhysicalVolumes()
const;
59 std::vector<TString> GetAllLogicalVolumesMatchingExpression(
const TString&)
const;
60 std::vector<TString> GetAllPhysicalVolumesMatchingExpression(
const TString&)
const;
62 inline bool IsValidGdmlName(
const TString& volume)
const {
63 for (
const auto& name : fGdmlNewPhysicalNames) {
71 inline bool IsValidPhysicalVolume(
const TString& volume)
const {
72 return fPhysicalToLogicalVolumeMap.count(volume) > 0;
74 inline bool IsValidLogicalVolume(
const TString& volume)
const {
75 return fLogicalToPhysicalMap.count(volume) > 0;
77 inline std::vector<TString> GetAllPhysicalVolumesFromLogical(
const TString& logicalVolume)
const {
78 if (IsValidLogicalVolume(logicalVolume)) {
79 return fLogicalToPhysicalMap.at(logicalVolume);
84 inline TVector3 GetPosition(
const TString& volume)
const {
85 return fPhysicalToPositionInWorldMap.at(volume);
88 inline bool IsAssembly()
const {
return fIsAssembly; }
90 void InsertVolumeName(Int_t
id,
const TString& volumeName);
92 TString GetVolumeFromID(Int_t
id)
const;
93 Int_t GetIDFromVolume(
const TString& volumeName)
const;
97 friend class DetectorConstruction;