Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4SDServices Class Reference

Sensitive detectors services. More...

#include <TG4SDServices.h>

Public Member Functions

 TG4SDServices ()
 
 ~TG4SDServices ()
 
void MapVolume (G4LogicalVolume *lv, G4int id, G4bool fillLVToVolIdMap)
 
void MapUserSD (const G4String &volumeName, TVirtualMCSensitiveDetector *userSD)
 
void PrintStatistics (G4bool open, G4bool close) const
 
void PrintVolNameToIdMap () const
 
void PrintVolIdToLVMap () const
 
void PrintSensitiveVolumes () const
 
void PrintUserSensitiveDetectors () const
 
void SetIsStopRun (G4bool stopRun)
 
G4int GetVolumeID (const G4String &volumeName) const
 
G4int GetVolumeID (G4LogicalVolume *volume) const
 
G4int GetMediumID (G4LogicalVolume *volume) const
 
G4String GetVolumeName (G4int volumeId) const
 
G4LogicalVolume * GetLogicalVolume (G4int volumeId, G4bool warn=true) const
 
G4int GetMediumId (G4int volumeId) const
 
TVirtualMCSensitiveDetector * GetUserSD (G4String volumeName, G4bool warn=true) const
 
G4bool GetIsStopRun () const
 
Int_t NofSensitiveDetectors () const
 
TG4SensitiveDetectorGetSensitiveDetector (G4VSensitiveDetector *sd) const
 
std::set< TVirtualMCSensitiveDetector * > * GetUserSDs () const
 
Int_t NofVolDaughters (const char *volName) const
 
const char * VolDaughterName (const char *volName, Int_t i) const
 
Int_t VolDaughterCopyNo (const char *volName, Int_t i) const
 

Static Public Member Functions

static TG4SDServicesInstance ()
 
static G4int GetFirstVolumeId ()
 

Private Member Functions

 TG4SDServices (const TG4SDServices &right)
 Not implemented.
 
TG4SDServicesoperator= (const TG4SDServices &right)
 Not implemented.
 

Private Attributes

G4bool fIsStopRun
 info about run stopping by user
 
std::map< G4String, G4int > fVolNameToIdMap
 map volume name -> volume id
 
std::map< G4int, G4LogicalVolume * > fVolIdToLVMap
 map volume id -> logical volume
 
std::map< G4LogicalVolume *, G4int > fLVToVolIdMap
 map logical volume -> volume id
 
G4bool fIsUserSDs
 info about user SDs
 

Static Private Attributes

static TG4SDServicesfgInstance = 0
 this instance
 
static const G4int fgkFirstVolumeId = 1
 the first volume id
 
static G4ThreadLocal std::set< TVirtualMCSensitiveDetector * > * fgUserSDs
 vector of user SDs
 
static G4ThreadLocal std::map< G4String, TVirtualMCSensitiveDetector * > * fgUserSDMap = 0
 map volume name -> user SD
 

Detailed Description

Sensitive detectors services.

The class provides service methods for accessing to Geant4 geometry, namely using TVirtualMC volumes identifiers (implemented via TG4SensitiveDetector instances).

Author
I. Hrivnacova; IPN, Orsay

Definition at line 41 of file TG4SDServices.h.

Constructor & Destructor Documentation

◆ TG4SDServices() [1/2]

TG4SDServices::TG4SDServices ( )

Default constructor

Definition at line 38 of file TG4SDServices.cxx.

◆ ~TG4SDServices()

TG4SDServices::~TG4SDServices ( )

Destructor

Definition at line 55 of file TG4SDServices.cxx.

◆ TG4SDServices() [2/2]

TG4SDServices::TG4SDServices ( const TG4SDServices & right)
private

Not implemented.

Member Function Documentation

◆ Instance()

◆ GetFirstVolumeId()

G4int TG4SDServices::GetFirstVolumeId ( )
inlinestatic

Returns the first volume id.

Definition at line 126 of file TG4SDServices.h.

Referenced by TG4SDConstruction::MapVolumesToInstanceIds().

◆ MapVolume()

void TG4SDServices::MapVolume ( G4LogicalVolume * lv,
G4int id,
G4bool fillLVToVolIdMap )

