]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODRecoDecay.h
technical changes:
[u/mrichter/AliRoot.git] / STEER / AliAODRecoDecay.h
CommitLineData
7de7497b 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 */
5
6//***********************************************************
7// Class AliAODRecoDecay
8// base class for AOD reconstructed decays
9// Author: A.Dainese, andrea.dainese@lnl.infn.it
10//***********************************************************
11
12#include <TMath.h>
5cc73331 13#include <TRef.h>
bfd68286 14#include <TClonesArray.h>
7de7497b 15#include "AliAODVertex.h"
58b0186f 16#include "AliAODTrack.h"
e045ffda 17#include "AliVTrack.h"
7de7497b 18
e045ffda 19class AliAODRecoDecay : public AliVTrack {
7de7497b 20
21 public:
22
23 AliAODRecoDecay();
24 AliAODRecoDecay(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
25 Double_t *px,Double_t *py,Double_t *pz,
26 Double_t *d0);
27 AliAODRecoDecay(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
28 Double_t *d0);
29 virtual ~AliAODRecoDecay();
30
31 AliAODRecoDecay(const AliAODRecoDecay& source);
32 AliAODRecoDecay& operator=(const AliAODRecoDecay& source);
33
34
35 // decay vertex
5cc73331 36 Double_t GetSecVtxX() const {return GetSecondaryVtx()->GetX();}
37 Double_t GetSecVtxY() const {return GetSecondaryVtx()->GetY();}
38 Double_t GetSecVtxZ() const {return GetSecondaryVtx()->GetZ();}
7de7497b 39 Double_t RadiusSecVtx() const;
40 void SetSecondaryVtx(AliAODVertex *vtx2) {fSecondaryVtx=vtx2;}
a11de4a0 41 AliAODVertex* GetSecondaryVtx() const { return (((AliAODVertex*)fSecondaryVtx.GetObject()) ? (AliAODVertex*)fSecondaryVtx.GetObject() : GetOwnSecondaryVtx()); }
42 void SetOwnSecondaryVtx(AliAODVertex *vtx2) {fOwnSecondaryVtx=vtx2;}
43 AliAODVertex* GetOwnSecondaryVtx() const {return fOwnSecondaryVtx;}
7de7497b 44 void GetSecondaryVtx(Double_t vtx[3]) const;
5cc73331 45 Double_t GetReducedChi2() const {return GetSecondaryVtx()->GetChi2perNDF();}
7de7497b 46 Short_t Charge() const {return fCharge;}
47 Short_t GetCharge() const {return fCharge;}
48 void SetCharge(Short_t charge=0) {fCharge=charge;}
49
bfd68286 50 // Match to MC signal:
51 // check if this candidate is matched to a MC signal
52 // If no, return -1
53 // If yes, return label (>=0) of the AliAODMCParticle
54 Int_t MatchToMC(Int_t pdgabs,TClonesArray *mcArray) const;
55 Int_t MatchToMC(Int_t pdgabs,TClonesArray *mcArray,Int_t *dgLabels) const;
56
7de7497b 57 // PID
58 void SetPID(Int_t nprongs,Double_t *pid);
59 Double_t *GetPID() const { return fPID; }
60 void GetPIDProng(Int_t ip,Double_t *pid) const;
61 virtual const Double_t *PID() const { return fPID; }
62
63 // prong-to-prong DCAs
5cc73331 64 void SetDCAs(Int_t nDCA,Double_t *dca);
65 void SetDCA(Double_t dca); // 2 prong
66 Double_t GetDCA(Int_t i=0) const {return fDCA[i];}
7de7497b 67
68 //event and run number
69 void SetEventRunNumbers(Int_t en,Int_t rn)
70 { fEventNumber=en; fRunNumber=rn; return; }
71 Int_t GetEventNumber() const { return fEventNumber; }
72 Int_t GetRunNumber() const { return fRunNumber; }
73
e045ffda 74 // methods of AliVTrack
75 virtual Int_t GetID() const { return -1; }
76 virtual UChar_t GetITSClusterMap() const;
77 virtual ULong_t GetStatus() const;
78 virtual Bool_t GetXYZ(Double_t *p) const { return XvYvZv(p); }
79 virtual Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const;
80
7de7497b 81 // kinematics & topology
82 Double_t Px() const;
83 Double_t Py() const;
84 Double_t Pz() const;
85 Double_t P() const {return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz());}
86 Double_t Pt() const {return TMath::Sqrt(Px()*Px()+Py()*Py());}
87 Double_t OneOverPt() const {return (Pt() ? 1./Pt() : 0.);}
c683ddc2 88 Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
1eab4b5c 89 Double_t Phi() const {return TMath::Pi()+TMath::ATan2(-Py(),-Px());}
7de7497b 90 Double_t Theta() const {return 0.5*TMath::Pi()-TMath::ATan(Pz()/(Pt()+1.e-13));}
91 Double_t Eta() const {return 0.5*TMath::Log((P()+Pz())/(P()-Pz()+1.e-13));}
c683ddc2 92 Double_t Xv() const { return GetSecVtxX(); }
93 Double_t Yv() const { return GetSecVtxY(); }
94 Double_t Zv() const { return GetSecVtxZ(); }
95 virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
7de7497b 96 Double_t E(UInt_t pdg) const;
97 Double_t Y(UInt_t pdg) const {return 0.5*TMath::Log((E(pdg)+Pz())/(E(pdg)-Pz()+1.e-13));}
98 Double_t DecayLength(Double_t point[3]) const;
99 Double_t DecayLength(AliAODVertex *vtx1) const
5cc73331 100 {return GetSecondaryVtx()->DistanceToVertex(vtx1);}
7de7497b 101 Double_t DecayLengthError(AliAODVertex *vtx1) const
5cc73331 102 {return GetSecondaryVtx()->ErrorDistanceToVertex(vtx1);}
7de7497b 103 Double_t NormalizedDecayLength(AliAODVertex *vtx1) const
104 {return DecayLength(vtx1)/DecayLengthError(vtx1);}
105 Double_t DecayLengthXY(Double_t point[3]) const;
106 Double_t DecayLengthXY(AliAODVertex *vtx1) const
5cc73331 107 {return GetSecondaryVtx()->DistanceXYToVertex(vtx1);}
7de7497b 108 Double_t DecayLengthXYError(AliAODVertex *vtx1) const
5cc73331 109 {return GetSecondaryVtx()->ErrorDistanceXYToVertex(vtx1);}
7de7497b 110 Double_t NormalizedDecayLengthXY(AliAODVertex *vtx1) const
111 {return DecayLengthXY(vtx1)/DecayLengthXYError(vtx1);}
112 Double_t Ct(UInt_t pdg,Double_t point[3]) const;
113 Double_t Ct(UInt_t pdg,AliAODVertex *vtx1) const;
114 Double_t CosPointingAngle(Double_t point[3]) const;
115 Double_t CosPointingAngle(AliAODVertex *vtx1) const;
116 Double_t CosPointingAngleXY(Double_t point[3]) const;
117 Double_t CosPointingAngleXY(AliAODVertex *vtx1) const;
118 Double_t CosThetaStar(Int_t ip,UInt_t pdgvtx,UInt_t pdgprong0,UInt_t pdgprong1) const;
119 Double_t InvMass(Int_t npdg,UInt_t *pdg) const;
120 Double_t ImpParXY(Double_t point[3]) const;
121 Double_t ImpParXY(AliAODVertex *vtx1) const;
122
123 // prongs
e045ffda 124 Int_t GetNProngs() const {return fNProngs;}
125 Int_t GetNDaughters() const {return GetSecondaryVtx()->GetNDaughters();}
126 TObject *GetDaughter(Int_t i) const {return (GetNDaughters()>i ? GetSecondaryVtx()->GetDaughter(i) : 0x0);}
7de7497b 127
e045ffda 128 Short_t ChargeProng(Int_t ip) const;
7de7497b 129 Double_t Getd0Prong(Int_t ip) const {return fd0[ip];}
130 Double_t Prodd0d0(Int_t ip1=0,Int_t ip2=0) const {return fd0[ip1]*fd0[ip2];}
131 Double_t PxProng(Int_t ip) const {return fPx[ip];}
132 Double_t PyProng(Int_t ip) const {return fPy[ip];}
133 Double_t PzProng(Int_t ip) const {return fPz[ip];}
134 Double_t PtProng(Int_t ip) const;
135 Double_t PProng(Int_t ip) const;
136 Double_t PhiProng(Int_t ip) const
137 {return TMath::ATan2(PyProng(ip),PxProng(ip));}
138 Double_t ThetaProng(Int_t ip) const
139 {return 0.5*TMath::Pi()-TMath::ATan(PzProng(ip)/(PtProng(ip)+1.e-13));}
140 Double_t EtaProng(Int_t ip) const
141 {return -TMath::Log(TMath::Tan(0.5*ThetaProng(ip)));}
142 Double_t EProng(Int_t ip,UInt_t pdg) const;
143 Double_t YProng(Int_t ip,UInt_t pdg) const
144 {return 0.5*TMath::Log((EProng(ip,pdg)+PzProng(ip))/(EProng(ip,pdg)-PzProng(ip)+1.e-13));}
145 Double_t Alpha() const; // for Armenteros-Podolanski plot (V0's)
146 Double_t QlProng(Int_t ip) const;
147 Double_t QtProng(Int_t ip=0) const; // for Armenteros-Podolanski plot (V0's)
148 Double_t QlProngFlightLine(Int_t ip,Double_t point[3]) const;
149 Double_t QlProngFlightLine(Int_t ip,AliAODVertex *vtx1) const;
150 Double_t QtProngFlightLine(Int_t ip,Double_t point[3]) const;
151 Double_t QtProngFlightLine(Int_t ip,AliAODVertex *vtx1) const;
152 Double_t InvMass2Prongs(Int_t ip1,Int_t ip2,UInt_t pdg1,UInt_t pdg2) const;
153 Double_t ProngsRelAngle(Int_t ip1=0,Int_t ip2=1) const;
154
155 // relate to other objects
156 //Double_t DistanceToVertex(AliAODVertex *vtx) // distance to a AliAODVertex
157 //Double_t DistanceToTrack(AliAODTrack *trk) // distance to a AliAODTrack
158
159
160 // print
161 void Print(Option_t* option = "") const;
5cc73331 162 //void PrintIndices() const {GetSecondaryVtx()->PrintIndices();}
7de7497b 163
ff7c57dd 164 // dummy functions for inheritance from AliVParticle
7de7497b 165 Double_t E() const
166 {printf("Dummy function; use AliAODRecoDecay::E(UInt_t pdg) instead"); return (Double_t)-999.;}
167 Double_t Y() const
168 {printf("Dummy function; use AliAODRecoDecay::Y(UInt_t pdg) instead"); return (Double_t)-999.;}
169 Double_t M() const
170 {printf("Dummy function"); return (Double_t)-999.;}
3c43fb2b 171 Int_t GetLabel() const {return -1;}
7de7497b 172 protected:
173
5cc73331 174 TRef fSecondaryVtx; // decay vertex
a11de4a0 175 AliAODVertex *fOwnSecondaryVtx; // temporary solution (to work outside AliAODEvent)
5cc73331 176 Short_t fCharge; // charge, use this convention for prongs charges:
177 // if(charge== 0) even-index prongs are +
178 // odd-index prongs are -
179 // if(charge==+1) even-index prongs are +
180 // odd-index prongs are -
181 // if(charge==-1) even-index prongs are -
182 // odd-index prongs are +
7de7497b 183
184 // TEMPORARY, to be removed when we do analysis on AliAODEvent
5cc73331 185 Int_t fNProngs; // number of prongs
186 Int_t fNDCA; // number of dca's
187 Int_t fNPID; // number of PID probabilities
188 Double32_t *fPx; //[fNProngs] px of tracks at the vertex [GeV/c]
189 Double32_t *fPy; //[fNProngs] py of tracks at the vertex [GeV/c]
190 Double32_t *fPz; //[fNProngs] pz of tracks at the vertex [GeV/c]
191 Double32_t *fd0; //[fNProngs] rphi impact params w.r.t. Primary Vtx [cm]
192 Double32_t *fDCA; //[fNDCA] prong-to-prong DCA [cm]
193 // convention:fDCA[0]=p0p1,fDCA[1]=p0p2,fDCA[2]=p1p2,...
194 Double32_t *fPID; //[fNPID] combined pid
195 // (combined detector response probabilities)
7de7497b 196
197 // TEMPORARY, to be removed when we do analysis on AliAODEvent
198 Int_t fEventNumber;
199 Int_t fRunNumber;
200 // TO BE PUT IN SPECIAL MC CLASS
201 //Bool_t fSignal; // TRUE if signal, FALSE if background (for simulation)
7de7497b 202 //Int_t fTrkNum[2]; // numbers of the two decay tracks
203 //Int_t fPdg[2]; // PDG codes of the two tracks (for sim.)
204 //Int_t fMum[2]; // PDG codes of the mothers (for sim.)
205
206 //
207
e045ffda 208 ClassDef(AliAODRecoDecay,4) // base class for AOD reconstructed decays
7de7497b 209};
210
211
212inline Short_t AliAODRecoDecay::ChargeProng(Int_t ip) const
213{
214 if(fCharge==0 || fCharge==+1) {
215 if(ip%2==0) {
216 return (Short_t)1;
217 } else {
218 return (Short_t)-1;
219 }
220 } else { // fCharge==-1
221 if(ip%2==0) {
222 return (Short_t)-1;
223 } else {
224 return (Short_t)1;
225 }
226 }
227}
228
229inline Double_t AliAODRecoDecay::RadiusSecVtx() const
230{
231 return TMath::Sqrt(GetSecVtxX()*GetSecVtxX()+GetSecVtxY()*GetSecVtxY());
232}
233
234inline void AliAODRecoDecay::GetSecondaryVtx(Double_t vtx[3]) const
235{
5cc73331 236 GetSecondaryVtx()->GetPosition(vtx);
7de7497b 237 return;
238}
239
240inline Double_t AliAODRecoDecay::Px() const
241{
242 Double_t px=0.;
243 for(Int_t i=0;i<GetNProngs();i++) px+=PxProng(i);
244 return px;
245}
246
247inline Double_t AliAODRecoDecay::Py() const
248{
249 Double_t py=0.;
250 for(Int_t i=0;i<GetNProngs();i++) py+=PyProng(i);
251 return py;
252}
253
254inline Double_t AliAODRecoDecay::Pz() const
255{
256 Double_t pz=0.;
257 for(Int_t i=0;i<GetNProngs();i++) pz+=PzProng(i);
258 return pz;
259}
260
261inline Double_t AliAODRecoDecay::Ct(UInt_t pdg,AliAODVertex *vtx1) const
262{
263 Double_t v[3];
264 vtx1->GetPosition(v);
265 return Ct(pdg,v);
266}
267
268inline Double_t AliAODRecoDecay::CosPointingAngle(AliAODVertex *vtx1) const
269{
270 Double_t v[3];
271 vtx1->GetPosition(v);
272 return CosPointingAngle(v);
273}
274
275inline Double_t AliAODRecoDecay::CosPointingAngleXY(AliAODVertex *vtx1) const
276{
277 Double_t v[3];
278 vtx1->GetPosition(v);
279 return CosPointingAngleXY(v);
280}
281
282inline Double_t AliAODRecoDecay::ImpParXY(AliAODVertex *vtx1) const
283{
284 Double_t v[3];
285 vtx1->GetPosition(v);
286 return ImpParXY(v);
287}
288
289inline Double_t AliAODRecoDecay::PtProng(Int_t ip) const
290{
291 return TMath::Sqrt(PxProng(ip)*PxProng(ip)+PyProng(ip)*PyProng(ip));
292}
293
294inline Double_t AliAODRecoDecay::PProng(Int_t ip) const
295{
296 return TMath::Sqrt(PtProng(ip)*PtProng(ip)+PzProng(ip)*PzProng(ip));
297}
298
299inline Double_t AliAODRecoDecay::QlProngFlightLine(Int_t ip,AliAODVertex *vtx1) const
300{
301 Double_t v[3];
302 vtx1->GetPosition(v);
303 return QlProngFlightLine(ip,v);
304}
305
306inline Double_t AliAODRecoDecay::QtProngFlightLine(Int_t ip,AliAODVertex *vtx1) const
307{
308 Double_t v[3];
309 vtx1->GetPosition(v);
310 return QtProngFlightLine(ip,v);
311}
312
5cc73331 313inline void AliAODRecoDecay::SetDCAs(Int_t nDCA,Double_t *dca)
7de7497b 314{
315 if(nDCA!=(GetNProngs()*(GetNProngs()-1)/2)) {
316 printf("Wrong number of DCAs, must be nProngs*(nProngs-1)/2");
317 return;
318 }
319 if(fDCA) delete [] fDCA;
94de4057 320 fNDCA = nDCA;
5cc73331 321 fDCA = new Double32_t[nDCA];
7de7497b 322 for(Int_t i=0;i<nDCA;i++)
323 fDCA[i] = dca[i];
324 return;
325}
326
5cc73331 327inline void AliAODRecoDecay::SetDCA(Double_t dca)
7de7497b 328{
5cc73331 329 Double_t ddca[1]; ddca[0]=dca;
7de7497b 330 SetDCAs(1,ddca);
331 return;
332}
333
334inline void AliAODRecoDecay::SetPID(Int_t nprongs,Double_t *pid)
335{
336 if(nprongs!=GetNProngs()) {
337 printf("Wrong number of prongs");
338 return;
339 }
340 if(fPID) delete [] fPID;
58b0186f 341 fNPID = nprongs*5;
5cc73331 342 fPID = new Double32_t[nprongs*5];
7de7497b 343 for(Int_t i=0;i<nprongs;i++)
344 for(Int_t j=0;j<5;j++)
345 fPID[i*5+j] = pid[i*5+j];
346 return;
347}
348
349inline void AliAODRecoDecay::GetPIDProng(Int_t ip,Double_t *pid) const
350{
351 for(Int_t j=0;j<5;j++)
352 pid[j] = fPID[ip*5+j];
353 return;
354}
355
356
357
358#endif
bfd68286 359