Geant4  10.02.p03
G4SDManager Class Reference

#include <G4SDManager.hh>

Collaboration diagram for G4SDManager:

Public Member Functions

 ~G4SDManager ()
 
void AddNewDetector (G4VSensitiveDetector *aSD)
 
void Activate (G4String dName, G4bool activeFlag)
 
G4int GetCollectionID (G4String colName)
 
G4int GetCollectionID (G4VHitsCollection *aHC)
 
G4VSensitiveDetector * FindSensitiveDetector (G4String dName, G4bool warning=true)
 
G4HCofThisEvent * PrepareNewEvent ()
 
void TerminateCurrentEvent (G4HCofThisEvent *HCE)
 
void AddNewCollection (G4String SDname, G4String DCname)
 
void SetVerboseLevel (G4int vl)
 
G4SDStructure * GetTreeTop () const
 
void ListTree () const
 
G4int GetCollectionCapacity () const
 
G4HCtable * GetHCtable () const
 

Static Public Member Functions

static G4SDManager * GetSDMpointer ()
 
static G4SDManager * GetSDMpointerIfExist ()
 

Protected Member Functions

 G4SDManager ()
 

Private Member Functions

 G4SDManager (const G4SDManager &)
 
G4SDManager & operator= (const G4SDManager &)
 

Private Attributes

G4SDStructure * treeTop
 
G4int verboseLevel
 
G4HCtable * HCtable
 
G4SDmessenger * theMessenger
 

Static Private Attributes

static G4ThreadLocal G4SDManager * fSDManager = nullptr
 

Detailed Description

Definition at line 50 of file G4SDManager.hh.

Constructor & Destructor Documentation

◆ G4SDManager() [1/2]

G4SDManager::G4SDManager ( )
protected

Definition at line 52 of file G4SDManager.cc.

52  :verboseLevel(0)
53 {
54  G4String topName = "/";
55  treeTop = new G4SDStructure(topName);
56  theMessenger = new G4SDmessenger(this);
57  HCtable = new G4HCtable;
58 }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
G4HCtable * HCtable
Definition: G4SDManager.hh:86
G4SDmessenger * theMessenger
Definition: G4SDManager.hh:87
G4int verboseLevel
Definition: G4SDManager.hh:85
Here is the caller graph for this function:

◆ ~G4SDManager()

G4SDManager::~G4SDManager ( )

Definition at line 60 of file G4SDManager.cc.

61 {
62  delete theMessenger;
63  delete HCtable;
64  delete treeTop;
65  theMessenger = nullptr;
66  HCtable = nullptr;
67  treeTop = nullptr;
68  fSDManager = nullptr;
69 }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
G4HCtable * HCtable
Definition: G4SDManager.hh:86
G4SDmessenger * theMessenger
Definition: G4SDManager.hh:87
static G4ThreadLocal G4SDManager * fSDManager
Definition: G4SDManager.hh:83

◆ G4SDManager() [2/2]

G4SDManager::G4SDManager ( const G4SDManager &  )
private

Member Function Documentation

◆ Activate()

void G4SDManager::Activate ( G4String  dName,
G4bool  activeFlag 
)

Definition at line 121 of file G4SDManager.cc.

