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

#include <B02Run.hh>

Inheritance diagram for B02Run:
Collaboration diagram for B02Run:

Public Member Functions

 B02Run (const std::vector< G4String > mfdName)
 
virtual ~B02Run ()
 
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 B02Run.hh.

Constructor & Destructor Documentation

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

Definition at line 70 of file B02Run.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 " << collectionID
98  << 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:

B02Run::~B02Run ( )
virtual

Definition at line 118 of file B02Run.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 B02Run::DumpAllScorer ( )

Definition at line 196 of file B02Run.cc.

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

Here is the call graph for this function:

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

Definition at line 70 of file B02Run.hh.

70 {return fRunMap[i];}

Here is the caller graph for this function:

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

Definition at line 172 of file B02Run.cc.

173  {
174  G4String fullName = detName+"/"+colName;
175  return GetHitsMap(fullName);
176 }
G4THitsMap< G4double > * GetHitsMap(G4int i)
Definition: B02Run.hh:70

Here is the call graph for this function:

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

Definition at line 182 of file B02Run.cc.

182  {
183  G4int Ncol = fCollName.size();
184  for ( G4int i = 0; i < Ncol; i++){
185  if ( fCollName[i] == fullName ){
186  return fRunMap[i];
187  }
188  }
189  return NULL;
190 }
int G4int
Definition: G4Types.hh:78
G4int B02Run::GetNumberOfHitsMap ( ) const
inline

Definition at line 66 of file B02Run.hh.

66 {return fRunMap.size();}

Here is the caller graph for this function:

void B02Run::Merge ( const G4Run aRun)
virtual

Reimplemented from G4Run.

Definition at line 219 of file B02Run.cc.

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

Here is the call graph for this function:

void B02Run::RecordEvent ( const G4Event aEvent)
virtual

Reimplemented from G4Run.

Definition at line 135 of file B02Run.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  //=======================================================
146  // Sum up HitsMap of this Event into HitsMap of this RUN
147  //=======================================================
148  G4int Ncol = fCollID.size();
149  for ( G4int i = 0; i < Ncol ; i++ ){ // Loop over HitsCollection
150  G4THitsMap<G4double>* EvtMap=0;
151  if ( fCollID[i] >= 0 ){ // Collection is attached to HCE
152  EvtMap = (G4THitsMap<G4double>*)(HCE->GetHC(fCollID[i]));
153  }else{
154  G4cout <<" Error EvtMap Not Found "<< i << G4endl;
155  }
156  if ( EvtMap ) {
157  //=== Sum up HitsMap of this event to HitsMap of RUN.===
158  *fRunMap[i] += *EvtMap;
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: