REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Public Member Functions | Data Fields | Private Member Functions | Private Attributes | Friends
TRestGeant4GeometryInfo Class Reference

Detailed Description

Definition at line 16 of file TRestGeant4GeometryInfo.h.

Public Member Functions

std::vector< TString > GetAllAlternativePhysicalVolumes () const
 Gets all the alternative (GDML) physical volume names. More...
 
std::vector< TString > GetAllLogicalVolumes () const
 Gets all the logical volume names. More...
 
std::vector< TString > GetAllLogicalVolumesMatchingExpression (const TString &) const
 Gets all the logical volume names matching a given regular expression. More...
 
std::vector< TString > GetAllPhysicalVolumes () const
 Gets all the (GDML) physical volume names. More...
 
std::vector< TString > GetAllPhysicalVolumesFromLogical (const TString &logicalVolume) const
 Gets all the (Geant4) physical volume names corresponding to a given logical volume name. More...
 
std::vector< TString > GetAllPhysicalVolumesMatchingExpression (const TString &) const
 Gets all the (GDML) physical volume names matching a given regular expression. More...
 
TString GetAlternativeNameFromGeant4PhysicalName (const TString &) const
 Gets the alternative physical volume name from the GDML file naming. Note that if a logical volume with daughter volumes is placed several times, their children physical volume will share the same Geant4 physical volume name but different alternative names. This method will return the first alternative name found. To get all the alternative names for a given Geant4 physical volume name, use GetAlternativeNamesFromGeant4PhysicalName(). More...
 
std::set< TString > GetAlternativeNamesFromGeant4PhysicalName (const TString &) const
 Gets all the alternative physical volume names from the GDML file naming that correspond to a given Geant4 physical volume name. Note that if a logical volume with daughter volumes is placed several times, their children physical volume will share the same Geant4 physical volume name but different alternative names. This method will return all the alternative names found. More...
 
TString GetAlternativePathFromGeant4Path (const TString &) const
 Converts a Geant4 volume path to a GDML volume path. The path is the concatenation of the names of the nested volumes from the world to the desired volume. This method is meant to handle the conversion of assembly imprints names to the GDML assembly names used in the GDML file. More...
 
TString GetGeant4PhysicalNameFromAlternativeName (const TString &) const
 
Int_t GetIDFromVolume (const TString &volumeName) const
 
TString GetPathSeparator () const
 
TVector3 GetPosition (const TString &volume) const
 Gets the position in world coordinates of a given physical volume. More...
 
TRotation GetRotation (const TString &volume) const
 Gets the rotation in world coordinates of a given physical volume. More...
 
TString GetVolumeFromID (Int_t id) const
 
void InsertVolumeName (Int_t id, const TString &volumeName)
 
bool IsAssembly () const
 
bool IsValidGdmlName (const TString &volume) const
 
bool IsValidGeant4PhysicalVolume (const TString &volume) const
 Checks if a (Geant4) physical volume name exists in the geometry. More...
 
bool IsValidLogicalVolume (const TString &volume) const
 Checks if a logical volume name exists in the geometry. More...
 
bool IsValidPhysicalVolume (const TString &volume) const
 Checks if a (GDML) physical volume name exists in the geometry. More...
 
void PopulateFromGdml (const TString &)
 
void Print (bool multiLine=false) const
 
void SetPathSeparator (const TString &separator)
 

Data Fields

std::map< TString, std::map< TString, TString > > fGdmlAssemblyToChildrenGeant4ToGdmlPhysicalNameMap
 
std::vector< TString > fGdmlLogicalNames
 Logical volume names as in the GDML file. More...
 
std::vector< TString > fGdmlNewPhysicalNames
 Physical volume names as in the GDML file. More...
 
std::map< TString, TString > fGeant4AssemblyImprintToAssemblyLogicalNameMap
 
std::map< TString, TString > fGeant4AssemblyImprintToGdmlNameMap
 
std::map< TString, TString > fLogicalToMaterialMap
 Map of logical volume name to its material name. More...
 
std::map< TString, std::vector< TString > > fLogicalToPhysicalMap
 
std::map< TString, TString > fNewPhysicalToGeant4PhysicalNameMap
 Map from new physical volume names (unique) to Geant4 physical volume names (not always unique) More...
 
std::map< TString, TString > fPhysicalToLogicalVolumeMap
 Map of GDML physical volume name to its logical volume name. More...
 
std::map< TString, TVector3 > fPhysicalToPositionInWorldMap
 Map of GDML physical volume name to its position in world coordinates. More...
 
