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"
38 ClassImp(AliRDHFCutsD0toKpi)
40 //--------------------------------------------------------------------------
41 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
43 fUseSpecialCuts(kFALSE),
50 // Default Constructor
54 TString varNames[11]={"inv. mass [GeV]",
65 Bool_t isUpperCut[11]={kTRUE,
76 SetVarNames(nvars,varNames,isUpperCut);
77 Bool_t forOpt[11]={kFALSE,
88 SetVarsForOpt(4,forOpt);
89 Float_t limits[2]={0,999999999.};
93 //--------------------------------------------------------------------------
94 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
96 fUseSpecialCuts(source.fUseSpecialCuts),
97 fLowPt(source.fLowPt),
98 fDefaultPID(source.fDefaultPID),
99 fUseKF(source.fUseKF),
100 fPtLowPID(source.fPtLowPID)
107 //--------------------------------------------------------------------------
108 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
111 // assignment operator
113 if(&source == this) return *this;
115 AliRDHFCuts::operator=(source);
116 fUseSpecialCuts=source.fUseSpecialCuts;
117 fLowPt=source.fLowPt;
118 fDefaultPID=source.fDefaultPID;
119 fUseKF=source.fUseKF;
120 fPtLowPID=source.fPtLowPID;
126 //---------------------------------------------------------------------------
127 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
129 // Fills in vars the values of the variables
132 if(nvars!=fnVarsForOpt) {
133 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
137 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
139 //recalculate vertex w/o daughters
140 Bool_t cleanvtx=kFALSE;
141 AliAODVertex *origownvtx=0x0;
142 if(fRemoveDaughtersFromPrimary) {
143 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
145 if(!RecalcOwnPrimaryVtx(dd,aod)) {
146 CleanOwnPrimaryVtx(dd,aod,origownvtx);
154 if(TMath::Abs(pdgdaughters[0])==211) {
155 vars[iter]=dd->InvMassD0();
157 vars[iter]=dd->InvMassD0bar();
162 vars[iter]=dd->GetDCA();
166 if(TMath::Abs(pdgdaughters[0])==211) {
167 vars[iter] = dd->CosThetaStarD0();
169 vars[iter] = dd->CosThetaStarD0bar();
174 if(TMath::Abs(pdgdaughters[0])==321) {
175 vars[iter]=dd->PtProng(0);
178 vars[iter]=dd->PtProng(1);
183 if(TMath::Abs(pdgdaughters[0])==211) {
184 vars[iter]=dd->PtProng(0);
187 vars[iter]=dd->PtProng(1);
192 if(TMath::Abs(pdgdaughters[0])==321) {
193 vars[iter]=dd->Getd0Prong(0);
196 vars[iter]=dd->Getd0Prong(1);
201 if(TMath::Abs(pdgdaughters[0])==211) {
202 vars[iter]=dd->Getd0Prong(0);
205 vars[iter]=dd->Getd0Prong(1);
210 vars[iter]= dd->Prodd0d0();
214 vars[iter]=dd->CosPointingAngle();
219 vars[iter]=TMath::Abs(dd->CosPointingAngleXY());
224 vars[iter]=dd->NormalizedDecayLengthXY();
227 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
231 //---------------------------------------------------------------------------
232 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
242 cout<<"Cut matrice not inizialized. Exit..."<<endl;
246 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
249 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
253 if(fKeepSignalMC) if(IsSignalMC(d,aod,421)) return 3;
255 Double_t ptD=d->Pt();
256 if(ptD<fMinPtCand) return 0;
257 if(ptD>fMaxPtCand) return 0;
259 if(d->HasBadDaughters()) return 0;
261 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
262 Int_t returnvaluePID=3;
263 Int_t returnvalueCuts=3;
265 // selection on candidate
266 if(selectionLevel==AliRDHFCuts::kAll ||
267 selectionLevel==AliRDHFCuts::kCandidate) {
271 //recalculate vertex w/o daughters
272 AliAODVertex *origownvtx=0x0;
273 if(fRemoveDaughtersFromPrimary && !fUseMCVertex) {
274 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
275 if(!RecalcOwnPrimaryVtx(d,aod)) {
276 CleanOwnPrimaryVtx(d,aod,origownvtx);
282 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
283 if(!SetMCPrimaryVtx(d,aod)) {
284 CleanOwnPrimaryVtx(d,aod,origownvtx);
291 Int_t okD0=0,okD0bar=0;
293 Int_t ptbin=PtBin(pt);
295 CleanOwnPrimaryVtx(d,aod,origownvtx);
299 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
302 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
304 d->InvMassD0(mD0,mD0bar);
305 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
306 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
307 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
309 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
312 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;
313 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;
314 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
317 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
318 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
319 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
320 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
321 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
323 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
326 d->CosThetaStarD0(ctsD0,ctsD0bar);
327 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
328 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
329 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
331 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
334 if(TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(9,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
336 Double_t normalDecayLengXY=d->NormalizedDecayLengthXY();
337 if (normalDecayLengXY < fCutsRD[GetGlobalIndex(10, ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
339 if (returnvalueCuts!=0) {
340 if (okD0) returnvalueCuts=1; //cuts passed as D0
341 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
342 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
347 if(fUseSpecialCuts) special=IsSelectedSpecialCuts(d);
348 if(!special) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
350 // unset recalculated primary vertex when not needed any more
351 CleanOwnPrimaryVtx(d,aod,origownvtx);
354 // go to selection with Kalman vertexing, if requested
355 returnvalueCuts = IsSelectedKF(d,aod);
358 fIsSelectedCuts=returnvalueCuts;
359 if(!returnvalueCuts) return 0;
364 if(selectionLevel==AliRDHFCuts::kAll ||
365 selectionLevel==AliRDHFCuts::kCandidate ||
366 selectionLevel==AliRDHFCuts::kPID) {
367 returnvaluePID = IsSelectedPID(d);
368 fIsSelectedPID=returnvaluePID;
369 if(!returnvaluePID) return 0;
372 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
374 if(!returnvalueComb) return 0;
376 // selection on daughter tracks
377 if(selectionLevel==AliRDHFCuts::kAll ||
378 selectionLevel==AliRDHFCuts::kTracks) {
379 if(!AreDaughtersSelected(d)) return 0;
382 // cout<<"Pid = "<<returnvaluePID<<endl;
383 return returnvalueComb;
386 //------------------------------------------------------------------------------------------
387 Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
388 AliAODEvent* aod) const {
390 // Apply selection using KF-vertexing
393 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
394 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
396 if(!track0 || !track1) {
397 cout<<"one or two D0 daughters missing!"<<endl;
401 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
402 Int_t returnvalueCuts=3;
404 // candidate selection with AliKF
405 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
407 Int_t okD0=0,okD0bar=0;
410 // convert tracks into AliKFParticles
412 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
413 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
414 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
415 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
417 // build D0 candidates
419 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
420 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
422 // create kf primary vertices
424 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
425 AliKFVertex primVtx(*vtx1);
426 AliKFVertex aprimVtx(*vtx1);
428 if(primVtx.GetNContributors()<=0) okD0 = 0;
429 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
430 if(!okD0 && !okD0bar) returnvalueCuts=0;
434 Double_t d0mass = d0c.GetMass();
435 Double_t ad0mass = ad0c.GetMass();
437 // calculate P of D0 and D0bar
438 Double_t d0P = d0c.GetP();
439 Double_t d0Px = d0c.GetPx();
440 Double_t d0Py = d0c.GetPy();
441 Double_t d0Pz = d0c.GetPz();
442 Double_t ad0P = ad0c.GetP();
443 Double_t ad0Px = ad0c.GetPx();
444 Double_t ad0Py = ad0c.GetPy();
445 Double_t ad0Pz = ad0c.GetPz();
447 //calculate Pt of D0 and D0bar
449 Double_t pt=d0c.GetPt();
450 Double_t apt=ad0c.GetPt();
452 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
454 if(track0->GetUsedForPrimVtxFit()) {
459 if(track1->GetUsedForPrimVtxFit()) {
467 if(primVtx.GetNContributors()<=0) okD0 = 0;
468 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
469 if(!okD0 && !okD0bar) returnvalueCuts=0;
471 //calculate cut variables
473 // calculate impact params of daughters w.r.t recalculated vertices
475 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
476 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
477 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
478 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
480 // calculate Product of Impact Params
482 Double_t prodParam = impactPi*impactKa;
483 Double_t aprodParam = aimpactPi*aimpactKa;
485 // calculate cosine of pointing angles
487 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
488 TVector3 fline(d0c.GetX()-primVtx.GetX(),
489 d0c.GetY()-primVtx.GetY(),
490 d0c.GetZ()-primVtx.GetZ());
491 Double_t pta = mom.Angle(fline);
492 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
494 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
495 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
496 ad0c.GetY()-aprimVtx.GetY(),
497 ad0c.GetZ()-aprimVtx.GetZ());
498 Double_t apta = amom.Angle(afline);
499 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
501 // calculate P of Pions at Decay Position of D0 and D0bar candidates
502 negKKF.TransportToParticle(d0c);
503 posPiKF.TransportToParticle(d0c);
504 posKKF.TransportToParticle(ad0c);
505 negPiKF.TransportToParticle(ad0c);
507 Double_t pxPi = posPiKF.GetPx();
508 Double_t pyPi = posPiKF.GetPy();
509 Double_t pzPi = posPiKF.GetPz();
510 Double_t ptPi = posPiKF.GetPt();
512 Double_t apxPi = negPiKF.GetPx();
513 Double_t apyPi = negPiKF.GetPy();
514 Double_t apzPi = negPiKF.GetPz();
515 Double_t aptPi = negPiKF.GetPt();
517 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
519 Double_t ptK = negKKF.GetPt();
520 Double_t aptK = posKKF.GetPt();
522 //calculate cos(thetastar)
523 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
525 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
526 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
527 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
528 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
530 // cos(thetastar) for D0 and Pion
532 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
533 Double_t beta = d0P/d0E;
534 Double_t gamma = d0E/massvtx;
535 TVector3 momPi(pxPi,pyPi,pzPi);
536 TVector3 momTot(d0Px,d0Py,d0Pz);
537 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
538 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
540 // cos(thetastar) for D0bar and Pion
542 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
543 Double_t abeta = ad0P/ad0E;
544 Double_t agamma = ad0E/massvtx;
545 TVector3 amomPi(apxPi,apyPi,apzPi);
546 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
547 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
548 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
550 // calculate reduced Chi2 for the full D0 fit
551 d0c.SetProductionVertex(primVtx);
552 ad0c.SetProductionVertex(aprimVtx);
553 negKKF.SetProductionVertex(d0c);
554 posPiKF.SetProductionVertex(d0c);
555 posKKF.SetProductionVertex(ad0c);
556 negPiKF.SetProductionVertex(ad0c);
557 d0c.TransportToProductionVertex();
558 ad0c.TransportToProductionVertex();
560 // calculate the decay length
561 Double_t decayLengthD0 = d0c.GetDecayLength();
562 Double_t adecayLengthD0 = ad0c.GetDecayLength();
564 Double_t chi2D0 = 50.;
565 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
566 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
569 Double_t achi2D0 = 50.;
570 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
571 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
575 Int_t ptbin=PtBin(pt);
576 Int_t aptbin=PtBin(apt);
578 if(ptbin < 0) okD0 = 0;
579 if(aptbin < 0) okD0bar = 0;
580 if(!okD0 && !okD0bar) returnvalueCuts=0;
582 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
583 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
584 if(!okD0 && !okD0bar) returnvalueCuts=0;
587 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
588 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
590 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
591 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
593 if(!okD0 && !okD0bar) returnvalueCuts=0;
595 // for the moment via the standard method due to bug in AliKF
596 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
597 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
598 if(!okD0 && !okD0bar) returnvalueCuts=0;
601 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
602 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
603 if(!okD0 && !okD0bar) returnvalueCuts=0;
606 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
607 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
608 if(!okD0 && !okD0bar) returnvalueCuts=0;
610 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
611 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
612 if(!okD0 && !okD0bar) returnvalueCuts=0;
614 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
615 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
616 if(!okD0 && !okD0bar) returnvalueCuts=0;
618 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
619 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
620 if(!okD0 && !okD0bar) returnvalueCuts=0;
622 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
623 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
624 if(!okD0 && !okD0bar) returnvalueCuts=0;
626 if(returnvalueCuts!=0) {
627 if(okD0) returnvalueCuts=1; //cuts passed as D0
628 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
629 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
632 return returnvalueCuts;
635 //---------------------------------------------------------------------------
637 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
640 // Checking if D0 is in fiducial acceptance region
644 // applying cut for pt > 5 GeV
645 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
646 if (TMath::Abs(y) > 0.8){
650 // appliying smooth cut for pt < 5 GeV
651 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
652 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
653 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
654 if (y < minFiducialY || y > maxFiducialY){
661 //---------------------------------------------------------------------------
662 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
664 // ############################################################
666 // Apply PID selection
669 // ############################################################
671 if(!fUsePID) return 3;
672 if(fDefaultPID) return IsSelectedPIDdefault(d);
674 Int_t isD0D0barPID[2]={1,2};
675 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
677 // values convention -1 = discarded
678 // 0 = not identified (but compatible) || No PID (->hasPID flag)
680 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
681 // Initial hypothesis: unknwon (but compatible)
682 combinedPID[0][0]=0; // prima figlia, Kaon
683 combinedPID[0][1]=0; // prima figlia, pione
684 combinedPID[1][0]=0; // seconda figlia, Kaon
685 combinedPID[1][1]=0; // seconda figlia, pion
687 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
688 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
689 for(Int_t daught=0;daught<2;daught++){
691 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
692 if(fPidHF->IsTOFPiKexcluded(aodtrack,5.)) return 0;
694 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
695 checkPIDInfo[daught]=kFALSE;
700 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
704 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
705 combinedPID[daught][1]=0;
707 fPidHF->SetTOF(kFALSE);
708 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
709 fPidHF->SetTOF(kTRUE);
710 fPidHF->SetCompat(kTRUE);
714 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
718 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
719 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
720 else isD0D0barPID[0]=0;// if K+ D0 excluded
722 /* else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
727 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
728 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
729 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
731 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
732 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
733 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
736 if(fLowPt && d->Pt()<fPtLowPID){
737 Double_t sigmaTPC[3]={3.,2.,0.};
738 fPidHF->SetSigmaForTPC(sigmaTPC);
740 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
742 Double_t ptProng=aodtrack->P();
745 fPidHF->SetCompat(kFALSE);
746 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
747 fPidHF->SetCompat(kTRUE);
750 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
751 combinedPID[daught][1]=0;
753 fPidHF->SetTOF(kFALSE);
754 Double_t sigmaTPCpi[3]={3.,3.,0.};
755 fPidHF->SetSigmaForTPC(sigmaTPCpi);
756 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
757 fPidHF->SetTOF(kTRUE);
759 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
761 combinedPID[daught][1]=1;
763 combinedPID[daught][1]=-1;
769 fPidHF->SetSigmaForTPC(sigma_tmp);
770 }// END OF LOOP ON DAUGHTERS
772 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
773 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
778 // FURTHER PID REQUEST (both daughter info is needed)
779 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
780 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
781 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
785 if(fLowPt && d->Pt()<fPtLowPID){
786 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
787 fWhyRejection=32;// reject cases where the Kaon is not identified
788 fPidHF->SetSigmaForTPC(sigma_tmp);
792 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
794 // cout<<"Why? "<<fWhyRejection<<endl;
795 return isD0D0barPID[0]+isD0D0barPID[1];
797 //---------------------------------------------------------------------------
798 Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
800 // ############################################################
802 // Apply PID selection
805 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
807 // d must be a AliAODRecoDecayHF2Prong object
808 // returns 0 if both D0 and D0bar are rejectecd
809 // 1 if D0 is accepted while D0bar is rejected
810 // 2 if D0bar is accepted while D0 is rejected
811 // 3 if both are accepted
812 // fWhyRejection variable (not returned for the moment, print it if needed)
813 // keeps some information on why a candidate has been
814 // rejected according to the following (unfriendly?) scheme
815 // if more rejection cases are considered interesting, just add numbers
817 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
818 // from 20 to 30: "detector" selection (PID acceptance)
821 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
823 // from 30 to 40: PID selection
824 // 31: no Kaon compatible tracks found between daughters
825 // 32: no Kaon identified tracks found (strong sel. at low momenta)
826 // 33: both mass hypotheses are rejected
828 // ############################################################
830 if(!fUsePID) return 3;
832 Int_t isD0D0barPID[2]={1,2};
833 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
834 Double_t tofSig,times[5];// used fot TOF pid
835 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
836 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
837 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
839 // values convention -1 = discarded
840 // 0 = not identified (but compatible) || No PID (->hasPID flag)
842 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
843 // Initial hypothesis: unknwon (but compatible)
844 isKaonPionTOF[0][0]=0;
845 isKaonPionTOF[0][1]=0;
846 isKaonPionTOF[1][0]=0;
847 isKaonPionTOF[1][1]=0;
849 isKaonPionTPC[0][0]=0;
850 isKaonPionTPC[0][1]=0;
851 isKaonPionTPC[1][0]=0;
852 isKaonPionTPC[1][1]=0;
861 for(Int_t daught=0;daught<2;daught++){
864 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
866 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
868 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
872 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
877 AliAODPid *pid=aodtrack->GetDetPid();
884 // ########### Step 1- Check of TPC and TOF response ####################
886 Double_t ptrack=aodtrack->P();
887 //#################### TPC PID #######################
888 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
889 // NO TPC PID INFO FOR THIS TRACK
893 static AliTPCPIDResponse theTPCpid;
894 AliAODPid *pidObj = aodtrack->GetDetPid();
895 Double_t ptProng=pidObj->GetTPCmomentum();
896 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
897 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
900 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
901 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
902 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
903 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
905 //else if(ptrack<.8){
907 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
908 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
909 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
910 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
913 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
914 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
915 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
916 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
921 // ##### TOF PID: do not ask nothing for pion/protons ############
922 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
923 // NO TOF PID INFO FOR THIS TRACK
927 tofSig=pid->GetTOFsignal();
928 pid->GetIntegratedTimes(times);
929 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
930 if(TMath::Abs(tofSig-times[3])>3.*160.){
931 isKaonPionTOF[daught][0]=-1;
935 isKaonPionTOF[daught][0]=1;
940 //######### Step 2: COMBINE TOF and TPC PID ###############
941 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
942 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
943 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
946 //######### Step 3: USE PID INFO
948 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
952 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
953 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
954 else isD0D0barPID[0]=0;// if K+ D0 excluded
956 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
960 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
961 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
962 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
964 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
965 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
966 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
969 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
970 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
971 // ############### NOT OPTIMIZED YET ###################################
973 isKaonPionTPC[daught][0]=0;
974 isKaonPionTPC[daught][1]=0;
975 AliAODPid *pidObj = aodtrack->GetDetPid();
976 Double_t ptProng=pidObj->GetTPCmomentum();
979 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
980 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
981 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
982 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
984 //else if(ptrack<.8){
986 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
987 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
988 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
989 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
992 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
993 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
997 }// END OF LOOP ON DAUGHTERS
999 // FURTHER PID REQUEST (both daughter info is needed)
1000 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
1001 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
1004 else if(hasPID[0]==0&&hasPID[1]==0){
1005 fWhyRejection=28;// reject cases in which no PID info is available
1009 // request of K identification at low D0 pt
1010 combinedPID[0][0]=0;
1011 combinedPID[0][1]=0;
1012 combinedPID[1][0]=0;
1013 combinedPID[1][1]=0;
1015 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
1016 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
1017 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
1018 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
1020 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
1021 fWhyRejection=32;// reject cases where the Kaon is not identified
1026 // cout<<"Why? "<<fWhyRejection<<endl;
1027 return isD0D0barPID[0]+isD0D0barPID[1];
1032 //---------------------------------------------------------------------------
1033 Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
1034 Int_t selectionvalCand,
1035 Int_t selectionvalPID) const
1038 // This method combines the tracks, PID and cuts selection results
1040 if(selectionvalTrack==0) return 0;
1044 switch(selectionvalPID) {
1049 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
1052 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
1055 returnvalue=selectionvalCand;
1064 //----------------------------------------------------------------------------
1065 Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1068 // Note: this method is temporary
1069 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1074 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1075 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1076 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1078 Int_t returnvalue=3; //cut passed
1079 for(Int_t i=0;i<2/*prongs*/;i++){
1080 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1082 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1083 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
1088 //----------------------------------------------
1089 void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1091 //switch on candidate selection via AliKFparticle
1097 TString varNamesKF[11]={"inv. mass [GeV]",
1108 Bool_t isUpperCutKF[11]={kTRUE,
1119 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1121 Bool_t forOpt[11]={kFALSE,
1132 SetVarsForOpt(4,forOpt);
1138 void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1140 //STANDARD CUTS USED FOR 2010 pp analysis
1141 //dca cut will be enlarged soon to 400 micron
1144 SetName("D0toKpiCutsStandard");
1145 SetTitle("Standard Cuts for D0 analysis");
1147 // PILE UP REJECTION
1148 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1155 // TRACKS ON SINGLE TRACKS
1156 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1157 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1158 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1159 esdTrackCuts->SetRequireITSRefit(kTRUE);
1160 // esdTrackCuts->SetMinNClustersITS(4);
1161 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1162 esdTrackCuts->SetMinDCAToVertexXY(0.);
1163 esdTrackCuts->SetEtaRange(-0.8,0.8);
1164 esdTrackCuts->SetPtRange(0.3,1.e10);
1166 AddTrackCuts(esdTrackCuts);
1169 const Int_t nptbins =14;
1170 const Double_t ptmax = 9999.;
1171 const Int_t nvars=11;
1172 Float_t ptbins[nptbins+1];
1189 SetGlobalIndex(nvars,nptbins);
1190 SetPtBins(nptbins+1,ptbins);
1192 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*/
1193 {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*/
1194 {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 */
1195 {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 */
1196 {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 */
1197 {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 */
1198 {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 */
1199 {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 */
1200 {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 */
1201 {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 */
1202 {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 */
1203 {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 */
1204 {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 */
1205 {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 */
1208 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1209 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1210 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1212 for (Int_t ibin=0;ibin<nptbins;ibin++){
1213 for (Int_t ivar = 0; ivar<nvars; ivar++){
1214 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1218 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1219 SetUseSpecialCuts(kTRUE);
1220 SetRemoveDaughtersFromPrim(kTRUE);
1222 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1223 delete [] cutsMatrixTransposeStand;
1224 cutsMatrixTransposeStand=NULL;
1227 AliAODPidHF* pidObj=new AliAODPidHF();
1228 //pidObj->SetName("pid4D0");
1230 const Int_t nlims=2;
1231 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1232 Bool_t compat=kTRUE; //effective only for this mode
1234 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1235 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1236 pidObj->SetMatch(mode);
1237 pidObj->SetPLimit(plims,nlims);
1238 pidObj->SetSigma(sigmas);
1239 pidObj->SetCompat(compat);
1240 pidObj->SetTPC(kTRUE);
1241 pidObj->SetTOF(kTRUE);
1242 pidObj->SetPCompatTOF(1.5);
1243 pidObj->SetSigmaForTPCCompat(3.);
1244 pidObj->SetSigmaForTOFCompat(3.);
1249 SetUseDefaultPID(kFALSE);
1263 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1265 // Final CUTS USED FOR 2010 PbPb analysis of central events
1266 // REMEMBER TO EVENTUALLY SWITCH ON
1267 // SetUseAOD049(kTRUE);
1270 SetName("D0toKpiCutsStandard");
1271 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1274 // CENTRALITY SELECTION
1275 SetMinCentrality(0.);
1276 SetMaxCentrality(80.);
1277 SetUseCentrality(AliRDHFCuts::kCentV0M);
1286 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1287 // PILE UP REJECTION
1288 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1290 // TRACKS ON SINGLE TRACKS
1291 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1292 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1293 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1294 esdTrackCuts->SetRequireITSRefit(kTRUE);
1295 // esdTrackCuts->SetMinNClustersITS(4);
1296 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1297 esdTrackCuts->SetMinDCAToVertexXY(0.);
1298 esdTrackCuts->SetEtaRange(-0.8,0.8);
1299 esdTrackCuts->SetPtRange(0.7,1.e10);
1301 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1302 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1303 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1306 AddTrackCuts(esdTrackCuts);
1307 // SPD k FIRST for Pt<3 GeV/c
1308 SetSelectCandTrackSPDFirst(kTRUE, 3);
1311 const Int_t nptbins =13;
1312 const Double_t ptmax = 9999.;
1313 const Int_t nvars=11;
1314 Float_t ptbins[nptbins+1];
1330 SetGlobalIndex(nvars,nptbins);
1331 SetPtBins(nptbins+1,ptbins);
1332 SetMinPtCandidate(2.);
1334 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*/
1335 {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*/
1336 {0.400,400.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-43000.*1E-8,0.85,0.995,2.},/* 1<pt<2 */
1337 {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 */
1338 {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 */
1339 {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 */
1340 {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 */
1341 {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 */
1342 {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 */
1343 {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 */
1344 {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 */
1345 {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 */
1346 {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 */
1349 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1350 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1351 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1353 for (Int_t ibin=0;ibin<nptbins;ibin++){
1354 for (Int_t ivar = 0; ivar<nvars; ivar++){
1355 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1359 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1360 SetUseSpecialCuts(kTRUE);
1361 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1362 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1363 delete [] cutsMatrixTransposeStand;
1364 cutsMatrixTransposeStand=NULL;
1367 AliAODPidHF* pidObj=new AliAODPidHF();
1368 //pidObj->SetName("pid4D0");
1370 const Int_t nlims=2;
1371 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1372 Bool_t compat=kTRUE; //effective only for this mode
1374 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1375 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1376 pidObj->SetMatch(mode);
1377 pidObj->SetPLimit(plims,nlims);
1378 pidObj->SetSigma(sigmas);
1379 pidObj->SetCompat(compat);
1380 pidObj->SetTPC(kTRUE);
1381 pidObj->SetTOF(kTRUE);
1382 pidObj->SetPCompatTOF(2.);
1383 pidObj->SetSigmaForTPCCompat(3.);
1384 pidObj->SetSigmaForTOFCompat(3.);
1389 SetUseDefaultPID(kFALSE);
1402 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010Peripherals() {
1403 // CUTS USED FOR D0 RAA for the CENTRALITY RANGE 20-80%
1406 SetName("D0toKpiCutsStandard");
1407 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run, for peripheral events");
1410 // CENTRALITY SELECTION
1411 SetMinCentrality(40.);
1412 SetMaxCentrality(80.);
1413 SetUseCentrality(AliRDHFCuts::kCentV0M);
1420 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1421 // PILE UP REJECTION
1422 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1424 // TRACKS ON SINGLE TRACKS
1425 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1426 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1427 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1428 esdTrackCuts->SetRequireITSRefit(kTRUE);
1429 // esdTrackCuts->SetMinNClustersITS(4);
1430 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1431 esdTrackCuts->SetMinDCAToVertexXY(0.);
1432 esdTrackCuts->SetEtaRange(-0.8,0.8);
1433 esdTrackCuts->SetPtRange(0.5,1.e10);
1435 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1436 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1437 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0025*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1440 AddTrackCuts(esdTrackCuts);
1441 // SPD k FIRST for Pt<3 GeV/c
1442 SetSelectCandTrackSPDFirst(kTRUE, 3);
1445 const Int_t nptbins =13;
1446 const Double_t ptmax = 9999.;
1447 const Int_t nvars=11;
1448 Float_t ptbins[nptbins+1];
1464 SetGlobalIndex(nvars,nptbins);
1465 SetPtBins(nptbins+1,ptbins);
1466 SetMinPtCandidate(0.);
1468 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*/
1469 {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*/
1470 {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 */
1471 {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 */
1472 {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 */
1473 {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 */
1474 {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 */
1475 {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 */
1476 {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 */
1477 {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 */
1478 {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 */
1479 {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 */
1480 {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 */
1483 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1484 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1485 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1487 for (Int_t ibin=0;ibin<nptbins;ibin++){
1488 for (Int_t ivar = 0; ivar<nvars; ivar++){
1489 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1493 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1494 SetUseSpecialCuts(kTRUE);
1495 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1496 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1497 delete [] cutsMatrixTransposeStand;
1498 cutsMatrixTransposeStand=NULL;
1501 AliAODPidHF* pidObj=new AliAODPidHF();
1502 //pidObj->SetName("pid4D0");
1504 const Int_t nlims=2;
1505 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1506 Bool_t compat=kTRUE; //effective only for this mode
1508 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1509 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1510 pidObj->SetMatch(mode);
1511 pidObj->SetPLimit(plims,nlims);
1512 pidObj->SetSigma(sigmas);
1513 pidObj->SetCompat(compat);
1514 pidObj->SetTPC(kTRUE);
1515 pidObj->SetTOF(kTRUE);
1516 pidObj->SetPCompatTOF(2.);
1517 pidObj->SetSigmaForTPCCompat(3.);
1518 pidObj->SetSigmaForTOFCompat(3.);
1522 SetUseDefaultPID(kFALSE);
1537 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2011() {
1539 // Default 2010 PbPb cut object
1540 SetStandardCutsPbPb2010();
1543 // Enable all 2011 PbPb run triggers
1545 SetTriggerClass("");
1546 ResetMaskAndEnableMBTrigger();
1547 EnableCentralTrigger();
1548 EnableSemiCentralTrigger();