ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TimeStepAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TimeStepAction.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
//
26
// This example is provided by the Geant4-DNA collaboration
27
// Any report or published results obtained using the Geant4-DNA software
28
// shall cite the following Geant4-DNA collaboration publication:
29
// Med. Phys. 37 (2010) 4692-4708
30
// J. Comput. Phys. 274 (2014) 841-882
31
// The Geant4-DNA web site is available at http://geant4-dna.org
32
//
33
//
36
37
#include "TimeStepAction.hh"
38
#include "
G4UnitsTable.hh
"
39
#include "
G4SystemOfUnits.hh
"
40
//#include "G4ITScheduler.hh"
41
//#include "G4Molecule.hh"
42
43
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
45
TimeStepAction::TimeStepAction
() :
46
G4UserTimeStepAction
()
47
{
61
AddTimeStep
(1 *
picosecond
, 0.1 *
picosecond
);
62
AddTimeStep
(10 *
picosecond
, 1 *
picosecond
);
63
AddTimeStep
(100 *
picosecond
, 10 *
picosecond
);
64
AddTimeStep
(1000 *
picosecond
, 100 *
picosecond
);
65
AddTimeStep
(10000 *
picosecond
, 1000 *
picosecond
);
66
}
67
68
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70
TimeStepAction::~TimeStepAction
()
71
{
72
}
73
74
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75
76
TimeStepAction::TimeStepAction
(
const
TimeStepAction
& other) :
77
G4UserTimeStepAction
(other)
78
{
79
}
80
81
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82
TimeStepAction
&
83
TimeStepAction::operator=
(
const
TimeStepAction
& rhs)
84
{
85
if
(
this
== &rhs)
return
*
this
;
// handle self assignment
86
//assignment operator
87
return
*
this
;
88
}
89
90
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91
92
void
TimeStepAction::StartProcessing
()
93
{
94
// You want to know why the simulation stopped ?
95
// G4ITScheduler::Instance()->WhyDoYouStop();
96
// At the end of the simulation, information will be printed
97
// It is better to place this command before the simulation starts
98
}
99
100
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101
102
void
TimeStepAction::UserPreTimeStepAction
()
103
{
104
}
105
106
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107
108
void
TimeStepAction::UserPostTimeStepAction
()
109
{
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114
115
// Here you can retrieve information related to reactions
116
void
117
TimeStepAction::UserReactionAction
(
const
G4Track
&
/*a*/
,
118
const
G4Track
&
/*b*/
,
119
const
std::vector<G4Track*>*
/*products*/
)
120
{
121
122
// Example to display reactions with product
123
// S. Incerti, H. Tran
124
// 2019/01/24
125
126
/*
127
if (products)
128
{
129
G4cout << G4endl;
130
G4int nbProducts = products->size();
131
for (int i = 0 ; i < nbProducts ; i ++)
132
{
133
G4cout << "-> A = "
134
<< GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")"
135
<< " reacts with B = "
136
<< GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")"
137
<< " creating product " << i+1 << " ="
138
<< GetMolecule((*products)[i])->GetName()
139
<< G4endl ;
140
141
G4cout
142
<<" A position: x(nm)="<<a.GetPosition().getX()/nm
143
<<" y(nm)="<<a.GetPosition().getY()/nm
144
<<" z(nm)="<<a.GetPosition().getZ()/nm
145
<<G4endl;
146
147
G4cout
148
<<" B position: x(nm)="<<b.GetPosition().getX()/nm
149
<<" y(nm)="<<b.GetPosition().getY()/nm
150
<<" z(nm)="<<b.GetPosition().getZ()/nm
151
<<G4endl;
152
153
G4cout
154
<<" Product " << i+1 << "position: x(nm)="<<(*products)[i]->GetPosition().getX()/nm
155
<<" y(nm)="<<a.GetPosition().getY()/nm
156
<<" z(nm)="<<a.GetPosition().getZ()/nm
157
<<G4endl;
158
}
159
}
160
161
else
162
163
{
164
G4cout << G4endl;
165
G4cout << "-> A = "
166
<< GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")"
167
<< " reacts with B = "
168
<< GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")"
169
<< G4endl ;
170
171
G4cout
172
<<" A position: x(nm)="<<a.GetPosition().getX()/nm
173
<<" y(nm)="<<a.GetPosition().getY()/nm
174
<<" z(nm)="<<a.GetPosition().getZ()/nm
175
<<G4endl;
176
177
G4cout
178
<<" B position: x(nm)="<<b.GetPosition().getX()/nm
179
<<" y(nm)="<<b.GetPosition().getY()/nm
180
<<" z(nm)="<<b.GetPosition().getZ()/nm
181
<<G4endl;
182
183
}
184
*/
185
186
}
187
188
void
TimeStepAction::EndProcessing
()
189
{
190
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
chem2
src
TimeStepAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:07
using
1.8.2 with
ECCE GitHub integration