2#ifndef REST_TRESTGEANT4GEOMETRYINFO_H
3#define REST_TRESTGEANT4GEOMETRYINFO_H
5#include <TRestStringOutput.h>
14class G4VPhysicalVolume;
20 bool fIsAssembly =
false;
21 TString fPathSeparator =
"_";
23 std::map<Int_t, TString> fVolumeNameMap = {};
24 std::map<TString, Int_t> fVolumeNameReverseMap = {};
26 void PopulateFromGeant4World(
const G4VPhysicalVolume*);
28 inline void InitializeOnDetectorConstruction(
const TString& gdmlFilename,
29 const G4VPhysicalVolume* world) {
30 PopulateFromGdml(gdmlFilename);
31 PopulateFromGeant4World(world);
42 std::map<TString, TString>
77 void PopulateFromGdml(
const TString&);
82 TString GetGeant4PhysicalNameFromAlternativeName(
const TString&)
const;
91 inline bool IsValidGdmlName(
const TString& volume)
const {
133 inline bool IsAssembly()
const {
return fIsAssembly; }
134 inline TString GetPathSeparator()
const {
return fPathSeparator; }
135 void SetPathSeparator(
const TString& separator) { fPathSeparator = separator; }
136 void InsertVolumeName(Int_t
id,
const TString& volumeName);
138 TString GetVolumeFromID(Int_t
id)
const;
139 Int_t GetIDFromVolume(
const TString& volumeName)
const;
141 void Print(
bool multiLine =
false)
const;
143 friend class DetectorConstruction;
TRotation GetRotation(const TString &volume) const
Gets the rotation in world coordinates of a given physical volume.
std::set< TString > GetAlternativeNamesFromGeant4PhysicalName(const TString &) const
Gets all the alternative physical volume names from the GDML file naming that correspond to a given G...
std::map< TString, TString > fPhysicalToLogicalVolumeMap
Map of GDML physical volume name to its logical volume name.
bool IsValidPhysicalVolume(const TString &volume) const
Checks if a (GDML) physical volume name exists in the geometry.
TString GetAlternativePathFromGeant4Path(const TString &) const
Converts a Geant4 volume path to a GDML volume path. The path is the concatenation of the names of th...
bool IsValidGeant4PhysicalVolume(const TString &volume) const
Checks if a (Geant4) physical volume name exists in the geometry.
TVector3 GetPosition(const TString &volume) const
Gets the position in world coordinates of a given physical volume.
std::map< TString, std::vector< TString > > fLogicalToPhysicalMap
std::map< TString, TString > fGeant4AssemblyImprintToGdmlNameMap
std::vector< TString > GetAllPhysicalVolumes() const
Gets all the (GDML) physical volume names.
TString GetAlternativeNameFromGeant4PhysicalName(const TString &) const
Gets the alternative physical volume name from the GDML file naming. Note that if a logical volume wi...
std::vector< TString > GetAllAlternativePhysicalVolumes() const
Gets all the alternative (GDML) physical volume names.
std::map< TString, TString > fGeant4AssemblyImprintToAssemblyLogicalNameMap
std::vector< TString > fGdmlLogicalNames
Logical volume names as in the GDML file.
bool IsValidLogicalVolume(const TString &volume) const
Checks if a logical volume name exists in the geometry.
std::map< TString, TRotation > fPhysicalToRotationInWorldMap
Map of GDML physical volume name to its rotation in world coordinates.
std::vector< TString > GetAllPhysicalVolumesMatchingExpression(const TString &) const
Gets all the (GDML) physical volume names matching a given regular expression.
std::vector< TString > GetAllLogicalVolumes() const
Gets all the logical volume names.
std::vector< TString > GetAllLogicalVolumesMatchingExpression(const TString &) const
Gets all the logical volume names matching a given regular expression.
std::map< TString, std::map< TString, TString > > fGdmlAssemblyToChildrenGeant4ToGdmlPhysicalNameMap
std::vector< TString > fGdmlNewPhysicalNames
Physical volume names as in the GDML file.
std::map< TString, TString > fNewPhysicalToGeant4PhysicalNameMap
Map from new physical volume names (unique) to Geant4 physical volume names (not always unique)
std::map< TString, TVector3 > fPhysicalToPositionInWorldMap
Map of GDML physical volume name to its position in world coordinates.
std::vector< TString > GetAllPhysicalVolumesFromLogical(const TString &logicalVolume) const
Gets all the (Geant4) physical volume names corresponding to a given logical volume name.
std::map< TString, TString > fLogicalToMaterialMap
Map of logical volume name to its material name.