Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B03Run Class Reference

#include <B03Run.hh>

Inheritance diagram for B03Run:
Collaboration diagram for B03Run:

Public Member Functions

 B03Run (const std::vector< G4String > mfdName)
 
virtual ~B03Run ()
 
virtual void RecordEvent (const G4Event *)
 
G4int GetNumberOfHitsMap () const
 
G4THitsMap< G4double > * GetHitsMap (G4int i)
 
G4THitsMap< G4double > * GetHitsMap (const G4String &detName, const G4String &colName)
 
G4THitsMap< G4double > * GetHitsMap (const G4String &fullName)
 
void DumpAllScorer ()
 
virtual void Merge (const G4Run *)
 
- Public Member Functions inherited from G4Run
 G4Run ()
 
virtual ~G4Run ()
 
G4int GetRunID () const
 
G4int GetNumberOfEvent () const
 
G4int GetNumberOfEventToBeProcessed () const
 
const G4HCtableGetHCtable () const
 
const G4DCtableGetDCtable () const
 
const G4StringGetRandomNumberStatus () const
 
void SetRunID (G4int id)
 
void SetNumberOfEventToBeProcessed (G4int n_ev)
 
void SetHCtable (G4HCtable *HCtbl)
 
void SetDCtable (G4DCtable *DCtbl)
 
void SetRandomNumberStatus (G4String &st)
 
void StoreEvent (G4Event *evt)
 
const std::vector< const
G4Event * > * 
GetEventVector () const
 

Additional Inherited Members

- Protected Attributes inherited from G4Run
G4int runID
 
G4int numberOfEvent
 
G4int numberOfEventToBeProcessed
 
G4HCtableHCtable
 
G4DCtableDCtable
 
G4String randomNumberStatus
 
std::vector< const G4Event * > * eventVector
 

Detailed Description

Definition at line 50 of file B03Run.hh.

Constructor & Destructor Documentation

B03Run::B03Run ( const std::vector< G4String mfdName)

Definition at line 70 of file B03Run.cc.

70  : G4Run()
71 {
73  //=================================================
74  // Initalize RunMaps for accumulation.
75  // Get CollectionIDs for HitCollections.
76  //=================================================
77  G4int Nmfd = mfdName.size();
78  for ( G4int idet = 0; idet < Nmfd ; idet++){ // Loop for all MFD.
79  G4String detName = mfdName[idet];
80  //--- Seek and Obtain MFD objects from SDmanager.
83  //
84  if ( mfd ){
85  //--- Loop over the registered primitive scorers.
86  for (G4int icol = 0; icol < mfd->GetNumberOfPrimitives(); icol++){
87  // Get Primitive Scorer object.
88  G4VPrimitiveScorer* scorer=mfd->GetPrimitive(icol);
89  // collection name and collectionID for HitsCollection,
90  // where type of HitsCollection is G4THitsMap in case of primitive scorer.
91  // The collection name is given by <MFD name>/<Primitive Scorer name>.
92  G4String collectionName = scorer->GetName();
93  G4String fullCollectionName = detName+"/"+collectionName;
94  G4int collectionID = SDman->GetCollectionID(fullCollectionName);
95  //
96  if ( collectionID >= 0 ){
97  G4cout << "++ "<<fullCollectionName<< " id "
98  << collectionID << G4endl;
99  // Store obtained HitsCollection information into data members.
100  // And, creates new G4THitsMap for accumulating quantities during RUN.
101  fCollName.push_back(fullCollectionName);
102  fCollID.push_back(collectionID);
103  fRunMap.push_back(new G4THitsMap<G4double>(detName
104  ,collectionName));
105  }else{
106  G4cout << "** collection " << fullCollectionName
107  << " not found. "<<G4endl;
108  }
109  }
110  }
111  }
112 }
G4String GetName() const
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
int G4int
Definition: G4Types.hh:78
G4Run()
Definition: G4Run.cc:34
G4GLOB_DLL std::ostream G4cout
G4VPrimitiveScorer * GetPrimitive(G4int id) const
G4VSensitiveDetector * FindSensitiveDetector(G4String dName, G4bool warning=true)
Definition: G4SDManager.cc:128
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

B03Run::~B03Run ( )
virtual

Definition at line 118 of file B03Run.cc.

119 {
120  //--- Clear HitsMap for RUN
121  G4int Nmap = fRunMap.size();
122  for ( G4int i = 0; i < Nmap; i++){
123  if(fRunMap[i] ) fRunMap[i]->clear();
124  }
125  fCollName.clear();
126  fCollID.clear();
127  fRunMap.clear();
128 }
int G4int
Definition: G4Types.hh:78

Member Function Documentation

