Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
G4DigiManager Class Reference

#include <G4DigiManager.hh>

Public Member Functions

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

Static Public Member Functions

static G4DigiManagerGetDMpointer ()
 
static G4DigiManagerGetDMpointerIfExist ()
 

Protected Member Functions

 G4DigiManager ()
 

Private Attributes

G4DCtableDCtable
 
std::vector< G4VDigitizerModule * > DMtable
 
G4RunManagerrunManager
 
G4SDManagerSDManager
 
G4DMmessengertheMessenger
 
G4int verboseLevel
 

Static Private Attributes

static G4ThreadLocal G4DigiManagerfDManager = 0
 

Detailed Description

Definition at line 52 of file G4DigiManager.hh.

Constructor & Destructor Documentation

◆ ~G4DigiManager()

G4DigiManager::~G4DigiManager ( )

Definition at line 62 of file G4DigiManager.cc.

63{
64 //DMtable.clearAndDestroy();
65 for(G4int i=0;i<int(DMtable.size());i++)
66 { delete DMtable[i]; }
67 DMtable.clear();
68 delete DCtable;
69 delete theMessenger;
70}
int G4int
Definition: G4Types.hh:85
G4DMmessenger * theMessenger
std::vector< G4VDigitizerModule * > DMtable
G4DCtable * DCtable

References DCtable, DMtable, and theMessenger.

◆ G4DigiManager() [1/2]

G4DigiManager::G4DigiManager ( const G4DigiManager )
delete

◆ G4DigiManager() [2/2]

G4DigiManager::G4DigiManager ( )
protected

Definition at line 54 of file G4DigiManager.cc.

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

References DCtable, G4RunManager::GetRunManager(), G4SDManager::GetSDMpointer(), runManager, SDManager, and theMessenger.

Referenced by GetDMpointer().

Member Function Documentation

◆ AddNewModule()

void G4DigiManager::AddNewModule ( G4VDigitizerModule DM)

Definition at line 72 of file G4DigiManager.cc.

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

References DCtable, DMtable, G4cout, G4endl, G4VDigitizerModule::GetCollectionName(), G4VDigitizerModule::GetName(), G4VDigitizerModule::GetNumberOfCollections(), G4DCtable::Registor(), runManager, G4RunManager::SetDCtable(), and verboseLevel.

◆ Digitize()

void G4DigiManager::Digitize ( G4String  mName)

Definition at line 110 of file G4DigiManager.cc.

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

References G4VDigitizerModule::Digitize(), FindDigitizerModule(), G4cout, and G4endl.

Referenced by G4DMmessenger::SetNewValue().

◆ FindDigitizerModule()

G4VDigitizerModule * G4DigiManager::FindDigitizerModule ( G4String  mName)

Definition at line 119 of file G4DigiManager.cc.

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

References DMtable.

Referenced by Digitize().

◆ GetCollectionCapacity()

G4int G4DigiManager::GetCollectionCapacity ( ) const
inline

Definition at line 106 of file G4DigiManager.hh.

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

References DCtable, and G4DCtable::entries().

◆ GetDCtable()

G4DCtable * G4DigiManager::GetDCtable ( ) const
inline

Definition at line 110 of file G4DigiManager.hh.

111 { return DCtable; }

References DCtable.

◆ GetDigiCollection()

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

Definition at line 143 of file G4DigiManager.cc.

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

References G4RunManager::GetCurrentEvent(), G4DCofThisEvent::GetDC(), G4Event::GetDCofThisEvent(), G4RunManager::GetPreviousEvent(), and runManager.

◆ GetDigiCollectionID()

G4int G4DigiManager::GetDigiCollectionID ( G4String  DCname)

Definition at line 163 of file G4DigiManager.cc.

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

References DCtable, G4cout, G4endl, and G4DCtable::GetCollectionID().

Referenced by G4VDigitizerModule::StoreDigiCollection().

◆ GetDMpointer()

G4DigiManager * G4DigiManager::GetDMpointer ( )
static

Definition at line 42 of file G4DigiManager.cc.

43{
44 if(!fDManager)
45 {
47 }
48 return fDManager;
49}
static G4ThreadLocal G4DigiManager * fDManager

References fDManager, and G4DigiManager().

Referenced by G4VDigitizerModule::G4VDigitizerModule().

◆ GetDMpointerIfExist()

G4DigiManager * G4DigiManager::GetDMpointerIfExist ( )
static

Definition at line 51 of file G4DigiManager.cc.

52{ return fDManager; }

References fDManager.

◆ GetHitsCollection()

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

Definition at line 128 of file G4DigiManager.cc.

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

References G4RunManager::GetCurrentEvent(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), G4RunManager::GetPreviousEvent(), and runManager.

◆ GetHitsCollectionID()

G4int G4DigiManager::GetHitsCollectionID ( G4String  HCname)

Definition at line 158 of file G4DigiManager.cc.

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

References G4SDManager::GetCollectionID(), and SDManager.

◆ GetModuleCapacity()

G4int G4DigiManager::GetModuleCapacity ( ) const
inline

Definition at line 108 of file G4DigiManager.hh.

109 { return G4int(DMtable.size()); }

References DMtable.

◆ GetVerboseLevel()

G4int G4DigiManager::GetVerboseLevel ( ) const
inline

Definition at line 104 of file G4DigiManager.hh.

105 { return verboseLevel; }

References verboseLevel.

◆ List()

void G4DigiManager::List ( ) const

Definition at line 207 of file G4DigiManager.cc.

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

References DMtable, G4cout, and G4endl.

Referenced by G4DMmessenger::SetNewValue().

◆ operator=()

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

◆ RestoreDCtable()

void G4DigiManager::RestoreDCtable ( G4DCtable dc)
inline

Definition at line 112 of file G4DigiManager.hh.

113 {
114 if(DCtable) delete DCtable;
115 DCtable = dc;
116 }

References DCtable.

◆ SetDigiCollection()

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

Definition at line 171 of file G4DigiManager.cc.

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

References G4DCofThisEvent::AddDigiCollection(), DCtable, G4DCtable::entries(), G4cout, G4endl, G4RunManager::GetCurrentEvent(), G4Event::GetDCofThisEvent(), G4VDigiCollection::GetName(), runManager, G4Event::SetDCofThisEvent(), and verboseLevel.

Referenced by G4VDigitizerModule::StoreDigiCollection().

◆ SetVerboseLevel()

void G4DigiManager::SetVerboseLevel ( G4int  vl)

Definition at line 200 of file G4DigiManager.cc.

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

References DMtable, and verboseLevel.

Referenced by G4DMmessenger::SetNewValue().

Field Documentation

◆ DCtable

G4DCtable* G4DigiManager::DCtable
private

◆ DMtable

std::vector<G4VDigitizerModule*> G4DigiManager::DMtable
private

◆ fDManager

G4ThreadLocal G4DigiManager * G4DigiManager::fDManager = 0
staticprivate

Definition at line 124 of file G4DigiManager.hh.

Referenced by GetDMpointer(), and GetDMpointerIfExist().

◆ runManager

G4RunManager* G4DigiManager::runManager
private

◆ SDManager

G4SDManager* G4DigiManager::SDManager
private

Definition at line 130 of file G4DigiManager.hh.

Referenced by G4DigiManager(), and GetHitsCollectionID().

◆ theMessenger

G4DMmessenger* G4DigiManager::theMessenger
private

Definition at line 128 of file G4DigiManager.hh.

Referenced by G4DigiManager(), and ~G4DigiManager().

◆ verboseLevel

G4int G4DigiManager::verboseLevel
private

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