]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFPair.cxx
Remove a run from LHC10e wo AODs; added run list for the new PbPb MC LHC11a10b_bis
[u/mrichter/AliRoot.git] / CORRFW / AliCFPair.cxx
CommitLineData
2fbc0b17 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17////////////////////////////////////////////////
18// Class to handle pairs of tracks
19// Useful for resonance analysis
20// Derives from AliVParticle =>
21// usable in Correction Framework
22////////////////////////////////////////////////
23// author : renaud.vernet@cern.ch
24////////////////////////////////////////////////
25
26#include "AliCFPair.h"
27#include "AliESDtrack.h"
28#include "AliESDv0.h"
29#include "AliESDEvent.h"
30#include "TMath.h"
10d9a8a6 31#include "AliAODv0.h"
2fbc0b17 32
33ClassImp(AliCFPair)
34
10d9a8a6 35AliCFPair::AliCFPair(AliVParticle* t1, AliVParticle* t2) :
2fbc0b17 36 AliVParticle(),
37 fIsV0(0),
38 fTrackNeg(t1),
39 fTrackPos(t2),
10d9a8a6 40 fESDV0(0x0),
41 fAODV0(0x0),
42 fLabel(-1),
d3e71b00 43 fV0PDG(0),
44 fMassNeg(0.),
45 fMassPos(0.)
2fbc0b17 46{
47 //
48 // 2-track ctor
49 //
50}
51AliCFPair::AliCFPair(AliESDv0* v0, AliESDEvent* esd) :
52 AliVParticle(),
53 fIsV0(1),
54 fTrackNeg(esd->GetTrack(v0->GetNindex())),
55 fTrackPos(esd->GetTrack(v0->GetPindex())),
10d9a8a6 56 fESDV0(v0),
57 fAODV0(0x0),
58 fLabel(-1),
d3e71b00 59 fV0PDG(0),
60 fMassNeg(0.),
61 fMassPos(0.)
10d9a8a6 62{
63 //
64 // V0 ctor
65 //
66}
67AliCFPair::AliCFPair(AliAODv0* v0) :
68 AliVParticle(),
69 fIsV0(1),
70 fTrackNeg((AliVParticle*)v0->GetSecondaryVtx()->GetDaughter(1)),
71 fTrackPos((AliVParticle*)v0->GetSecondaryVtx()->GetDaughter(0)),
72 fESDV0(0x0),
73 fAODV0(v0),
74 fLabel(-1),
d3e71b00 75 fV0PDG(0),
76 fMassNeg(0.),
77 fMassPos(0.)
2fbc0b17 78{
79 //
80 // V0 ctor
81 //
82}
83AliCFPair::AliCFPair(const AliCFPair& c) :
84 AliVParticle(c),
85 fIsV0(c.fIsV0),
86 fTrackNeg(c.fTrackNeg),
87 fTrackPos(c.fTrackPos),
10d9a8a6 88 fESDV0(c.fESDV0),
89 fAODV0(c.fAODV0),
90 fLabel(c.fLabel),
d3e71b00 91 fV0PDG(c.fV0PDG),
92 fMassNeg(c.fMassNeg),
93 fMassPos(c.fMassPos)
2fbc0b17 94{
95 //
96 // Copy constructor.
97 //
98}
99AliCFPair& AliCFPair::operator=(const AliCFPair& c) {
100 //
101 // assignment operator.
102 //
103
104 if (this!=&c) {
105 AliVParticle::operator=(c);
106 fIsV0 = c.fIsV0;
107 fTrackNeg = c.fTrackNeg ;
108 fTrackPos = c.fTrackPos ;
10d9a8a6 109 fESDV0 = c.fESDV0 ;
110 fAODV0 = c.fAODV0 ;
111 fLabel = c.fLabel ;
112 fV0PDG = c.fV0PDG ;
d3e71b00 113 fMassNeg = c.fMassNeg ;
114 fMassPos = c.fMassPos;
2fbc0b17 115 }
116 return *this;
117}
118Bool_t AliCFPair::PxPyPz(Double_t p[3]) const {
119 //
120 // sets pair total momentum in vector p
121 //
10d9a8a6 122 if (fIsV0) {
123 if (fESDV0) fESDV0->GetPxPyPz(p[0],p[1],p[2]);
124 else if (fAODV0) fAODV0->PxPyPz(p);
125 else Error("PxPyPz","Pointer to V0 not found");
126 }
127 else if (fTrackNeg && fTrackPos) {
128 p[0]=fTrackNeg->Px()+fTrackPos->Px();
129 p[1]=fTrackNeg->Py()+fTrackPos->Py();
130 p[2]=fTrackNeg->Pz()+fTrackPos->Pz();
2fbc0b17 131 }
10d9a8a6 132 else Error("PxPyPz","Could not find V0 nor track pointers");
2fbc0b17 133 return kTRUE;
134}
135
136Double32_t AliCFPair::P() const {
137 //
138 // returns pair total momentum norm
139 //
140 Double32_t mom[3];
141 PxPyPz(mom);
142 return TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
143}
144
145Double32_t AliCFPair::Px() const {
146 //
147 // returns pair X-projected momentum
148 //
149 Double32_t mom[3];
150 PxPyPz(mom);
151 return mom[0];
152}
153Double32_t AliCFPair::Py() const {
154 //
155 // returns pair Y-projected momentum
156 //
157 Double32_t mom[3];
158 PxPyPz(mom);
159 return mom[1];
160}
161Double32_t AliCFPair::Pz() const {
162 //
163 // returns pair Z-projected momentum
164 //
165 Double32_t mom[3];
166 PxPyPz(mom);
167 return mom[2];
168}
169Double32_t AliCFPair::Pt() const {
170 //
171 // returns pair transverse (XY) momentum
172 //
173 Double32_t mom[3];
174 PxPyPz(mom);
175 return sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
176}
177Double32_t AliCFPair::E() const {
178 //
179 // returns pair total energy according to ESD-calculated mass
180 //
181 Double32_t mom[3];
182 PxPyPz(mom);
183 Double32_t mass=M() ;
184 return TMath::Sqrt(mass*mass + mom[0]*mom[0]+ mom[1]*mom[1]+ mom[2]*mom[2]);
185}
186Bool_t AliCFPair::XvYvZv(Double_t x[3]) const {
187 //
188 // sets pair position to x
189 // since this class is designed for resonances, the assumed pair position
190 // should be the same for both tracks. neg track position is kept here
191 //
10d9a8a6 192
193 if (fIsV0) {
194 if (fESDV0) fESDV0->GetXYZ(x[0],x[1],x[2]);
195 else if (fAODV0) fAODV0->XvYvZv(x);
196 else Error("PxPyPz","Pointer to V0 not found");
2fbc0b17 197 }
10d9a8a6 198 else if (fTrackNeg) fTrackNeg->PxPyPz(x);
199 else Error("PxPyPz","Could not find V0 nor track pointers");
200
2fbc0b17 201 return kTRUE;
202}
203Double32_t AliCFPair::Xv() const {
204 //
205 // returns pair X-projected position
206 //
207 Double32_t pos[3];
208 XvYvZv(pos);
209 return pos[0];
210}
211Double32_t AliCFPair::Yv() const {
212 //
213 // returns pair Y-projected position
214 //
215 Double32_t pos[3];
216 XvYvZv(pos);
217 return pos[1];
218}
219Double32_t AliCFPair::Zv() const {
220 //
221 // returns pair Z-projected position
222 //
223 Double32_t pos[3];
224 XvYvZv(pos);
225 return pos[2];
226}
227Double32_t AliCFPair::Phi() const {
228 //
229 // returns pair phi angle (in transverse plane)
230 //
231 return TMath::Pi()+TMath::ATan2(-Py(),-Px());
232}
233Double32_t AliCFPair::Theta() const {
234 //
235 // returns pair theta angle (in YZ plane)
236 //
237 return (Pz()==0)?TMath::PiOver2():TMath::ACos(Pz()/P());
238}
239Double32_t AliCFPair::Eta() const {
240 //
241 // returns pair pseudo-rapidity
242 //
243 Double32_t pmom = P();
244 Double32_t pz = Pz();
245 if (pmom != TMath::Abs(pz)) return 0.5*TMath::Log((pmom+pz)/(pmom-pz));
246 else return 999;
247}
248Double32_t AliCFPair::Y() const {
249 //
250 // returns pair rapidity
251 //
252 Double32_t e = E();
253 Double32_t pz = Pz();
254
255 if (e == pz || e == -pz) {
256 printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
257 return 999;
258 }
259 if (e < pz) {
260 printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
261 return 999;
262 }
263 Double32_t y = 0.5 * log((e + pz) / (e - pz));
264 return y;
265}
266Double32_t AliCFPair::M() const {
267 //
268 // returns pair invariant mass
269 // in case of a V0, returns the current mass hypothesis
270 // otherwise returns ESD-calculated mass
271 //
272
10d9a8a6 273 Double32_t minv = 0. ;
2fbc0b17 274
10d9a8a6 275 if (fIsV0) {
276 if (fESDV0) {
277 fESDV0->ChangeMassHypothesis(fV0PDG);
278 minv = (Double32_t)fESDV0->GetEffMass();
279 }
280 else if (fAODV0) {
281 switch (fV0PDG) {
282 case 310 : minv = fAODV0->MassK0Short() ; break ;
283 case 3122 : minv = fAODV0->MassLambda() ; break ;
284 case -3122: minv = fAODV0->MassAntiLambda() ; break ;
285 default: minv = -1. ; break ;
286 }
287 }
288 else Error("PxPyPz","Pointer to V0 not found");
289 }
290 else if (fTrackNeg && fTrackPos) {
2fbc0b17 291 Double32_t p = P() ;
d3e71b00 292 Double32_t e =0. ;
293 if (fMassNeg==0. && fMassPos==0.) {
294 e = fTrackNeg->E() + fTrackPos->E() ;
295 }
296 else {
297 e =
298 TMath::Sqrt(TMath::Power(fTrackNeg->P(),2)+TMath::Power(fMassNeg,2)) +
299 TMath::Sqrt(TMath::Power(fTrackPos->P(),2)+TMath::Power(fMassPos,2)) ;
300 }
2fbc0b17 301 minv = TMath::Sqrt(e*e-p*p);
302 }
10d9a8a6 303 else Error("M","Could not find V0 nor track pointers");
304
2fbc0b17 305 return minv ;
306}