std::map< TString, TRotation > fPhysicalToRotationInWorldMap
 Map of GDML physical volume name to its rotation in world coordinates. More...
 

Private Member Functions

void InitializeOnDetectorConstruction (const TString &gdmlFilename, const G4VPhysicalVolume *world)
 
void PopulateFromGeant4World (const G4VPhysicalVolume *)
 

Private Attributes

bool fIsAssembly = false
 
TString fPathSeparator = "_"
 
std::map< Int_t, TString > fVolumeNameMap = {}
 
std::map< TString, Int_t > fVolumeNameReverseMap = {}
 

Friends

class DetectorConstruction
 

Member Function Documentation

◆ GetAllAlternativePhysicalVolumes()

std::vector< TString > TRestGeant4GeometryInfo::GetAllAlternativePhysicalVolumes ( ) const

Gets all the alternative (GDML) physical volume names.

Returns
A vector with all the alternative (GDML) physical volume names.

Definition at line 506 of file TRestGeant4GeometryInfo.cxx.

◆ GetAllLogicalVolumes()

std::vector< TString > TRestGeant4GeometryInfo::GetAllLogicalVolumes ( ) const

Gets all the logical volume names.

Returns
A vector with all the logical volume names used in the GDML file.

Definition at line 476 of file TRestGeant4GeometryInfo.cxx.

◆ GetAllLogicalVolumesMatchingExpression()

std::vector< TString > TRestGeant4GeometryInfo::GetAllLogicalVolumesMatchingExpression ( const TString &  regularExpression) const

Gets all the logical volume names matching a given regular expression.

Parameters
regularExpressionThe regular expression to match logical volume names.
Returns
A vector with all the logical volume names matching the regular expression.

Definition at line 543 of file TRestGeant4GeometryInfo.cxx.

◆ GetAllPhysicalVolumes()

std::vector< TString > TRestGeant4GeometryInfo::GetAllPhysicalVolumes ( ) const

Gets all the (GDML) physical volume names.

Returns
A vector with all the (GDML) physical volume names used in the GDML file.

Definition at line 491 of file TRestGeant4GeometryInfo.cxx.

◆ GetAllPhysicalVolumesFromLogical()

std::vector< TString > TRestGeant4GeometryInfo::GetAllPhysicalVolumesFromLogical ( const TString &  logicalVolume) const
inline

Gets all the (Geant4) physical volume names corresponding to a given logical volume name.

Definition at line 116 of file TRestGeant4GeometryInfo.h.

◆ GetAllPhysicalVolumesMatchingExpression()

std::vector< TString > TRestGeant4GeometryInfo::GetAllPhysicalVolumesMatchingExpression ( const TString &  regularExpression) const

Gets all the (GDML) physical volume names matching a given regular expression.

Parameters
regularExpressionThe regular expression to match physical volume names.
Returns
A vector with all the (GDML) physical volume names matching the regular expression.

Definition at line 522 of file TRestGeant4GeometryInfo.cxx.

◆ GetAlternativeNameFromGeant4PhysicalName()

TString TRestGeant4GeometryInfo::GetAlternativeNameFromGeant4PhysicalName ( const TString &  geant4PhysicalName) const

Gets the alternative physical volume name from the GDML file naming. Note that if a logical volume with daughter volumes is placed several times, their children physical volume will share the same Geant4 physical volume name but different alternative names. This method will return the first alternative name found. To get all the alternative names for a given Geant4 physical volume name, use GetAlternativeNamesFromGeant4PhysicalName().

Parameters
geant4PhysicalNameThe Geant4 physical volume name.
Returns
The corresponding alternative physical volume name used in the GDML file.

Definition at line 369 of file TRestGeant4GeometryInfo.cxx.

◆ GetAlternativeNamesFromGeant4PhysicalName()

set< TString > TRestGeant4GeometryInfo::GetAlternativeNamesFromGeant4PhysicalName ( const TString &  geant4PhysicalName) const

Gets all the alternative physical volume names from the GDML file naming that correspond to a given Geant4 physical volume name. Note that if a logical volume with daughter volumes is placed several times, their children physical volume will share the same Geant4 physical volume name but different alternative names. This method will return all the alternative names found.

Parameters
geant4PhysicalNameThe Geant4 physical volume name.
Returns
A set with all the corresponding alternative physical volume names used in the GDML file.

Definition at line 389 of file TRestGeant4GeometryInfo.cxx.

◆ GetAlternativePathFromGeant4Path()

