1 /*************************************************************************
2 * Copyright(c) 1998-2009, 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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////
18 // Dielectron Pair class. Internally it makes use of AliKFParticle. //
20 ///////////////////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <AliVTrack.h>
25 #include <AliVVertex.h>
28 #include "AliDielectronPair.h"
30 ClassImp(AliDielectronPair)
32 AliDielectronPair::AliDielectronPair() :
42 // Default Constructor
47 //______________________________________________
48 AliDielectronPair::AliDielectronPair(AliVTrack * const particle1, Int_t pid1,
49 AliVTrack * const particle2, Int_t pid2, Char_t type) :
59 // Constructor with tracks
61 SetTracks(particle1, pid1, particle2, pid2);
64 //______________________________________________
65 AliDielectronPair::AliDielectronPair(const AliKFParticle * const particle1,
66 const AliKFParticle * const particle2,
67 AliVTrack * const refParticle1,
68 AliVTrack * const refParticle2, Char_t type) :
78 // Constructor with tracks
80 SetTracks(particle1, particle2,refParticle1,refParticle2);
83 //______________________________________________
84 AliDielectronPair::~AliDielectronPair()
92 //______________________________________________
93 void AliDielectronPair::SetTracks(AliVTrack * const particle1, Int_t pid1,
94 AliVTrack * const particle2, Int_t pid2)
97 // Sort particles by pt, first particle larget Pt
98 // set AliKF daughters and pair
99 // refParticle1 and 2 are the original tracks. In the case of track rotation
100 // they are needed in the framework
106 AliKFParticle kf1(*particle1,pid1);
107 AliKFParticle kf2(*particle2,pid2);
109 fPair.AddDaughter(kf1);
110 fPair.AddDaughter(kf2);
112 if (particle1->Pt()>particle2->Pt()){
125 //______________________________________________
126 void AliDielectronPair::SetTracks(const AliKFParticle * const particle1,
127 const AliKFParticle * const particle2,
128 AliVTrack * const refParticle1,
129 AliVTrack * const refParticle2)
132 // Sort particles by pt, first particle larget Pt
133 // set AliKF daughters and pair
134 // refParticle1 and 2 are the original tracks. In the case of track rotation
135 // they are needed in the framework
141 AliKFParticle kf1(*particle1);
142 AliKFParticle kf2(*particle2);
144 fPair.AddDaughter(kf1);
145 fPair.AddDaughter(kf2);
147 if (kf1.GetPt()>kf2.GetPt()){
148 fRefD1 = refParticle1;
149 fRefD2 = refParticle2;
153 fRefD1 = refParticle2;
154 fRefD2 = refParticle1;
160 //______________________________________________
161 void AliDielectronPair::GetThetaPhiCM(Double_t &thetaHE, Double_t &phiHE, Double_t &thetaCS, Double_t &phiCS) const
164 // Calculate theta and phi in helicity and Collins-Soper coordinate frame
166 const Double_t kBeamEnergy = 3500.;
167 Double_t pxyz1[3]={fD1.GetPx(),fD1.GetPy(),fD1.GetPz()};
168 Double_t pxyz2[3]={fD2.GetPx(),fD2.GetPy(),fD2.GetPz()};
169 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
170 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
172 // AliVParticle *d1 = static_cast<AliVParticle*>(fRefD1.GetObject());
173 // AliVParticle *d2 = static_cast<AliVParticle*>(fRefD2.GetObject());
175 // d1->PxPyPz(pxyz1);
176 // d2->PxPyPz(pxyz2);
178 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
179 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
181 // first & second daughter 4-mom
182 TLorentzVector p1Mom(pxyz1[0],pxyz1[1],pxyz1[2],
183 TMath::Sqrt(pxyz1[0]*pxyz1[0]+pxyz1[1]*pxyz1[1]+pxyz1[2]*pxyz1[2]+eleMass*eleMass));
184 TLorentzVector p2Mom(pxyz2[0],pxyz2[1],pxyz2[2],
185 TMath::Sqrt(pxyz2[0]*pxyz2[0]+pxyz2[1]*pxyz2[1]+pxyz2[2]*pxyz2[2]+eleMass*eleMass));
186 // J/Psi 4-momentum vector
187 TLorentzVector motherMom=p1Mom+p2Mom;
189 // boost all the 4-mom vectors to the mother rest frame
190 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
197 TVector3 zAxisHE = (motherMom.Vect()).Unit();
198 TVector3 zAxisCS = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
199 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
200 TVector3 xAxisHE = (yAxis.Cross(zAxisHE)).Unit();
201 TVector3 xAxisCS = (yAxis.Cross(zAxisCS)).Unit();
203 // fill theta and phi
205 thetaHE = zAxisHE.Dot((p1Mom.Vect()).Unit());
206 thetaCS = zAxisCS.Dot((p1Mom.Vect()).Unit());
207 phiHE = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisHE));
208 phiCS = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisCS));
210 thetaHE = zAxisHE.Dot((p2Mom.Vect()).Unit());
211 thetaCS = zAxisCS.Dot((p2Mom.Vect()).Unit());
212 phiHE = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisHE));
213 phiCS = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisCS));
217 //______________________________________________
218 Double_t AliDielectronPair::ThetaPhiCM(const AliVParticle* d1, const AliVParticle* d2,
219 const Bool_t isHE, const Bool_t isTheta)
221 // The function calculates theta and phi in the mother rest frame with
222 // respect to the helicity coordinate system and Collins-Soper coordinate system
223 // TO DO: generalize for different decays (only J/Psi->e+e- now)
225 // Laboratory frame 4-vectors:
226 // projectile beam & target beam 4-mom
227 // TODO: need to retrieve the beam energy from somewhere
228 const Double_t kBeamEnergy = 3500.;
229 Double_t px1=d1->Px();
230 Double_t py1=d1->Py();
231 Double_t pz1=d1->Pz();
232 Double_t px2=d2->Px();
233 Double_t py2=d2->Py();
234 Double_t pz2=d2->Pz();
235 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
236 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
238 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
239 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
241 // first & second daughter 4-mom
242 TLorentzVector p1Mom(px1,py1,pz1,TMath::Sqrt(px1*px1+py1*py1+pz1*pz1+eleMass*eleMass));
243 TLorentzVector p2Mom(px2,py2,pz2,TMath::Sqrt(px2*px2+py2*py2+pz2*pz2+eleMass*eleMass));
244 // J/Psi 4-momentum vector
245 TLorentzVector motherMom=p1Mom+p2Mom;
247 // boost all the 4-mom vectors to the mother rest frame
248 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
256 if(isHE) zAxis = (motherMom.Vect()).Unit();
257 else zAxis = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
258 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
259 TVector3 xAxis = (yAxis.Cross(zAxis)).Unit();
261 // return either theta or phi
264 return zAxis.Dot((p1Mom.Vect()).Unit());
266 return zAxis.Dot((p2Mom.Vect()).Unit());
271 return TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxis));
273 return TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxis));
277 //______________________________________________
278 Double_t AliDielectronPair::ThetaPhiCM(const Bool_t isHE, const Bool_t isTheta) const {
279 // The function calculates theta and phi in the mother rest frame with
280 // respect to the helicity coordinate system and Collins-Soper coordinate system
281 // TO DO: generalize for different decays (only J/Psi->e+e- now)
283 // Laboratory frame 4-vectors:
284 // projectile beam & target beam 4-mom
285 AliVParticle *d1 = static_cast<AliVParticle*>(fRefD1.GetObject());
286 AliVParticle *d2 = static_cast<AliVParticle*>(fRefD2.GetObject());
288 const Double_t kBeamEnergy = 3500.;
289 Double_t px1=d1->Px();
290 Double_t py1=d1->Py();
291 Double_t pz1=d1->Pz();
292 Double_t px2=d2->Px();
293 Double_t py2=d2->Py();
294 Double_t pz2=d2->Pz();
295 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
296 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
298 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
299 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
301 // first & second daughter 4-mom
302 // first & second daughter 4-mom
303 TLorentzVector p1Mom(px1,py1,pz1,TMath::Sqrt(px1*px1+py1*py1+pz1*pz1+eleMass*eleMass));
304 TLorentzVector p2Mom(px2,py2,pz2,TMath::Sqrt(px2*px2+py2*py2+pz2*pz2+eleMass*eleMass));
305 // J/Psi 4-momentum vector
306 TLorentzVector motherMom=p1Mom+p2Mom;
308 // boost all the 4-mom vectors to the mother rest frame
309 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
317 if(isHE) zAxis = (motherMom.Vect()).Unit();
318 else zAxis = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
319 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
320 TVector3 xAxis = (yAxis.Cross(zAxis)).Unit();
322 // return either theta or phi
325 return zAxis.Dot((p1Mom.Vect()).Unit());
327 return zAxis.Dot((p2Mom.Vect()).Unit());
331 return TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxis));
333 return TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxis));
337 // //______________________________________________
338 // Double_t AliDielectronPair::GetLXY(const AliVVertex * const vtx) const
341 // // Calculate the decay length in XY taking into account the primary vertex position
343 // if(!vtx) return 0;
344 // return ( (Xv()-vtx->GetX()) * Px() + (Yv()-vtx->GetY()) * Py() )/Pt() ;
347 // //______________________________________________
348 // Double_t AliDielectronPair::GetPseudoProperTime(const AliVVertex * const vtx) const
351 // // Calculate the pseudo proper time
353 // Double_t lxy=GetLXY(vtx);
354 // Double_t psProperDecayLength = lxy*(TDatabasePDG::Instance()->GetParticle(443)->Mass())/Pt();
355 // return psProperDecayLength;