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
39
#include <
G4Scheduler.hh
>
40
#include "
G4UnitsTable.hh
"
41
#include "
G4SystemOfUnits.hh
"
42
//#include "G4Molecule.hh"
43
44
TimeStepAction::TimeStepAction
() :
G4UserTimeStepAction
()
45
{
53
AddTimeStep
(1*
picosecond
, 0.1*
picosecond
);
54
AddTimeStep
(10*
picosecond
, 1*
picosecond
);
55
AddTimeStep
(100*
picosecond
, 3*
picosecond
);
56
AddTimeStep
(1000*
picosecond
, 10*
picosecond
);
57
AddTimeStep
(10000*
picosecond
, 100*
picosecond
);
58
}
59
60
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61
62
TimeStepAction::~TimeStepAction
()
63
{
64
//dtor
65
}
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69
TimeStepAction::TimeStepAction
(
const
TimeStepAction
& other) :
70
G4UserTimeStepAction
(other)
71
{
72
//copy ctor
73
}
74
75
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76
77
TimeStepAction
&
78
TimeStepAction::operator=
(
const
TimeStepAction
& rhs)
79
{
80
if
(
this
== &rhs)
return
*
this
;
// handle self assignment
81
//assignment operator
82
return
*
this
;
83
}
84
85
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86
87
void
TimeStepAction::UserPostTimeStepAction
()
88
{
89
// G4cout << "_________________" << G4endl;
90
/*
91
G4cout << "Time Step : "
92
<< G4BestUnit(G4ITScheduler::Instance()->GetTimeStep(),
93
"Time")
94
<< G4endl;
95
96
G4cout << "End of step: "
97
<< G4BestUnit(G4ITScheduler::Instance()->GetGlobalTime(),
98
"Time")
99
<< G4endl;
100
*/
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
105
void
TimeStepAction::UserReactionAction
(
const
G4Track
&
/*a*/
,
106
const
G4Track
&
/*b*/
,
107
const
std::vector<G4Track*>*
/*products*/
)
108
{
109
// Example to display reactions with product
110
// S. Incerti, H. Tran
111
// 2019/01/24
112
113
/*
114
if (products)
115
{
116
G4cout << G4endl;
117
G4int nbProducts = products->size();
118
for (int i = 0 ; i < nbProducts ; i ++)
119
{
120
G4cout << "-> A = "
121
<< GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")"
122
<< " reacts with B = "
123
<< GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")"
124
<< " creating product " << i+1 << " ="
125
<< GetMolecule((*products)[i])->GetName()
126
<< G4endl ;
127
128
G4cout
129
<<" A position: x(nm)="<<a.GetPosition().getX()/nm
130
<<" y(nm)="<<a.GetPosition().getY()/nm
131
<<" z(nm)="<<a.GetPosition().getZ()/nm
132
<<G4endl;
133
134
G4cout
135
<<" B position: x(nm)="<<b.GetPosition().getX()/nm
136
<<" y(nm)="<<b.GetPosition().getY()/nm
137
<<" z(nm)="<<b.GetPosition().getZ()/nm
138
<<G4endl;
139
140
G4cout
141
<<" Product " << i+1 << "position: x(nm)="<<(*products)[i]->GetPosition().getX()/nm
142
<<" y(nm)="<<a.GetPosition().getY()/nm
143
<<" z(nm)="<<a.GetPosition().getZ()/nm
144
<<G4endl;
145
}
146
}
147
148
else
149
150
{
151
G4cout << G4endl;
152
G4cout << "-> A = "
153
<< GetMolecule(&a)->GetName() << " (TrackID=" << a.GetTrackID() << ")"
154
<< " reacts with B = "
155
<< GetMolecule(&b)->GetName() << " (TrackID=" << b.GetTrackID() << ")"
156
<< G4endl ;
157
158
G4cout
159
<<" A position: x(nm)="<<a.GetPosition().getX()/nm
160
<<" y(nm)="<<a.GetPosition().getY()/nm
161
<<" z(nm)="<<a.GetPosition().getZ()/nm
162
<<G4endl;
163
164
G4cout
165
<<" B position: x(nm)="<<b.GetPosition().getX()/nm
166
<<" y(nm)="<<b.GetPosition().getY()/nm
167
<<" z(nm)="<<b.GetPosition().getZ()/nm
168
<<G4endl;
169
170
}
171
*/
172
173
}
geant4
tree
geant4-10.6-release
examples
extended
medical
dna
chem3
src
TimeStepAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:07
using
1.8.2 with
ECCE GitHub integration