Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SDManager Class Reference

#include <G4SDManager.hh>

Public Member Functions

 ~G4SDManager ()
 
void AddNewDetector (G4VSensitiveDetector *aSD)
 
void Activate (G4String dName, G4bool activeFlag)
 
G4int GetCollectionID (G4String colName)
 
G4int GetCollectionID (G4VHitsCollection *aHC)
 
G4VSensitiveDetectorFindSensitiveDetector (G4String dName, G4bool warning=true)
 
G4HCofThisEventPrepareNewEvent ()
 
void TerminateCurrentEvent (G4HCofThisEvent *HCE)
 
void AddNewCollection (G4String SDname, G4String DCname)
 
void SetVerboseLevel (G4int vl)
 
G4SDStructureGetTreeTop () const
 
void ListTree () const
 
G4int GetCollectionCapacity () const
 
G4HCtableGetHCtable () const
 
void RegisterSDFilter (G4VSDFilter *filter)
 
void DeRegisterSDFilter (G4VSDFilter *filter)
 

Static Public Member Functions

static G4SDManagerGetSDMpointer ()
 
static G4SDManagerGetSDMpointerIfExist ()
 

Protected Member Functions

 G4SDManager ()
 

Detailed Description

Definition at line 52 of file G4SDManager.hh.

Constructor & Destructor Documentation

◆ G4SDManager()

G4SDManager::G4SDManager ( )
protected

Definition at line 49 of file G4SDManager.cc.

50 : verboseLevel(0)
51{
52 G4String topName = "/";
53 treeTop = new G4SDStructure(topName);
54 theMessenger = new G4SDmessenger(this);
55 HCtable = new G4HCtable;
56}

Referenced by GetSDMpointer().

◆ ~G4SDManager()

G4SDManager::~G4SDManager ( )

Definition at line 58 of file G4SDManager.cc.

59{
60 delete theMessenger;
61 delete HCtable;
62 delete treeTop;
63 DestroyFilters();
64 theMessenger = nullptr;
65 HCtable = nullptr;
66 treeTop = nullptr;
67 fSDManager = nullptr;
68}

Member Function Documentation

◆ Activate()

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

Definition at line 125 of file G4SDManager.cc.

126{
127 G4String pathName = dName;
128 if(pathName[0] != '/')
129 pathName.insert(0, "/");
130 treeTop->Activate(pathName, activeFlag);
131}
void Activate(const G4String &aName, G4bool sensitiveFlag)

Referenced by G4RTRunAction::BeginOfRunAction(), G4RTRunAction::EndOfRunAction(), G4TheRayTracer::RestoreUserActions(), G4SDmessenger::SetNewValue(), and G4TheRayTracer::StoreUserActions().

◆ AddNewCollection()

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

Definition at line 94 of file G4SDManager.cc.

95{
96 G4int i = HCtable->Registor(SDname, DCname);
97 if(verboseLevel > 0)
98 {
99 if(i < 0)
100 {
101 if(verboseLevel > 1)
102 G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname
103 << "/" << DCname << "> has already been reginstered." << G4endl;
104 }
105 else
106 {
107 G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname
108 << "/" << DCname << "> is registered at " << i << G4endl;
109 }
110 }
111}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4int Registor(G4String SDname, G4String HCname)
Definition: G4HCtable.cc:36

Referenced by AddNewDetector(), and G4MultiFunctionalDetector::RegisterPrimitive().

◆ AddNewDetector()

void G4SDManager::AddNewDetector ( G4VSensitiveDetector aSD)

Definition at line 70 of file G4SDManager.cc.

71{
72 G4int numberOfCollections = aSD->GetNumberOfCollections();
73 G4String pathName = aSD->GetPathName();
74 if(pathName[0] != '/')
75 pathName.insert(0, "/");
76 if(pathName.back() != '/')
77 pathName += "/";
78 treeTop->AddNewDetector(aSD, pathName);
79 if(numberOfCollections < 1)
80 return;
81 for(G4int i = 0; i < numberOfCollections; i++)
82 {
83 G4String SDname = aSD->GetName();
84 G4String DCname = aSD->GetCollectionName(i);
85 AddNewCollection(SDname, DCname);
86 }
87 if(verboseLevel > 0)
88 {
89 G4cout << "New sensitive detector <" << aSD->GetName()
90 << "> is registered at " << pathName << G4endl;
91 }
92}
void AddNewCollection(G4String SDname, G4String DCname)
Definition: G4SDManager.cc:94
void AddNewDetector(G4VSensitiveDetector *aSD, const G4String &treeStructure)
G4int GetNumberOfCollections() const
G4String GetCollectionName(G4int id) const
G4String GetPathName() const

