1 /**************************************************************************
2 * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /////////////////////////////////////////////////////////////
20 // Class for cuts on AOD reconstructed D0->Kpi
22 // Author: A.Dainese, andrea.dainese@pd.infn.it
23 /////////////////////////////////////////////////////////////
25 #include <TDatabasePDG.h>
26 #include <Riostream.h>
28 #include "AliRDHFCutsD0toKpi.h"
29 #include "AliAODRecoDecayHF2Prong.h"
30 #include "AliAODTrack.h"
31 #include "AliESDtrack.h"
32 #include "AliAODPid.h"
33 #include "AliTPCPIDResponse.h"
34 #include "AliAODVertex.h"
35 #include "AliKFVertex.h"
36 #include "AliKFParticle.h"
41 ClassImp(AliRDHFCutsD0toKpi)
43 //--------------------------------------------------------------------------
44 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
46 fUseSpecialCuts(kFALSE),
51 fPtMaxSpecialCuts(9999.)
54 // Default Constructor
58 TString varNames[11]={"inv. mass [GeV]",
69 Bool_t isUpperCut[11]={kTRUE,
80 SetVarNames(nvars,varNames,isUpperCut);
81 Bool_t forOpt[11]={kFALSE,
92 SetVarsForOpt(4,forOpt);
93 Float_t limits[2]={0,999999999.};
97 //--------------------------------------------------------------------------
98 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
100 fUseSpecialCuts(source.fUseSpecialCuts),
101 fLowPt(source.fLowPt),
102 fDefaultPID(source.fDefaultPID),
103 fUseKF(source.fUseKF),
104 fPtLowPID(source.fPtLowPID),
105 fPtMaxSpecialCuts(source.fPtMaxSpecialCuts)
112 //--------------------------------------------------------------------------
113 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
116 // assignment operator
118 if(&source == this) return *this;
120 AliRDHFCuts::operator=(source);
121 fUseSpecialCuts=source.fUseSpecialCuts;
122 fLowPt=source.fLowPt;
123 fDefaultPID=source.fDefaultPID;
124 fUseKF=source.fUseKF;
125 fPtLowPID=source.fPtLowPID;
126 fPtMaxSpecialCuts=source.fPtMaxSpecialCuts;
132 //---------------------------------------------------------------------------
133 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
135 // Fills in vars the values of the variables
138 if(nvars!=fnVarsForOpt) {
139 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
143 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
145 //recalculate vertex w/o daughters
146 Bool_t cleanvtx=kFALSE;
147 AliAODVertex *origownvtx=0x0;
148 if(fRemoveDaughtersFromPrimary) {
149 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
151 if(!RecalcOwnPrimaryVtx(dd,aod)) {
152 CleanOwnPrimaryVtx(dd,aod,origownvtx);
160 if(TMath::Abs(pdgdaughters[0])==211) {
161 vars[iter]=dd->InvMassD0();
163 vars[iter]=dd->InvMassD0bar();
168 vars[iter]=dd->GetDCA();
172 if(TMath::Abs(pdgdaughters[0])==211) {
173 vars[iter] = dd->CosThetaStarD0();
175 vars[iter] = dd->CosThetaStarD0bar();
180 if(TMath::Abs(pdgdaughters[0])==321) {
181 vars[iter]=dd->PtProng(0);
184 vars[iter]=dd->PtProng(1);
189 if(TMath::Abs(pdgdaughters[0])==211) {
190 vars[iter]=dd->PtProng(0);
193 vars[iter]=dd->PtProng(1);
198 if(TMath::Abs(pdgdaughters[0])==321) {
199 vars[iter]=dd->Getd0Prong(0);
202 vars[iter]=dd->Getd0Prong(1);
207 if(TMath::Abs(pdgdaughters[0])==211) {
208 vars[iter]=dd->Getd0Prong(0);
211 vars[iter]=dd->Getd0Prong(1);
216 vars[iter]= dd->Prodd0d0();
220 vars[iter]=dd->CosPointingAngle();
225 vars[iter]=TMath::Abs(dd->CosPointingAngleXY());
230 vars[iter]=dd->NormalizedDecayLengthXY();
233 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
237 //---------------------------------------------------------------------------
238 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
248 cout<<"Cut matrice not inizialized. Exit..."<<endl;
252 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
255 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
259 if(fKeepSignalMC) if(IsSignalMC(d,aod,421)) return 3;
261 Double_t ptD=d->Pt();
262 if(ptD<fMinPtCand) return 0;
263 if(ptD>fMaxPtCand) return 0;
265 if(d->HasBadDaughters()) return 0;
267 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
268 Int_t returnvaluePID=3;
269 Int_t returnvalueCuts=3;
271 // selection on candidate
272 if(selectionLevel==AliRDHFCuts::kAll ||
273 selectionLevel==AliRDHFCuts::kCandidate) {
277 //recalculate vertex w/o daughters
278 AliAODVertex *origownvtx=0x0;
279 if(fRemoveDaughtersFromPrimary && !fUseMCVertex) {
280 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
281 if(!RecalcOwnPrimaryVtx(d,aod)) {
282 CleanOwnPrimaryVtx(d,aod,origownvtx);
288 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
289 if(!SetMCPrimaryVtx(d,aod)) {
290 CleanOwnPrimaryVtx(d,aod,origownvtx);
297 Int_t okD0=0,okD0bar=0;
299 Int_t ptbin=PtBin(pt);
301 CleanOwnPrimaryVtx(d,aod,origownvtx);
305 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
308 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
310 d->InvMassD0(mD0,mD0bar);
311 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
312 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
313 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
315 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
318 if(d->Pt2Prong(1) < fCutsRD[GetGlobalIndex(3,ptbin)]*fCutsRD[GetGlobalIndex(3,ptbin)] || d->Pt2Prong(0) < fCutsRD[GetGlobalIndex(4,ptbin)]*fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
319 if(d->Pt2Prong(0) < fCutsRD[GetGlobalIndex(3,ptbin)]*fCutsRD[GetGlobalIndex(3,ptbin)] || d->Pt2Prong(1) < fCutsRD[GetGlobalIndex(4,ptbin)]*fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
320 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
323 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
324 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
325 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
326 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
327 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
329 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
332 d->CosThetaStarD0(ctsD0,ctsD0bar);
333 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
334 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
335 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
337 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
340 if(TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(9,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
342 Double_t normalDecayLengXY=d->NormalizedDecayLengthXY();
343 if (normalDecayLengXY < fCutsRD[GetGlobalIndex(10, ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
345 if (returnvalueCuts!=0) {
346 if (okD0) returnvalueCuts=1; //cuts passed as D0
347 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
348 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
353 if(fUseSpecialCuts && (pt<fPtMaxSpecialCuts)) special=IsSelectedSpecialCuts(d);
354 if(!special) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
356 // unset recalculated primary vertex when not needed any more
357 CleanOwnPrimaryVtx(d,aod,origownvtx);
360 // go to selection with Kalman vertexing, if requested
361 returnvalueCuts = IsSelectedKF(d,aod);
364 fIsSelectedCuts=returnvalueCuts;
365 if(!returnvalueCuts) return 0;
370 if(selectionLevel==AliRDHFCuts::kAll ||
371 selectionLevel==AliRDHFCuts::kCandidate ||
372 selectionLevel==AliRDHFCuts::kPID) {
373 returnvaluePID = IsSelectedPID(d);
374 fIsSelectedPID=returnvaluePID;
375 if(!returnvaluePID) return 0;
378 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
380 if(!returnvalueComb) return 0;
382 // selection on daughter tracks
383 if(selectionLevel==AliRDHFCuts::kAll ||
384 selectionLevel==AliRDHFCuts::kTracks) {
385 if(!AreDaughtersSelected(d)) return 0;
388 // cout<<"Pid = "<<returnvaluePID<<endl;
389 return returnvalueComb;
392 //------------------------------------------------------------------------------------------
393 Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
394 AliAODEvent* aod) const {
396 // Apply selection using KF-vertexing
399 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
400 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
402 if(!track0 || !track1) {
403 cout<<"one or two D0 daughters missing!"<<endl;
407 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
408 Int_t returnvalueCuts=3;
410 // candidate selection with AliKF
411 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
413 Int_t okD0=0,okD0bar=0;
416 // convert tracks into AliKFParticles
418 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
419 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
420 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
421 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
423 // build D0 candidates
425 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
426 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
428 // create kf primary vertices
430 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
431 AliKFVertex primVtx(*vtx1);
432 AliKFVertex aprimVtx(*vtx1);
434 if(primVtx.GetNContributors()<=0) okD0 = 0;
435 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
436 if(!okD0 && !okD0bar) returnvalueCuts=0;
440 Double_t d0mass = d0c.GetMass();
441 Double_t ad0mass = ad0c.GetMass();
443 // calculate P of D0 and D0bar
444 Double_t d0P = d0c.GetP();
445 Double_t d0Px = d0c.GetPx();
446 Double_t d0Py = d0c.GetPy();
447 Double_t d0Pz = d0c.GetPz();
448 Double_t ad0P = ad0c.GetP();
449 Double_t ad0Px = ad0c.GetPx();
450 Double_t ad0Py = ad0c.GetPy();
451 Double_t ad0Pz = ad0c.GetPz();
453 //calculate Pt of D0 and D0bar
455 Double_t pt=d0c.GetPt();
456 Double_t apt=ad0c.GetPt();
458 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
460 if(track0->GetUsedForPrimVtxFit()) {
465 if(track1->GetUsedForPrimVtxFit()) {
473 if(primVtx.GetNContributors()<=0) okD0 = 0;
474 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
475 if(!okD0 && !okD0bar) returnvalueCuts=0;
477 //calculate cut variables
479 // calculate impact params of daughters w.r.t recalculated vertices
481 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
482 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
483 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
484 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
486 // calculate Product of Impact Params
488 Double_t prodParam = impactPi*impactKa;
489 Double_t aprodParam = aimpactPi*aimpactKa;
491 // calculate cosine of pointing angles
493 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
494 TVector3 fline(d0c.GetX()-primVtx.GetX(),
495 d0c.GetY()-primVtx.GetY(),
496 d0c.GetZ()-primVtx.GetZ());
497 Double_t pta = mom.Angle(fline);
498 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
500 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
501 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
502 ad0c.GetY()-aprimVtx.GetY(),
503 ad0c.GetZ()-aprimVtx.GetZ());
504 Double_t apta = amom.Angle(afline);
505 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
507 // calculate P of Pions at Decay Position of D0 and D0bar candidates
508 negKKF.TransportToParticle(d0c);
509 posPiKF.TransportToParticle(d0c);
510 posKKF.TransportToParticle(ad0c);
511 negPiKF.TransportToParticle(ad0c);
513 Double_t pxPi = posPiKF.GetPx();
514 Double_t pyPi = posPiKF.GetPy();
515 Double_t pzPi = posPiKF.GetPz();
516 Double_t ptPi = posPiKF.GetPt();
518 Double_t apxPi = negPiKF.GetPx();
519 Double_t apyPi = negPiKF.GetPy();
520 Double_t apzPi = negPiKF.GetPz();
521 Double_t aptPi = negPiKF.GetPt();
523 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
525 Double_t ptK = negKKF.GetPt();
526 Double_t aptK = posKKF.GetPt();
528 //calculate cos(thetastar)
529 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
531 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
532 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
533 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
534 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
536 // cos(thetastar) for D0 and Pion
538 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
539 Double_t beta = d0P/d0E;
540 Double_t gamma = d0E/massvtx;
541 TVector3 momPi(pxPi,pyPi,pzPi);
542 TVector3 momTot(d0Px,d0Py,d0Pz);
543 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
544 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
546 // cos(thetastar) for D0bar and Pion
548 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
549 Double_t abeta = ad0P/ad0E;
550 Double_t agamma = ad0E/massvtx;
551 TVector3 amomPi(apxPi,apyPi,apzPi);
552 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
553 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
554 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
556 // calculate reduced Chi2 for the full D0 fit
557 d0c.SetProductionVertex(primVtx);
558 ad0c.SetProductionVertex(aprimVtx);
559 negKKF.SetProductionVertex(d0c);
560 posPiKF.SetProductionVertex(d0c);
561 posKKF.SetProductionVertex(ad0c);
562 negPiKF.SetProductionVertex(ad0c);
563 d0c.TransportToProductionVertex();
564 ad0c.TransportToProductionVertex();
566 // calculate the decay length
567 Double_t decayLengthD0 = d0c.GetDecayLength();
568 Double_t adecayLengthD0 = ad0c.GetDecayLength();
570 Double_t chi2D0 = 50.;
571 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
572 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
575 Double_t achi2D0 = 50.;
576 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
577 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
581 Int_t ptbin=PtBin(pt);
582 Int_t aptbin=PtBin(apt);
584 if(ptbin < 0) okD0 = 0;
585 if(aptbin < 0) okD0bar = 0;
586 if(!okD0 && !okD0bar) returnvalueCuts=0;
588 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
589 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
590 if(!okD0 && !okD0bar) returnvalueCuts=0;
593 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
594 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
596 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
597 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
599 if(!okD0 && !okD0bar) returnvalueCuts=0;
601 // for the moment via the standard method due to bug in AliKF
602 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
603 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
604 if(!okD0 && !okD0bar) returnvalueCuts=0;
607 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
608 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
609 if(!okD0 && !okD0bar) returnvalueCuts=0;
612 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
613 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
614 if(!okD0 && !okD0bar) returnvalueCuts=0;
616 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
617 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
618 if(!okD0 && !okD0bar) returnvalueCuts=0;
620 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
621 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
622 if(!okD0 && !okD0bar) returnvalueCuts=0;
624 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
625 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
626 if(!okD0 && !okD0bar) returnvalueCuts=0;
628 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
629 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
630 if(!okD0 && !okD0bar) returnvalueCuts=0;
632 if(returnvalueCuts!=0) {
633 if(okD0) returnvalueCuts=1; //cuts passed as D0
634 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
635 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
638 return returnvalueCuts;
641 //---------------------------------------------------------------------------
643 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
646 // Checking if D0 is in fiducial acceptance region
650 // applying cut for pt > 5 GeV
651 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
652 if (TMath::Abs(y) > 0.8){
656 // appliying smooth cut for pt < 5 GeV
657 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
658 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
659 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
660 if (y < minFiducialY || y > maxFiducialY){
667 //---------------------------------------------------------------------------
668 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
670 // ############################################################
672 // Apply PID selection
675 // ############################################################
677 if(!fUsePID) return 3;
678 if(fDefaultPID) return IsSelectedPIDdefault(d);
680 Int_t isD0D0barPID[2]={1,2};
681 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
683 // values convention -1 = discarded
684 // 0 = not identified (but compatible) || No PID (->hasPID flag)
686 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
687 // Initial hypothesis: unknwon (but compatible)
688 combinedPID[0][0]=0; // prima figlia, Kaon
689 combinedPID[0][1]=0; // prima figlia, pione
690 combinedPID[1][0]=0; // seconda figlia, Kaon
691 combinedPID[1][1]=0; // seconda figlia, pion
693 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
694 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
695 for(Int_t daught=0;daught<2;daught++){
697 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
698 if(fPidHF->IsTOFPiKexcluded(aodtrack,5.)) return 0;
700 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
701 checkPIDInfo[daught]=kFALSE;
706 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
710 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
711 combinedPID[daught][1]=0;
713 fPidHF->SetTOF(kFALSE);
714 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
715 fPidHF->SetTOF(kTRUE);
716 fPidHF->SetCompat(kTRUE);
720 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
724 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
725 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
726 else isD0D0barPID[0]=0;// if K+ D0 excluded
728 /* else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
733 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
734 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
735 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
737 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
738 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
739 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
742 if(fLowPt && d->Pt()<fPtLowPID){
743 Double_t sigmaTPC[3]={3.,2.,0.};
744 fPidHF->SetSigmaForTPC(sigmaTPC);
746 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
748 Double_t ptProng=aodtrack->P();
751 fPidHF->SetCompat(kFALSE);
752 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
753 fPidHF->SetCompat(kTRUE);
756 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
757 combinedPID[daught][1]=0;
759 fPidHF->SetTOF(kFALSE);
760 Double_t sigmaTPCpi[3]={3.,3.,0.};
761 fPidHF->SetSigmaForTPC(sigmaTPCpi);
762 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
763 fPidHF->SetTOF(kTRUE);
765 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
767 combinedPID[daught][1]=1;
769 combinedPID[daught][1]=-1;
775 fPidHF->SetSigmaForTPC(sigma_tmp);
776 }// END OF LOOP ON DAUGHTERS
778 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
779 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
784 // FURTHER PID REQUEST (both daughter info is needed)
785 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
786 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
787 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
791 if(fLowPt && d->Pt()<fPtLowPID){
792 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
793 fWhyRejection=32;// reject cases where the Kaon is not identified
794 fPidHF->SetSigmaForTPC(sigma_tmp);
798 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
800 // cout<<"Why? "<<fWhyRejection<<endl;
801 return isD0D0barPID[0]+isD0D0barPID[1];
803 //---------------------------------------------------------------------------
804 Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
806 // ############################################################
808 // Apply PID selection
811 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
813 // d must be a AliAODRecoDecayHF2Prong object
814 // returns 0 if both D0 and D0bar are rejectecd
815 // 1 if D0 is accepted while D0bar is rejected
816 // 2 if D0bar is accepted while D0 is rejected
817 // 3 if both are accepted
818 // fWhyRejection variable (not returned for the moment, print it if needed)
819 // keeps some information on why a candidate has been
820 // rejected according to the following (unfriendly?) scheme
821 // if more rejection cases are considered interesting, just add numbers
823 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
824 // from 20 to 30: "detector" selection (PID acceptance)
827 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
829 // from 30 to 40: PID selection
830 // 31: no Kaon compatible tracks found between daughters
831 // 32: no Kaon identified tracks found (strong sel. at low momenta)
832 // 33: both mass hypotheses are rejected
834 // ############################################################
836 if(!fUsePID) return 3;
838 Int_t isD0D0barPID[2]={1,2};
839 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
840 Double_t tofSig,times[5];// used fot TOF pid
841 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
842 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
843 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
845 // values convention -1 = discarded
846 // 0 = not identified (but compatible) || No PID (->hasPID flag)
848 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
849 // Initial hypothesis: unknwon (but compatible)
850 isKaonPionTOF[0][0]=0;
851 isKaonPionTOF[0][1]=0;
852 isKaonPionTOF[1][0]=0;
853 isKaonPionTOF[1][1]=0;
855 isKaonPionTPC[0][0]=0;
856 isKaonPionTPC[0][1]=0;
857 isKaonPionTPC[1][0]=0;
858 isKaonPionTPC[1][1]=0;
867 for(Int_t daught=0;daught<2;daught++){
870 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
872 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
874 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
878 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
883 AliAODPid *pid=aodtrack->GetDetPid();
890 // ########### Step 1- Check of TPC and TOF response ####################
892 Double_t ptrack=aodtrack->P();
893 //#################### TPC PID #######################
894 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
895 // NO TPC PID INFO FOR THIS TRACK
899 static AliTPCPIDResponse theTPCpid;
900 AliAODPid *pidObj = aodtrack->GetDetPid();
901 Double_t ptProng=pidObj->GetTPCmomentum();
902 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
903 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
906 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
907 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
908 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
909 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
911 //else if(ptrack<.8){
913 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
914 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
915 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
916 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
919 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
920 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
921 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
922 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
927 // ##### TOF PID: do not ask nothing for pion/protons ############
928 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
929 // NO TOF PID INFO FOR THIS TRACK
933 tofSig=pid->GetTOFsignal();
934 pid->GetIntegratedTimes(times);
935 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
936 if(TMath::Abs(tofSig-times[3])>3.*160.){
937 isKaonPionTOF[daught][0]=-1;
941 isKaonPionTOF[daught][0]=1;
946 //######### Step 2: COMBINE TOF and TPC PID ###############
947 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
948 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
949 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
952 //######### Step 3: USE PID INFO
954 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
958 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){// if in conflict (both pi- and K-), if k for both TPC and TOF -> is K
959 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
960 else isD0D0barPID[0]=0;// if K+ D0 excluded
962 else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){// if in conflict (both pi- and K-) and k- only for TPC or TOF -> reject
966 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
967 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
968 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
970 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
971 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
972 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
975 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
976 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
977 // ############### NOT OPTIMIZED YET ###################################
979 isKaonPionTPC[daught][0]=0;
980 isKaonPionTPC[daught][1]=0;
981 AliAODPid *pidObj = aodtrack->GetDetPid();
982 Double_t ptProng=pidObj->GetTPCmomentum();
985 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
986 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
987 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
988 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
990 //else if(ptrack<.8){
992 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
993 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
994 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
995 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
998 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
999 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
1003 }// END OF LOOP ON DAUGHTERS
1005 // FURTHER PID REQUEST (both daughter info is needed)
1006 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
1007 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
1010 else if(hasPID[0]==0&&hasPID[1]==0){
1011 fWhyRejection=28;// reject cases in which no PID info is available
1015 // request of K identification at low D0 pt
1016 combinedPID[0][0]=0;
1017 combinedPID[0][1]=0;
1018 combinedPID[1][0]=0;
1019 combinedPID[1][1]=0;
1021 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
1022 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
1023 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
1024 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
1026 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
1027 fWhyRejection=32;// reject cases where the Kaon is not identified
1032 // cout<<"Why? "<<fWhyRejection<<endl;
1033 return isD0D0barPID[0]+isD0D0barPID[1];
1038 //---------------------------------------------------------------------------
1039 Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
1040 Int_t selectionvalCand,
1041 Int_t selectionvalPID) const
1044 // This method combines the tracks, PID and cuts selection results
1046 if(selectionvalTrack==0) return 0;
1050 switch(selectionvalPID) {
1055 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
1058 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
1061 returnvalue=selectionvalCand;
1070 //----------------------------------------------------------------------------
1071 Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1074 // Note: this method is temporary
1075 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1080 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1081 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1082 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1084 Int_t returnvalue=3; //cut passed
1085 for(Int_t i=0;i<2/*prongs*/;i++){
1086 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1088 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1089 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
1094 //----------------------------------------------
1095 void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1097 //switch on candidate selection via AliKFparticle
1103 TString varNamesKF[11]={"inv. mass [GeV]",
1114 Bool_t isUpperCutKF[11]={kTRUE,
1125 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1127 Bool_t forOpt[11]={kFALSE,
1138 SetVarsForOpt(4,forOpt);
1144 void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1146 //STANDARD CUTS USED FOR 2010 pp analysis
1147 //dca cut will be enlarged soon to 400 micron
1150 SetName("D0toKpiCutsStandard");
1151 SetTitle("Standard Cuts for D0 analysis");
1153 // PILE UP REJECTION
1154 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1161 // TRACKS ON SINGLE TRACKS
1162 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1163 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1164 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1165 esdTrackCuts->SetRequireITSRefit(kTRUE);
1166 // esdTrackCuts->SetMinNClustersITS(4);
1167 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1168 esdTrackCuts->SetMinDCAToVertexXY(0.);
1169 esdTrackCuts->SetEtaRange(-0.8,0.8);
1170 esdTrackCuts->SetPtRange(0.3,1.e10);
1172 AddTrackCuts(esdTrackCuts);
1175 const Int_t nptbins =14;
1176 const Double_t ptmax = 9999.;
1177 const Int_t nvars=11;
1178 Float_t ptbins[nptbins+1];
1195 SetGlobalIndex(nvars,nptbins);
1196 SetPtBins(nptbins+1,ptbins);
1198 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,350.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.80,0.,0.},/* pt<0.5*/
1199 {0.400,350.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.80,0.,0.},/* 0.5<pt<1*/
1200 {0.400,300.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.80,0.,0.},/* 1<pt<2 */
1201 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-15000.*1E-8,0.85,0.,0.},/* 2<pt<3 */
1202 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 3<pt<4 */
1203 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 4<pt<5 */
1204 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 5<pt<6 */
1205 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 6<pt<7 */
1206 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-7000.*1E-8,0.85,0.,0.},/* 7<pt<8 */
1207 {0.400,300.*1E-4,0.9,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.,0.},/* 8<pt<12 */
1208 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,10000.*1E-8,0.85,0.,0.},/* 12<pt<16 */
1209 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.},/* 16<pt<20 */
1210 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.},/* 20<pt<24 */
1211 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.}};/* pt>24 */
1214 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1215 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1216 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1218 for (Int_t ibin=0;ibin<nptbins;ibin++){
1219 for (Int_t ivar = 0; ivar<nvars; ivar++){
1220 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1224 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1225 SetUseSpecialCuts(kTRUE);
1226 SetRemoveDaughtersFromPrim(kTRUE);
1228 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1229 delete [] cutsMatrixTransposeStand;
1230 cutsMatrixTransposeStand=NULL;
1233 AliAODPidHF* pidObj=new AliAODPidHF();
1234 //pidObj->SetName("pid4D0");
1236 const Int_t nlims=2;
1237 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1238 Bool_t compat=kTRUE; //effective only for this mode
1240 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1241 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1242 pidObj->SetMatch(mode);
1243 pidObj->SetPLimit(plims,nlims);
1244 pidObj->SetSigma(sigmas);
1245 pidObj->SetCompat(compat);
1246 pidObj->SetTPC(kTRUE);
1247 pidObj->SetTOF(kTRUE);
1248 pidObj->SetPCompatTOF(1.5);
1249 pidObj->SetSigmaForTPCCompat(3.);
1250 pidObj->SetSigmaForTOFCompat(3.);
1251 pidObj->SetOldPid(kTRUE);
1255 SetUseDefaultPID(kFALSE);
1269 void AliRDHFCutsD0toKpi::SetStandardCutsPP2011_276TeV() {
1271 // STANDARD CUTS USED FOR 2011 pp analysis at 2.76TeV
1274 SetName("D0toKpiCutsStandard");
1275 SetTitle("Standard Cuts for D0 analysis in pp2011 at 2.76TeV run");
1280 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1281 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1283 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1284 esdTrackCuts->SetRequireITSRefit(kTRUE);
1285 esdTrackCuts->SetEtaRange(-0.8,0.8);
1286 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1287 AliESDtrackCuts::kAny);
1288 // default is kBoth, otherwise kAny
1289 esdTrackCuts->SetMinDCAToVertexXY(0.);
1290 esdTrackCuts->SetPtRange(0.3,1.e10);
1292 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1293 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1294 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1296 AddTrackCuts(esdTrackCuts);
1299 const Int_t nvars=11;
1300 const Int_t nptbins=13;
1301 Float_t ptbins[nptbins+1];
1317 SetPtBins(nptbins+1,ptbins);
1320 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,0.04,0.75,0.3,0.3,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* pt<0.5*/
1321 {0.400,0.04,0.75,0.3,0.3,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* 0.5<pt<1*/
1322 {0.400,0.03,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.8,0.,0.},/* 1<pt<2 */
1323 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0003,0.9,0.,0.},/* 2<pt<3 */
1324 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0002,0.9,0.,0.},/* 3<pt<4 */
1325 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.00015,0.9,0.,0.},/* 4<pt<5 */
1326 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0001,0.9,0.,0.},/* 5<pt<6 */
1327 {0.400,0.09,0.85,0.7,0.7,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* 6<pt<8 */
1328 {0.400,0.06,0.85,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.00001,0.85,0.,0.},/* 8<pt<12 */
1329 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 12<pt<16 */
1330 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 16<pt<20 */
1331 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 20<pt<24 */
1332 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.}};/* pt>24 */
1334 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1335 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1336 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1337 for (Int_t ibin=0;ibin<nptbins;ibin++){
1338 for (Int_t ivar = 0; ivar<nvars; ivar++){
1339 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1342 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1343 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1344 delete [] cutsMatrixTransposeStand;
1348 AliAODPidHF* pidObj=new AliAODPidHF();
1350 const Int_t nlims=2;
1351 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1352 Bool_t compat=kTRUE; //effective only for this mode
1354 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1355 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1356 pidObj->SetMatch(mode);
1357 pidObj->SetPLimit(plims,nlims);
1358 pidObj->SetSigma(sigmas);
1359 pidObj->SetCompat(compat);
1360 pidObj->SetTPC(kTRUE);
1361 pidObj->SetTOF(kTRUE);
1362 pidObj->SetOldPid(kTRUE);
1365 SetUseDefaultPID(kFALSE); //to use the AliAODPidHF
1369 //activate pileup rejection (for pp)
1370 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1372 //Do recalculate the vertex
1373 SetRemoveDaughtersFromPrim(kTRUE);
1378 // Use the kFirst selection for tracks with candidate D with pt<2
1379 SetSelectCandTrackSPDFirst(kTRUE,2.);
1381 // Use special cuts for D candidates with pt<2
1382 SetUseSpecialCuts(kTRUE);
1383 SetMaximumPtSpecialCuts(2.);
1394 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1396 // Final CUTS USED FOR 2010 PbPb analysis of central events
1397 // REMEMBER TO EVENTUALLY SWITCH ON
1398 // SetUseAOD049(kTRUE);
1401 SetName("D0toKpiCutsStandard");
1402 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1405 // CENTRALITY SELECTION
1406 SetMinCentrality(0.);
1407 SetMaxCentrality(80.);
1408 SetUseCentrality(AliRDHFCuts::kCentV0M);
1417 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1418 // PILE UP REJECTION
1419 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1421 // TRACKS ON SINGLE TRACKS
1422 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1423 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1424 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1425 esdTrackCuts->SetRequireITSRefit(kTRUE);
1426 // esdTrackCuts->SetMinNClustersITS(4);
1427 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1428 esdTrackCuts->SetMinDCAToVertexXY(0.);
1429 esdTrackCuts->SetEtaRange(-0.8,0.8);
1430 esdTrackCuts->SetPtRange(0.7,1.e10);
1432 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1433 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1434 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1437 AddTrackCuts(esdTrackCuts);
1438 // SPD k FIRST for Pt<3 GeV/c
1439 SetSelectCandTrackSPDFirst(kTRUE, 3);
1442 const Int_t nptbins =13;
1443 const Double_t ptmax = 9999.;
1444 const Int_t nvars=11;
1445 Float_t ptbins[nptbins+1];
1461 SetGlobalIndex(nvars,nptbins);
1462 SetPtBins(nptbins+1,ptbins);
1463 SetMinPtCandidate(2.);
1465 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,400.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.85,0.99,2.},/* pt<0.5*/
1466 {0.400,400.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.9,0.99,2.},/* 0.5<pt<1*/
1467 {0.400,400.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-43000.*1E-8,0.85,0.995,8.},/* 1<pt<2 */
1468 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-45000.*1E-8,0.95,0.998,7.},/* 2<pt<3 */
1469 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-36000.*1E-8,0.95,0.998,5.},/* 3<pt<4 */
1470 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-27000.*1E-8,0.95,0.998,5.},/* 4<pt<5 */
1471 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-21000.*1E-8,0.92,0.998,5.},/* 5<pt<6 */
1472 {0.400,270.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-14000.*1E-8,0.88,0.998,5.},/* 6<pt<8 */
1473 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.998,5.},/* 8<pt<12 */
1474 {0.400,350.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.83,0.998,8.},/* 12<pt<16 */
1475 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.82,0.995,6.},/* 16<pt<20 */
1476 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.81,0.995,6.},/* 20<pt<24 */
1477 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.8,0.99,2.}};/* pt>24 */
1480 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1481 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1482 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1484 for (Int_t ibin=0;ibin<nptbins;ibin++){
1485 for (Int_t ivar = 0; ivar<nvars; ivar++){
1486 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1490 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1491 SetUseSpecialCuts(kTRUE);
1492 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1493 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1494 delete [] cutsMatrixTransposeStand;
1495 cutsMatrixTransposeStand=NULL;
1498 AliAODPidHF* pidObj=new AliAODPidHF();
1499 //pidObj->SetName("pid4D0");
1501 const Int_t nlims=2;
1502 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1503 Bool_t compat=kTRUE; //effective only for this mode
1505 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1506 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1507 pidObj->SetMatch(mode);
1508 pidObj->SetPLimit(plims,nlims);
1509 pidObj->SetSigma(sigmas);
1510 pidObj->SetCompat(compat);
1511 pidObj->SetTPC(kTRUE);
1512 pidObj->SetTOF(kTRUE);
1513 pidObj->SetPCompatTOF(2.);
1514 pidObj->SetSigmaForTPCCompat(3.);
1515 pidObj->SetSigmaForTOFCompat(3.);
1516 pidObj->SetOldPid(kTRUE);
1521 SetUseDefaultPID(kFALSE);
1534 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010Peripherals() {
1535 // CUTS USED FOR D0 RAA for the CENTRALITY RANGE 20-80%
1538 SetName("D0toKpiCutsStandard");
1539 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run, for peripheral events");
1542 // CENTRALITY SELECTION
1543 SetMinCentrality(40.);
1544 SetMaxCentrality(80.);
1545 SetUseCentrality(AliRDHFCuts::kCentV0M);
1552 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1553 // PILE UP REJECTION
1554 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1556 // TRACKS ON SINGLE TRACKS
1557 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1558 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1559 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1560 esdTrackCuts->SetRequireITSRefit(kTRUE);
1561 // esdTrackCuts->SetMinNClustersITS(4);
1562 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1563 esdTrackCuts->SetMinDCAToVertexXY(0.);
1564 esdTrackCuts->SetEtaRange(-0.8,0.8);
1565 esdTrackCuts->SetPtRange(0.5,1.e10);
1567 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1568 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1569 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0025*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1572 AddTrackCuts(esdTrackCuts);
1573 // SPD k FIRST for Pt<3 GeV/c
1574 SetSelectCandTrackSPDFirst(kTRUE, 3);
1577 const Int_t nptbins =13;
1578 const Double_t ptmax = 9999.;
1579 const Int_t nvars=11;
1580 Float_t ptbins[nptbins+1];
1596 SetGlobalIndex(nvars,nptbins);
1597 SetPtBins(nptbins+1,ptbins);
1598 SetMinPtCandidate(0.);
1600 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,400.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-20000.*1E-8,0.7,0.993,2.},/* pt<0.5*/
1601 {0.400,400.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.85,0.993,2.},/* 0.5<pt<1*/
1602 {0.400,400.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.85,0.995,6.},/* 1<pt<2 */
1603 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.95,0.991,5.},/* 2<pt<3 */
1604 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-36000.*1E-8,0.95,0.993,5.},/* 3<pt<4 */
1605 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-27000.*1E-8,0.95,0.995,5.},/* 4<pt<5 */
1606 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-21000.*1E-8,0.92,0.998,5.},/* 5<pt<6 */
1607 {0.400,270.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-14000.*1E-8,0.88,0.998,5.},/* 6<pt<8 */
1608 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.995,5.},/* 8<pt<12 */
1609 {0.400,350.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.83,0.995,4.},/* 12<pt<16 */
1610 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.82,0.995,4.},/* 16<pt<20 */
1611 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.81,0.995,4.},/* 20<pt<24 */
1612 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.8,0.995,4.}};/* pt>24 */
1615 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1616 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1617 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1619 for (Int_t ibin=0;ibin<nptbins;ibin++){
1620 for (Int_t ivar = 0; ivar<nvars; ivar++){
1621 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1625 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1626 SetUseSpecialCuts(kTRUE);
1627 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1628 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1629 delete [] cutsMatrixTransposeStand;
1630 cutsMatrixTransposeStand=NULL;
1633 AliAODPidHF* pidObj=new AliAODPidHF();
1634 //pidObj->SetName("pid4D0");
1636 const Int_t nlims=2;
1637 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1638 Bool_t compat=kTRUE; //effective only for this mode
1640 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1641 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1642 pidObj->SetMatch(mode);
1643 pidObj->SetPLimit(plims,nlims);
1644 pidObj->SetSigma(sigmas);
1645 pidObj->SetCompat(compat);
1646 pidObj->SetTPC(kTRUE);
1647 pidObj->SetTOF(kTRUE);
1648 pidObj->SetPCompatTOF(2.);
1649 pidObj->SetSigmaForTPCCompat(3.);
1650 pidObj->SetSigmaForTOFCompat(3.);
1651 pidObj->SetOldPid(kTRUE);
1655 SetUseDefaultPID(kFALSE);
1670 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2011() {
1672 // Default 2010 PbPb cut object
1673 SetStandardCutsPbPb2010();
1674 AliAODPidHF *pidobj=GetPidHF();
1676 pidobj->SetOldPid(kFALSE);
1679 // Enable all 2011 PbPb run triggers
1681 SetTriggerClass("");
1682 ResetMaskAndEnableMBTrigger();
1683 EnableCentralTrigger();
1684 EnableSemiCentralTrigger();