]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliAODRecoCascadeHF3Prong.cxx
First version of the Lc to K0sP and Xic to XiPiPi classes from AOD tracks ( Y. Watanabe )
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAODRecoCascadeHF3Prong.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////////
19 //
20 // Class for AOD reconstructed heavy-flavour cascades 3prong
21 // Used for Xic->pi Xi pi analysis
22 //
23 // Author: Y.S. Watanabe, wyosuke@cns.s.u-tokyo.ac.jp
24 /////////////////////////////////////////////////////////////
25
26 #include <TVector3.h>
27 #include <TDatabasePDG.h>
28 #include <TClonesArray.h>
29 #include "AliAODMCParticle.h"
30 #include "AliAODRecoDecay.h"
31 #include "AliAODVertex.h"
32 #include "AliAODRecoDecayHF3Prong.h"
33 #include "AliAODRecoCascadeHF3Prong.h"
34
35 ClassImp(AliAODRecoCascadeHF3Prong)
36
37 //-----------------------------------------------------------------------------
38
39 AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong() :
40 AliAODRecoDecayHF3Prong()
41 {
42   //
43   // Default Constructor
44   //
45 }
46
47 //-----------------------------------------------------------------------------
48 AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong(AliAODVertex *vtx2, Short_t charge,
49                                                      Double_t *px, Double_t *py, Double_t *pz,
50                                                      Double_t *d0, Double_t *d0err, 
51                                                      Double_t *dca, Double_t sigvert,
52                                                      Double_t dist12,Double_t dist23):
53   AliAODRecoDecayHF3Prong(vtx2, px, py, pz, d0, d0err, dca,sigvert,dist12,dist23,charge)
54 {
55   //
56   //  Constructor with AliAODVertex for decay vertex
57   //
58 }
59
60 //-----------------------------------------------------------------------------
61 AliAODRecoCascadeHF3Prong::AliAODRecoCascadeHF3Prong(const AliAODRecoCascadeHF3Prong &source) :
62   AliAODRecoDecayHF3Prong(source)
63 {
64   //
65   // Copy constructor
66   //
67 }
68
69 //-----------------------------------------------------------------------------
70 AliAODRecoCascadeHF3Prong &AliAODRecoCascadeHF3Prong::operator=(const AliAODRecoCascadeHF3Prong &source)
71 {
72   //
73   // assignment operator
74   //
75   if(&source == this) return *this;
76
77   AliAODRecoDecayHF3Prong::operator=(source);
78
79   return *this;
80 }
81
82 //-----------------------------------------------------------------------------
83 AliAODRecoCascadeHF3Prong::~AliAODRecoCascadeHF3Prong()
84 {
85   //
86   // Default Destructor
87   //
88 }
89
90 //----------------------------------------------------------------------------
91 //Int_t AliAODRecoCascadeHF3Prong::MatchToMC(Int_t pdgabs,Int_t pdgabs3prong,
92 //                                     Int_t *pdgDg,Int_t *pdgDg3prong,
93 //                                   TClonesArray *mcArray, Bool_t isV0) const
94 //{
95 //  //
96 //  // Check if this candidate is matched to a MC signal
97 //  // If no, return -1
98 //  // If yes, return label (>=0) of the AliAODMCParticle
99 //  // 
100 //
101 //  Int_t ndg=GetNDaughters();
102 //  if(ndg==0) {
103 //    AliError("No daughters available");
104 //    return -1;
105 //  }
106 //
107 //  if ( isV0 &&
108 //       ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
109 //       (pdgDg[1]==211 && pdgDg[0]==3122) ) ) {
110 //    AliWarning(Form("Please, pay attention: first element in AliAODRecoCascadeHF3Prong object must be the bachelor and second one V0. Skipping! (pdgDg[0] = %d, (pdgDg[1] = %d)", pdgDg[0], pdgDg[1]));
111 //    return -1;
112 //  }
113 //
114 //  Int_t lab3Prong = -1;
115 //
116 //  if (!isV0) {
117 //    AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
118 //    lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
119 //  } else {
120 //    AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
121 //    lab2Prong = theV0->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong); // the V0
122 //  }
123 //
124 //  if(lab2Prong<0) return -1;
125 //
126 //  Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
127 //
128 //  if (!isV0) {
129 //    // loop on daughters and write labels
130 //    for(Int_t i=0; i<ndg; i++) {
131 //      AliVTrack *trk = dynamic_cast<AliVTrack*>(GetDaughter(i));
132 //      if(!trk) continue;
133 //      Int_t lab = trk->GetLabel();
134 //      if(lab==-1) { // this daughter is the 2prong
135 //      lab=lab2Prong;
136 //      } else if(lab<-1) continue;
137 //      dgLabels[i] = lab;
138 //    }
139 //  } else {
140 //    AliVTrack *trk = dynamic_cast<AliVTrack*>(GetBachelor()); // the bachelor
141 //    if (!trk) return -1;
142 //    dgLabels[0] = trk->GetLabel();//TMath::Abs(trk->GetLabel());
143 //    dgLabels[1] = lab2Prong;
144 //  }
145 //
146 //  Int_t finalLabel = AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
147 //
148 //  if (finalLabel>=0){
149 //    // debug printouts for Lc->V0 bachelor case
150 //
151 //    if ( isV0 && (dgLabels[0]!=-1 && dgLabels[1]!=-1) ) {
152 //      AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
153 //      Bool_t onTheFly = theV0->GetOnFlyStatus();
154 //      if (pdgDg[0]==2212 && pdgDg[1]==310) {
155 //      AliAODMCParticle*k0s = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
156 //      if(k0s){
157 //        Int_t labK0 = k0s->GetMother();       
158 //        AliAODMCParticle*k0bar = dynamic_cast<AliAODMCParticle*>(mcArray->At(labK0));
159 //        if(k0bar){
160 //          AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d) -> LabelK0S=%d (%d -> %d %d)",onTheFly,labK0,k0bar->GetPdgCode(),lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
161 //          AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
162 //                          finalLabel,pdgabs,
163 //                          dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
164 //        }
165 //      }
166 //      } else if (pdgDg[0]==211 && pdgDg[1]==3122) {
167 //      AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d -> %d %d)",onTheFly,lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
168 //      AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
169 //                      finalLabel,pdgabs,
170 //                    dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
171 //      }
172 //
173 //    }
174 //  }
175 //
176 //  return finalLabel;
177 //
178 //}
179
180 //________________________________________________________________________
181 Double_t AliAODRecoCascadeHF3Prong::CascDcaXiDaughters() const
182 {
183   //
184   // DCA between Xi daughters
185   //
186
187   AliAODcascade *casc = (AliAODcascade*)GetCascade();
188   if (!casc) 
189     return -1.;
190   return casc->DcaXiDaughters();
191
192 }
193
194 //________________________________________________________________________
195 Double_t AliAODRecoCascadeHF3Prong::CascDcaV0Daughters() const
196 {
197   //
198   // DCA between Cascade-V0 daughters
199   //
200
201   AliAODcascade *casc = (AliAODcascade*)GetCascade();
202   if (!casc) 
203     return -1.;
204   return casc->DcaV0Daughters();
205
206 }
207
208 //________________________________________________________________________
209 Double_t AliAODRecoCascadeHF3Prong::CascDecayLength() const
210 {
211   //
212   // Decay length of Xi
213   //
214
215   AliAODcascade *casc = (AliAODcascade*)GetCascade();
216
217   if (!casc) 
218     return -1.;
219   AliAODVertex *vtxPrimary = GetPrimaryVtx();
220   Double_t posVtx[3] = {0.,0.,0.};
221   vtxPrimary->GetXYZ(posVtx);
222   return casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
223
224 }
225
226 //________________________________________________________________________
227 Double_t AliAODRecoCascadeHF3Prong::CascDecayLengthV0() const
228 {
229   //
230   // Decay length of V0 from Xi
231   //
232
233   AliAODcascade *casc = (AliAODcascade*)GetCascade();
234   if (!casc) 
235     return -1.;
236   return casc->DecayLengthV0();
237
238 }
239 //________________________________________________________________________
240 Double_t AliAODRecoCascadeHF3Prong::CascCosPointingAngle() const 
241 {
242   //
243   // Xi pointing angle to primary vertex
244   //
245
246   AliAODcascade *casc = (AliAODcascade*)GetCascade();
247   if (!casc) 
248     return -999.;
249
250   AliAODVertex *vtxPrimary = GetPrimaryVtx();
251   Double_t posVtx[3] = {0.,0.,0.};
252   vtxPrimary->GetXYZ(posVtx);
253   return casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
254 }
255 //________________________________________________________________________
256 Double_t AliAODRecoCascadeHF3Prong::CascCosPointingAngleV0() const 
257 {
258   //
259   // Cos pointing angle of V0 to Xi decay vertex
260   //
261
262   AliAODcascade *casc = (AliAODcascade*)GetCascade();
263   if (!casc) 
264     return -999.;
265   return casc->CosPointingAngle(casc->GetDecayVertexXi());
266 }
267
268 //________________________________________________________________________
269 Double_t AliAODRecoCascadeHF3Prong::CascDcaV0ToPrimVertex() const
270 {
271   //
272   // DCA to primary vertex of Cascade-V0 
273   //
274
275   AliAODcascade *casc = (AliAODcascade*)GetCascade();
276   if (!casc) 
277     return -1.;
278   return casc->DcaV0ToPrimVertex();
279 }
280
281 //________________________________________________________________________
282 Double_t AliAODRecoCascadeHF3Prong::CascDcaPosToPrimVertex() const
283 {
284   //
285   // DCA to primary vertex of Cascade-positive track
286   //
287
288   AliAODcascade *casc = (AliAODcascade*)GetCascade();
289   if (!casc) 
290     return -1.;
291   return casc->DcaPosToPrimVertex();
292 }
293
294 //________________________________________________________________________
295 Double_t AliAODRecoCascadeHF3Prong::CascDcaNegToPrimVertex() const
296 {
297   //
298   // DCA to primary vertex of Cascade-negative track
299   //
300
301   AliAODcascade *casc = (AliAODcascade*)GetCascade();
302   if (!casc) 
303     return -1.;
304   return casc->DcaNegToPrimVertex();
305 }
306
307 //________________________________________________________________________
308 Double_t AliAODRecoCascadeHF3Prong::CascDcaBachToPrimVertex() const
309 {
310   //
311   // DCA to primary vertex of Cascade-Bachelor track
312   //
313
314   AliAODcascade *casc = (AliAODcascade*)GetCascade();
315   if (!casc) 
316     return -1.;
317   return casc->DcaBachToPrimVertex();
318 }
319
320 //________________________________________________________________________
321 Double_t AliAODRecoCascadeHF3Prong::CascMassXi() const
322 {
323   //
324   // Xi mass
325   //
326
327   AliAODcascade *casc = (AliAODcascade*)GetCascade();
328   if (!casc) 
329     return -1.;
330   return casc->MassXi();
331 }
332
333 //________________________________________________________________________
334 Double_t AliAODRecoCascadeHF3Prong::CascMassLambda() const
335 {
336   //
337   // Lambda mass of cascade-v0
338   //
339
340   AliAODcascade *casc = (AliAODcascade*)GetCascade();
341   if (!casc) 
342     return -1.;
343   return casc->MassLambda();
344 }
345
346 //________________________________________________________________________
347 Double_t AliAODRecoCascadeHF3Prong::CascMassAntiLambda() const
348 {
349   //
350   // Anti-Lambda mass of cascade-v0
351   //
352         
353   AliAODcascade *casc = (AliAODcascade*)GetCascade();
354   if (!casc) 
355     return -1.;
356   return casc->MassAntiLambda();
357 }
358
359 //________________________________________________________________________
360 Double_t AliAODRecoCascadeHF3Prong::XicCosPointingAngle() const
361 {
362   //
363   // Xic pointing angle to primary vertex
364   //
365
366   AliAODVertex *vtxPrimary = GetPrimaryVtx();
367   AliAODVertex *vtxSecondary = GetSecondaryVtx();
368
369   Double_t dx = vtxSecondary->GetX()-vtxPrimary->GetX();
370   Double_t dy = vtxSecondary->GetY()-vtxPrimary->GetY();
371   Double_t dl = sqrt(dx*dx+dy*dy);
372
373   Double_t px = Px();
374   Double_t py = Py();
375   Double_t pt = Pt();
376
377   if(dl>0&&pt>0)
378     return (px*dx+py*dy)/pt/dl; 
379   else
380     return -9999.;
381 }