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