Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
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 ( )
protected

Definition at line 55 of file G4DigiManager.cc.

References G4RunManager::GetRunManager(), and G4SDManager::GetSDMpointer().

Referenced by GetDMpointer().

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:74
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4DigiManager::~G4DigiManager ( )

Definition at line 63 of file G4DigiManager.cc.

References int().

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 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78

Member Function Documentation

void G4DigiManager::AddNewModule ( G4VDigitizerModule DM)

Definition at line 73 of file G4DigiManager.cc.

References G4cout, G4endl, G4VDigitizerModule::GetCollectionName(), G4VDigitizerModule::GetName(), G4VDigitizerModule::GetNumberOfCollections(), int(), G4DCtable::Registor(), and G4RunManager::SetDCtable().

Referenced by CexmcEventAction::CexmcEventAction(), and GammaRayTelEventAction::GammaRayTelEventAction().

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 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
G4int GetNumberOfCollections() const
G4String GetName() const
G4GLOB_DLL std::ostream G4cout
G4int Registor(G4String SDname, G4String DCname)
Definition: G4DCtable.cc:37
void SetDCtable(G4DCtable *DCtbl)
G4String GetCollectionName(G4int i) const
#define G4endl
Definition: G4ios.hh:61
void G4DigiManager::Digitize ( G4String  mName)

Definition at line 111 of file G4DigiManager.cc.

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

Referenced by G4DMmessenger::SetNewValue().

112 {
114  if(aDM)
115  { aDM->Digitize(); }
116  else
117  { G4cout << "Unknown digitizer module <" << mName << ">. Digitize() ignored." << G4endl; }
118 }
virtual void Digitize()=0
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4VDigitizerModule * FindDigitizerModule(G4String mName)
G4VDigitizerModule * G4DigiManager::FindDigitizerModule ( G4String  mName)

Definition at line 120 of file G4DigiManager.cc.

References int().

Referenced by Digitize(), and GammaRayTelEventAction::EndOfEventAction().

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 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
G4int G4DigiManager::GetCollectionCapacity ( ) const
inline

Definition at line 116 of file G4DigiManager.hh.

References G4DCtable::entries().

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

Definition at line 120 of file G4DigiManager.hh.

121  { return DCtable; }
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().

Referenced by GammaRayTelEventAction::EndOfEventAction().

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 }
const G4Event * GetPreviousEvent(G4int i) const
G4VDigiCollection * GetDC(G4int i) const
G4DCofThisEvent * GetDCofThisEvent() const
Definition: G4Event.hh:176
const G4Event * GetCurrentEvent() const
G4int G4DigiManager::GetDigiCollectionID ( G4String  DCname)

Definition at line 164 of file G4DigiManager.cc.

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

Referenced by GammaRayTelDigitizer::Digitize(), GammaRayTelEventAction::EndOfEventAction(), and G4VDigitizerModule::StoreDigiCollection().

165 {
166  G4int i = DCtable->GetCollectionID(DCname);
167  if(i==-2)
168  { G4cout << "< " << DCname << "> is ambegious." << G4endl; }
169  return i;
170 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int GetCollectionID(G4String DCname) const
Definition: G4DCtable.cc:46
G4DigiManager * G4DigiManager::GetDMpointer ( )
static
G4DigiManager * G4DigiManager::GetDMpointerIfExist ( )
static

Definition at line 52 of file G4DigiManager.cc.

53 { return fDManager; }
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().

Referenced by GammaRayTelDigitizer::Digitize(), CexmcTrackPointsDigitizer::Digitize(), and CexmcEnergyDepositDigitizer::Digitize().

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 }
const G4Event * GetPreviousEvent(G4int i) const
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
const G4Event * GetCurrentEvent() const
G4int G4DigiManager::GetHitsCollectionID ( G4String  HCname)

Definition at line 159 of file G4DigiManager.cc.

References G4SDManager::GetCollectionID().

Referenced by GammaRayTelDigitizer::Digitize(), CexmcTrackPointsDigitizer::Digitize(), and CexmcEnergyDepositDigitizer::Digitize().

160 {
161  return SDManager->GetCollectionID(HCname);
162 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
G4int G4DigiManager::GetModuleCapacity ( ) const
inline

Definition at line 118 of file G4DigiManager.hh.

119  { return DMtable.size(); }
G4int G4DigiManager::GetVerboseLevel ( ) const
inline

Definition at line 114 of file G4DigiManager.hh.

115  { return verboseLevel; }
void G4DigiManager::List ( ) const

Definition at line 208 of file G4DigiManager.cc.

References G4cout, G4endl, and int().

Referenced by G4DMmessenger::SetNewValue().

209 {
210  for(G4int i=0;i<int(DMtable.size());i++)
211  { G4cout << " " << i << " : " << DMtable[i]->GetName() << G4endl; }
212 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4DigiManager::RestoreDCtable ( G4DCtable dc)
inline

Definition at line 122 of file G4DigiManager.hh.

123  {
124  if(DCtable) delete DCtable;
125  DCtable = dc;
126  }
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().

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 }
G4int entries() const
Definition: G4DCtable.hh:66
G4GLOB_DLL std::ostream G4cout
void SetDCofThisEvent(G4DCofThisEvent *value)
Definition: G4Event.hh:118
void AddDigiCollection(G4int DCID, G4VDigiCollection *aDC)
#define G4endl
Definition: G4ios.hh:61
G4DCofThisEvent * GetDCofThisEvent() const
Definition: G4Event.hh:176
const G4Event * GetCurrentEvent() const
void G4DigiManager::SetVerboseLevel ( G4int  vl)

Definition at line 201 of file G4DigiManager.cc.

References int().

Referenced by G4DMmessenger::SetNewValue().

202 {
203  verboseLevel = val;
204  for(G4int i=0;i<int(DMtable.size());i++)
205  { DMtable[i]->SetVerboseLevel(val); }
206 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
int G4int
Definition: G4Types.hh:78

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