1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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 ////////////////////////////////////////////////
26 #include "AliCFPair.h"
27 #include "AliESDtrack.h"
29 #include "AliESDEvent.h"
34 AliCFPair::AliCFPair(AliESDtrack*t1, AliESDtrack*t2) :
45 AliCFPair::AliCFPair(AliESDv0* v0, AliESDEvent* esd) :
48 fTrackNeg(esd->GetTrack(v0->GetNindex())),
49 fTrackPos(esd->GetTrack(v0->GetPindex())),
56 AliCFPair::AliCFPair(const AliCFPair& c) :
59 fTrackNeg(c.fTrackNeg),
60 fTrackPos(c.fTrackPos),
67 AliCFPair& AliCFPair::operator=(const AliCFPair& c) {
69 // assignment operator.
73 AliVParticle::operator=(c);
75 fTrackNeg = c.fTrackNeg ;
76 fTrackPos = c.fTrackPos ;
81 Bool_t AliCFPair::PxPyPz(Double_t p[3]) const {
83 // sets pair total momentum in vector p
86 fV0->GetPxPyPz(p[0],p[1],p[2]);
88 Double32_t p1[3], p2[3];
89 fTrackNeg->PxPyPz(p1);
90 fTrackPos->PxPyPz(p2);
98 Double32_t AliCFPair::P() const {
100 // returns pair total momentum norm
104 return TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
107 Double32_t AliCFPair::Px() const {
109 // returns pair X-projected momentum
115 Double32_t AliCFPair::Py() const {
117 // returns pair Y-projected momentum
123 Double32_t AliCFPair::Pz() const {
125 // returns pair Z-projected momentum
131 Double32_t AliCFPair::Pt() const {
133 // returns pair transverse (XY) momentum
137 return sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
139 Double32_t AliCFPair::E() const {
141 // returns pair total energy according to ESD-calculated mass
145 Double32_t mass=M() ;
146 return TMath::Sqrt(mass*mass + mom[0]*mom[0]+ mom[1]*mom[1]+ mom[2]*mom[2]);
148 Bool_t AliCFPair::XvYvZv(Double_t x[3]) const {
150 // sets pair position to x
151 // since this class is designed for resonances, the assumed pair position
152 // should be the same for both tracks. neg track position is kept here
156 fV0->GetXYZ(x[0],x[1],x[2]);
159 fTrackNeg->PxPyPz(x1);
166 Double32_t AliCFPair::Xv() const {
168 // returns pair X-projected position
174 Double32_t AliCFPair::Yv() const {
176 // returns pair Y-projected position
182 Double32_t AliCFPair::Zv() const {
184 // returns pair Z-projected position
190 Double32_t AliCFPair::Phi() const {
192 // returns pair phi angle (in transverse plane)
194 return TMath::Pi()+TMath::ATan2(-Py(),-Px());
196 Double32_t AliCFPair::Theta() const {
198 // returns pair theta angle (in YZ plane)
200 return (Pz()==0)?TMath::PiOver2():TMath::ACos(Pz()/P());
202 Double32_t AliCFPair::Eta() const {
204 // returns pair pseudo-rapidity
206 Double32_t pmom = P();
207 Double32_t pz = Pz();
208 if (pmom != TMath::Abs(pz)) return 0.5*TMath::Log((pmom+pz)/(pmom-pz));
211 Double32_t AliCFPair::Y() const {
213 // returns pair rapidity
216 Double32_t pz = Pz();
218 if (e == pz || e == -pz) {
219 printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
223 printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
226 Double32_t y = 0.5 * log((e + pz) / (e - pz));
229 Double32_t AliCFPair::M() const {
231 // returns pair invariant mass
232 // in case of a V0, returns the current mass hypothesis
233 // otherwise returns ESD-calculated mass
238 if (fIsV0) minv = (Double32_t)fV0->GetEffMass();
241 Double32_t e = fTrackNeg->E() + fTrackPos->E() ;
242 minv = TMath::Sqrt(e*e-p*p);