Geant4 9.6.0
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
 

Static Public Member Functions

static G4SDManagerGetSDMpointer ()
 
static G4SDManagerGetSDMpointerIfExist ()
 

Protected Member Functions

 G4SDManager ()
 

Detailed Description

Definition at line 50 of file G4SDManager.hh.

Constructor & Destructor Documentation

◆ G4SDManager()

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}

Referenced by GetSDMpointer().

◆ ~G4SDManager()

G4SDManager::~G4SDManager ( )

Definition at line 60 of file G4SDManager.cc.

61{
62 delete theMessenger;
63 delete HCtable;
64 delete treeTop;
65}

Member Function Documentation

◆ Activate()

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

Definition at line 119 of file G4SDManager.cc.

120{
121 G4String pathName = dName;
122 if( pathName(0) != '/' ) pathName.prepend("/");
123 treeTop->Activate(pathName,activeFlag);
124}
void Activate(G4String aName, G4bool sensitiveFlag)
G4String & prepend(const char *)

Referenced by 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 {
93 if(i<0) {
95 ED << "G4SDManager::AddNewCollection : the collection <"
96 << SDname << "/" << DCname << "> has already been reginstered." << G4endl;
97 G4Exception("G4SDManager::AddNewCollection","Det0001",JustWarning,ED);
98 }
99 else
100 {
101 G4cout << "G4SDManager::AddNewCollection : the collection <"
102 << SDname << "/" << DCname << "> is registered at " << i << G4endl;
103 }
104 }
105}
@ JustWarning
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4int Registor(G4String SDname, G4String HCname)
Definition: G4HCtable.cc:37
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

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

◆ AddNewDetector()

void G4SDManager::AddNewDetector ( G4VSensitiveDetector aSD)

Definition at line 67 of file G4SDManager.cc.

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

Referenced by G4VScoringMesh::G4VScoringMesh().

◆ FindSensitiveDetector()

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

Definition at line 126 of file G4SDManager.cc.

127{
128 G4String pathName = dName;
129 if( pathName(0) != '/' ) pathName.prepend("/");
130 return treeTop->FindSensitiveDetector(pathName, warning);
131}
G4VSensitiveDetector * FindSensitiveDetector(G4String aName, G4bool warning=true)

◆ 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

◆ GetCollectionID() [1/2]

G4int G4SDManager::GetCollectionID ( G4String  colName)

Definition at line 133 of file G4SDManager.cc.

134{
135 G4int id = HCtable->GetCollectionID(colName);
136 if(id==-1)
137 { G4cout << "<" << colName << "> is not found." << G4endl; }
138 else if(id==-2)
139 { G4cout << "<" << colName << "> is ambiguous." << G4endl; }
140 return id;
141}
G4int GetCollectionID(G4String HCname) const
Definition: G4HCtable.cc:46

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

◆ GetCollectionID() [2/2]

G4int G4SDManager::GetCollectionID ( G4VHitsCollection aHC)

Definition at line 143 of file G4SDManager.cc.

144{
145 G4String HCname = aHC->GetSDname();
146 HCname += "/";
147 HCname += aHC->GetName();
148 return GetCollectionID(HCname);
149}
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:133

◆ GetHCtable()

G4HCtable * G4SDManager::GetHCtable ( ) const
inline

Definition at line 101 of file G4SDManager.hh.

102 { return HCtable; }

Referenced by G4RunManager::RunInitialization().

◆ GetSDMpointer()

G4SDManager * G4SDManager::GetSDMpointer ( )
static

◆ GetSDMpointerIfExist()

◆ GetTreeTop()

G4SDStructure * G4SDManager::GetTreeTop ( ) const
inline

Definition at line 95 of file G4SDManager.hh.

96 { return treeTop; }

◆ ListTree()

void G4SDManager::ListTree ( ) const
inline

Definition at line 97 of file G4SDManager.hh.

98 { treeTop->ListTree(); }

Referenced by G4SDmessenger::SetNewValue().

◆ PrepareNewEvent()

G4HCofThisEvent * G4SDManager::PrepareNewEvent ( )

Definition at line 107 of file G4SDManager.cc.

108{
109 G4HCofThisEvent* HCE = new G4HCofThisEvent(HCtable->entries());
110 treeTop->Initialize(HCE);
111 return HCE;
112}
void Initialize(G4HCofThisEvent *HCE)

◆ SetVerboseLevel()

void G4SDManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 90 of file G4SDManager.hh.

91 {
92 verboseLevel = vl;
93 treeTop->SetVerboseLevel(vl);
94 }
void SetVerboseLevel(G4int vl)

Referenced by G4SDmessenger::SetNewValue().

◆ TerminateCurrentEvent()

void G4SDManager::TerminateCurrentEvent ( G4HCofThisEvent HCE)

Definition at line 114 of file G4SDManager.cc.

115{
116 treeTop->Terminate(HCE);
117}
void Terminate(G4HCofThisEvent *HCE)

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