Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
B03Run Class Reference

#include <B03Run.hh>

Inheritance diagram for B03Run:
G4Run

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.

References G4SDManager::FindSensitiveDetector(), G4cout, G4endl, G4SDManager::GetCollectionID(), G4VPrimitiveScorer::GetName(), G4MultiFunctionalDetector::GetNumberOfPrimitives(), G4MultiFunctionalDetector::GetPrimitive(), and G4SDManager::GetSDMpointer().

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:131
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:124
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
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 199 of file B03Run.cc.

References G4THitsMap< T >::entries(), G4cout, G4endl, GetHitsMap(), G4THitsMap< T >::GetMap(), G4VHitsCollection::GetName(), GetNumberOfHitsMap(), G4VHitsCollection::GetSDname(), and n.

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

Definition at line 70 of file B03Run.hh.

Referenced by DumpAllScorer(), B03RunAction::EndOfRunAction(), and GetHitsMap().

70 {return fRunMap[i];}
G4THitsMap< G4double > * B03Run::GetHitsMap ( const G4String detName,
const G4String colName 
)

Definition at line 172 of file B03Run.cc.

References G4cout, G4endl, and GetHitsMap().

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

Definition at line 184 of file B03Run.cc.

References G4cout, and G4endl.

184  {
185  G4cout << " getting hits map " << fullName << G4endl;
186  G4int Ncol = fCollName.size();
187  for ( G4int i = 0; i < Ncol; i++){
188  if ( fCollName[i] == fullName ){
189  return fRunMap[i];
190  }
191  }
192  return NULL;
193 }
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.

Referenced by DumpAllScorer().

66 {return fRunMap.size();}
void B03Run::Merge ( const G4Run aRun)
virtual

Reimplemented from G4Run.

Definition at line 222 of file B03Run.cc.

References G4Run::Merge().

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

Reimplemented from G4Run.

Definition at line 135 of file B03Run.cc.

References G4cout, G4endl, G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), and G4Run::numberOfEvent.

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
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174

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