void B03Run::DumpAllScorer ( )

Definition at line 198 of file B03Run.cc.

198  {
199 
200  // - Number of HitsMap in this RUN.
202  // - GetHitsMap and dump values.
203  for ( G4int i = 0; i < n ; i++ ){
204  G4THitsMap<G4double>* RunMap =GetHitsMap(i);
205  if ( RunMap ) {
206  G4cout << " PrimitiveScorer RUN "
207  << RunMap->GetSDname() <<","<< RunMap->GetName() << G4endl;
208  G4cout << " Number of entries " << RunMap->entries() << G4endl;
209  std::map<G4int,G4double*>::iterator itr = RunMap->GetMap()->begin();
210  for(; itr != RunMap->GetMap()->end(); itr++) {
211  G4cout << " copy no.: " << itr->first
212  << " Run Value : " << *(itr->second)
213  << G4endl;
214  }
215  }
216  }
217 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfHitsMap() const
Definition: B03Run.hh:66
const G4int n
G4int entries() const
Definition: G4THitsMap.hh:200
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:99
#define G4endl
Definition: G4ios.hh:61
G4THitsMap< G4double > * GetHitsMap(G4int i)
Definition: B03Run.hh:70

Here is the call graph for this function:

G4THitsMap<G4double>* B03Run::GetHitsMap ( G4int  i)
inline

Definition at line 70 of file B03Run.hh.

70 {return fRunMap[i];}

Here is the caller graph for this function:

G4THitsMap< G4double > * B03Run::GetHitsMap ( const G4String detName,
const G4String colName 
)

Definition at line 171 of file B03Run.cc.

172  {
173  G4String fullName = detName+"/"+colName;
174  G4cout << " getting hits map " << fullName << G4endl;
175  return GetHitsMap(fullName);
176 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4THitsMap< G4double > * GetHitsMap(G4int i)
Definition: B03Run.hh:70

Here is the call graph for this function:

G4THitsMap< G4double > * B03Run::GetHitsMap ( const G4String fullName)

Definition at line 183 of file B03Run.cc.

183  {
184  G4cout << " getting hits map " << fullName << G4endl;
185  G4int Ncol = fCollName.size();
186  for ( G4int i = 0; i < Ncol; i++){
187  if ( fCollName[i] == fullName ){
188  return fRunMap[i];
189  }
190  }
191  return NULL;
192 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int B03Run::GetNumberOfHitsMap ( ) const
inline

Definition at line 66 of file B03Run.hh.

66 {return fRunMap.size();}

Here is the caller graph for this function:

void B03Run::Merge ( const G4Run aRun)
virtual

Reimplemented from G4Run.

Definition at line 221 of file B03Run.cc.

222 {
223  const B03Run * localRun = static_cast<const B03Run *>(aRun);
224  //=======================================================
225  // Merge HitsMap of working threads
226  //=======================================================
227  G4int nCol = localRun->fCollID.size();
228  for ( G4int i = 0; i < nCol ; i++ ){ // Loop over HitsCollection
229  if ( localRun->fCollID[i] >= 0 ){
230  *fRunMap[i] += *localRun->fRunMap[i];
231  }
232  }
233 
234  G4Run::Merge(aRun);
235 }
virtual void Merge(const G4Run *)
Definition: G4Run.cc:54
Definition: B03Run.hh:50
int G4int
Definition: G4Types.hh:78

Here is the call graph for this function:

void B03Run::RecordEvent ( const G4Event aEvent)
virtual

Reimplemented from G4Run.

Definition at line 135 of file B03Run.cc.

136 {
137  numberOfEvent++; // This is an original line.
138 
139  //=============================
140  // HitsCollection of This Event
141  //============================
142  G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent();
143  if (!HCE) return;
144  //=======================================================
145  // Sum up HitsMap of this Event into HitsMap of this RUN
146  //=======================================================
147  G4int Ncol = fCollID.size();
148  for ( G4int i = 0; i < Ncol ; i++ ){ // Loop over HitsCollection
149  G4THitsMap<G4double>* EvtMap=0;
150  if ( fCollID[i] >= 0 ){ // Collection is attached to HCE
151  EvtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID[i]));
152  }else{
153  G4cout <<" Error EvtMap Not Found "<< i << G4endl;
154  }
155  if ( EvtMap ) {
156  //=== Sum up HitsMap of this event to HitsMap of RUN.===
157  *fRunMap[i] += *EvtMap;
158  //======================================================
159  }
160  }
161 
162 
163 }
G4int numberOfEvent
Definition: G4Run.hh:59
G4VHitsCollection * GetHC(G4int i)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:185

Here is the call graph for this function:


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