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