ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE06SteppingVerbose.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RE06SteppingVerbose.cc
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 //
30 
31 #include "RE06SteppingVerbose.hh"
32 
33 #include "G4SteppingManager.hh"
34 #include "G4UnitsTable.hh"
35 #include "G4RegionStore.hh"
36 #include "G4Region.hh"
37 #include "G4Electron.hh"
38 #include "G4Positron.hh"
39 #include "G4RunManagerKernel.hh"
40 #include "G4TrackingManager.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
46  fTimers(),
47  fNofTimers(0),
48  fRegIdx(-1),
49  fEp(false)
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {
56  for(G4int j=0;j<fNofTimers;j++)
57  { delete fTimers[j]; }
58  fTimers.clear();
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {
66  fNofRegions = regionStore->size();
67  fNofTimers = 2 * fNofRegions;
68  G4int nEnt = fTimers.size();
69  if(nEnt<fNofTimers)
70  {
71  for(G4int i=nEnt;i<fNofTimers;i++)
72  { fTimers.push_back(new G4SliceTimer); }
73  }
74  for(G4int j=0;j<fNofTimers;j++)
75  { fTimers[j]->Clear(); }
76  fRegIdx = -1;
77  fEp = false;
78 
79  // Set verbosity for timing
81 #ifdef G4VERBOSE
83 #endif
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
90  for(G4int i=0;i<fNofRegions;i++)
91  {
92  G4cout << G4endl;
93  G4cout << "Region <"
94  << (*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();
112  fRegIdx = FindRegion(reg);
113  fTimers[fRegIdx]->Start();
115  if(pd==G4Electron::ElectronDefinition() ||
116  pd==G4Positron::PositronDefinition()) fEp = true;
117  if(fEp) fTimers[fNofRegions+fRegIdx]->Start();
118 }
119 
120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
121 
123 {
124  fTimers[fRegIdx]->Stop();
125  if(fEp)
126  {
127  fTimers[fNofRegions+fRegIdx]->Stop();
128  fEp = false;
129  }
130  fRegIdx = -1;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 
136 {
137  G4RegionStore* regionStore = G4RegionStore::GetInstance();
138  G4int sz = regionStore->size();
139  for(G4int i=0;i<sz;i++)
140  { if(rgn==(*regionStore)[i]) return i; }
141  return -1;
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......