Referenced by G4VScoringMesh::G4VScoringMesh(), G4VUserDetectorConstruction::SetSensitiveDetector(), and G4VUserParallelWorld::SetSensitiveDetector().

◆ DeRegisterSDFilter()

void G4SDManager::DeRegisterSDFilter ( G4VSDFilter filter)

Definition at line 169 of file G4SDManager.cc.

170{
171 for(auto f = FilterList.begin(); f != FilterList.end(); f++)
172 {
173 if(*f == filter)
174 {
175 FilterList.erase(f);
176 break;
177 }
178 }
179}

Referenced by G4VSDFilter::~G4VSDFilter().

◆ FindSensitiveDetector()

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

Definition at line 133 of file G4SDManager.cc.

135{
136 G4String pathName = dName;
137 if(pathName[0] != '/')
138 pathName.insert(0, "/");
139 return treeTop->FindSensitiveDetector(pathName, warning);
140}
G4VSensitiveDetector * FindSensitiveDetector(const G4String &aName, G4bool warning=true)

◆ GetCollectionCapacity()

G4int G4SDManager::GetCollectionCapacity ( ) const
inline

Definition at line 100 of file G4SDManager.hh.

100{ return HCtable->entries(); }
G4int entries() const
Definition: G4HCtable.hh:65

◆ GetCollectionID() [1/2]

G4int G4SDManager::GetCollectionID ( G4String  colName)

Definition at line 142 of file G4SDManager.cc.

143{
144 G4int id = HCtable->GetCollectionID(colName);
145 if(id == -1)
146 {
147 G4cout << "<" << colName << "> is not found." << G4endl;
148 }
149 else if(id == -2)
150 {
151 G4cout << "<" << colName << "> is ambiguous." << G4endl;
152 }
153 return id;
154}
G4int GetCollectionID(G4String HCname) const
Definition: G4HCtable.cc:48

Referenced by G4VSensitiveDetector::GetCollectionID(), G4VPrimitiveScorer::GetCollectionID(), GetCollectionID(), and G4DigiManager::GetHitsCollectionID().

◆ GetCollectionID() [2/2]

G4int G4SDManager::GetCollectionID ( G4VHitsCollection aHC)

Definition at line 156 of file G4SDManager.cc.

157{
158 G4String HCname = aHC->GetSDname();
159 HCname += "/";
160 HCname += aHC->GetName();
161 return GetCollectionID(HCname);
162}
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:142
const G4String & GetSDname() const
const G4String & GetName() const

◆ GetHCtable()

G4HCtable * G4SDManager::GetHCtable ( ) const
inline

◆ GetSDMpointer()

◆ GetSDMpointerIfExist()

◆ GetTreeTop()

G4SDStructure * G4SDManager::GetTreeTop ( ) const
inline

Definition at line 98 of file G4SDManager.hh.

98{ return treeTop; }

◆ ListTree()

void G4SDManager::ListTree ( ) const
inline

Definition at line 99 of file G4SDManager.hh.

99{ treeTop->ListTree(); }

Referenced by G4SDmessenger::SetNewValue().

◆ PrepareNewEvent()

G4HCofThisEvent * G4SDManager::PrepareNewEvent ( )

Definition at line 113 of file G4SDManager.cc.

114{
115 G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
116 treeTop->Initialize(HCE);
117 return HCE;
118}
void Initialize(G4HCofThisEvent *HCE)

Referenced by G4RunManager::RunInitialization(), G4WorkerRunManager::RunInitialization(), and G4WorkerTaskRunManager::RunInitialization().

◆ RegisterSDFilter()

void G4SDManager::RegisterSDFilter ( G4VSDFilter filter)

Definition at line 164 of file G4SDManager.cc.

165{
166 FilterList.push_back(filter);
167}

Referenced by G4VSDFilter::G4VSDFilter().

◆ SetVerboseLevel()

void G4SDManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 93 of file G4SDManager.hh.

94 {
95 verboseLevel = vl;
96 treeTop->SetVerboseLevel(vl);
97 }
void SetVerboseLevel(G4int vl)

Referenced by G4SDmessenger::SetNewValue().

◆ TerminateCurrentEvent()

void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent HCE)

Definition at line 120 of file G4SDManager.cc.

121{
122 treeTop->Terminate(HCE);
123}
void Terminate(G4HCofThisEvent *HCE)

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