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
F04Trajectory.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file F04Trajectory.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
//
29
//
30
31
#include "
G4AttDef.hh
"
32
#include "
G4AttValue.hh
"
33
#include "
G4AttDefStore.hh
"
34
35
#include "
G4UIcommand.hh
"
36
#include "
G4UnitsTable.hh
"
37
38
#include "
F04Trajectory.hh
"
39
#include "
F04TrajectoryPoint.hh
"
40
#include "
G4ParticleTable.hh
"
41
42
//#define G4ATTDEBUG
43
#ifdef G4ATTDEBUG
44
#include "
G4AttCheck.hh
"
45
#endif
46
47
G4ThreadLocal
G4Allocator<F04Trajectory>
*
F04TrajectoryAllocator
=0;
48
49
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51
F04Trajectory::F04Trajectory
()
52
: fpPointsContainer(0), fTrackID(0), fParentID(0),
53
fPDGCharge(0.0), fPDGEncoding(0), fParticleName(
""
),
54
fInitialMomentum(
G4ThreeVector
()) {;}
55
56
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57
58
F04Trajectory::F04Trajectory
(
const
G4Track
* aTrack)
59
{
60
G4ParticleDefinition
* particleDefinition = aTrack->
GetDefinition
();
61
fParticleName
= particleDefinition->
GetParticleName
();
62
fPDGCharge
= particleDefinition->
GetPDGCharge
();
63
fPDGEncoding
= particleDefinition->
GetPDGEncoding
();
64
fTrackID
= aTrack->
GetTrackID
();
65
fParentID
= aTrack->
GetParentID
();
66
fInitialMomentum
= aTrack->
GetMomentum
();
67
fpPointsContainer
=
new
TrajectoryPointContainer
();
68
// Following is for the first trajectory point
69
fpPointsContainer
->push_back(
new
F04TrajectoryPoint
(aTrack));
70
}
71
72
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
74
F04Trajectory::F04Trajectory
(
F04Trajectory
&
right
) :
G4VTrajectory
()
75
{
76
fParticleName
= right.
fParticleName
;
77
fPDGCharge
= right.
fPDGCharge
;
78
fPDGEncoding
= right.
fPDGEncoding
;
79
fTrackID
= right.
fTrackID
;
80
fParentID
= right.
fParentID
;
81
fInitialMomentum
= right.
fInitialMomentum
;
82
fpPointsContainer
=
new
TrajectoryPointContainer
();
83
84
for
(
size_t
i=0;i<right.
fpPointsContainer
->size();++i) {
85
F04TrajectoryPoint
* rightPoint
86
= (
F04TrajectoryPoint
*)((*(right.
fpPointsContainer
))[i]);
87
fpPointsContainer
->push_back(
new
F04TrajectoryPoint
(*rightPoint));
88
}
89
}
90
91
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92
93
F04Trajectory::~F04Trajectory
()
94
{
95
for
(
size_t
i=0;i<
fpPointsContainer
->size();++i){
96
delete
(*fpPointsContainer)[i];
97
}
98
fpPointsContainer
->clear();
99
100
delete
fpPointsContainer
;
101
}
102
103
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104
105
void
F04Trajectory::ShowTrajectory
(std::ostream& os)
const
106
{
107
// Invoke the default implementation in G4VTrajectory...
108
G4VTrajectory::ShowTrajectory
(os);
109
// ... or override with your own code here.
110
}
111
112
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114
void
F04Trajectory::AppendStep
(
const
G4Step
* aStep)
115
{
116
fpPointsContainer
->push_back(
new
F04TrajectoryPoint
(aStep));
117
}
118
119
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120
121
G4ParticleDefinition
*
F04Trajectory::GetParticleDefinition
()
122
{
123
return
(
G4ParticleTable::GetParticleTable
()->FindParticle(
fParticleName
));
124
}
125
126
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127
128
void
F04Trajectory::MergeTrajectory
(
G4VTrajectory
* secondTrajectory)
129
{
130
if
(!secondTrajectory)
return
;
131
132
F04Trajectory
*
second
= (
F04Trajectory
*)secondTrajectory;
133
G4int
ent = second->
GetPointEntries
();
134
// initial point of the second trajectory should not be merged
135
for
(
G4int
i=1; i<ent; ++i) {
136
fpPointsContainer
->push_back((*(second->
fpPointsContainer
))[i]);
137
}
138
delete
(*second->
fpPointsContainer
)[0];
139
second->
fpPointsContainer
->clear();
140
}
141
142
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143
144
const
std::map<G4String,G4AttDef>*
F04Trajectory::GetAttDefs
()
const
145
{
146
G4bool
isNew;
147
std::map<G4String,G4AttDef>* store
148
=
G4AttDefStore::GetInstance
(
"Trajectory"
,isNew);
149
150
if
(isNew) {
151
152
G4String
ID(
"ID"
);
153
(*store)[ID] =
G4AttDef
(ID,
"Track ID"
,
"Bookkeeping"
,
""
,
"G4int"
);
154
155
G4String
PID
(
"PID"
);
156
(*store)[PID] =
G4AttDef
(PID,
"Parent ID"
,
"Bookkeeping"
,
""
,
"G4int"
);
157
158
G4String
PN(
"PN"
);
159
(*store)[PN] =
G4AttDef
(PN,
"Particle Name"
,
"Physics"
,
""
,
"G4String"
);
160
161
G4String
Ch(
"Ch"
);
162
(*store)[Ch] =
G4AttDef
(Ch,
"Charge"
,
"Physics"
,
"e+"
,
"G4double"
);
163
164
G4String
PDG(
"PDG"
);
165
(*store)[PDG] =
G4AttDef
(PDG,
"PDG Encoding"
,
"Physics"
,
""
,
"G4int"
);
166
167
G4String
IMom(
"IMom"
);
168
(*store)[IMom] =
G4AttDef
(IMom,
169
"Momentum of track at start of trajectory"
,
170
"Physics"
,
"G4BestUnit"
,
"G4ThreeVector"
);
171
172
G4String
IMag(
"IMag"
);
173
(*store)[IMag] =
G4AttDef
(IMag,
174
"Magnitude of momentum of track at start of trajectory"
,
175
"Physics"
,
"G4BestUnit"
,
"G4double"
);
176
177
G4String
NTP(
"NTP"
);
178
(*store)[NTP] =
G4AttDef
(NTP,
"No. of points"
,
"Bookkeeping"
,
""
,
"G4int"
);
179
180
}
181
return
store;
182
}
183
184
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
185
186
std::vector<G4AttValue>*
F04Trajectory::CreateAttValues
()
const
187
{
188
std::vector<G4AttValue>*
values
=
new
std::vector<G4AttValue>;
189
190
values->push_back
191
(
G4AttValue
(
"ID"
,
G4UIcommand::ConvertToString
(
fTrackID
),
""
));
192
193
values->push_back
194
(
G4AttValue
(
"PID"
,
G4UIcommand::ConvertToString
(
fParentID
),
""
));
195
196
values->push_back(
G4AttValue
(
"PN"
,
fParticleName
,
""
));
197
198
values->push_back
199
(
G4AttValue
(
"Ch"
,
G4UIcommand::ConvertToString
(
fPDGCharge
),
""
));
200
201
values->push_back
202
(
G4AttValue
(
"PDG"
,
G4UIcommand::ConvertToString
(
fPDGEncoding
),
""
));
203
204
values->push_back
205
(
G4AttValue
(
"IMom"
,
G4BestUnit
(
fInitialMomentum
,
"Energy"
),
""
));
206
207
values->push_back
208
(
G4AttValue
(
"IMag"
,
G4BestUnit
(
fInitialMomentum
.
mag
(),
"Energy"
),
""
));
209
210
values->push_back
211
(
G4AttValue
(
"NTP"
,
G4UIcommand::ConvertToString
(
GetPointEntries
()),
""
));
212
213
#ifdef G4ATTDEBUG
214
G4cout
<<
G4AttCheck
(values,
GetAttDefs
());
215
#endif
216
return
values
;
217
}
geant4
tree
geant4-10.6-release
examples
extended
field
field04
src
F04Trajectory.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:05
using
1.8.2 with
ECCE GitHub integration