Geant4 10.7.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 ()
 
 G4DigiManager (const G4DigiManager &)=delete
 
G4DigiManageroperator= (const G4DigiManager &)=delete
 
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 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

◆ 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);
57 runManager = G4RunManager::GetRunManager();
58 SDManager = G4SDManager::GetSDMpointer();
59 DCtable = new G4DCtable;
60}
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:84
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:39

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
107 runManager->SetDCtable(DCtable);
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

◆ 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

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}

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

◆ GetDCtable()

G4DCtable * G4DigiManager::GetDCtable ( ) const
inline

Definition at line 110 of file G4DigiManager.hh.

111 { return 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

◆ 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

Referenced by G4VDigitizerModule::StoreDigiCollection().

◆ GetDMpointer()

G4DigiManager * G4DigiManager::GetDMpointer ( )
static

Definition at line 42 of file G4DigiManager.cc.

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

Referenced by G4VDigitizerModule::G4VDigitizerModule().

◆ GetDMpointerIfExist()

G4DigiManager * G4DigiManager::GetDMpointerIfExist ( )
static

Definition at line 51 of file G4DigiManager.cc.

52{ return 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)

◆ 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:135

◆ GetModuleCapacity()

G4int G4DigiManager::GetModuleCapacity ( ) const
inline

Definition at line 108 of file G4DigiManager.hh.

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

◆ GetVerboseLevel()

G4int G4DigiManager::GetVerboseLevel ( ) const
inline

Definition at line 104 of file G4DigiManager.hh.

105 { return 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}

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 }

◆ 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

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}

Referenced by G4DMmessenger::SetNewValue().


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