122 {
123  G4String pathName = dName;
124  if( pathName(0) != '/' ) pathName.prepend("/");
125  treeTop->Activate(pathName,activeFlag);
126 }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
void Activate(G4String aName, G4bool sensitiveFlag)
G4String & prepend(const char *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddNewCollection()

void G4SDManager::AddNewCollection ( G4String  SDname,
G4String  DCname 
)

Definition at line 92 of file G4SDManager.cc.

93 {
94  G4int i = HCtable->Registor(SDname,DCname);
95  if(verboseLevel>0)
96  {
97  if(i<0) {
98  if(verboseLevel>1) G4cout << "G4SDManager::AddNewCollection : the collection <"
99  << SDname << "/" << DCname << "> has already been reginstered." << G4endl;
100  }
101  else
102  {
103  G4cout << "G4SDManager::AddNewCollection : the collection <"
104  << SDname << "/" << DCname << "> is registered at " << i << G4endl;
105  }
106  }
107 }
G4HCtable * HCtable
Definition: G4SDManager.hh:86
int G4int
Definition: G4Types.hh:78
G4int Registor(G4String SDname, G4String HCname)
Definition: G4HCtable.cc:37
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int verboseLevel
Definition: G4SDManager.hh:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddNewDetector()

void G4SDManager::AddNewDetector ( G4VSensitiveDetector *  aSD)

Definition at line 71 of file G4SDManager.cc.

72 {
73  G4int numberOfCollections = aSD->GetNumberOfCollections();
74  G4String pathName = aSD->GetPathName();
75  if( pathName(0) != '/' ) pathName.prepend("/");
76  if( pathName(pathName.length()-1) != '/' ) pathName += "/";
77  treeTop->AddNewDetector(aSD,pathName);
78  if(numberOfCollections<1) return;
79  for(G4int i=0;i<numberOfCollections;i++)
80  {
81  G4String SDname = aSD->GetName();
82  G4String DCname = aSD->GetCollectionName(i);
83  AddNewCollection(SDname,DCname);
84  }
85  if( verboseLevel > 0 )
86  {
87  G4cout << "New sensitive detector <" << aSD->GetName()
88  << "> is registered at " << pathName << G4endl;
89  }
90 }
void AddNewDetector(G4VSensitiveDetector *aSD, G4String treeStructure)
void AddNewCollection(G4String SDname, G4String DCname)
Definition: G4SDManager.cc:92
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
int G4int
Definition: G4Types.hh:78
G4int GetNumberOfCollections() const
G4String & prepend(const char *)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4String GetCollectionName(G4int id) const
G4int verboseLevel
Definition: G4SDManager.hh:85
G4String GetPathName() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindSensitiveDetector()

G4VSensitiveDetector * G4SDManager::FindSensitiveDetector ( G4String  dName,
G4bool  warning = true 
)

Definition at line 128 of file G4SDManager.cc.

129 {
130  G4String pathName = dName;
131  if( pathName(0) != '/' ) pathName.prepend("/");
132  return treeTop->FindSensitiveDetector(pathName, warning);
133 }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
G4String & prepend(const char *)
G4VSensitiveDetector * FindSensitiveDetector(G4String aName, G4bool warning=true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCollectionCapacity()

G4int G4SDManager::GetCollectionCapacity ( ) const
inline

Definition at line 99 of file G4SDManager.hh.

100  { return HCtable->entries(); }
G4int entries() const
Definition: G4HCtable.hh:66
G4HCtable * HCtable
Definition: G4SDManager.hh:86
Here is the call graph for this function:

◆ GetCollectionID() [1/2]

G4int G4SDManager::GetCollectionID ( G4String  colName)

Definition at line 135 of file G4SDManager.cc.

136 {
137  G4int id = HCtable->GetCollectionID(colName);
138  if(id==-1)
139  { G4cout << "<" << colName << "> is not found." << G4endl; }
140  else if(id==-2)
141  { G4cout << "<" << colName << "> is ambiguous." << G4endl; }
142  return id;
143 }
G4HCtable * HCtable
Definition: G4SDManager.hh:86
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int GetCollectionID(G4String HCname) const
Definition: G4HCtable.cc:46
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ GetCollectionID() [2/2]

G4int G4SDManager::GetCollectionID ( G4VHitsCollection *  aHC)

Definition at line 145 of file G4SDManager.cc.

Here is the call graph for this function:

◆ GetHCtable()

G4HCtable* G4SDManager::GetHCtable ( ) const
inline

Definition at line 101 of file G4SDManager.hh.

102  { return HCtable; }
G4HCtable * HCtable
Definition: G4SDManager.hh:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSDMpointer()

G4SDManager * G4SDManager::GetSDMpointer ( )
static

Definition at line 40 of file G4SDManager.cc.

41 {
42  if(!fSDManager)
43  {
44  fSDManager = new G4SDManager;
45  }
46  return fSDManager;
47 }
static G4ThreadLocal G4SDManager * fSDManager
Definition: G4SDManager.hh:83
Here is the call graph for this function:

◆ GetSDMpointerIfExist()

G4SDManager * G4SDManager::GetSDMpointerIfExist ( )
static

Definition at line 49 of file G4SDManager.cc.

50 { return fSDManager; }
static G4ThreadLocal G4SDManager * fSDManager
Definition: G4SDManager.hh:83
Here is the caller graph for this function:

◆ GetTreeTop()

G4SDStructure* G4SDManager::GetTreeTop ( ) const
inline

Definition at line 95 of file G4SDManager.hh.

96  { return treeTop; }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84

◆ ListTree()

void G4SDManager::ListTree ( ) const
inline

Definition at line 97 of file G4SDManager.hh.

98  { treeTop->ListTree(); }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4SDManager& G4SDManager::operator= ( const G4SDManager &  )
private
Here is the caller graph for this function:

◆ PrepareNewEvent()

G4HCofThisEvent * G4SDManager::PrepareNewEvent ( )

Definition at line 109 of file G4SDManager.cc.

110 {
112  treeTop->Initialize(HCE);
113  return HCE;
114 }
G4int entries() const
Definition: G4HCtable.hh:66
void Initialize(G4HCofThisEvent *HCE)
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
G4HCtable * HCtable
Definition: G4SDManager.hh:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVerboseLevel()

void G4SDManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 90 of file G4SDManager.hh.

91  {
92  verboseLevel = vl;
94  }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
void SetVerboseLevel(G4int vl)
G4int verboseLevel
Definition: G4SDManager.hh:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TerminateCurrentEvent()

void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent *  HCE)

Definition at line 116 of file G4SDManager.cc.

117 {
118  treeTop->Terminate(HCE);
119 }
G4SDStructure * treeTop
Definition: G4SDManager.hh:84
void Terminate(G4HCofThisEvent *HCE)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fSDManager

G4ThreadLocal G4SDManager * G4SDManager::fSDManager = nullptr
staticprivate

Definition at line 83 of file G4SDManager.hh.

◆ HCtable

G4HCtable* G4SDManager::HCtable
private

Definition at line 86 of file G4SDManager.hh.

◆ theMessenger

G4SDmessenger* G4SDManager::theMessenger
private

Definition at line 87 of file G4SDManager.hh.

◆ treeTop

G4SDStructure* G4SDManager::treeTop
private

Definition at line 84 of file G4SDManager.hh.

◆ verboseLevel

G4int G4SDManager::verboseLevel
private

Definition at line 85 of file G4SDManager.hh.


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