Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExN07SteppingVerbose.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 //
27 // $Id$
28 //
29 
30 #include "ExN07SteppingVerbose.hh"
31 
32 #include "G4SteppingManager.hh"
33 #include "G4UnitsTable.hh"
34 #include "G4RegionStore.hh"
35 #include "G4Region.hh"
36 #include "G4Electron.hh"
37 #include "G4Positron.hh"
38 #include "G4RunManagerKernel.hh"
39 #include "G4TrackingManager.hh"
40 
42 : nTimers(0),regIdx(-1),ep(false)
43 {}
44 
46 {
47  for(G4int j=0;j<nTimers;j++)
48  { delete fTimers[j]; }
49  fTimers.clear();
50 }
51 
53 {
55  nRegions = regionStore->size();
56  nTimers = 2 * nRegions;
57  G4int nEnt = fTimers.size();
58  if(nEnt<nTimers)
59  {
60  for(G4int i=nEnt;i<nTimers;i++)
61  { fTimers.push_back(new G4SliceTimer); }
62  }
63  for(G4int j=0;j<nTimers;j++)
64  { fTimers[j]->Clear(); }
65  regIdx = -1;
66  ep = false;
67 
68  // Set verbosity for timing
70 #ifdef G4VERBOSE
72 #endif
73 }
74 
76 {
77  for(G4int i=0;i<nRegions;i++)
78  {
79  G4cout << G4endl;
80  G4cout << "Region <" << (*G4RegionStore::GetInstance())[i]->GetName() << ">" << G4endl;
81  G4cout << " All particles : User=" << fTimers[i]->GetUserElapsed()
82  << " Real=" << fTimers[i]->GetRealElapsed()
83  << " Sys=" << fTimers[i]->GetSystemElapsed() << G4endl;
84  G4cout << " e+ / e- : User=" << fTimers[nRegions+i]->GetUserElapsed()
85  << " Real=" << fTimers[nRegions+i]->GetRealElapsed()
86  << " Sys=" << fTimers[nRegions+i]->GetSystemElapsed() << G4endl;
87  }
88  G4cout << G4endl;
89 }
90 
92 {
93  CopyState();
95  regIdx = FindRegion(reg);
96  fTimers[regIdx]->Start();
99  if(ep) fTimers[nRegions+regIdx]->Start();
100 }
101 
103 {
104  fTimers[regIdx]->Stop();
105  if(ep)
106  {
107  fTimers[nRegions+regIdx]->Stop();
108  ep = false;
109  }
110  regIdx = -1;
111 }
112 
113 G4int ExN07SteppingVerbose::FindRegion(G4Region* rgn)
114 {
115  G4RegionStore* regionStore = G4RegionStore::GetInstance();
116  G4int sz = regionStore->size();
117  for(G4int i=0;i<sz;i++)
118  { if(rgn==(*regionStore)[i]) return i; }
119  return -1;
120 }
121 
122 
123 // Empty methods not to be used.
125 {;}
127 {;}
129 {;}
131 {;}
133 {;}
135 {;}
137 {;}
139 {;}
141 {;}
143 {;}
145 {;}
147 {;}
149 {;}
150 
151