Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
26 /// \file RE06/src/RE06SteppingVerbose.cc
27 /// \brief Implementation of the RE06SteppingVerbose class
28 //
29 // $Id: RE06SteppingVerbose.cc 66526 2012-12-19 13:41:33Z ihrivnac $
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 <" << (*G4RegionStore::GetInstance())[i]->GetName() << ">" << G4endl;
95  G4cout << " All particles : User=" << fTimers[i]->GetUserElapsed()
96  << " Real=" << fTimers[i]->GetRealElapsed()
97  << " Sys=" << fTimers[i]->GetSystemElapsed() << G4endl;
98  G4cout << " e+ / e- : User=" << fTimers[fNofRegions+i]->GetUserElapsed()
99  << " Real=" << fTimers[fNofRegions+i]->GetRealElapsed()
100  << " Sys=" << fTimers[fNofRegions+i]->GetSystemElapsed() << G4endl;
101  }
102  G4cout << G4endl;
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108 {
109  CopyState();
111  fRegIdx = FindRegion(reg);
112  fTimers[fRegIdx]->Start();
115  if(fEp) fTimers[fNofRegions+fRegIdx]->Start();
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  fTimers[fRegIdx]->Stop();
123  if(fEp)
124  {
125  fTimers[fNofRegions+fRegIdx]->Stop();
126  fEp = false;
127  }
128  fRegIdx = -1;
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132 
133 G4int RE06SteppingVerbose::FindRegion(G4Region* rgn)
134 {
135  G4RegionStore* regionStore = G4RegionStore::GetInstance();
136  G4int sz = regionStore->size();
137  for(G4int i=0;i<sz;i++)
138  { if(rgn==(*regionStore)[i]) return i; }
139  return -1;
140 }
141 
142 //....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 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
#define G4endl
Definition: G4ios.hh:61