AliPhysics  c2e202c (c2e202c)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAODRecoCascadeHF.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
21 //
22 // Author: X-M. Zhang, zhangxm@iopp.ccnu.edu.cn
24 
25 #include <TVector3.h>
26 #include <TDatabasePDG.h>
27 #include <TClonesArray.h>
28 #include "AliAODMCParticle.h"
29 #include "AliAODRecoDecay.h"
30 #include "AliAODVertex.h"
32 #include "AliAODRecoCascadeHF.h"
33 
37 
38 //-----------------------------------------------------------------------------
39 
42 {
46 }
47 //-----------------------------------------------------------------------------
49  Double_t *px, Double_t *py, Double_t *pz,
50  Double_t *d0, Double_t *d0err, Double_t dca) :
51  AliAODRecoDecayHF2Prong(vtx2, px, py, pz, d0, d0err, dca)
52 {
56  SetCharge(charge);
57 }
58 //-----------------------------------------------------------------------------
60  Double_t *d0, Double_t *d0err, Double_t dca) :
61  AliAODRecoDecayHF2Prong(vtx2, d0, d0err, dca)
62 {
66  SetCharge(charge);
67 }
68 //-----------------------------------------------------------------------------
71 {
75 }
76 //-----------------------------------------------------------------------------
78 {
79  //
81  //
82  if(&source == this) return *this;
83 
85 
86  return *this;
87 }
88 //-----------------------------------------------------------------------------
90 {
94 }
95 //-----------------------------------------------------------------------------
97 {
101  Double_t e[3];
102  if (Charge()>0){
103  e[0]=Get2Prong()->EProng(0,211);
104  e[1]=Get2Prong()->EProng(1,321);
105  }else{
106  e[0]=Get2Prong()->EProng(0,321);
107  e[1]=Get2Prong()->EProng(1,211);
108  }
109  e[2]=EProng(0,211);
110 
111  Double_t esum = e[0]+e[1]+e[2];
112  Double_t minv = TMath::Sqrt(esum*esum-P()*P());
113 
114  return minv;
115 }
116 //----------------------------------------------------------------------------
117 Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
118  Int_t *pdgDg,Int_t *pdgDg2prong,
119  TClonesArray *mcArray, Bool_t isV0) const
120 {
126 
127  Int_t ndg=GetNDaughters();
128  if(ndg==0) {
129  AliError("No daughters available");
130  return -1;
131  }
132 
133  if ( isV0 &&
134  ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
135  (pdgDg[1]==211 && pdgDg[0]==3122) ) ) {
136  AliWarning(Form("Please, pay attention: first element in AliAODRecoCascadeHF object must be the bachelor and second one V0. Skipping! (pdgDg[0] = %d, (pdgDg[1] = %d)", pdgDg[0], pdgDg[1]));
137  return -1;
138  }
139 
140  Int_t lab2Prong = -1;
141 
142  if (!isV0) {
143  AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
144  lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
145  } else {
146  AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
147  lab2Prong = theV0->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong); // the V0
148  }
149 
150  if(lab2Prong<0) return -1;
151 
152  Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
153 
154  if (!isV0) {
155  // loop on daughters and write labels
156  for(Int_t i=0; i<ndg; i++) {
157  AliVTrack *trk = dynamic_cast<AliVTrack*>(GetDaughter(i));
158  if(!trk) continue;
159  Int_t lab = trk->GetLabel();
160  if(lab==-1) { // this daughter is the 2prong
161  lab=lab2Prong;
162  } else if(lab<-1) continue;
163  dgLabels[i] = lab;
164  }
165  } else {
166  AliVTrack *trk = dynamic_cast<AliVTrack*>(GetBachelor()); // the bachelor
167  if (!trk) return -1;
168  dgLabels[0] = trk->GetLabel();//TMath::Abs(trk->GetLabel());
169  dgLabels[1] = lab2Prong;
170  }
171 
172  Int_t finalLabel = AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
173 
174  if (finalLabel>=0){
175  // debug printouts for Lc->V0 bachelor case
176 
177  if ( isV0 && (dgLabels[0]!=-1 && dgLabels[1]!=-1) ) {
178  AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
179  Bool_t onTheFly = theV0->GetOnFlyStatus();
180  if (pdgDg[0]==2212 && pdgDg[1]==310) {
181  AliAODMCParticle*k0s = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
182  if(k0s){
183  Int_t labK0 = k0s->GetMother();
184  AliAODMCParticle*k0bar = dynamic_cast<AliAODMCParticle*>(mcArray->At(labK0));
185  if(k0bar){
186  AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d) -> LabelK0S=%d (%d -> %d %d)",onTheFly,labK0,k0bar->GetPdgCode(),lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
187  AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
188  finalLabel,pdgabs,
189  dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
190  }
191  }
192  } else if (pdgDg[0]==211 && pdgDg[1]==3122) {
193  AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d -> %d %d)",onTheFly,lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
194  AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
195  finalLabel,pdgabs,
196  dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
197  }
198 
199  }
200  }
201 
202  return finalLabel;
203 
204 }
205 //-----------------------------------------------------------------------------
206 Bool_t AliAODRecoCascadeHF::SelectDstar(const Double_t *cutsDstar,
207  const Double_t *cutsD0,
208  Bool_t testD0) const
209 {
210  //
211  // cutsDstar[0] = inv. mass half width of D* [GeV]
212  // cutsDstar[1] = half width of (M_Kpipi-M_D0) [GeV]
213  // cutsDstar[2] = PtMin of pi_s [GeV/c]
214  // cutsDstar[3] = PtMax of pi_s [GeV/c]
215  // cutsDstar[4] = theta, angle between the pi_s and decay plane of the D0 [rad]
216  //
217  // cutsD0[0] = inv. mass half width [GeV]
218  // cutsD0[1] = dca [cm]
219  // cutsD0[2] = cosThetaStar
220  // cutsD0[3] = pTK [GeV/c]
221  // cutsD0[4] = pTPi [GeV/c]
222  // cutsD0[5] = d0K [cm] upper limit!
223  // cutsD0[6] = d0Pi [cm] upper limit!
224  // cutsD0[7] = d0d0 [cm^2]
225  // cutsD0[8] = cosThetaPoint
226 
227 
228  // check that the D0 passes the cuts
229  // (if we have a D*+, it has to pass as D0,
230  // if we have a D*-, it has to pass as D0bar)
231 
232  if(testD0) {
233  Int_t okD0=0,okD0bar=0;
234  Get2Prong()->SelectD0(cutsD0,okD0,okD0bar);
235  if((Charge()==+1 && !okD0) || (Charge()==-1 && !okD0bar)) return kFALSE;
236  }
237 
238  if( (PtProng(0)<cutsDstar[2]) || (PtProng(0)>cutsDstar[3]) ) return kFALSE;
239 
240  Double_t mDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
241  Double_t invmDstar = InvMassDstarKpipi();
242  if(TMath::Abs(mDstar-invmDstar)>cutsDstar[0]) return kFALSE;
243 
244  Double_t mD0 = TDatabasePDG::Instance()->GetParticle(421)->Mass();
245  if(TMath::Abs((mDstar-mD0)-DeltaInvMass())>cutsDstar[1]) return kFALSE;
246 
247  Double_t theta = AngleD0dkpPisoft();
248  if(theta>cutsDstar[4]) return kFALSE;
249 
250  return kTRUE;
251 }
252 //-----------------------------------------------------------------------------
253 Bool_t AliAODRecoCascadeHF::SelectLctoV0(const Double_t *cutsLctoV0,
254  Bool_t okLck0sp, Bool_t okLcLpi, Bool_t okLcLbarpi) const
255 {
267 
268  // if ( !Getv0() || !Getv0PositiveTrack() || !Getv0NegativeTrack() )
269  // { AliInfo(Form("Not adapted for ESDv0s, return true...")); return false; }
270 
271  Double_t mLck0sp,mLcLpi;
272  okLck0sp=1; okLcLpi=1; okLcLbarpi=1;
273 
274  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
275  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
276  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
277 
278  // k0s + p
279  double mk0s = Getv0()->MassK0Short();
280  mLck0sp = InvMassLctoK0sP();
281 
282  // lambda + pi
283  double mlambda = Getv0()->MassLambda();
284  double malambda = Getv0()->MassAntiLambda();
285  mLcLpi = InvMassLctoLambdaPi();
286 
287  // cut on Lc mass
288  // with k0s p hypothesis
289  if(TMath::Abs(mLck0sp-mLcPDG)>cutsLctoV0[0]) okLck0sp = 0;
290  // with Lambda pi hypothesis
291  if(TMath::Abs(mLcLpi-mLcPDG)>cutsLctoV0[1]) okLcLpi = 0;
292  okLcLbarpi = okLcLpi;
293 
294  // cuts on the v0 mass
295  if( TMath::Abs(mk0s-mk0sPDG)>cutsLctoV0[2]) okLck0sp = 0;
296  //if( TMath::Abs(mlambda-mLPDG)>cutsLctoV0[3] &&
297  //TMath::Abs(malambda-mLPDG)>cutsLctoV0[3] ) okLcLpi = 0;
298  if( !(GetBachelor()->Charge()==+1 && TMath::Abs(mlambda-mLPDG)<=cutsLctoV0[3]) ) okLcLpi = 0;
299  if( !(GetBachelor()->Charge()==-1 && TMath::Abs(malambda-mLPDG)<=cutsLctoV0[3]) ) okLcLbarpi = 0;
300 
301  if(!okLck0sp && !okLcLpi && !okLcLbarpi) return 0;
302 
303  // cuts on the minimum pt of the tracks
304  if(TMath::Abs(GetBachelor()->Pt()) < cutsLctoV0[4]) return 0;
305  if(TMath::Abs(Getv0PositiveTrack()->Pt()) < cutsLctoV0[5]) return 0;
306  if(TMath::Abs(Getv0NegativeTrack()->Pt()) < cutsLctoV0[6]) return 0;
307 
308  // cut on the cascade dca
309  if( TMath::Abs(GetDCA(0))>cutsLctoV0[7] //||
310  //TMath::Abs(Getv0()->DcaPosToPrimVertex())>cutsLctoV0[7] ||
311  //TMath::Abs(Getv0()->DcaNegToPrimVertex())>cutsLctoV0[7]
312  ) return 0;
313 
314  // cut on the v0 dca
315  if(TMath::Abs(Getv0()->DcaV0Daughters()) > cutsLctoV0[8]) return 0;
316 
317  // cut on V0 cosine of pointing angle wrt PV
318  if (CosV0PointingAngle() < cutsLctoV0[9]) { // cosine of V0 pointing angle wrt primary vertex
319  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
320  return 0;
321  }
322 
323  // cut on bachelor transverse impact parameter wrt PV
324  if (TMath::Abs(Getd0Prong(0)) > cutsLctoV0[10]) { // bachelor transverse impact parameter wrt PV
325  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
326  return 0;
327  }
328 
329  // cut on V0 transverse impact parameter wrt PV
330  if (TMath::Abs(Getd0Prong(1)) > cutsLctoV0[11]) { // V0 transverse impact parameter wrt PV
331  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
332  return 0;
333  }
334 
335  // cut on K0S invariant mass veto
336  if (TMath::Abs(Getv0()->MassK0Short()-mk0sPDG) < cutsLctoV0[12]) { // K0S invariant mass veto
337  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
338  return 0;
339  }
340 
341  // cut on Lambda/LambdaBar invariant mass veto
342  if (TMath::Abs(Getv0()->MassLambda()-mLPDG) < cutsLctoV0[13] ||
343  TMath::Abs(Getv0()->MassAntiLambda()-mLPDG) < cutsLctoV0[13] ) { // Lambda/LambdaBar invariant mass veto
344  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
345  return 0;
346  }
347 
348  // cut on gamma invariant mass veto
349  if (Getv0()->InvMass2Prongs(0,1,11,11) < cutsLctoV0[14]) { // K0S invariant mass veto
350  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
351  return 0;
352  }
353 
354  // cut on V0 pT min
355  if (Getv0()->Pt() < cutsLctoV0[15]) { // V0 pT min
356  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",Getv0()->Pt(),cutsLctoV0[15]));
357  return 0;
358  }
359 
360  return true;
361 
362 }
363 //-----------------------------------------------------------------------------
368 
369  TVector3 p3Trk0(Get2Prong()->PxProng(0),Get2Prong()->PyProng(0),Get2Prong()->PzProng(0)); // from D0
370  TVector3 p3Trk1(Get2Prong()->PxProng(1),Get2Prong()->PyProng(1),Get2Prong()->PzProng(1)); // from D0
371  TVector3 p3Trk2(PxProng(0),PyProng(0),PzProng(0)); // pi_s
372 
373  TVector3 perp = p3Trk0.Cross(p3Trk1);
374  Double_t theta = p3Trk2.Angle(perp);
375  if(theta>(TMath::Pi()-theta)) theta = TMath::Pi() - theta;
376  theta = TMath::Pi()/2. - theta;
377 
378  return theta;
379 }
380 //-----------------------------------------------------------------------------
385  TVector3 p3Trk0(Get2Prong()->PxProng(0),Get2Prong()->PyProng(0),Get2Prong()->PzProng(0)); // from D0
386  TVector3 p3Trk1(Get2Prong()->PxProng(1),Get2Prong()->PyProng(1),Get2Prong()->PzProng(1)); // from D0
387  TVector3 p3Trk2(PxProng(0),PyProng(0),PzProng(0)); // pi_s
388 
389  Double_t alpha = p3Trk0.Angle(p3Trk2);
390  Double_t beta = p3Trk1.Angle(p3Trk2);
391 
392  Double_t cosphi01 = TMath::Cos(alpha) / TMath::Cos(AngleD0dkpPisoft());
393  Double_t cosphi02 = TMath::Cos(beta) / TMath::Cos(AngleD0dkpPisoft());
394 
395  Double_t phi01 = TMath::ACos(cosphi01);
396  Double_t phi02 = TMath::ACos(cosphi02);
397  Double_t phi00 = p3Trk0.Angle(p3Trk1);
398 
399  if((phi01>phi00) || (phi02>phi00)) return kFALSE;
400  return kTRUE;
401 }
402 
403 //-----------------------------------------------------------------------------
405 {
409 
410  AliAODv0 *v0 = (AliAODv0*)Getv0();
411 
412  if (!v0)
413  return -1.;
414  AliAODVertex *vtxPrimary = GetPrimaryVtx();
415  Double_t posVtx[3] = {0.,0.,0.};
416  vtxPrimary->GetXYZ(posVtx);
417  return v0->DecayLengthV0(posVtx);
418 
419 }
420 //-----------------------------------------------------------------------------
422 {
426  AliAODv0 *v0 = (AliAODv0*)Getv0();
427 
428  if (!v0)
429  return -1.;
430  AliAODVertex *vtxPrimary = GetPrimaryVtx();
431  Double_t posVtx[3] = {0.,0.,0.};
432  vtxPrimary->GetXYZ(posVtx);
433  return v0->DecayLengthXY(posVtx);
434 
435 }
436 //-----------------------------------------------------------------------------
438 {
442 
443  AliAODv0 *v0 = (AliAODv0*)Getv0();
444 
445  if (!v0)
446  return -999.;
447 
448  AliAODVertex *vtxPrimary = GetPrimaryVtx();
449  Double_t posVtx[3] = {0.,0.,0.};
450  vtxPrimary->GetXYZ(posVtx);
451  return v0->CosPointingAngle(posVtx);
452 
453 }
454 //-----------------------------------------------------------------------------
456 {
460 
461  AliAODv0 *v0 = (AliAODv0*)Getv0();
462 
463  if (!v0)
464  return -999.;
465 
466  AliAODVertex *vtxPrimary = GetPrimaryVtx();
467  Double_t posVtx[3] = {0.,0.,0.};
468  vtxPrimary->GetXYZ(posVtx);
469  return v0->CosPointingAngleXY(posVtx);
470 
471 }
472 //-----------------------------------------------------------------------------
474 {
478 
479  AliAODv0 *v0 = (AliAODv0*)Getv0();
480 
481  if (!v0)
482  return -1.;
483  //AliAODVertex *vtxPrimary = GetPrimaryVtx();
484  //Double_t posVtx[3] = {0.,0.,0.};
485  //vtxPrimary->GetXYZ(posVtx);
486  //return v0->NormalizedDecayLength(posVtx);
487  return v0->NormalizedDecayLength(GetPrimaryVtx());
488 
489 }
490 //-----------------------------------------------------------------------------
492 {
496  AliAODv0 *v0 = (AliAODv0*)Getv0();
497 
498  if (!v0)
499  return -1.;
500  //AliAODVertex *vtxPrimary = GetPrimaryVtx();
501  //Double_t posVtx[3] = {0.,0.,0.};
502  //vtxPrimary->GetXYZ(posVtx);
503  //return v0->NormalizedDecayLengthXY(posVtx);
504  return v0->NormalizedDecayLengthXY(GetPrimaryVtx());
505 
506 }
Int_t charge
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Double_t DeltaInvMass() const
Bool_t TrigonometricalCut() const
Double_t NormalizedV0DecayLength() const
Int_t MatchToMC(Int_t pdgabs, Int_t pdgabs2prong, Int_t *pdgDg, Int_t *pdgDg2prong, TClonesArray *mcArray, Bool_t isV0=kFALSE) const
AliAODTrack * Getv0NegativeTrack() const
AliAODv0 * Getv0() const
Double_t InvMassLctoLambdaPi() const
Double_t CosV0PointingAngleXY() const
Double_t NormalizedV0DecayLengthXY() const
Double_t DecayLengthXYV0() const
Bool_t SelectDstar(const Double_t *cutsDstar, const Double_t *cutsD0, Bool_t testD0=kTRUE) const
Double_t AngleD0dkpPisoft() const
Double_t InvMassLctoK0sP() const
AliAODTrack * Getv0PositiveTrack() const
AliAODTrack * GetBachelor() const
Bool_t SelectD0(const Double_t *cuts, Int_t &okD0, Int_t &okD0bar) const
Double_t CosV0PointingAngle() const
AliAODRecoDecayHF2Prong & operator=(const AliAODRecoDecayHF2Prong &source)
Bool_t SelectLctoV0(const Double_t *cutsLctoV0, Bool_t okLck0sp, Bool_t okLcLpi, Bool_t okLcLbarpi) const
AliAODVertex * GetPrimaryVtx() const
Double_t InvMassDstarKpipi() const
Double_t DecayLengthV0() const
AliAODRecoDecayHF2Prong * Get2Prong() const
AliAODRecoCascadeHF & operator=(const AliAODRecoCascadeHF &source)