1 #ifndef ALIAODRECODECAY_H
2 #define ALIAODRECODECAY_H
3 /* Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 //***********************************************************
7 // Class AliAODRecoDecay
8 // base class for AOD reconstructed decays
9 // Author: A.Dainese, andrea.dainese@lnl.infn.it
10 //***********************************************************
14 #include "AliAODVertex.h"
15 #include "AliVParticle.h"
17 class AliAODRecoDecay : public AliVParticle {
22 AliAODRecoDecay(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
23 Double_t *px,Double_t *py,Double_t *pz,
25 AliAODRecoDecay(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
27 virtual ~AliAODRecoDecay();
29 AliAODRecoDecay(const AliAODRecoDecay& source);
30 AliAODRecoDecay& operator=(const AliAODRecoDecay& source);
34 Double_t GetSecVtxX() const {return GetSecondaryVtx()->GetX();}
35 Double_t GetSecVtxY() const {return GetSecondaryVtx()->GetY();}
36 Double_t GetSecVtxZ() const {return GetSecondaryVtx()->GetZ();}
37 Double_t RadiusSecVtx() const;
38 void SetSecondaryVtx(AliAODVertex *vtx2) {fSecondaryVtx=vtx2;}
39 AliAODVertex* GetSecondaryVtx() const { return (((AliAODVertex*)fSecondaryVtx.GetObject()) ? (AliAODVertex*)fSecondaryVtx.GetObject() : GetOwnSecondaryVtx()); }
40 void SetOwnSecondaryVtx(AliAODVertex *vtx2) {fOwnSecondaryVtx=vtx2;}
41 AliAODVertex* GetOwnSecondaryVtx() const {return fOwnSecondaryVtx;}
42 void GetSecondaryVtx(Double_t vtx[3]) const;
43 Double_t GetReducedChi2() const {return GetSecondaryVtx()->GetChi2perNDF();}
44 Short_t Charge() const {return fCharge;}
45 Short_t GetCharge() const {return fCharge;}
46 void SetCharge(Short_t charge=0) {fCharge=charge;}
49 void SetPID(Int_t nprongs,Double_t *pid);
50 Double_t *GetPID() const { return fPID; }
51 void GetPIDProng(Int_t ip,Double_t *pid) const;
52 virtual const Double_t *PID() const { return fPID; }
54 // prong-to-prong DCAs
55 void SetDCAs(Int_t nDCA,Double_t *dca);
56 void SetDCA(Double_t dca); // 2 prong
57 Double_t GetDCA(Int_t i=0) const {return fDCA[i];}
59 //event and run number
60 void SetEventRunNumbers(Int_t en,Int_t rn)
61 { fEventNumber=en; fRunNumber=rn; return; }
62 Int_t GetEventNumber() const { return fEventNumber; }
63 Int_t GetRunNumber() const { return fRunNumber; }
65 // kinematics & topology
69 Double_t P() const {return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz());}
70 Double_t Pt() const {return TMath::Sqrt(Px()*Px()+Py()*Py());}
71 Double_t OneOverPt() const {return (Pt() ? 1./Pt() : 0.);}
72 Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
73 Double_t Phi() const {return TMath::Pi()+TMath::ATan2(-Py(),-Px());}
74 Double_t Theta() const {return 0.5*TMath::Pi()-TMath::ATan(Pz()/(Pt()+1.e-13));}
75 Double_t Eta() const {return 0.5*TMath::Log((P()+Pz())/(P()-Pz()+1.e-13));}
76 Double_t Xv() const { return GetSecVtxX(); }
77 Double_t Yv() const { return GetSecVtxY(); }
78 Double_t Zv() const { return GetSecVtxZ(); }
79 virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
80 Double_t E(UInt_t pdg) const;
81 Double_t Y(UInt_t pdg) const {return 0.5*TMath::Log((E(pdg)+Pz())/(E(pdg)-Pz()+1.e-13));}
82 Double_t DecayLength(Double_t point[3]) const;
83 Double_t DecayLength(AliAODVertex *vtx1) const
84 {return GetSecondaryVtx()->DistanceToVertex(vtx1);}
85 Double_t DecayLengthError(AliAODVertex *vtx1) const
86 {return GetSecondaryVtx()->ErrorDistanceToVertex(vtx1);}
87 Double_t NormalizedDecayLength(AliAODVertex *vtx1) const
88 {return DecayLength(vtx1)/DecayLengthError(vtx1);}
89 Double_t DecayLengthXY(Double_t point[3]) const;
90 Double_t DecayLengthXY(AliAODVertex *vtx1) const
91 {return GetSecondaryVtx()->DistanceXYToVertex(vtx1);}
92 Double_t DecayLengthXYError(AliAODVertex *vtx1) const
93 {return GetSecondaryVtx()->ErrorDistanceXYToVertex(vtx1);}
94 Double_t NormalizedDecayLengthXY(AliAODVertex *vtx1) const
95 {return DecayLengthXY(vtx1)/DecayLengthXYError(vtx1);}
96 Double_t Ct(UInt_t pdg,Double_t point[3]) const;
97 Double_t Ct(UInt_t pdg,AliAODVertex *vtx1) const;
98 Double_t CosPointingAngle(Double_t point[3]) const;
99 Double_t CosPointingAngle(AliAODVertex *vtx1) const;
100 Double_t CosPointingAngleXY(Double_t point[3]) const;
101 Double_t CosPointingAngleXY(AliAODVertex *vtx1) const;
102 Double_t CosThetaStar(Int_t ip,UInt_t pdgvtx,UInt_t pdgprong0,UInt_t pdgprong1) const;
103 Double_t InvMass(Int_t npdg,UInt_t *pdg) const;
104 Double_t ImpParXY(Double_t point[3]) const;
105 Double_t ImpParXY(AliAODVertex *vtx1) const;
108 //Int_t GetNProngs() const {return GetSecondaryVtx()->GetNDaughters();}
109 Int_t GetNProngs() const {return fNProngs;}
111 Short_t ChargeProng(Int_t ip) const;
112 Double_t Getd0Prong(Int_t ip) const {return fd0[ip];}
113 Double_t Prodd0d0(Int_t ip1=0,Int_t ip2=0) const {return fd0[ip1]*fd0[ip2];}
114 Double_t PxProng(Int_t ip) const {return fPx[ip];}
115 Double_t PyProng(Int_t ip) const {return fPy[ip];}
116 Double_t PzProng(Int_t ip) const {return fPz[ip];}
117 Double_t PtProng(Int_t ip) const;
118 Double_t PProng(Int_t ip) const;
119 Double_t PhiProng(Int_t ip) const
120 {return TMath::ATan2(PyProng(ip),PxProng(ip));}
121 Double_t ThetaProng(Int_t ip) const
122 {return 0.5*TMath::Pi()-TMath::ATan(PzProng(ip)/(PtProng(ip)+1.e-13));}
123 Double_t EtaProng(Int_t ip) const
124 {return -TMath::Log(TMath::Tan(0.5*ThetaProng(ip)));}
125 Double_t EProng(Int_t ip,UInt_t pdg) const;
126 Double_t YProng(Int_t ip,UInt_t pdg) const
127 {return 0.5*TMath::Log((EProng(ip,pdg)+PzProng(ip))/(EProng(ip,pdg)-PzProng(ip)+1.e-13));}
128 Double_t Alpha() const; // for Armenteros-Podolanski plot (V0's)
129 Double_t QlProng(Int_t ip) const;
130 Double_t QtProng(Int_t ip=0) const; // for Armenteros-Podolanski plot (V0's)
131 Double_t QlProngFlightLine(Int_t ip,Double_t point[3]) const;
132 Double_t QlProngFlightLine(Int_t ip,AliAODVertex *vtx1) const;
133 Double_t QtProngFlightLine(Int_t ip,Double_t point[3]) const;
134 Double_t QtProngFlightLine(Int_t ip,AliAODVertex *vtx1) const;
135 Double_t InvMass2Prongs(Int_t ip1,Int_t ip2,UInt_t pdg1,UInt_t pdg2) const;
136 Double_t ProngsRelAngle(Int_t ip1=0,Int_t ip2=1) const;
138 // relate to other objects
139 //Double_t DistanceToVertex(AliAODVertex *vtx) // distance to a AliAODVertex
140 //Double_t DistanceToTrack(AliAODTrack *trk) // distance to a AliAODTrack
144 void Print(Option_t* option = "") const;
145 //void PrintIndices() const {GetSecondaryVtx()->PrintIndices();}
147 // dummy functions for inheritance from AliVParticle
149 {printf("Dummy function; use AliAODRecoDecay::E(UInt_t pdg) instead"); return (Double_t)-999.;}
151 {printf("Dummy function; use AliAODRecoDecay::Y(UInt_t pdg) instead"); return (Double_t)-999.;}
153 {printf("Dummy function"); return (Double_t)-999.;}
157 TRef fSecondaryVtx; // decay vertex
158 AliAODVertex *fOwnSecondaryVtx; // temporary solution (to work outside AliAODEvent)
159 Short_t fCharge; // charge, use this convention for prongs charges:
160 // if(charge== 0) even-index prongs are +
161 // odd-index prongs are -
162 // if(charge==+1) even-index prongs are +
163 // odd-index prongs are -
164 // if(charge==-1) even-index prongs are -
165 // odd-index prongs are +
167 // TEMPORARY, to be removed when we do analysis on AliAODEvent
168 Int_t fNProngs; // number of prongs
169 Int_t fNDCA; // number of dca's
170 Int_t fNPID; // number of PID probabilities
171 Double32_t *fPx; //[fNProngs] px of tracks at the vertex [GeV/c]
172 Double32_t *fPy; //[fNProngs] py of tracks at the vertex [GeV/c]
173 Double32_t *fPz; //[fNProngs] pz of tracks at the vertex [GeV/c]
174 Double32_t *fd0; //[fNProngs] rphi impact params w.r.t. Primary Vtx [cm]
175 Double32_t *fDCA; //[fNDCA] prong-to-prong DCA [cm]
176 // convention:fDCA[0]=p0p1,fDCA[1]=p0p2,fDCA[2]=p1p2,...
177 Double32_t *fPID; //[fNPID] combined pid
178 // (combined detector response probabilities)
180 // TEMPORARY, to be removed when we do analysis on AliAODEvent
183 // TO BE PUT IN SPECIAL MC CLASS
184 //Bool_t fSignal; // TRUE if signal, FALSE if background (for simulation)
185 //Int_t fTrkNum[2]; // numbers of the two decay tracks
186 //Int_t fPdg[2]; // PDG codes of the two tracks (for sim.)
187 //Int_t fMum[2]; // PDG codes of the mothers (for sim.)
191 ClassDef(AliAODRecoDecay,3) // base class for AOD reconstructed decays
195 inline Short_t AliAODRecoDecay::ChargeProng(Int_t ip) const
197 if(fCharge==0 || fCharge==+1) {
203 } else { // fCharge==-1
212 inline Double_t AliAODRecoDecay::RadiusSecVtx() const
214 return TMath::Sqrt(GetSecVtxX()*GetSecVtxX()+GetSecVtxY()*GetSecVtxY());
217 inline void AliAODRecoDecay::GetSecondaryVtx(Double_t vtx[3]) const
219 GetSecondaryVtx()->GetPosition(vtx);
223 inline Double_t AliAODRecoDecay::Px() const
226 for(Int_t i=0;i<GetNProngs();i++) px+=PxProng(i);
230 inline Double_t AliAODRecoDecay::Py() const
233 for(Int_t i=0;i<GetNProngs();i++) py+=PyProng(i);
237 inline Double_t AliAODRecoDecay::Pz() const
240 for(Int_t i=0;i<GetNProngs();i++) pz+=PzProng(i);
244 inline Double_t AliAODRecoDecay::Ct(UInt_t pdg,AliAODVertex *vtx1) const
247 vtx1->GetPosition(v);
251 inline Double_t AliAODRecoDecay::CosPointingAngle(AliAODVertex *vtx1) const
254 vtx1->GetPosition(v);
255 return CosPointingAngle(v);
258 inline Double_t AliAODRecoDecay::CosPointingAngleXY(AliAODVertex *vtx1) const
261 vtx1->GetPosition(v);
262 return CosPointingAngleXY(v);
265 inline Double_t AliAODRecoDecay::ImpParXY(AliAODVertex *vtx1) const
268 vtx1->GetPosition(v);
272 inline Double_t AliAODRecoDecay::PtProng(Int_t ip) const
274 return TMath::Sqrt(PxProng(ip)*PxProng(ip)+PyProng(ip)*PyProng(ip));
277 inline Double_t AliAODRecoDecay::PProng(Int_t ip) const
279 return TMath::Sqrt(PtProng(ip)*PtProng(ip)+PzProng(ip)*PzProng(ip));
282 inline Double_t AliAODRecoDecay::QlProngFlightLine(Int_t ip,AliAODVertex *vtx1) const
285 vtx1->GetPosition(v);
286 return QlProngFlightLine(ip,v);
289 inline Double_t AliAODRecoDecay::QtProngFlightLine(Int_t ip,AliAODVertex *vtx1) const
292 vtx1->GetPosition(v);
293 return QtProngFlightLine(ip,v);
296 inline void AliAODRecoDecay::SetDCAs(Int_t nDCA,Double_t *dca)
298 if(nDCA!=(GetNProngs()*(GetNProngs()-1)/2)) {
299 printf("Wrong number of DCAs, must be nProngs*(nProngs-1)/2");
302 if(fDCA) delete [] fDCA;
303 fDCA = new Double32_t[nDCA];
304 for(Int_t i=0;i<nDCA;i++)
309 inline void AliAODRecoDecay::SetDCA(Double_t dca)
311 Double_t ddca[1]; ddca[0]=dca;
316 inline void AliAODRecoDecay::SetPID(Int_t nprongs,Double_t *pid)
318 if(nprongs!=GetNProngs()) {
319 printf("Wrong number of prongs");
322 if(fPID) delete [] fPID;
323 fPID = new Double32_t[nprongs*5];
324 for(Int_t i=0;i<nprongs;i++)
325 for(Int_t j=0;j<5;j++)
326 fPID[i*5+j] = pid[i*5+j];
330 inline void AliAODRecoDecay::GetPIDProng(Int_t ip,Double_t *pid) const
332 for(Int_t j=0;j<5;j++)
333 pid[j] = fPID[ip*5+j];