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

#include <G4DigiManager.hh>

Public Member Functions

 ~G4DigiManager ()
 
void AddNewModule (G4VDigitizerModule *DM)
 
void Digitize (G4String mName)
 
G4VDigitizerModuleFindDigitizerModule (G4String mName)
 
const G4VHitsCollectionGetHitsCollection (G4int HCID, G4int eventID=0)
 
const G4VDigiCollectionGetDigiCollection (G4int DCID, G4int eventID=0)
 
G4int GetHitsCollectionID (G4String HCname)
 
G4int GetDigiCollectionID (G4String DCname)
 
void SetDigiCollection (G4int DCID, G4VDigiCollection *aDC)
 
void SetVerboseLevel (G4int vl)
 
void List () const
 
G4int GetVerboseLevel () const
 
G4int GetCollectionCapacity () const
 
G4int GetModuleCapacity () const
 
G4DCtableGetDCtable () const
 
void RestoreDCtable (G4DCtable *dc)
 

Static Public Member Functions

static G4DigiManagerGetDMpointer ()
 
static G4DigiManagerGetDMpointerIfExist ()
 

Protected Member Functions

 G4DigiManager ()
 

Detailed Description

Definition at line 54 of file G4DigiManager.hh.

Constructor & Destructor Documentation

◆ G4DigiManager()

G4DigiManager::G4DigiManager ( )
protected

Definition at line 55 of file G4DigiManager.cc.

55 :verboseLevel(0)
56{
57 theMessenger = new G4DMmessenger(this);
58 runManager = G4RunManager::GetRunManager();
59 SDManager = G4SDManager::GetSDMpointer();
60 DCtable = new G4DCtable;
61}
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:62
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40

Referenced by GetDMpointer().

◆ ~G4DigiManager()

G4DigiManager::~G4DigiManager ( )

Definition at line 63 of file G4DigiManager.cc.

64{
65 //DMtable.clearAndDestroy();
66 for(G4int i=0;i<int(DMtable.size());i++)
67 { delete DMtable[i]; }
68 DMtable.clear();
69 delete DCtable;
70 delete theMessenger;
71}
int G4int
Definition: G4Types.hh:66

Member Function Documentation

◆ AddNewModule()

void G4DigiManager::AddNewModule ( G4VDigitizerModule DM)

Definition at line 73 of file G4DigiManager.cc.

74{
75 G4String DMname = DM->GetName();
76 for(int j=0;j<int(DMtable.size());j++)
77 {
78 if(DMtable[j]==DM)
79 {
80 G4cout << "<" << DMname << "> has already been registored." << G4endl;
81 return;
82 }
83 }
84 if( verboseLevel > 0 )
85 {
86 G4cout << "New DigitizerModule <" << DMname
87 << "> is registored." << G4endl;
88 }
89 DMtable.push_back(DM);
90
91 G4int numberOfCollections = DM->GetNumberOfCollections();
92 for(int i=0;i<numberOfCollections;i++)
93 {
94 G4String DCname = DM->GetCollectionName(i);
95 if( DCtable->Registor(DMname,DCname) < 0 )
96 {
97 G4cout << "DigiCollection <" << DCname
98 << "> has already been registored with "
99 << DMname << " DigitizerModule." << G4endl;
100 }
101 else if( verboseLevel > 0 )
102 {
103 G4cout << "DigiCollection " << DCname
104 << " is registored. " << G4endl;
105 }
106 }
107
108 runManager->SetDCtable(DCtable);
109}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4int Registor(G4String SDname, G4String DCname)
Definition: G4DCtable.cc:37
void SetDCtable(G4DCtable *DCtbl)
G4int GetNumberOfCollections() const
G4String GetName() const
G4String GetCollectionName(G4int i) const

◆ Digitize()

void G4DigiManager::Digitize ( G4String  mName)

Definition at line 111 of file G4DigiManager.cc.

112{
114 if(aDM)
115 { aDM->Digitize(); }
116 else
117 { G4cout << "Unknown digitizer module <" << mName << ">. Digitize() ignored." << G4endl; }
118}
G4VDigitizerModule * FindDigitizerModule(G4String mName)
virtual void Digitize()=0

Referenced by G4DMmessenger::SetNewValue().

◆ FindDigitizerModule()

G4VDigitizerModule * G4DigiManager::FindDigitizerModule ( G4String  mName)

Definition at line 120 of file G4DigiManager.cc.

121{
122 for(G4int i=0;i<int(DMtable.size());i++)
123 {
124 if(DMtable[i]->GetName() == mName) return DMtable[i];
125 }
126 return NULL;
127}

Referenced by Digitize().

◆ GetCollectionCapacity()

G4int G4DigiManager::GetCollectionCapacity ( ) const
inline

Definition at line 116 of file G4DigiManager.hh.

117 { return DCtable->entries(); }
G4int entries() const
Definition: G4DCtable.hh:66

◆ GetDCtable()

G4DCtable * G4DigiManager::GetDCtable ( ) const
inline

Definition at line 120 of file G4DigiManager.hh.

121 { return DCtable; }

◆ GetDigiCollection()

const G4VDigiCollection * G4DigiManager::GetDigiCollection ( G4int  DCID,
G4int  eventID = 0 
)

Definition at line 144 of file G4DigiManager.cc.

145{
146 const G4Event* evt = NULL;
147 if(eventID==0)
148 { evt = runManager->GetCurrentEvent(); }
149 else
150 { evt = runManager->GetPreviousEvent(eventID); }
151 if(evt==NULL) return NULL;
152
153 G4DCofThisEvent* DCE = evt->GetDCofThisEvent();
154 if(DCE==NULL) return NULL;
155
156 return DCE->GetDC(DCID);
157}
G4VDigiCollection * GetDC(G4int i) const
G4DCofThisEvent * GetDCofThisEvent() const
Definition: G4Event.hh:175
const G4Event * GetPreviousEvent(G4int i) const
const G4Event * GetCurrentEvent() const

◆ GetDigiCollectionID()

G4int G4DigiManager::GetDigiCollectionID ( G4String  DCname)

Definition at line 164 of file G4DigiManager.cc.

165{
166 G4int i = DCtable->GetCollectionID(DCname);
167 if(i==-2)
168 { G4cout << "< " << DCname << "> is ambegious." << G4endl; }
169 return i;
170}
G4int GetCollectionID(G4String DCname) const
Definition: G4DCtable.cc:46

Referenced by G4VDigitizerModule::StoreDigiCollection().

◆ GetDMpointer()

G4DigiManager * G4DigiManager::GetDMpointer ( )
static

Definition at line 43 of file G4DigiManager.cc.

44{
45 if(!fDManager)
46 {
47 fDManager = new G4DigiManager;
48 }
49 return fDManager;
50}

Referenced by G4VDigitizerModule::G4VDigitizerModule().

◆ GetDMpointerIfExist()

G4DigiManager * G4DigiManager::GetDMpointerIfExist ( )
static

Definition at line 52 of file G4DigiManager.cc.

53{ return fDManager; }

◆ GetHitsCollection()

const G4VHitsCollection * G4DigiManager::GetHitsCollection ( G4int  HCID,
G4int  eventID = 0 
)

Definition at line 129 of file G4DigiManager.cc.

130{
131 const G4Event* evt = NULL;
132 if(eventID==0)
133 { evt = runManager->GetCurrentEvent(); }
134 else
135 { evt = runManager->GetPreviousEvent(eventID); }
136 if(evt==NULL) return NULL;
137
138 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
139 if(HCE==NULL) return NULL;
140
141 return HCE->GetHC(HCID);
142}
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:173
G4VHitsCollection * GetHC(G4int i)

◆ GetHitsCollectionID()

G4int G4DigiManager::GetHitsCollectionID ( G4String  HCname)

Definition at line 159 of file G4DigiManager.cc.

160{
161 return SDManager->GetCollectionID(HCname);
162}
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:133

◆ GetModuleCapacity()

G4int G4DigiManager::GetModuleCapacity ( ) const
inline

Definition at line 118 of file G4DigiManager.hh.

119 { return DMtable.size(); }

◆ GetVerboseLevel()

G4int G4DigiManager::GetVerboseLevel ( ) const
inline

Definition at line 114 of file G4DigiManager.hh.

115 { return verboseLevel; }

◆ List()

void G4DigiManager::List ( ) const

Definition at line 208 of file G4DigiManager.cc.

209{
210 for(G4int i=0;i<int(DMtable.size());i++)
211 { G4cout << " " << i << " : " << DMtable[i]->GetName() << G4endl; }
212}

Referenced by G4DMmessenger::SetNewValue().

◆ RestoreDCtable()

void G4DigiManager::RestoreDCtable ( G4DCtable dc)
inline

Definition at line 122 of file G4DigiManager.hh.

123 {
124 if(DCtable) delete DCtable;
125 DCtable = dc;
126 }

◆ SetDigiCollection()

void G4DigiManager::SetDigiCollection ( G4int  DCID,
G4VDigiCollection aDC 
)

Definition at line 172 of file G4DigiManager.cc.

173{
174 const G4Event* consEvt = runManager->GetCurrentEvent();
175 if(consEvt==NULL)
176 {
177 G4cout << "G4DigiManager::SetDigiCollection --- "
178 << "Event object is not available." << G4endl;
179 return;
180 }
181
182 G4Event* evt = (G4Event*)consEvt;
183 G4DCofThisEvent* DCE = evt->GetDCofThisEvent();
184 if(DCE==NULL)
185 {
186 DCE = new G4DCofThisEvent(DCtable->entries());
187 evt->SetDCofThisEvent(DCE);
188 if(verboseLevel>0)
189 { G4cout << "DCofThisEvent object is added to current G4Event." << G4endl; }
190 }
191
192 DCE->AddDigiCollection(DCID,aDC);
193
194 if(verboseLevel>0)
195 {
196 G4cout << aDC->GetName() << " is stored at " << DCID
197 << "-th slot of G4DCofThisEvent." << G4endl;
198 }
199}
void AddDigiCollection(G4int DCID, G4VDigiCollection *aDC)
void SetDCofThisEvent(G4DCofThisEvent *value)
Definition: G4Event.hh:117

Referenced by G4VDigitizerModule::StoreDigiCollection().

◆ SetVerboseLevel()

void G4DigiManager::SetVerboseLevel ( G4int  vl)

Definition at line 201 of file G4DigiManager.cc.

202{
203 verboseLevel = val;
204 for(G4int i=0;i<int(DMtable.size());i++)
205 { DMtable[i]->SetVerboseLevel(val); }
206}

Referenced by G4DMmessenger::SetNewValue().


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