Download
|
User Forum
|
Contact Us
|
Bug Reports
Home
>
Examples
Loading...
Searching...
No Matches
extended
runAndEvent
RE06
src
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
//
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
44
RE06SteppingVerbose::RE06SteppingVerbose
()
45
:
G4VSteppingVerbose
(),
46
fTimers(),
47
fNofTimers(0),
48
fRegIdx(-1),
49
fEp(false)
50
{}
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54
RE06SteppingVerbose::~RE06SteppingVerbose
()
55
{
56
for
(G4int j=0;j<
fNofTimers
;j++)
57
{
delete
fTimers
[j]; }
58
fTimers
.clear();
59
}
60
61
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63
void
RE06SteppingVerbose::InitializeTimers
()
64
{
65
G4RegionStore
* regionStore = G4RegionStore::GetInstance();
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
80
G4RunManagerKernel::GetRunManagerKernel()->GetTrackingManager()->SetVerboseLevel(0);
81
#ifdef G4VERBOSE
82
fManager->SetVerboseLevel(1);
83
#endif
84
}
85
86
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
88
void
RE06SteppingVerbose::Report
()
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
107
void
RE06SteppingVerbose::NewStep
()
108
{
109
CopyState();
110
G4Region
* reg = fTrack->GetStep()->GetPreStepPoint()
111
->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
112
fRegIdx
=
FindRegion
(reg);
113
fTimers
[
fRegIdx
]->Start();
114
G4ParticleDefinition
* pd = fTrack->GetDefinition();
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
122
void
RE06SteppingVerbose::StepInfo
()
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
135
G4int
RE06SteppingVerbose::FindRegion
(
G4Region
* rgn)
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......
RE06SteppingVerbose.hh
Definition of the RE06SteppingVerbose class.
G4ParticleDefinition
G4RegionStore
G4Region
G4SliceTimer
G4VSteppingVerbose
RE06SteppingVerbose::NewStep
virtual void NewStep()
Definition
RE06SteppingVerbose.cc:107
RE06SteppingVerbose::StepInfo
virtual void StepInfo()
Definition
RE06SteppingVerbose.cc:122
RE06SteppingVerbose::fTimers
std::vector< G4SliceTimer * > fTimers
Definition
RE06SteppingVerbose.hh:75
RE06SteppingVerbose::FindRegion
G4int FindRegion(G4Region *)
Definition
RE06SteppingVerbose.cc:135
RE06SteppingVerbose::fRegIdx
G4int fRegIdx
Definition
RE06SteppingVerbose.hh:78
RE06SteppingVerbose::~RE06SteppingVerbose
virtual ~RE06SteppingVerbose()
Definition
RE06SteppingVerbose.cc:54
RE06SteppingVerbose::fEp
G4bool fEp
Definition
RE06SteppingVerbose.hh:79
RE06SteppingVerbose::Report
void Report()
Definition
RE06SteppingVerbose.cc:88
RE06SteppingVerbose::RE06SteppingVerbose
RE06SteppingVerbose()
Definition
RE06SteppingVerbose.cc:44
RE06SteppingVerbose::fNofTimers
G4int fNofTimers
Definition
RE06SteppingVerbose.hh:77
RE06SteppingVerbose::InitializeTimers
void InitializeTimers()
Definition
RE06SteppingVerbose.cc:63
RE06SteppingVerbose::fNofRegions
G4int fNofRegions
Definition
RE06SteppingVerbose.hh:76
Generated on Tue Jan 30 2024 12:18:45 for Geant4 examples by
1.9.8
Applications
|
User Support
|
Publications
|
Collaboration