AliPhysics  cda3415 (cda3415)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAODRecoCascadeHF3Prong.cxx
Go to the documentation of this file.
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 
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
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"
34 
38 
39 //-----------------------------------------------------------------------------
40 
43 {
47 }
48 
49 //-----------------------------------------------------------------------------
51  Double_t *px, Double_t *py, Double_t *pz,
52  Double_t *d0, Double_t *d0err,
53  Double_t *dca, Double_t sigvert,
54  Double_t dist12,Double_t dist23):
55  AliAODRecoDecayHF3Prong(vtx2, px, py, pz, d0, d0err, dca,sigvert,dist12,dist23,charge)
56 {
60 }
61 
62 //-----------------------------------------------------------------------------
65 {
69 }
70 
71 //-----------------------------------------------------------------------------
73 {
77  if(&source == this) return *this;
78 
80 
81  return *this;
82 }
83 
84 //-----------------------------------------------------------------------------
86 {
90 }
91 
92 
93 //________________________________________________________________________
95 {
99 
100  AliAODcascade *casc = (AliAODcascade*)GetCascade();
101  if (!casc)
102  return -1.;
103  return casc->DcaXiDaughters();
104 
105 }
106 
107 //________________________________________________________________________
109 {
113 
114  AliAODcascade *casc = (AliAODcascade*)GetCascade();
115  if (!casc)
116  return -1.;
117  return casc->DcaV0Daughters();
118 
119 }
120 
121 //________________________________________________________________________
123 {
127 
128  AliAODcascade *casc = (AliAODcascade*)GetCascade();
129 
130  if (!casc)
131  return -1.;
132  AliAODVertex *vtxPrimary = GetPrimaryVtx();
133  Double_t posVtx[3] = {0.,0.,0.};
134  vtxPrimary->GetXYZ(posVtx);
135  return casc->DecayLengthXi(posVtx[0],posVtx[1],posVtx[2]);
136 
137 }
138 
139 //________________________________________________________________________
141 {
145 
146  AliAODcascade *casc = (AliAODcascade*)GetCascade();
147  if (!casc)
148  return -1.;
149  return casc->DecayLengthV0();
150 
151 }
152 //________________________________________________________________________
154 {
158 
159  AliAODcascade *casc = (AliAODcascade*)GetCascade();
160  if (!casc)
161  return -999.;
162 
163  AliAODVertex *vtxPrimary = GetPrimaryVtx();
164  Double_t posVtx[3] = {0.,0.,0.};
165  vtxPrimary->GetXYZ(posVtx);
166  return casc->CosPointingAngleXi(posVtx[0],posVtx[1],posVtx[2]);
167 }
168 //________________________________________________________________________
170 {
174 
175  AliAODcascade *casc = (AliAODcascade*)GetCascade();
176  if (!casc)
177  return -999.;
178  return casc->CosPointingAngle(casc->GetDecayVertexXi());
179 }
180 
181 //________________________________________________________________________
183 {
187 
188  AliAODcascade *casc = (AliAODcascade*)GetCascade();
189  if (!casc)
190  return -1.;
191  return casc->DcaV0ToPrimVertex();
192 }
193 
194 //________________________________________________________________________
196 {
200 
201  AliAODcascade *casc = (AliAODcascade*)GetCascade();
202  if (!casc)
203  return -1.;
204  return casc->DcaPosToPrimVertex();
205 }
206 
207 //________________________________________________________________________
209 {
213 
214  AliAODcascade *casc = (AliAODcascade*)GetCascade();
215  if (!casc)
216  return -1.;
217  return casc->DcaNegToPrimVertex();
218 }
219 
220 //________________________________________________________________________
222 {
226 
227  AliAODcascade *casc = (AliAODcascade*)GetCascade();
228  if (!casc)
229  return -1.;
230  return casc->DcaBachToPrimVertex();
231 }
232 
233 //________________________________________________________________________
235 {
239 
240  AliAODcascade *casc = (AliAODcascade*)GetCascade();
241  if (!casc)
242  return -1.;
243  return casc->MassXi();
244 }
245 
246 //________________________________________________________________________
248 {
252 
253  AliAODcascade *casc = (AliAODcascade*)GetCascade();
254  if (!casc)
255  return -1.;
256  return casc->MassLambda();
257 }
258 
259 //________________________________________________________________________
261 {
265 
266  AliAODcascade *casc = (AliAODcascade*)GetCascade();
267  if (!casc)
268  return -1.;
269  return casc->MassAntiLambda();
270 }
271 
272 //________________________________________________________________________
274 {
278 
279  AliAODVertex *vtxPrimary = GetPrimaryVtx();
280  AliAODVertex *vtxSecondary = GetSecondaryVtx();
281 
282  Double_t dx = vtxSecondary->GetX()-vtxPrimary->GetX();
283  Double_t dy = vtxSecondary->GetY()-vtxPrimary->GetY();
284  Double_t dl = sqrt(dx*dx+dy*dy);
285 
286  Double_t px = Px();
287  Double_t py = Py();
288  Double_t pt = Pt();
289 
290  if(dl>0&&pt>0)
291  return (px*dx+py*dy)/pt/dl;
292  else
293  return -9999.;
294 }
295 //________________________________________________________________________
297 {
301 
302  AliAODVertex *vtxPrimary = GetPrimaryVtx();
303  AliAODVertex *vtxSecondary = GetSecondaryVtx();
304 
305  Double_t dx = vtxSecondary->GetX()-vtxPrimary->GetX();
306  Double_t dy = vtxSecondary->GetY()-vtxPrimary->GetY();
307  Double_t dl = sqrt(dx*dx+dy*dy);
308 
309  Double_t px = PxProng(0)+PxProng(2);
310  Double_t py = PyProng(0)+PyProng(2);
311  Double_t pt = sqrt(px*px+py*py);
312 
313  if(dl>0&&pt>0)
314  return (px*dx+py*dy)/pt/dl;
315  else
316  return -9999.;
317 }
318 //----------------------------------------------------------------------------
320  Int_t *pdgDg,Int_t *pdgDgcasc,Int_t *pdgDgv0
321  ,TClonesArray *mcArray) const
322 {
328 
329  Int_t ndg=GetNDaughters();
330  if(ndg==0) {
331  AliError("No daughters available");
332  return -1;
333  }
334 
335  if ( pdgabs!=4232 || pdgDg[0]!=211 || pdgDg[1]!=3312 || pdgDg[2]!=211 )
336  {
337  AliWarning(Form("Please, pay attention: Only pi Xi pi decay is supported now"));
338  return -1;
339  }
340 
341  AliAODcascade *theCascade = dynamic_cast<AliAODcascade*>(GetCascade());
342  if(!theCascade) return -1;
343  AliAODTrack *trk1 = dynamic_cast<AliAODTrack*>(GetBachelor1()); // the bachelor
344  if (!trk1) return -1;
345  AliAODTrack *trk2 = dynamic_cast<AliAODTrack*>(GetBachelor2()); // the bachelor
346  if (!trk2) return -1;
347 
348  Int_t labcasc = MatchToMCCascade(theCascade,pdgabscasc,pdgDgcasc,pdgDgv0,mcArray); // the cascade
349  if(labcasc<0) return -1;
350  Int_t labtrk1 = trk1->GetLabel();
351  if(labtrk1<0) return -1;
352  Int_t labtrk2 = trk2->GetLabel();
353  if(labtrk2<0) return -1;
354 
355  Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
356 
357  dgLabels[0] = labtrk1;
358  dgLabels[1] = labcasc;
359  dgLabels[2] = labtrk2;
360 
361  Int_t finalLabel = MatchToMCXicPlus(pdgabs,mcArray,dgLabels,3,3,pdgDg);
362 
363  return finalLabel;
364 
365 }
366 //________________________________________________________________________
367 Int_t AliAODRecoCascadeHF3Prong::MatchToMCCascade(AliAODcascade *theCascade, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const // the cascade
368 {
369 
370  AliAODTrack *cptrack = (AliAODTrack*) theCascade->GetDaughter(0);
371  if(!cptrack) return -1;
372  Int_t label_p = cptrack->GetLabel();
373  if(label_p<0) return -1;
374  AliAODTrack *cntrack = (AliAODTrack*) theCascade->GetDaughter(1);
375  if(!cntrack) return -1;
376  Int_t label_n = cntrack->GetLabel();
377  if(label_n<0) return -1;
378  Int_t labv0 = theCascade->MatchToMC(pdgDgcasc[1],mcArray,2,pdgDgv0);
379  if(labv0<0) return -1;
380  AliAODMCParticle *mcpartv0= (AliAODMCParticle*) mcArray->At(labv0);
381 
382  AliAODTrack *cbtrack = (AliAODTrack*) theCascade->GetDecayVertexXi()->GetDaughter(0);
383  if(!cbtrack) return -1;
384 
385  Int_t label_b = cbtrack->GetLabel();
386  if(label_b<0) return -1;
387 
388  AliAODMCParticle *mcpartb= (AliAODMCParticle*) mcArray->At(label_b);
389  Int_t pdgb = TMath::Abs(mcpartb->GetPdgCode());
390  if(pdgb!=pdgDgcasc[0]) return -1;
391 
392  AliAODMCParticle *mcmotherv0=mcpartv0;
393  Bool_t isFromXiv0 = kFALSE;
394  Int_t labxiv0 = mcmotherv0->GetMother();
395  if(labxiv0<0) return -1;
396  mcmotherv0 = (AliAODMCParticle*) mcArray->At(labxiv0);
397  if(mcmotherv0){
398  Int_t pdg = TMath::Abs(mcmotherv0 ->GetPdgCode());
399  if(pdg==pdgabscasc){
400  isFromXiv0 = kTRUE;
401  }
402  }
403  if(!isFromXiv0) return -1;
404 
405  AliAODMCParticle *mcmotherb=mcpartb;
406  Bool_t isFromXib = kFALSE;
407  Int_t labxib = mcmotherb->GetMother();
408  if(labxib<0) return -1;
409  mcmotherb = (AliAODMCParticle*) mcArray->At(labxib);
410  if(mcmotherb){
411  Int_t pdg = TMath::Abs(mcmotherb ->GetPdgCode());
412  if(pdg==pdgabscasc){
413  isFromXib = kTRUE;
414  }
415  }
416  if(!isFromXib) return -1;
417 
418  if(labxiv0!=labxib) return -1;//Bachelor and V0 should come from the same Xi
419 
420  return labxib;
421 }
422 //----------------------------------------------------------------------------
424  Int_t dgLabels[10],Int_t ndg,
425  Int_t ndgCk, const Int_t *pdgDg) const
426 {
433 
434  Int_t labMom[10]={0,0,0,0,0,0,0,0,0,0};
435  Int_t i,j,lab,labMother,pdgMother,pdgPart;
436  AliAODMCParticle *part=0;
437  AliAODMCParticle *mother=0;
438  Bool_t pdgUsed[10]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
439 
440  // loop on daughter labels
441  for(i=0; i<ndg; i++) {
442  labMom[i]=-1;
443  lab = TMath::Abs(dgLabels[i]);
444  if(lab<0) {
445  printf("daughter with negative label %d\n",lab);
446  return -1;
447  }
448  part = (AliAODMCParticle*)mcArray->At(lab);
449  if(!part) {
450  printf("no MC particle\n");
451  return -1;
452  }
453 
454  // check the PDG of the daughter, if requested
455  if(ndgCk>0) {
456  pdgPart=TMath::Abs(part->GetPdgCode());
457  for(j=0; j<ndg; j++) {
458  if(!pdgUsed[j] && pdgPart==pdgDg[j]) {
459  pdgUsed[j]=kTRUE;
460  break;
461  }
462  }
463  }
464 
465  mother = part;
466  while(mother->GetMother()>=0) {
467  labMother=mother->GetMother();
468  mother = (AliAODMCParticle*)mcArray->At(labMother);
469  if(!mother) {
470  printf("no MC mother particle\n");
471  break;
472  }
473  pdgMother = TMath::Abs(mother->GetPdgCode());
474  if(pdgMother==pdgabs) {
475  labMom[i]=labMother;
476  break;
477  } else if(pdgMother>pdgabs || pdgMother<10) {
478  break;
479  }
480  }
481  if(labMom[i]==-1) return -1; // mother PDG not ok for this daughter
482  } // end loop on daughters
483 
484  // check if the candidate is signal
485  labMother=labMom[0];
486  // all labels have to be the same and !=-1
487  for(i=0; i<ndg; i++) {
488  if(labMom[i]==-1) return -1;
489  if(labMom[i]!=labMother) return -1;
490  }
491 
492  // check that all daughter PDGs are matched
493  if(ndgCk>0) {
494  for(i=0; i<ndg; i++) {
495  if(pdgUsed[i]==kFALSE) return -1;
496  }
497  }
498 
499  return labMother;
500 }
Int_t charge
Int_t pdg
AliAODTrack * GetBachelor2() const
double Double_t
Definition: External.C:58
Int_t MatchToMCCascade(AliAODcascade *casc, Int_t pdgabscasc, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
AliAODcascade * GetCascade() const
AliAODRecoCascadeHF3Prong & operator=(const AliAODRecoCascadeHF3Prong &source)
Int_t MatchToMCXicPlus(Int_t pdgabs, TClonesArray *mcArray, Int_t dgLabels[10], Int_t ndg, Int_t ndgCk, const Int_t *pdgDg) const
int Int_t
Definition: External.C:63
AliAODTrack * GetBachelor1() const
short Short_t
Definition: External.C:23
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabscasc, Int_t *pdgDg, Int_t *pdgDgcasc, Int_t *pdgDgv0, TClonesArray *mcArray) const
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliAODRecoDecayHF3Prong & operator=(const AliAODRecoDecayHF3Prong &source)
AliAODVertex * GetPrimaryVtx() const
bool Bool_t
Definition: External.C:53