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

Sensitive detectors services. More...

#include <TG4SDServices.h>

Public Member Functions

 TG4SDServices ()
 ~TG4SDServices ()
void ClearVolumeMaps ()
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
std::vector< G4LogicalVolume * > GetLogicalVolumes (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
TG4SensitiveDetector * GetSensitiveDetector (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 TG4SDServices * Instance ()
static G4int GetFirstVolumeId ()

Private Member Functions

 TG4SDServices (const TG4SDServices &right)
 Not implemented.
TG4SDServices & operator= (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::multimap< G4int, G4LogicalVolume * > fVolIdToLVMap
 one VMC source ID -> all its Geant4 representations
std::map< G4LogicalVolume *, G4int > fLVToVolIdMap
 map logical volume -> volume id
std::vector< G4int > fInstanceToVolId
 Dense read-only stepping cache, indexed by Geant4 instance ID.
G4bool fIsUserSDs
 info about user SDs

Static Private Attributes

static TG4SDServices * fgInstance = 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 42 of file TG4SDServices.h.

Constructor & Destructor Documentation

◆ TG4SDServices() [1/2]

TG4SDServices::TG4SDServices ( )

Default constructor

Definition at line 38 of file TG4SDServices.cxx.

Referenced by Instance(), operator=(), and TG4SDServices().

◆ ~TG4SDServices()

TG4SDServices::~TG4SDServices ( )

Destructor

Definition at line 56 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 133 of file TG4SDServices.h.

Referenced by TG4SDConstruction::MapVolumesToInstanceIds().

◆ ClearVolumeMaps()

void TG4SDServices::ClearVolumeMaps ( )

Definition at line 67 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ MapVolume()

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

◆ 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 94 of file TG4SDServices.cxx.

◆ PrintStatistics()

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

Print G4 SD statistics

Definition at line 127 of file TG4SDServices.cxx.

Referenced by TG4RunManager::LateInitialize().

◆ PrintVolNameToIdMap()

void TG4SDServices::PrintVolNameToIdMap ( ) const

Print volume name -> volume id map

Definition at line 140 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintVolIdToLVMap()

void TG4SDServices::PrintVolIdToLVMap ( ) const

Print volume id -> lv map

Definition at line 160 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintSensitiveVolumes()

void TG4SDServices::PrintSensitiveVolumes ( ) const

Print volumes which have defined SD

Definition at line 181 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ PrintUserSensitiveDetectors()

void TG4SDServices::PrintUserSensitiveDetectors ( ) const

Print volumes which have defined SD

Definition at line 200 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 139 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

Definition at line 238 of file TG4SDServices.cxx.

◆ GetMediumID()

G4int TG4SDServices::GetMediumID ( G4LogicalVolume * volume) const

Return the medium ID for the specified logical volume.

Definition at line 252 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 302 of file TG4SDServices.cxx.

◆ GetLogicalVolumes()

std::vector< G4LogicalVolume * > TG4SDServices::GetLogicalVolumes ( G4int volumeId) const

Definition at line 322 of file TG4SDServices.cxx.

◆ 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 331 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 354 of file TG4SDServices.cxx.

◆ GetUserSD()

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

Definition at line 280 of file TG4SDServices.cxx.

Referenced by TG4SDConstruction::Construct().

◆ GetIsStopRun()

G4bool TG4SDServices::GetIsStopRun ( ) const
inline

Returns flag for notifying about stopping run by a user.

Definition at line 145 of file TG4SDServices.h.

Referenced by TG4RunManager::FinishRun().

◆ NofSensitiveDetectors()

Int_t TG4SDServices::NofSensitiveDetectors ( ) const

Return the total number of sensitive detectors.

Definition at line 363 of file TG4SDServices.cxx.

Referenced by PrintStatistics().

◆ GetSensitiveDetector()

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

Check and convert type of the sensitive detector.

Definition at line 371 of file TG4SDServices.cxx.

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

◆ GetUserSDs()

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

Returns the user SD vector

Definition at line 151 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 390 of file TG4SDServices.cxx.

◆ 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 403 of file TG4SDServices.cxx.

◆ 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 430 of file TG4SDServices.cxx.

◆ operator=()

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

Not implemented.

Member Data Documentation

◆ fgInstance

TG4SDServices * TG4SDServices::fgInstance = 0
staticprivate

this instance

Definition at line 96 of file TG4SDServices.h.

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

◆ fgkFirstVolumeId

const G4int TG4SDServices::fgkFirstVolumeId = 1
staticprivate

the first volume id

Definition at line 98 of file TG4SDServices.h.

Referenced by GetFirstVolumeId().

◆ fIsStopRun

G4bool TG4SDServices::fIsStopRun
private

info about run stopping by user

Definition at line 100 of file TG4SDServices.h.

Referenced by GetIsStopRun(), SetIsStopRun(), and TG4SDServices().

◆ fVolNameToIdMap

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

map volume name -> volume id

Definition at line 103 of file TG4SDServices.h.

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

◆ fVolIdToLVMap

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

one VMC source ID -> all its Geant4 representations

Definition at line 106 of file TG4SDServices.h.

Referenced by ClearVolumeMaps(), GetLogicalVolume(), GetLogicalVolumes(), MapVolume(), PrintVolIdToLVMap(), and TG4SDServices().

◆ fLVToVolIdMap

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

map logical volume -> volume id

Definition at line 109 of file TG4SDServices.h.

Referenced by ClearVolumeMaps(), MapVolume(), and TG4SDServices().

◆ fInstanceToVolId

std::vector<G4int> TG4SDServices::fInstanceToVolId
private

Dense read-only stepping cache, indexed by Geant4 instance ID.

Definition at line 112 of file TG4SDServices.h.

Referenced by ClearVolumeMaps(), GetVolumeID(), MapVolume(), and TG4SDServices().

◆ fgUserSDs

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

vector of user SDs

Definition at line 115 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 119 of file TG4SDServices.h.

Referenced by GetUserSD(), and MapUserSD().

◆ fIsUserSDs

G4bool TG4SDServices::fIsUserSDs
private

info about user SDs

Definition at line 122 of file TG4SDServices.h.

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


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