forked from alisw/AliPhysics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAliCFPair.cxx
executable file
·306 lines (292 loc) · 7.54 KB
/
AliCFPair.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
////////////////////////////////////////////////
// Class to handle pairs of tracks
// Useful for resonance analysis
// Derives from AliVParticle =>
// usable in Correction Framework
////////////////////////////////////////////////
// author : [email protected]
////////////////////////////////////////////////
#include "AliCFPair.h"
#include "AliESDtrack.h"
#include "AliESDv0.h"
#include "AliESDEvent.h"
#include "TMath.h"
#include "AliAODv0.h"
ClassImp(AliCFPair)
AliCFPair::AliCFPair(AliVParticle* t1, AliVParticle* t2) :
AliVParticle(),
fIsV0(0),
fTrackNeg(t1),
fTrackPos(t2),
fESDV0(0x0),
fAODV0(0x0),
fLabel(-1),
fV0PDG(0),
fMassNeg(0.),
fMassPos(0.)
{
//
// 2-track ctor
//
}
AliCFPair::AliCFPair(AliESDv0* v0, AliESDEvent* esd) :
AliVParticle(),
fIsV0(1),
fTrackNeg(esd->GetTrack(v0->GetNindex())),
fTrackPos(esd->GetTrack(v0->GetPindex())),
fESDV0(v0),
fAODV0(0x0),
fLabel(-1),
fV0PDG(0),
fMassNeg(0.),
fMassPos(0.)
{
//
// V0 ctor
//
}
AliCFPair::AliCFPair(AliAODv0* v0) :
AliVParticle(),
fIsV0(1),
fTrackNeg((AliVParticle*)v0->GetSecondaryVtx()->GetDaughter(1)),
fTrackPos((AliVParticle*)v0->GetSecondaryVtx()->GetDaughter(0)),
fESDV0(0x0),
fAODV0(v0),
fLabel(-1),
fV0PDG(0),
fMassNeg(0.),
fMassPos(0.)
{
//
// V0 ctor
//
}
AliCFPair::AliCFPair(const AliCFPair& c) :
AliVParticle(c),
fIsV0(c.fIsV0),
fTrackNeg(c.fTrackNeg),
fTrackPos(c.fTrackPos),
fESDV0(c.fESDV0),
fAODV0(c.fAODV0),
fLabel(c.fLabel),
fV0PDG(c.fV0PDG),
fMassNeg(c.fMassNeg),
fMassPos(c.fMassPos)
{
//
// Copy constructor.
//
}
AliCFPair& AliCFPair::operator=(const AliCFPair& c) {
//
// assignment operator.
//
if (this!=&c) {
AliVParticle::operator=(c);
fIsV0 = c.fIsV0;
fTrackNeg = c.fTrackNeg ;
fTrackPos = c.fTrackPos ;
fESDV0 = c.fESDV0 ;
fAODV0 = c.fAODV0 ;
fLabel = c.fLabel ;
fV0PDG = c.fV0PDG ;
fMassNeg = c.fMassNeg ;
fMassPos = c.fMassPos;
}
return *this;
}
Bool_t AliCFPair::PxPyPz(Double_t p[3]) const {
//
// sets pair total momentum in vector p
//
if (fIsV0) {
if (fESDV0) fESDV0->GetPxPyPz(p[0],p[1],p[2]);
else if (fAODV0) fAODV0->PxPyPz(p);
else Error("PxPyPz","Pointer to V0 not found");
}
else if (fTrackNeg && fTrackPos) {
p[0]=fTrackNeg->Px()+fTrackPos->Px();
p[1]=fTrackNeg->Py()+fTrackPos->Py();
p[2]=fTrackNeg->Pz()+fTrackPos->Pz();
}
else Error("PxPyPz","Could not find V0 nor track pointers");
return kTRUE;
}
Double32_t AliCFPair::P() const {
//
// returns pair total momentum norm
//
Double32_t mom[3];
PxPyPz(mom);
return TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
}
Double32_t AliCFPair::Px() const {
//
// returns pair X-projected momentum
//
Double32_t mom[3];
PxPyPz(mom);
return mom[0];
}
Double32_t AliCFPair::Py() const {
//
// returns pair Y-projected momentum
//
Double32_t mom[3];
PxPyPz(mom);
return mom[1];
}
Double32_t AliCFPair::Pz() const {
//
// returns pair Z-projected momentum
//
Double32_t mom[3];
PxPyPz(mom);
return mom[2];
}
Double32_t AliCFPair::Pt() const {
//
// returns pair transverse (XY) momentum
//
Double32_t mom[3];
PxPyPz(mom);
return sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
}
Double32_t AliCFPair::E() const {
//
// returns pair total energy according to ESD-calculated mass
//
Double32_t mom[3];
PxPyPz(mom);
Double32_t mass=M() ;
return TMath::Sqrt(mass*mass + mom[0]*mom[0]+ mom[1]*mom[1]+ mom[2]*mom[2]);
}
Bool_t AliCFPair::XvYvZv(Double_t x[3]) const {
//
// sets pair position to x
// since this class is designed for resonances, the assumed pair position
// should be the same for both tracks. neg track position is kept here
//
if (fIsV0) {
if (fESDV0) fESDV0->GetXYZ(x[0],x[1],x[2]);
else if (fAODV0) fAODV0->XvYvZv(x);
else Error("PxPyPz","Pointer to V0 not found");
}
else if (fTrackNeg) fTrackNeg->PxPyPz(x);
else Error("PxPyPz","Could not find V0 nor track pointers");
return kTRUE;
}
Double32_t AliCFPair::Xv() const {
//
// returns pair X-projected position
//
Double32_t pos[3];
XvYvZv(pos);
return pos[0];
}
Double32_t AliCFPair::Yv() const {
//
// returns pair Y-projected position
//
Double32_t pos[3];
XvYvZv(pos);
return pos[1];
}
Double32_t AliCFPair::Zv() const {
//
// returns pair Z-projected position
//
Double32_t pos[3];
XvYvZv(pos);
return pos[2];
}
Double32_t AliCFPair::Phi() const {
//
// returns pair phi angle (in transverse plane)
//
return TMath::Pi()+TMath::ATan2(-Py(),-Px());
}
Double32_t AliCFPair::Theta() const {
//
// returns pair theta angle (in YZ plane)
//
return (Pz()==0)?TMath::PiOver2():TMath::ACos(Pz()/P());
}
Double32_t AliCFPair::Eta() const {
//
// returns pair pseudo-rapidity
//
Double32_t pmom = P();
Double32_t pz = Pz();
if (pmom != TMath::Abs(pz)) return 0.5*TMath::Log((pmom+pz)/(pmom-pz));
else return 999;
}
Double32_t AliCFPair::Y() const {
//
// returns pair rapidity
//
Double32_t e = E();
Double32_t pz = Pz();
if (e == pz || e == -pz) {
printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
return 999;
}
if (e < pz) {
printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
return 999;
}
Double32_t y = 0.5 * log((e + pz) / (e - pz));
return y;
}
Double32_t AliCFPair::M() const {
//
// returns pair invariant mass
// in case of a V0, returns the current mass hypothesis
// otherwise returns ESD-calculated mass
//
Double32_t minv = 0. ;
if (fIsV0) {
if (fESDV0) {
fESDV0->ChangeMassHypothesis(fV0PDG);
minv = (Double32_t)fESDV0->GetEffMass();
}
else if (fAODV0) {
switch (fV0PDG) {
case 310 : minv = fAODV0->MassK0Short() ; break ;
case 3122 : minv = fAODV0->MassLambda() ; break ;
case -3122: minv = fAODV0->MassAntiLambda() ; break ;
default: minv = -1. ; break ;
}
}
else Error("PxPyPz","Pointer to V0 not found");
}
else if (fTrackNeg && fTrackPos) {
Double32_t p = P() ;
Double32_t e =0. ;
if (fMassNeg==0. && fMassPos==0.) {
e = fTrackNeg->E() + fTrackPos->E() ;
}
else {
e =
TMath::Sqrt(TMath::Power(fTrackNeg->P(),2)+TMath::Power(fMassNeg,2)) +
TMath::Sqrt(TMath::Power(fTrackPos->P(),2)+TMath::Power(fMassPos,2)) ;
}
minv = TMath::Sqrt(e*e-p*p);
}
else Error("M","Could not find V0 nor track pointers");
return minv ;
}