#include <G4DigiManager.hh>
Public Member Functions | |
~G4DigiManager () | |
void | AddNewModule (G4VDigitizerModule *DM) |
void | Digitize (G4String mName) |
G4VDigitizerModule * | FindDigitizerModule (G4String mName) |
const G4VHitsCollection * | GetHitsCollection (G4int HCID, G4int eventID=0) |
const G4VDigiCollection * | GetDigiCollection (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 |
G4DCtable * | GetDCtable () const |
void | RestoreDCtable (G4DCtable *dc) |
Static Public Member Functions | |
static G4DigiManager * | GetDMpointer () |
static G4DigiManager * | GetDMpointerIfExist () |
Protected Member Functions | |
G4DigiManager () |
Definition at line 54 of file G4DigiManager.hh.
G4DigiManager::G4DigiManager | ( | ) | [protected] |
Definition at line 55 of file G4DigiManager.cc.
References G4RunManager::GetRunManager(), and G4SDManager::GetSDMpointer().
00055 :verboseLevel(0) 00056 { 00057 theMessenger = new G4DMmessenger(this); 00058 runManager = G4RunManager::GetRunManager(); 00059 SDManager = G4SDManager::GetSDMpointer(); 00060 DCtable = new G4DCtable; 00061 }
G4DigiManager::~G4DigiManager | ( | ) |
Definition at line 63 of file G4DigiManager.cc.
00064 { 00065 //DMtable.clearAndDestroy(); 00066 for(G4int i=0;i<int(DMtable.size());i++) 00067 { delete DMtable[i]; } 00068 DMtable.clear(); 00069 delete DCtable; 00070 delete theMessenger; 00071 }
void G4DigiManager::AddNewModule | ( | G4VDigitizerModule * | DM | ) |
Definition at line 73 of file G4DigiManager.cc.
References G4cout, G4endl, G4VDigitizerModule::GetCollectionName(), G4VDigitizerModule::GetName(), G4VDigitizerModule::GetNumberOfCollections(), G4DCtable::Registor(), and G4RunManager::SetDCtable().
00074 { 00075 G4String DMname = DM->GetName(); 00076 for(int j=0;j<int(DMtable.size());j++) 00077 { 00078 if(DMtable[j]==DM) 00079 { 00080 G4cout << "<" << DMname << "> has already been registored." << G4endl; 00081 return; 00082 } 00083 } 00084 if( verboseLevel > 0 ) 00085 { 00086 G4cout << "New DigitizerModule <" << DMname 00087 << "> is registored." << G4endl; 00088 } 00089 DMtable.push_back(DM); 00090 00091 G4int numberOfCollections = DM->GetNumberOfCollections(); 00092 for(int i=0;i<numberOfCollections;i++) 00093 { 00094 G4String DCname = DM->GetCollectionName(i); 00095 if( DCtable->Registor(DMname,DCname) < 0 ) 00096 { 00097 G4cout << "DigiCollection <" << DCname 00098 << "> has already been registored with " 00099 << DMname << " DigitizerModule." << G4endl; 00100 } 00101 else if( verboseLevel > 0 ) 00102 { 00103 G4cout << "DigiCollection " << DCname 00104 << " is registored. " << G4endl; 00105 } 00106 } 00107 00108 runManager->SetDCtable(DCtable); 00109 }
void G4DigiManager::Digitize | ( | G4String | mName | ) |
Definition at line 111 of file G4DigiManager.cc.
References G4VDigitizerModule::Digitize(), FindDigitizerModule(), G4cout, and G4endl.
Referenced by G4DMmessenger::SetNewValue().
00112 { 00113 G4VDigitizerModule* aDM = FindDigitizerModule(mName); 00114 if(aDM) 00115 { aDM->Digitize(); } 00116 else 00117 { G4cout << "Unknown digitizer module <" << mName << ">. Digitize() ignored." << G4endl; } 00118 }
G4VDigitizerModule * G4DigiManager::FindDigitizerModule | ( | G4String | mName | ) |
Definition at line 120 of file G4DigiManager.cc.
Referenced by Digitize().
00121 { 00122 for(G4int i=0;i<int(DMtable.size());i++) 00123 { 00124 if(DMtable[i]->GetName() == mName) return DMtable[i]; 00125 } 00126 return NULL; 00127 }
G4int G4DigiManager::GetCollectionCapacity | ( | ) | const [inline] |
Definition at line 116 of file G4DigiManager.hh.
References G4DCtable::entries().
00117 { return DCtable->entries(); }
G4DCtable* G4DigiManager::GetDCtable | ( | ) | const [inline] |
const G4VDigiCollection * G4DigiManager::GetDigiCollection | ( | G4int | DCID, | |
G4int | eventID = 0 | |||
) |
Definition at line 144 of file G4DigiManager.cc.
References G4RunManager::GetCurrentEvent(), G4DCofThisEvent::GetDC(), G4Event::GetDCofThisEvent(), and G4RunManager::GetPreviousEvent().
00145 { 00146 const G4Event* evt = NULL; 00147 if(eventID==0) 00148 { evt = runManager->GetCurrentEvent(); } 00149 else 00150 { evt = runManager->GetPreviousEvent(eventID); } 00151 if(evt==NULL) return NULL; 00152 00153 G4DCofThisEvent* DCE = evt->GetDCofThisEvent(); 00154 if(DCE==NULL) return NULL; 00155 00156 return DCE->GetDC(DCID); 00157 }
Definition at line 164 of file G4DigiManager.cc.
References G4cout, G4endl, and G4DCtable::GetCollectionID().
Referenced by G4VDigitizerModule::StoreDigiCollection().
00165 { 00166 G4int i = DCtable->GetCollectionID(DCname); 00167 if(i==-2) 00168 { G4cout << "< " << DCname << "> is ambegious." << G4endl; } 00169 return i; 00170 }
G4DigiManager * G4DigiManager::GetDMpointer | ( | ) | [static] |
Definition at line 43 of file G4DigiManager.cc.
Referenced by G4VDigitizerModule::G4VDigitizerModule().
00044 { 00045 if(!fDManager) 00046 { 00047 fDManager = new G4DigiManager; 00048 } 00049 return fDManager; 00050 }
G4DigiManager * G4DigiManager::GetDMpointerIfExist | ( | ) | [static] |
const G4VHitsCollection * G4DigiManager::GetHitsCollection | ( | G4int | HCID, | |
G4int | eventID = 0 | |||
) |
Definition at line 129 of file G4DigiManager.cc.
References G4RunManager::GetCurrentEvent(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), and G4RunManager::GetPreviousEvent().
00130 { 00131 const G4Event* evt = NULL; 00132 if(eventID==0) 00133 { evt = runManager->GetCurrentEvent(); } 00134 else 00135 { evt = runManager->GetPreviousEvent(eventID); } 00136 if(evt==NULL) return NULL; 00137 00138 G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); 00139 if(HCE==NULL) return NULL; 00140 00141 return HCE->GetHC(HCID); 00142 }
Definition at line 159 of file G4DigiManager.cc.
References G4SDManager::GetCollectionID().
00160 { 00161 return SDManager->GetCollectionID(HCname); 00162 }
G4int G4DigiManager::GetModuleCapacity | ( | ) | const [inline] |
G4int G4DigiManager::GetVerboseLevel | ( | ) | const [inline] |
void G4DigiManager::List | ( | ) | const |
Definition at line 208 of file G4DigiManager.cc.
References G4cout, and G4endl.
Referenced by G4DMmessenger::SetNewValue().
00209 { 00210 for(G4int i=0;i<int(DMtable.size());i++) 00211 { G4cout << " " << i << " : " << DMtable[i]->GetName() << G4endl; } 00212 }
void G4DigiManager::RestoreDCtable | ( | G4DCtable * | dc | ) | [inline] |
void G4DigiManager::SetDigiCollection | ( | G4int | DCID, | |
G4VDigiCollection * | aDC | |||
) |
Definition at line 172 of file G4DigiManager.cc.
References G4DCofThisEvent::AddDigiCollection(), G4DCtable::entries(), G4cout, G4endl, G4RunManager::GetCurrentEvent(), G4Event::GetDCofThisEvent(), G4VDigiCollection::GetName(), and G4Event::SetDCofThisEvent().
Referenced by G4VDigitizerModule::StoreDigiCollection().
00173 { 00174 const G4Event* consEvt = runManager->GetCurrentEvent(); 00175 if(consEvt==NULL) 00176 { 00177 G4cout << "G4DigiManager::SetDigiCollection --- " 00178 << "Event object is not available." << G4endl; 00179 return; 00180 } 00181 00182 G4Event* evt = (G4Event*)consEvt; 00183 G4DCofThisEvent* DCE = evt->GetDCofThisEvent(); 00184 if(DCE==NULL) 00185 { 00186 DCE = new G4DCofThisEvent(DCtable->entries()); 00187 evt->SetDCofThisEvent(DCE); 00188 if(verboseLevel>0) 00189 { G4cout << "DCofThisEvent object is added to current G4Event." << G4endl; } 00190 } 00191 00192 DCE->AddDigiCollection(DCID,aDC); 00193 00194 if(verboseLevel>0) 00195 { 00196 G4cout << aDC->GetName() << " is stored at " << DCID 00197 << "-th slot of G4DCofThisEvent." << G4endl; 00198 } 00199 }
void G4DigiManager::SetVerboseLevel | ( | G4int | vl | ) |
Definition at line 201 of file G4DigiManager.cc.
Referenced by G4DMmessenger::SetNewValue().
00202 { 00203 verboseLevel = val; 00204 for(G4int i=0;i<int(DMtable.size());i++) 00205 { DMtable[i]->SetVerboseLevel(val); } 00206 }