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