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 "AliDielectronPair.h"
24 #include "AliVTrack.h"
27 ClassImp(AliDielectronPair)
29 AliDielectronPair::AliDielectronPair() :
39 // Default Constructor
44 //______________________________________________
45 AliDielectronPair::AliDielectronPair(AliVTrack * const particle1, Int_t pid1,
46 AliVTrack * const particle2, Int_t pid2, Char_t type) :
56 // Constructor with tracks
58 SetTracks(particle1, pid1, particle2, pid2);
61 //______________________________________________
62 AliDielectronPair::AliDielectronPair(const AliKFParticle * const particle1,
63 const AliKFParticle * const particle2,
64 AliVTrack * const refParticle1,
65 AliVTrack * const refParticle2, Char_t type) :
75 // Constructor with tracks
77 SetTracks(particle1, particle2,refParticle1,refParticle2);
80 //______________________________________________
81 AliDielectronPair::~AliDielectronPair()
89 //______________________________________________
90 void AliDielectronPair::SetTracks(AliVTrack * const particle1, Int_t pid1,
91 AliVTrack * const particle2, Int_t pid2)
94 // Sort particles by pt, first particle larget Pt
95 // set AliKF daughters and pair
96 // refParticle1 and 2 are the original tracks. In the case of track rotation
97 // they are needed in the framework
103 AliKFParticle kf1(*particle1,pid1);
104 AliKFParticle kf2(*particle2,pid2);
106 fPair.AddDaughter(kf1);
107 fPair.AddDaughter(kf2);
109 if (particle1->Pt()>particle2->Pt()){
122 //______________________________________________
123 void AliDielectronPair::SetTracks(const AliKFParticle * const particle1,
124 const AliKFParticle * const particle2,
125 AliVTrack * const refParticle1,
126 AliVTrack * const refParticle2)
129 // Sort particles by pt, first particle larget Pt
130 // set AliKF daughters and pair
131 // refParticle1 and 2 are the original tracks. In the case of track rotation
132 // they are needed in the framework
138 AliKFParticle kf1(*particle1);
139 AliKFParticle kf2(*particle2);
141 fPair.AddDaughter(kf1);
142 fPair.AddDaughter(kf2);
144 if (kf1.GetPt()>kf2.GetPt()){
145 fRefD1 = refParticle1;
146 fRefD2 = refParticle2;
150 fRefD1 = refParticle2;
151 fRefD2 = refParticle1;
157 //______________________________________________
158 void AliDielectronPair::GetThetaPhiCM(Double_t &thetaHE, Double_t &phiHE, Double_t &thetaCS, Double_t &phiCS) const
161 // Calculate theta and phi in helicity and Collins-Soper coordinate frame
163 const Double_t kBeamEnergy = 3500.;
164 Double_t pxyz1[3]={fD1.GetPx(),fD1.GetPy(),fD1.GetPz()};
165 Double_t pxyz2[3]={fD2.GetPx(),fD2.GetPy(),fD2.GetPz()};
166 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
167 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
169 // AliVParticle *d1 = static_cast<AliVParticle*>(fRefD1.GetObject());
170 // AliVParticle *d2 = static_cast<AliVParticle*>(fRefD2.GetObject());
172 // d1->PxPyPz(pxyz1);
173 // d2->PxPyPz(pxyz2);
175 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
176 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
178 // first & second daughter 4-mom
179 TLorentzVector p1Mom(pxyz1[0],pxyz1[1],pxyz1[2],
180 TMath::Sqrt(pxyz1[0]*pxyz1[0]+pxyz1[1]*pxyz1[1]+pxyz1[2]*pxyz1[2]+eleMass*eleMass));
181 TLorentzVector p2Mom(pxyz2[0],pxyz2[1],pxyz2[2],
182 TMath::Sqrt(pxyz2[0]*pxyz2[0]+pxyz2[1]*pxyz2[1]+pxyz2[2]*pxyz2[2]+eleMass*eleMass));
183 // J/Psi 4-momentum vector
184 TLorentzVector motherMom=p1Mom+p2Mom;
186 // boost all the 4-mom vectors to the mother rest frame
187 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
194 TVector3 zAxisHE = (motherMom.Vect()).Unit();
195 TVector3 zAxisCS = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
196 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
197 TVector3 xAxisHE = (yAxis.Cross(zAxisHE)).Unit();
198 TVector3 xAxisCS = (yAxis.Cross(zAxisCS)).Unit();
200 // fill theta and phi
202 thetaHE = zAxisHE.Dot((p1Mom.Vect()).Unit());
203 thetaCS = zAxisCS.Dot((p1Mom.Vect()).Unit());
204 phiHE = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisHE));
205 phiCS = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisCS));
207 thetaHE = zAxisHE.Dot((p2Mom.Vect()).Unit());
208 thetaCS = zAxisCS.Dot((p2Mom.Vect()).Unit());
209 phiHE = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisHE));
210 phiCS = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisCS));
214 //______________________________________________
215 Double_t AliDielectronPair::ThetaPhiCM(const AliVParticle* d1, const AliVParticle* d2,
216 const Bool_t isHE, const Bool_t isTheta)
218 // The function calculates theta and phi in the mother rest frame with
219 // respect to the helicity coordinate system and Collins-Soper coordinate system
220 // TO DO: generalize for different decays (only J/Psi->e+e- now)
222 // Laboratory frame 4-vectors:
223 // projectile beam & target beam 4-mom
224 // TODO: need to retrieve the beam energy from somewhere
225 const Double_t kBeamEnergy = 3500.;
226 Double_t px1=d1->Px();
227 Double_t py1=d1->Py();
228 Double_t pz1=d1->Pz();
229 Double_t px2=d2->Px();
230 Double_t py2=d2->Py();
231 Double_t pz2=d2->Pz();
232 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
233 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
235 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
236 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
238 // first & second daughter 4-mom
239 TLorentzVector p1Mom(px1,py1,pz1,TMath::Sqrt(px1*px1+py1*py1+pz1*pz1+eleMass*eleMass));
240 TLorentzVector p2Mom(px2,py2,pz2,TMath::Sqrt(px2*px2+py2*py2+pz2*pz2+eleMass*eleMass));
241 // J/Psi 4-momentum vector
242 TLorentzVector motherMom=p1Mom+p2Mom;
244 // boost all the 4-mom vectors to the mother rest frame
245 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
253 if(isHE) zAxis = (motherMom.Vect()).Unit();
254 else zAxis = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
255 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
256 TVector3 xAxis = (yAxis.Cross(zAxis)).Unit();
258 // return either theta or phi
261 return zAxis.Dot((p1Mom.Vect()).Unit());
263 return zAxis.Dot((p2Mom.Vect()).Unit());
268 return TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxis));
270 return TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxis));
274 //______________________________________________
275 Double_t AliDielectronPair::ThetaPhiCM(const Bool_t isHE, const Bool_t isTheta) const {
276 // The function calculates theta and phi in the mother rest frame with
277 // respect to the helicity coordinate system and Collins-Soper coordinate system
278 // TO DO: generalize for different decays (only J/Psi->e+e- now)
280 // Laboratory frame 4-vectors:
281 // projectile beam & target beam 4-mom
282 AliVParticle *d1 = static_cast<AliVParticle*>(fRefD1.GetObject());
283 AliVParticle *d2 = static_cast<AliVParticle*>(fRefD2.GetObject());
285 const Double_t kBeamEnergy = 3500.;
286 Double_t px1=d1->Px();
287 Double_t py1=d1->Py();
288 Double_t pz1=d1->Pz();
289 Double_t px2=d2->Px();
290 Double_t py2=d2->Py();
291 Double_t pz2=d2->Pz();
292 Double_t eleMass=AliPID::ParticleMass(AliPID::kElectron);
293 Double_t proMass=AliPID::ParticleMass(AliPID::kProton);
295 TLorentzVector projMom(0.,0.,-kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
296 TLorentzVector targMom(0.,0., kBeamEnergy,TMath::Sqrt(kBeamEnergy*kBeamEnergy+proMass*proMass));
298 // first & second daughter 4-mom
299 // first & second daughter 4-mom
300 TLorentzVector p1Mom(px1,py1,pz1,TMath::Sqrt(px1*px1+py1*py1+pz1*pz1+eleMass*eleMass));
301 TLorentzVector p2Mom(px2,py2,pz2,TMath::Sqrt(px2*px2+py2*py2+pz2*pz2+eleMass*eleMass));
302 // J/Psi 4-momentum vector
303 TLorentzVector motherMom=p1Mom+p2Mom;
305 // boost all the 4-mom vectors to the mother rest frame
306 TVector3 beta = (-1.0/motherMom.E())*motherMom.Vect();
314 if(isHE) zAxis = (motherMom.Vect()).Unit();
315 else zAxis = ((projMom.Vect()).Unit()-(targMom.Vect()).Unit()).Unit();
316 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
317 TVector3 xAxis = (yAxis.Cross(zAxis)).Unit();
319 // return either theta or phi
322 return zAxis.Dot((p1Mom.Vect()).Unit());
324 return zAxis.Dot((p2Mom.Vect()).Unit());
328 return TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxis));
330 return TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxis));