Geant4  10.02.p01
RE06SteppingVerbose.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 // $Id: RE06SteppingVerbose.cc 84600 2014-10-17 07:43:51Z gcosmo $
30 //
31 
32 #include "RE06SteppingVerbose.hh"
33 
34 #include "G4SteppingManager.hh"
35 #include "G4UnitsTable.hh"
36 #include "G4RegionStore.hh"
37 #include "G4Region.hh"
38 #include "G4Electron.hh"
39 #include "G4Positron.hh"
40 #include "G4RunManagerKernel.hh"
41 #include "G4TrackingManager.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47  fTimers(),
48  fNofTimers(0),
49  fRegIdx(-1),
50  fEp(false)
51 {}
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {
57  for(G4int j=0;j<fNofTimers;j++)
58  { delete fTimers[j]; }
59  fTimers.clear();
60 }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {
67  fNofRegions = regionStore->size();
68  fNofTimers = 2 * fNofRegions;
69  G4int nEnt = fTimers.size();
70  if(nEnt<fNofTimers)
71  {
72  for(G4int i=nEnt;i<fNofTimers;i++)
73  { fTimers.push_back(new G4SliceTimer); }
74  }
75  for(G4int j=0;j<fNofTimers;j++)
76  { fTimers[j]->Clear(); }
77  fRegIdx = -1;
78  fEp = false;
79 
80  // Set verbosity for timing
82 #ifdef G4VERBOSE
84 #endif
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  for(G4int i=0;i<fNofRegions;i++)
92  {
93  G4cout << G4endl;
94  G4cout << "Region <"
95  << (*G4RegionStore::GetInstance())[i]->GetName() << ">" << G4endl;
96  G4cout << " All particles : User=" << fTimers[i]->GetUserElapsed()
97  << " Real=" << fTimers[i]->GetRealElapsed()
98  << " Sys=" << fTimers[i]->GetSystemElapsed() << G4endl;
99  G4cout << " e+ / e- : User=" << fTimers[fNofRegions+i]->GetUserElapsed()
100  << " Real=" << fTimers[fNofRegions+i]->GetRealElapsed()
101  << " Sys=" << fTimers[fNofRegions+i]->GetSystemElapsed() << G4endl;
102  }
103  G4cout << G4endl;
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
109 {
110  CopyState();
113  fRegIdx = FindRegion(reg);
114  fTimers[fRegIdx]->Start();
116  if(pd==G4Electron::ElectronDefinition() ||
117  pd==G4Positron::PositronDefinition()) fEp = true;
118  if(fEp) fTimers[fNofRegions+fRegIdx]->Start();
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122 
124 {
125  fTimers[fRegIdx]->Stop();
126  if(fEp)
127  {
128  fTimers[fNofRegions+fRegIdx]->Stop();
129  fEp = false;
130  }
131  fRegIdx = -1;
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
137 {
138  G4RegionStore* regionStore = G4RegionStore::GetInstance();
139  G4int sz = regionStore->size();
140  for(G4int i=0;i<sz;i++)
141  { if(rgn==(*regionStore)[i]) return i; }
142  return -1;
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition * GetDefinition() const
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
Definition of the RE06SteppingVerbose class.
void SetVerboseLevel(G4int vLevel)
G4TrackingManager * GetTrackingManager() const
G4Region * GetRegion() const
const G4Step * GetStep() const
int G4int
Definition: G4Types.hh:78
static G4RunManagerKernel * GetRunManagerKernel()
static const G4double reg
static G4RegionStore * GetInstance()
G4StepPoint * GetPreStepPoint() const
G4SteppingManager * fManager
G4GLOB_DLL std::ostream G4cout
G4VPhysicalVolume * GetPhysicalVolume() const
static G4Positron * PositronDefinition()
Definition: G4Positron.cc:89
void SetVerboseLevel(G4int vLevel)
G4LogicalVolume * GetLogicalVolume() const
std::vector< G4SliceTimer * > fTimers
G4int FindRegion(G4Region *)
#define G4endl
Definition: G4ios.hh:61