TString TRestGeant4GeometryInfo::GetAlternativePathFromGeant4Path ( const TString &  geant4Path) const

Converts a Geant4 volume path to a GDML volume path. The path is the concatenation of the names of the nested volumes from the world to the desired volume. This method is meant to handle the conversion of assembly imprints names to the GDML assembly names used in the GDML file.

Parameters
geant4PathThe Geant4 volume path.
Returns
The corresponding GDML volume path using the PV names defined in the GDML file.

Definition at line 335 of file TRestGeant4GeometryInfo.cxx.

◆ GetGeant4PhysicalNameFromAlternativeName()

TString TRestGeant4GeometryInfo::GetGeant4PhysicalNameFromAlternativeName ( const TString &  alternativeName) const

Definition at line 400 of file TRestGeant4GeometryInfo.cxx.

◆ GetIDFromVolume()

Int_t TRestGeant4GeometryInfo::GetIDFromVolume ( const TString &  volumeName) const

Definition at line 420 of file TRestGeant4GeometryInfo.cxx.

◆ GetPathSeparator()

TString TRestGeant4GeometryInfo::GetPathSeparator ( ) const
inline

Definition at line 134 of file TRestGeant4GeometryInfo.h.

◆ GetPosition()

TVector3 TRestGeant4GeometryInfo::GetPosition ( const TString &  volume) const
inline

Gets the position in world coordinates of a given physical volume.

Definition at line 124 of file TRestGeant4GeometryInfo.h.

◆ GetRotation()

TRotation TRestGeant4GeometryInfo::GetRotation ( const TString &  volume) const
inline

Gets the rotation in world coordinates of a given physical volume.

Definition at line 129 of file TRestGeant4GeometryInfo.h.

◆ GetVolumeFromID()

TString TRestGeant4GeometryInfo::GetVolumeFromID ( Int_t  id) const

Definition at line 416 of file TRestGeant4GeometryInfo.cxx.

◆ InitializeOnDetectorConstruction()

void TRestGeant4GeometryInfo::InitializeOnDetectorConstruction ( const TString &  gdmlFilename,
const G4VPhysicalVolume *  world 
)
inlineprivate

Definition at line 28 of file TRestGeant4GeometryInfo.h.

◆ InsertVolumeName()

void TRestGeant4GeometryInfo::InsertVolumeName ( Int_t  id,
const TString &  volumeName 
)

Definition at line 430 of file TRestGeant4GeometryInfo.cxx.

◆ IsAssembly()

bool TRestGeant4GeometryInfo::IsAssembly ( ) const
inline

Definition at line 133 of file TRestGeant4GeometryInfo.h.

◆ IsValidGdmlName()

bool TRestGeant4GeometryInfo::IsValidGdmlName ( const TString &  volume) const
inline

Definition at line 91 of file TRestGeant4GeometryInfo.h.

◆ IsValidGeant4PhysicalVolume()

bool TRestGeant4GeometryInfo::IsValidGeant4PhysicalVolume ( const TString &  volume) const
inline

Checks if a (Geant4) physical volume name exists in the geometry.

Definition at line 101 of file TRestGeant4GeometryInfo.h.

◆ IsValidLogicalVolume()

bool TRestGeant4GeometryInfo::IsValidLogicalVolume ( const TString &  volume) const
inline

Checks if a logical volume name exists in the geometry.

Definition at line 111 of file TRestGeant4GeometryInfo.h.

◆ IsValidPhysicalVolume()

bool TRestGeant4GeometryInfo::IsValidPhysicalVolume ( const TString &  volume) const
inline

Checks if a (GDML) physical volume name exists in the geometry.

Definition at line 106 of file TRestGeant4GeometryInfo.h.

◆ PopulateFromGdml()

void TRestGeant4GeometryInfo::PopulateFromGdml ( const TString &  gdmlFilename)

Definition at line 70 of file TRestGeant4GeometryInfo.cxx.

◆ Print()

void TRestGeant4GeometryInfo::Print ( bool  multiLine = false) const

Definition at line 435 of file TRestGeant4GeometryInfo.cxx.

◆ SetPathSeparator()

void TRestGeant4GeometryInfo::SetPathSeparator ( const TString &  separator)
inline

Definition at line 135 of file TRestGeant4GeometryInfo.h.

Friends And Related Function Documentation

◆ DetectorConstruction

friend class DetectorConstruction
friend

Definition at line 143 of file TRestGeant4GeometryInfo.h.

Field Documentation

◆ fGdmlAssemblyToChildrenGeant4ToGdmlPhysicalNameMap