Add the given volume in the maps. Do nothing if a given volume id or name is already present.

Definition at line 66 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::MapVolumesToInstanceIds(), and TG4SDConstruction::MapVolumesToSDIds().

◆ MapUserSD()

void TG4SDServices::MapUserSD ( const G4String & volumeName,
TVirtualMCSensitiveDetector * userSD )

Add the given user sensitive detector in the map. Print a warning if a fiven volyme name is already present

Definition at line 87 of file TG4SDServices.cxx.

Referenced by TG4SDManager::SetSensitiveDetector().

◆ PrintStatistics()

void TG4SDServices::PrintStatistics ( G4bool open,
G4bool close ) const

Print G4 SD statistics

Definition at line 120 of file TG4SDServices.cxx.

Referenced by TG4RunManager::LateInitialize().

◆ PrintVolNameToIdMap()

void TG4SDServices::PrintVolNameToIdMap ( ) const

Print volume name -> volume id map

Definition at line 133 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintVolIdToLVMap()

void TG4SDServices::PrintVolIdToLVMap ( ) const

Print volume id -> lv map

Definition at line 153 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintSensitiveVolumes()

void TG4SDServices::PrintSensitiveVolumes ( ) const

Print volumes which have defined SD

Definition at line 174 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintUserSensitiveDetectors()

void TG4SDServices::PrintUserSensitiveDetectors ( ) const

Print volumes which have defined SD

Definition at line 193 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct(), and TG4SDMessenger::SetNewValue().

◆ SetIsStopRun()

void TG4SDServices::SetIsStopRun ( G4bool stopRun)
inline

Sets flag for notifying about stopping run by a user.

Definition at line 132 of file TG4SDServices.h.

Referenced by TG4RunManager::FinishRun(), and TG4StepManager::StopRun().

◆ GetVolumeID() [1/2]

G4int TG4SDServices::GetVolumeID ( const G4String & volumeName) const

◆ GetVolumeID() [2/2]

G4int TG4SDServices::GetVolumeID ( G4LogicalVolume * volume) const

Return the volume ID of the specified logical volume. The volume ID is defined via associated sensitive detector ID or is taken from a map (if user applies sentitive volumes selection.)

Definition at line 234 of file TG4SDServices.cxx.

◆ GetMediumID()

G4int TG4SDServices::GetMediumID ( G4LogicalVolume * volume) const

Return the medium ID for the specified logical volume.

Definition at line 282 of file TG4SDServices.cxx.

Referenced by TG4StepManager::CurrentMedium().

◆ GetVolumeName()

G4String TG4SDServices::GetVolumeName ( G4int volumeId) const

Return the name of the volume with the given identifier. Give a warning in case logical volume is not associated with a sensitive detector.

Definition at line 332 of file TG4SDServices.cxx.

Referenced by TG4SDManager::VolName().

◆ GetLogicalVolume()

G4LogicalVolume * TG4SDServices::GetLogicalVolume ( G4int volumeId,
G4bool warn = true ) const

Return the first found logical volume with specified volumeId (sensitive detector ID) in G4LogicalVolumeStore.

Definition at line 352 of file TG4SDServices.cxx.

Referenced by GetMediumId(), GetVolumeName(), NofVolDaughters(), VolDaughterCopyNo(), and VolDaughterName().

◆ GetMediumId()

Int_t TG4SDServices::GetMediumId ( G4int volumeId) const

Return the material number for a given volume Id

Definition at line 375 of file TG4SDServices.cxx.

Referenced by TG4SDManager::VolId2Mate().

◆ GetUserSD()

TVirtualMCSensitiveDetector * TG4SDServices::GetUserSD ( G4String volumeName,
G4bool warn = true ) const

◆ GetIsStopRun()

G4bool TG4SDServices::GetIsStopRun ( ) const
inline

Returns flag for notifying about stopping run by a user.

Definition at line 138 of file TG4SDServices.h.

Referenced by TG4RunManager::FinishRun().

◆ NofSensitiveDetectors()

Int_t TG4SDServices::NofSensitiveDetectors ( ) const

Return the total number of sensitive detectors.

Definition at line 384 of file TG4SDServices.cxx.

