Geant4 11.2.2
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 (const G4SDManager &)=delete
 
G4SDManageroperator= (const G4SDManager &)=delete
 
 ~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 53 of file G4SDManager.hh.

Constructor & Destructor Documentation

◆ G4SDManager() [1/2]

G4SDManager::G4SDManager ( const G4SDManager & )
delete

◆ ~G4SDManager()

G4SDManager::~G4SDManager ( )

Definition at line 57 of file G4SDManager.cc.

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

◆ G4SDManager() [2/2]

G4SDManager::G4SDManager ( )
protected

Definition at line 49 of file G4SDManager.cc.

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

Referenced by GetSDMpointer().

Member Function Documentation

◆ Activate()

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

Definition at line 113 of file G4SDManager.cc.

114{
115 G4String pathName = dName;
116 if (pathName[0] != '/') pathName.insert(0, "/");
117 treeTop->Activate(pathName, activeFlag);
118}
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 88 of file G4SDManager.cc.

89{
90 G4int i = HCtable->Registor(SDname, DCname);
91 if (verboseLevel > 0) {
92 if (i < 0) {
93 if (verboseLevel > 1)
94 G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname << "/" << DCname
95 << "> has already been reginstered." << G4endl;
96 }
97 else {
98 G4cout << "G4SDManager::AddNewCollection : the collection <" << SDname << "/" << DCname
99 << "> is registered at " << i << G4endl;
100 }
101 }
102}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4int Registor(G4String SDname, G4String HCname)
Definition G4HCtable.cc:33

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

◆ AddNewDetector()

void G4SDManager::AddNewDetector ( G4VSensitiveDetector * aSD)

Definition at line 69 of file G4SDManager.cc.

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

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

◆ DeRegisterSDFilter()

void G4SDManager::DeRegisterSDFilter ( G4VSDFilter * filter)

Definition at line 149 of file G4SDManager.cc.

150{
151 for (auto f = FilterList.begin(); f != FilterList.end(); f++) {
152 if (*f == filter) {
153 FilterList.erase(f);
154 break;
155 }
156 }
157}

Referenced by G4VSDFilter::~G4VSDFilter().

◆ FindSensitiveDetector()

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

Definition at line 120 of file G4SDManager.cc.

121{
122 G4String pathName = dName;
123 if (pathName[0] != '/') pathName.insert(0, "/");
124 return treeTop->FindSensitiveDetector(pathName, warning);
125}
G4VSensitiveDetector * FindSensitiveDetector(const G4String &aName, G4bool warning=true)

◆ GetCollectionCapacity()

G4int G4SDManager::GetCollectionCapacity ( ) const
inline

Definition at line 94 of file G4SDManager.hh.

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

◆ GetCollectionID() [1/2]

G4int G4SDManager::GetCollectionID ( G4String colName)

Definition at line 127 of file G4SDManager.cc.

128{
129 G4int id = HCtable->GetCollectionID(colName);
130 if (id == -1) {
131 G4cout << "<" << colName << "> is not found." << G4endl;
132 }
133 else if (id == -2) {
134 G4cout << "<" << colName << "> is ambiguous." << G4endl;
135 }
136 return id;
137}
G4int GetCollectionID(G4String HCname) const
Definition G4HCtable.cc:43

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

◆ GetCollectionID() [2/2]

G4int G4SDManager::GetCollectionID ( G4VHitsCollection * aHC)

Definition at line 139 of file G4SDManager.cc.

140{
141 G4String HCname = aHC->GetSDname();
142 HCname += "/";
143 HCname += aHC->GetName();
144 return GetCollectionID(HCname);
145}
G4int GetCollectionID(G4String colName)
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 92 of file G4SDManager.hh.

92{ return treeTop; }

◆ ListTree()

void G4SDManager::ListTree ( ) const
inline

Definition at line 93 of file G4SDManager.hh.

93{ treeTop->ListTree(); }

Referenced by G4SDmessenger::SetNewValue().

◆ operator=()

G4SDManager & G4SDManager::operator= ( const G4SDManager & )
delete

◆ PrepareNewEvent()

G4HCofThisEvent * G4SDManager::PrepareNewEvent ( )

Definition at line 104 of file G4SDManager.cc.

105{
106 auto HCE = new G4HCofThisEvent(HCtable->entries());
107 treeTop->Initialize(HCE);
108 return HCE;
109}
void Initialize(G4HCofThisEvent *HCE)

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

◆ RegisterSDFilter()

void G4SDManager::RegisterSDFilter ( G4VSDFilter * filter)

Definition at line 147 of file G4SDManager.cc.

147{ FilterList.push_back(filter); }

Referenced by G4VSDFilter::G4VSDFilter().

◆ SetVerboseLevel()

void G4SDManager::SetVerboseLevel ( G4int vl)
inline

Definition at line 87 of file G4SDManager.hh.

88 {
89 verboseLevel = vl;
90 treeTop->SetVerboseLevel(vl);
91 }
void SetVerboseLevel(G4int vl)

Referenced by G4SDmessenger::SetNewValue().

◆ TerminateCurrentEvent()

void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent * HCE)

Definition at line 111 of file G4SDManager.cc.

111{ treeTop->Terminate(HCE); }
void Terminate(G4HCofThisEvent *HCE)

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