std::map<TString, std::map<TString, TString> > TRestGeant4GeometryInfo::fGdmlAssemblyToChildrenGeant4ToGdmlPhysicalNameMap

Map of each assembly name to a map of Geant4 naming of the assembly daughters to their GDML physical volume names. For example: {"micromegas_assembly" -> { "mMBaseLV_pv_0" -> "mMBase", "mMBaseClosingBracketLV_pv_1" -> "mMBaseClosingBracket1"}}

Definition at line 52 of file TRestGeant4GeometryInfo.h.

◆ fGdmlLogicalNames

std::vector<TString> TRestGeant4GeometryInfo::fGdmlLogicalNames

Logical volume names as in the GDML file.

Definition at line 39 of file TRestGeant4GeometryInfo.h.

◆ fGdmlNewPhysicalNames

std::vector<TString> TRestGeant4GeometryInfo::fGdmlNewPhysicalNames

Physical volume names as in the GDML file.

Definition at line 36 of file TRestGeant4GeometryInfo.h.

◆ fGeant4AssemblyImprintToAssemblyLogicalNameMap

std::map<TString, TString> TRestGeant4GeometryInfo::fGeant4AssemblyImprintToAssemblyLogicalNameMap

Map of GDML physical volume name of an assembly to its assembly name. For example: {"micromegasRight" -> "micromegas_assembly"}

Definition at line 56 of file TRestGeant4GeometryInfo.h.

◆ fGeant4AssemblyImprintToGdmlNameMap

std::map<TString, TString> TRestGeant4GeometryInfo::fGeant4AssemblyImprintToGdmlNameMap

Map of Geant4 prefix for the assembly imprint to the GDML physical volume name of that assembly imprint. For example: {"av_1_impr_1" -> "micromegasRight" , "av_1_impr_2" -> "micromegasleft"}

Definition at line 47 of file TRestGeant4GeometryInfo.h.

◆ fIsAssembly

bool TRestGeant4GeometryInfo::fIsAssembly = false
private

Definition at line 20 of file TRestGeant4GeometryInfo.h.

◆ fLogicalToMaterialMap

std::map<TString, TString> TRestGeant4GeometryInfo::fLogicalToMaterialMap

Map of logical volume name to its material name.

Definition at line 66 of file TRestGeant4GeometryInfo.h.

◆ fLogicalToPhysicalMap

std::map<TString, std::vector<TString> > TRestGeant4GeometryInfo::fLogicalToPhysicalMap

Map of logical volume name to their Geant4 physical volume names. Note that many physical volumes can share the same logical volume.

Definition at line 63 of file TRestGeant4GeometryInfo.h.

◆ fNewPhysicalToGeant4PhysicalNameMap

std::map<TString, TString> TRestGeant4GeometryInfo::fNewPhysicalToGeant4PhysicalNameMap

Map from new physical volume names (unique) to Geant4 physical volume names (not always unique)

Definition at line 43 of file TRestGeant4GeometryInfo.h.

◆ fPathSeparator

TString TRestGeant4GeometryInfo::fPathSeparator = "_"
private

Definition at line 21 of file TRestGeant4GeometryInfo.h.

◆ fPhysicalToLogicalVolumeMap

std::map<TString, TString> TRestGeant4GeometryInfo::fPhysicalToLogicalVolumeMap

Map of GDML physical volume name to its logical volume name.

Definition at line 59 of file TRestGeant4GeometryInfo.h.

◆ fPhysicalToPositionInWorldMap

std::map<TString, TVector3> TRestGeant4GeometryInfo::fPhysicalToPositionInWorldMap

Map of GDML physical volume name to its position in world coordinates.

Definition at line 69 of file TRestGeant4GeometryInfo.h.

◆ fPhysicalToRotationInWorldMap

std::map<TString, TRotation> TRestGeant4GeometryInfo::fPhysicalToRotationInWorldMap

Map of GDML physical volume name to its rotation in world coordinates.

Definition at line 72 of file TRestGeant4GeometryInfo.h.

◆ fVolumeNameMap

std::map<Int_t, TString> TRestGeant4GeometryInfo::fVolumeNameMap = {}
private

Definition at line 23 of file TRestGeant4GeometryInfo.h.

◆ fVolumeNameReverseMap

std::map<TString, Int_t> TRestGeant4GeometryInfo::fVolumeNameReverseMap = {}
private

Definition at line 24 of file TRestGeant4GeometryInfo.h.


The documentation for this class was generated from the following files: