/
FairVTrack.cxx
296 lines (252 loc) · 6.67 KB
/
FairVTrack.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#include "FairVTrack.h"
#include "TPad.h"
#include "TParticle.h"
#include "TView.h"
#include "TGeoTrack.h"
#include <iostream>
using std::cout;
using std::endl;
ClassImp(FairVTrack)
//_______________________________________________________________________
FairVTrack::FairVTrack():
fTrack(0),
fIndex(0),
fParticle(0)
{
//
// Default constructor
//
}
//_______________________________________________________________________
FairVTrack::FairVTrack(const FairVTrack& pts):
TPolyLine3D(pts),
fTrack(0),
fIndex(0),
fParticle(0)
{
//
// Copy constructor
//
pts.Copy(*this);
}
//_______________________________________________________________________
FairVTrack::FairVTrack(Int_t nhits):
TPolyLine3D(nhits),
fTrack(0),
fIndex(0),
fParticle(0)
{
//
// Standard constructor
//
ResetBit(kCanDelete);
}
//_______________________________________________________________________
FairVTrack::~FairVTrack()
{
//
// Default destructor
//
}
//_______________________________________________________________________
void FairVTrack::Copy(TObject& pts) const
{
//
// Copy *this onto pts
//
if((TObject*)this != &pts) {
((TPolyLine3D*)this)->Copy(dynamic_cast<TPolyLine3D&>(pts));
(dynamic_cast<FairVTrack&>(pts)).fGLList = fGLList;
(dynamic_cast<FairVTrack&>(pts)).fLastPoint = fLastPoint;
(dynamic_cast<FairVTrack&>(pts)).fIndex = fIndex;
(dynamic_cast<FairVTrack&>(pts)).fParticle = fParticle;
}
}
//_______________________________________________________________________
Int_t FairVTrack::DistancetoPrimitive(Int_t px, Int_t py)
{
//
//*-*-*-*-*-*-*Compute distance from point px,py to a 3-D polymarker*-*-*-*-*
//*-* =====================================================
//*-*
//*-* Compute the closest distance of approach from point
//*-* px,py to each segment
//*-* of the polyline.
//*-* Returns when the distance found is below DistanceMaximum.
//*-* The distance is computed in pixels units.
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//const Int_t inaxis = 7;
//Int_t dist = 9999;
return TPolyLine3D::DistancetoPrimitive(px,py);
}
//_______________________________________________________________________
void FairVTrack::DumpParticle() const
{
//
// Dump particle corresponding to this point
if (fParticle) { fParticle->Dump(); }
}
//_______________________________________________________________________
void FairVTrack::ExecuteEvent(Int_t event, Int_t px, Int_t py)
{
//
//*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*-*-*-*-*
//*-* =========================================
//*-*
//*-* This member function must be implemented to realize the action
//*-* corresponding to the mouse click on the object in the window
//*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
gPad->SetCursor(kCross);
/*
if (gPad->GetView())
gPad->GetView()->ExecuteRotateView(event, px, py);
*/
// cout << "FairVTrack::ExecuteEvent" << event <<" " <<px <<" " << py<< endl;
fParticle->ExecuteEvent(event, px, py);
}
//_______________________________________________________________________
const Text_t* FairVTrack::GetName() const
{
//
// Return name of the Geant3 particle corresponding to this point
//
if (!fParticle) { return "Particle"; }
return fParticle->GetName();
}
//_______________________________________________________________________
Text_t* FairVTrack::GetObjectInfo(Int_t px, Int_t py) const
{
//
// Redefines TObject::GetObjectInfo.
// Displays the info (particle,etc
// corresponding to cursor position px,py
//
// static char info[64];
// sprintf(info,"%s %d",GetName(),fIndex);
return fParticle->GetObjectInfo(px,py);
}
//_______________________________________________________________________
TParticle* FairVTrack::GetParticle() const
{
//
// Returns pointer to particle
return fParticle;
}
//_______________________________________________________________________
void FairVTrack::InspectParticle() const
{
// Inspect particle corresponding to this track
if (fParticle) { fParticle->Inspect(); }
}
//_______________________________________________________________________
void FairVTrack::SetParticle(TParticle* p)
{
fParticle = p;
SetLineColor(Color(p->GetPdgCode()));
}
//_______________________________________________________________________
void FairVTrack::SetTrack(TGeoTrack* Tr)
{
fTrack=Tr;
SetLineColor(Color(Tr->GetPDG()));
}
//_______________________________________________________________________
Int_t FairVTrack::Color(Int_t pdg)
{
switch(pdg) {
case 22 :
return 1; // photon
case -2112 :
return 2 ; // anti-neutron
case -11 :
return 3; // e+
case -3122 :
return 4; // anti-Lambda
case 11 :
return 5; // e-
case -3222 :
return 6; // Sigma-
case 12 :
return 7; // e-neutrino (NB: flavour undefined by Geant)
case -3212 :
return 8; // Sigma0
case -13 :
return 9; // mu+
case -3112 :
return 10; // Sigma+ (PB)*/
case 13 :
return 11; // mu-
case -3322 :
return 12; // Xi0
case 111 :
return 13; // pi0
case -3312 :
return 14; // Xi+
case 211 :
return 15; // pi+
case -3334 :
return 16; // Omega+ (PB)
case -211 :
return 17; // pi-
case -15 :
return 18; // tau+
case 130 :
return 19; // K long
case 15 :
return 20; // tau-
case 321 :
return 21; // K+
case 411 :
return 22; // D+
case -321 :
return 23; // K-
case -411 :
return 24; // D-
case 2112 :
return 25; // n
case 421 :
return 26; // D0
case 2212 :
return 27; // p
case -421 :
return 28; // D0
case -2212 :
return 29; // anti-proton
case 431 :
return 30; // Ds+
case 310 :
return 31; // K short
case -431 :
return 32; // anti Ds-
case 221 :
return 33; // eta
case 4122 :
return 34; // Lamba_c+
case 3122 :
return 35; // Lambda
case 24 :
return 36; // W+
case 3222 :
return 37; // Sigma+
case -24 :
return 38; // W-
case 3212 :
return 39; // Sigma0
case 23 :
return 40; // Z
case 3112 :
return 41; // Sigma-
case 3322 :
return 42; // Xi0
case 3312 :
return 43; // Xi-
case 3334 :
return 44; // Omega- (PB)
case 50000050 :
return 801; // Cerenkov
default :
return 0;
}
}