Referenced by TG4SDManager::NofVolumes(), and PrintStatistics().

◆ GetSensitiveDetector()

TG4SensitiveDetector * TG4SDServices::GetSensitiveDetector ( G4VSensitiveDetector * sd) const

Check and convert type of the sensitive detector.

Definition at line 392 of file TG4SDServices.cxx.

Referenced by GetMediumID(), GetVolumeID(), TG4SteppingAction::ProcessTrackOnBoundary(), and TG4TrackingAction::UserProcessHits().

◆ GetUserSDs()

std::set< TVirtualMCSensitiveDetector * > * TG4SDServices::GetUserSDs ( ) const
inline

Returns the user SD vector

Definition at line 144 of file TG4SDServices.h.

◆ NofVolDaughters()

Int_t TG4SDServices::NofVolDaughters ( const char * volName) const

Return the number of daughter of the volume specified by name

Definition at line 411 of file TG4SDServices.cxx.

Referenced by TG4SDManager::NofVolDaughters().

◆ VolDaughterName()

const char * TG4SDServices::VolDaughterName ( const char * volName,
Int_t i ) const

Return the name of the i-th daughter of the volume specified by name.

Definition at line 424 of file TG4SDServices.cxx.

Referenced by TG4SDManager::VolDaughterName().

◆ VolDaughterCopyNo()

Int_t TG4SDServices::VolDaughterCopyNo ( const char * volName,
Int_t i ) const

Return the copyNo of the i-th daughter of the volume specified by name.

Definition at line 450 of file TG4SDServices.cxx.

Referenced by TG4SDManager::VolDaughterCopyNo().

◆ operator=()

TG4SDServices & TG4SDServices::operator= ( const TG4SDServices & right)
private

Not implemented.

Member Data Documentation

◆ fgInstance

TG4SDServices * TG4SDServices::fgInstance = 0
staticprivate

this instance

Definition at line 92 of file TG4SDServices.h.

Referenced by Instance(), TG4SDServices(), and ~TG4SDServices().

◆ fgkFirstVolumeId

const G4int TG4SDServices::fgkFirstVolumeId = 1
staticprivate

the first volume id

Definition at line 94 of file TG4SDServices.h.

Referenced by GetFirstVolumeId(), and GetVolumeID().

◆ fIsStopRun

G4bool TG4SDServices::fIsStopRun
private

info about run stopping by user

Definition at line 96 of file TG4SDServices.h.

Referenced by GetIsStopRun(), and SetIsStopRun().

◆ fVolNameToIdMap

std::map<G4String, G4int> TG4SDServices::fVolNameToIdMap
private

map volume name -> volume id

Definition at line 99 of file TG4SDServices.h.

Referenced by GetVolumeID(), MapVolume(), and PrintVolNameToIdMap().

◆ fVolIdToLVMap

std::map<G4int, G4LogicalVolume*> TG4SDServices::fVolIdToLVMap
private

map volume id -> logical volume

Definition at line 102 of file TG4SDServices.h.

Referenced by GetLogicalVolume(), MapVolume(), and PrintVolIdToLVMap().

◆ fLVToVolIdMap

std::map<G4LogicalVolume*, G4int> TG4SDServices::fLVToVolIdMap
private

map logical volume -> volume id

Definition at line 105 of file TG4SDServices.h.

Referenced by GetVolumeID(), and MapVolume().

◆ fgUserSDs

G4ThreadLocal std::set< TVirtualMCSensitiveDetector * > * TG4SDServices::fgUserSDs
staticprivate
Initial value:
=
0

vector of user SDs

Definition at line 108 of file TG4SDServices.h.

Referenced by GetUserSDs(), and MapUserSD().

◆ fgUserSDMap

G4ThreadLocal std::map< G4String, TVirtualMCSensitiveDetector * > * TG4SDServices::fgUserSDMap = 0
staticprivate

map volume name -> user SD

Definition at line 112 of file TG4SDServices.h.

Referenced by GetUserSD(), and MapUserSD().

◆ fIsUserSDs

G4bool TG4SDServices::fIsUserSDs
private

info about user SDs

Definition at line 115 of file TG4SDServices.h.

Referenced by GetMediumID(), GetVolumeID(), and MapUserSD().


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