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.),
52 fmaxPtrackForPID(9999)
55 // Default Constructor
59 TString varNames[11]={"inv. mass [GeV]",
70 Bool_t isUpperCut[11]={kTRUE,
81 SetVarNames(nvars,varNames,isUpperCut);
82 Bool_t forOpt[11]={kFALSE,
93 SetVarsForOpt(4,forOpt);
94 Float_t limits[2]={0,999999999.};
98 //--------------------------------------------------------------------------
99 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
101 fUseSpecialCuts(source.fUseSpecialCuts),
102 fLowPt(source.fLowPt),
103 fDefaultPID(source.fDefaultPID),
104 fUseKF(source.fUseKF),
105 fPtLowPID(source.fPtLowPID),
106 fPtMaxSpecialCuts(source.fPtMaxSpecialCuts),
107 fmaxPtrackForPID(source.fmaxPtrackForPID)
114 //--------------------------------------------------------------------------
115 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
118 // assignment operator
120 if(&source == this) return *this;
122 AliRDHFCuts::operator=(source);
123 fUseSpecialCuts=source.fUseSpecialCuts;
124 fLowPt=source.fLowPt;
125 fDefaultPID=source.fDefaultPID;
126 fUseKF=source.fUseKF;
127 fPtLowPID=source.fPtLowPID;
128 fPtMaxSpecialCuts=source.fPtMaxSpecialCuts;
129 fmaxPtrackForPID=source.fmaxPtrackForPID;
134 //---------------------------------------------------------------------------
135 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
137 // Fills in vars the values of the variables
140 if(nvars!=fnVarsForOpt) {
141 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
145 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
147 //recalculate vertex w/o daughters
148 Bool_t cleanvtx=kFALSE;
149 AliAODVertex *origownvtx=0x0;
150 if(fRemoveDaughtersFromPrimary) {
151 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
153 if(!RecalcOwnPrimaryVtx(dd,aod)) {
154 CleanOwnPrimaryVtx(dd,aod,origownvtx);
162 if(TMath::Abs(pdgdaughters[0])==211) {
163 vars[iter]=dd->InvMassD0();
165 vars[iter]=dd->InvMassD0bar();
170 vars[iter]=dd->GetDCA();
174 if(TMath::Abs(pdgdaughters[0])==211) {
175 vars[iter] = dd->CosThetaStarD0();
177 vars[iter] = dd->CosThetaStarD0bar();
182 if(TMath::Abs(pdgdaughters[0])==321) {
183 vars[iter]=dd->PtProng(0);
186 vars[iter]=dd->PtProng(1);
191 if(TMath::Abs(pdgdaughters[0])==211) {
192 vars[iter]=dd->PtProng(0);
195 vars[iter]=dd->PtProng(1);
200 if(TMath::Abs(pdgdaughters[0])==321) {
201 vars[iter]=dd->Getd0Prong(0);
204 vars[iter]=dd->Getd0Prong(1);
209 if(TMath::Abs(pdgdaughters[0])==211) {
210 vars[iter]=dd->Getd0Prong(0);
213 vars[iter]=dd->Getd0Prong(1);
218 vars[iter]= dd->Prodd0d0();
222 vars[iter]=dd->CosPointingAngle();
227 vars[iter]=TMath::Abs(dd->CosPointingAngleXY());
232 vars[iter]=dd->NormalizedDecayLengthXY();
235 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
239 //---------------------------------------------------------------------------
240 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
250 cout<<"Cut matrice not inizialized. Exit..."<<endl;
254 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
255 if(!d->HasSelectionBit(AliRDHFCutsD0toKpi::kD0toKpiCuts))return 0;
258 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
262 if(fKeepSignalMC) if(IsSignalMC(d,aod,421)) return 3;
264 Double_t ptD=d->Pt();
265 if(ptD<fMinPtCand) return 0;
266 if(ptD>fMaxPtCand) return 0;
268 if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
270 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
271 Int_t returnvaluePID=3;
272 Int_t returnvalueCuts=3;
274 // selection on candidate
275 if(selectionLevel==AliRDHFCuts::kAll ||
276 selectionLevel==AliRDHFCuts::kCandidate) {
280 //recalculate vertex w/o daughters
281 AliAODVertex *origownvtx=0x0;
282 if(fRemoveDaughtersFromPrimary && !fUseMCVertex) {
283 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
284 if(!RecalcOwnPrimaryVtx(d,aod)) {
285 CleanOwnPrimaryVtx(d,aod,origownvtx);
291 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
292 if(!SetMCPrimaryVtx(d,aod)) {
293 CleanOwnPrimaryVtx(d,aod,origownvtx);
300 Int_t okD0=0,okD0bar=0;
302 Int_t ptbin=PtBin(pt);
304 CleanOwnPrimaryVtx(d,aod,origownvtx);
308 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
311 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
313 d->InvMassD0(mD0,mD0bar);
314 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
315 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
316 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
318 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
321 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;
322 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;
323 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
326 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
327 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
328 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
329 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
330 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
332 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
335 d->CosThetaStarD0(ctsD0,ctsD0bar);
336 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
337 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
338 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
340 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
343 if(TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(9,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
345 Double_t normalDecayLengXY=d->NormalizedDecayLengthXY();
346 if (normalDecayLengXY < fCutsRD[GetGlobalIndex(10, ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
348 if (returnvalueCuts!=0) {
349 if (okD0) returnvalueCuts=1; //cuts passed as D0
350 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
351 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
356 if(fUseSpecialCuts && (pt<fPtMaxSpecialCuts)) special=IsSelectedSpecialCuts(d);
357 if(!special) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
359 // unset recalculated primary vertex when not needed any more
360 CleanOwnPrimaryVtx(d,aod,origownvtx);
363 // go to selection with Kalman vertexing, if requested
364 returnvalueCuts = IsSelectedKF(d,aod);
367 fIsSelectedCuts=returnvalueCuts;
368 if(!returnvalueCuts) return 0;
373 if(selectionLevel==AliRDHFCuts::kAll ||
374 selectionLevel==AliRDHFCuts::kCandidate ||
375 selectionLevel==AliRDHFCuts::kPID) {
376 returnvaluePID = IsSelectedPID(d);
377 fIsSelectedPID=returnvaluePID;
378 if(!returnvaluePID) return 0;
381 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
383 if(!returnvalueComb) return 0;
385 // selection on daughter tracks
386 if(selectionLevel==AliRDHFCuts::kAll ||
387 selectionLevel==AliRDHFCuts::kTracks) {
388 if(!AreDaughtersSelected(d)) return 0;
391 // cout<<"Pid = "<<returnvaluePID<<endl;
392 return returnvalueComb;
395 //------------------------------------------------------------------------------------------
396 Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
397 AliAODEvent* aod) const {
399 // Apply selection using KF-vertexing
402 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
403 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
405 if(!track0 || !track1) {
406 cout<<"one or two D0 daughters missing!"<<endl;
410 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
411 Int_t returnvalueCuts=3;
413 // candidate selection with AliKF
414 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
416 Int_t okD0=0,okD0bar=0;
419 // convert tracks into AliKFParticles
421 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
422 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
423 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
424 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
426 // build D0 candidates
428 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
429 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
431 // create kf primary vertices
433 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
434 AliKFVertex primVtx(*vtx1);
435 AliKFVertex aprimVtx(*vtx1);
437 if(primVtx.GetNContributors()<=0) okD0 = 0;
438 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
439 if(!okD0 && !okD0bar) returnvalueCuts=0;
443 Double_t d0mass = d0c.GetMass();
444 Double_t ad0mass = ad0c.GetMass();
446 // calculate P of D0 and D0bar
447 Double_t d0P = d0c.GetP();
448 Double_t d0Px = d0c.GetPx();
449 Double_t d0Py = d0c.GetPy();
450 Double_t d0Pz = d0c.GetPz();
451 Double_t ad0P = ad0c.GetP();
452 Double_t ad0Px = ad0c.GetPx();
453 Double_t ad0Py = ad0c.GetPy();
454 Double_t ad0Pz = ad0c.GetPz();
456 //calculate Pt of D0 and D0bar
458 Double_t pt=d0c.GetPt();
459 Double_t apt=ad0c.GetPt();
461 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
463 if(track0->GetUsedForPrimVtxFit()) {
468 if(track1->GetUsedForPrimVtxFit()) {
476 if(primVtx.GetNContributors()<=0) okD0 = 0;
477 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
478 if(!okD0 && !okD0bar) returnvalueCuts=0;
480 //calculate cut variables
482 // calculate impact params of daughters w.r.t recalculated vertices
484 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
485 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
486 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
487 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
489 // calculate Product of Impact Params
491 Double_t prodParam = impactPi*impactKa;
492 Double_t aprodParam = aimpactPi*aimpactKa;
494 // calculate cosine of pointing angles
496 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
497 TVector3 fline(d0c.GetX()-primVtx.GetX(),
498 d0c.GetY()-primVtx.GetY(),
499 d0c.GetZ()-primVtx.GetZ());
500 Double_t pta = mom.Angle(fline);
501 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
503 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
504 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
505 ad0c.GetY()-aprimVtx.GetY(),
506 ad0c.GetZ()-aprimVtx.GetZ());
507 Double_t apta = amom.Angle(afline);
508 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
510 // calculate P of Pions at Decay Position of D0 and D0bar candidates
511 negKKF.TransportToParticle(d0c);
512 posPiKF.TransportToParticle(d0c);
513 posKKF.TransportToParticle(ad0c);
514 negPiKF.TransportToParticle(ad0c);
516 Double_t pxPi = posPiKF.GetPx();
517 Double_t pyPi = posPiKF.GetPy();
518 Double_t pzPi = posPiKF.GetPz();
519 Double_t ptPi = posPiKF.GetPt();
521 Double_t apxPi = negPiKF.GetPx();
522 Double_t apyPi = negPiKF.GetPy();
523 Double_t apzPi = negPiKF.GetPz();
524 Double_t aptPi = negPiKF.GetPt();
526 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
528 Double_t ptK = negKKF.GetPt();
529 Double_t aptK = posKKF.GetPt();
531 //calculate cos(thetastar)
532 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
534 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
535 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
536 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
537 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
539 // cos(thetastar) for D0 and Pion
541 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
542 Double_t beta = d0P/d0E;
543 Double_t gamma = d0E/massvtx;
544 TVector3 momPi(pxPi,pyPi,pzPi);
545 TVector3 momTot(d0Px,d0Py,d0Pz);
546 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
547 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
549 // cos(thetastar) for D0bar and Pion
551 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
552 Double_t abeta = ad0P/ad0E;
553 Double_t agamma = ad0E/massvtx;
554 TVector3 amomPi(apxPi,apyPi,apzPi);
555 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
556 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
557 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
559 // calculate reduced Chi2 for the full D0 fit
560 d0c.SetProductionVertex(primVtx);
561 ad0c.SetProductionVertex(aprimVtx);
562 negKKF.SetProductionVertex(d0c);
563 posPiKF.SetProductionVertex(d0c);
564 posKKF.SetProductionVertex(ad0c);
565 negPiKF.SetProductionVertex(ad0c);
566 d0c.TransportToProductionVertex();
567 ad0c.TransportToProductionVertex();
569 // calculate the decay length
570 Double_t decayLengthD0 = d0c.GetDecayLength();
571 Double_t adecayLengthD0 = ad0c.GetDecayLength();
573 Double_t chi2D0 = 50.;
574 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
575 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
578 Double_t achi2D0 = 50.;
579 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
580 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
584 Int_t ptbin=PtBin(pt);
585 Int_t aptbin=PtBin(apt);
587 if(ptbin < 0) okD0 = 0;
588 if(aptbin < 0) okD0bar = 0;
589 if(!okD0 && !okD0bar) returnvalueCuts=0;
591 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
592 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
593 if(!okD0 && !okD0bar) returnvalueCuts=0;
596 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
597 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
599 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
600 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
602 if(!okD0 && !okD0bar) returnvalueCuts=0;
604 // for the moment via the standard method due to bug in AliKF
605 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
606 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
607 if(!okD0 && !okD0bar) returnvalueCuts=0;
610 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
611 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
612 if(!okD0 && !okD0bar) returnvalueCuts=0;
615 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
616 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
617 if(!okD0 && !okD0bar) returnvalueCuts=0;
619 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
620 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
621 if(!okD0 && !okD0bar) returnvalueCuts=0;
623 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
624 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
625 if(!okD0 && !okD0bar) returnvalueCuts=0;
627 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
628 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
629 if(!okD0 && !okD0bar) returnvalueCuts=0;
631 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
632 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
633 if(!okD0 && !okD0bar) returnvalueCuts=0;
635 if(returnvalueCuts!=0) {
636 if(okD0) returnvalueCuts=1; //cuts passed as D0
637 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
638 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
641 return returnvalueCuts;
644 //---------------------------------------------------------------------------
646 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
649 // Checking if D0 is in fiducial acceptance region
653 // applying cut for pt > 5 GeV
654 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
655 if (TMath::Abs(y) > 0.8){
659 // appliying smooth cut for pt < 5 GeV
660 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
661 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
662 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
663 if (y < minFiducialY || y > maxFiducialY){
670 //---------------------------------------------------------------------------
671 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
673 // ############################################################
675 // Apply PID selection
678 // ############################################################
680 if(!fUsePID) return 3;
681 if(fDefaultPID) return IsSelectedPIDdefault(d);
683 Int_t isD0D0barPID[2]={1,2};
684 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
686 // values convention -1 = discarded
687 // 0 = not identified (but compatible) || No PID (->hasPID flag)
689 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
690 // Initial hypothesis: unknwon (but compatible)
691 combinedPID[0][0]=0; // prima figlia, Kaon
692 combinedPID[0][1]=0; // prima figlia, pione
693 combinedPID[1][0]=0; // seconda figlia, Kaon
694 combinedPID[1][1]=0; // seconda figlia, pion
696 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
697 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
698 for(Int_t daught=0;daught<2;daught++){
700 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
701 if(fPidHF->IsTOFPiKexcluded(aodtrack,5.)) return 0;
703 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
704 checkPIDInfo[daught]=kFALSE;
707 Double_t pProng=aodtrack->P();
710 if(pProng<fmaxPtrackForPID){
711 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
714 if(pProng<fmaxPtrackForPID){
715 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
716 combinedPID[daught][1]=0;
718 fPidHF->SetTOF(kFALSE);
719 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
720 fPidHF->SetTOF(kTRUE);
721 fPidHF->SetCompat(kTRUE);
725 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
729 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
730 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
731 else isD0D0barPID[0]=0;// if K+ D0 excluded
733 /* else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
738 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
739 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
740 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
742 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
743 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
744 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
747 if(fLowPt && d->Pt()<fPtLowPID){
748 Double_t sigmaTPC[3]={3.,2.,0.};
749 fPidHF->SetSigmaForTPC(sigmaTPC);
751 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
754 fPidHF->SetCompat(kFALSE);
755 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
756 fPidHF->SetCompat(kTRUE);
759 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
760 combinedPID[daught][1]=0;
762 fPidHF->SetTOF(kFALSE);
763 Double_t sigmaTPCpi[3]={3.,3.,0.};
764 fPidHF->SetSigmaForTPC(sigmaTPCpi);
765 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
766 fPidHF->SetTOF(kTRUE);
768 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
770 combinedPID[daught][1]=1;
772 combinedPID[daught][1]=-1;
778 fPidHF->SetSigmaForTPC(sigma_tmp);
779 }// END OF LOOP ON DAUGHTERS
781 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
782 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
787 // FURTHER PID REQUEST (both daughter info is needed)
788 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
789 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
790 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
794 if(fLowPt && d->Pt()<fPtLowPID){
795 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
796 fWhyRejection=32;// reject cases where the Kaon is not identified
797 fPidHF->SetSigmaForTPC(sigma_tmp);
801 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
803 // cout<<"Why? "<<fWhyRejection<<endl;
804 return isD0D0barPID[0]+isD0D0barPID[1];
806 //---------------------------------------------------------------------------
807 Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
809 // ############################################################
811 // Apply PID selection
814 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
816 // d must be a AliAODRecoDecayHF2Prong object
817 // returns 0 if both D0 and D0bar are rejectecd
818 // 1 if D0 is accepted while D0bar is rejected
819 // 2 if D0bar is accepted while D0 is rejected
820 // 3 if both are accepted
821 // fWhyRejection variable (not returned for the moment, print it if needed)
822 // keeps some information on why a candidate has been
823 // rejected according to the following (unfriendly?) scheme
824 // if more rejection cases are considered interesting, just add numbers
826 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
827 // from 20 to 30: "detector" selection (PID acceptance)
830 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
832 // from 30 to 40: PID selection
833 // 31: no Kaon compatible tracks found between daughters
834 // 32: no Kaon identified tracks found (strong sel. at low momenta)
835 // 33: both mass hypotheses are rejected
837 // ############################################################
839 if(!fUsePID) return 3;
841 Int_t isD0D0barPID[2]={1,2};
842 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
843 Double_t tofSig,times[5];// used fot TOF pid
844 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
845 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
846 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
848 // values convention -1 = discarded
849 // 0 = not identified (but compatible) || No PID (->hasPID flag)
851 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
852 // Initial hypothesis: unknwon (but compatible)
853 isKaonPionTOF[0][0]=0;
854 isKaonPionTOF[0][1]=0;
855 isKaonPionTOF[1][0]=0;
856 isKaonPionTOF[1][1]=0;
858 isKaonPionTPC[0][0]=0;
859 isKaonPionTPC[0][1]=0;
860 isKaonPionTPC[1][0]=0;
861 isKaonPionTPC[1][1]=0;
870 for(Int_t daught=0;daught<2;daught++){
873 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
875 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
877 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
881 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
886 AliAODPid *pid=aodtrack->GetDetPid();
893 // ########### Step 1- Check of TPC and TOF response ####################
895 Double_t ptrack=aodtrack->P();
896 //#################### TPC PID #######################
897 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
898 // NO TPC PID INFO FOR THIS TRACK
902 static AliTPCPIDResponse theTPCpid;
903 AliAODPid *pidObj = aodtrack->GetDetPid();
904 Double_t ptProng=pidObj->GetTPCmomentum();
905 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
906 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
909 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
910 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
911 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
912 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
914 //else if(ptrack<.8){
916 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
917 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
918 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
919 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
922 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
923 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
924 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
925 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
930 // ##### TOF PID: do not ask nothing for pion/protons ############
931 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
932 // NO TOF PID INFO FOR THIS TRACK
936 tofSig=pid->GetTOFsignal();
937 pid->GetIntegratedTimes(times);
938 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
939 if(TMath::Abs(tofSig-times[3])>3.*160.){
940 isKaonPionTOF[daught][0]=-1;
944 isKaonPionTOF[daught][0]=1;
949 //######### Step 2: COMBINE TOF and TPC PID ###############
950 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
951 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
952 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
955 //######### Step 3: USE PID INFO
957 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
961 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
962 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
963 else isD0D0barPID[0]=0;// if K+ D0 excluded
965 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
969 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
970 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
971 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
973 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
974 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
975 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
978 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
979 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
980 // ############### NOT OPTIMIZED YET ###################################
982 isKaonPionTPC[daught][0]=0;
983 isKaonPionTPC[daught][1]=0;
984 AliAODPid *pidObj = aodtrack->GetDetPid();
985 Double_t ptProng=pidObj->GetTPCmomentum();
988 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
989 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
990 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
991 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
993 //else if(ptrack<.8){
995 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
996 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
997 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
998 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
1001 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
1002 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
1006 }// END OF LOOP ON DAUGHTERS
1008 // FURTHER PID REQUEST (both daughter info is needed)
1009 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
1010 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
1013 else if(hasPID[0]==0&&hasPID[1]==0){
1014 fWhyRejection=28;// reject cases in which no PID info is available
1018 // request of K identification at low D0 pt
1019 combinedPID[0][0]=0;
1020 combinedPID[0][1]=0;
1021 combinedPID[1][0]=0;
1022 combinedPID[1][1]=0;
1024 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
1025 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
1026 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
1027 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
1029 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
1030 fWhyRejection=32;// reject cases where the Kaon is not identified
1035 // cout<<"Why? "<<fWhyRejection<<endl;
1036 return isD0D0barPID[0]+isD0D0barPID[1];
1041 //---------------------------------------------------------------------------
1042 Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
1043 Int_t selectionvalCand,
1044 Int_t selectionvalPID) const
1047 // This method combines the tracks, PID and cuts selection results
1049 if(selectionvalTrack==0) return 0;
1053 switch(selectionvalPID) {
1058 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
1061 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
1064 returnvalue=selectionvalCand;
1073 //----------------------------------------------------------------------------
1074 Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1077 // Note: this method is temporary
1078 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1083 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1084 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1085 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1087 Int_t returnvalue=3; //cut passed
1088 for(Int_t i=0;i<2/*prongs*/;i++){
1089 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1091 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1092 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
1097 //----------------------------------------------
1098 void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1100 //switch on candidate selection via AliKFparticle
1106 TString varNamesKF[11]={"inv. mass [GeV]",
1117 Bool_t isUpperCutKF[11]={kTRUE,
1128 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1130 Bool_t forOpt[11]={kFALSE,
1141 SetVarsForOpt(4,forOpt);
1147 void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1149 //STANDARD CUTS USED FOR 2010 pp analysis
1150 //dca cut will be enlarged soon to 400 micron
1153 SetName("D0toKpiCutsStandard");
1154 SetTitle("Standard Cuts for D0 analysis");
1156 // PILE UP REJECTION
1157 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1164 // TRACKS ON SINGLE TRACKS
1165 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1166 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1167 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1168 esdTrackCuts->SetRequireITSRefit(kTRUE);
1169 // esdTrackCuts->SetMinNClustersITS(4);
1170 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1171 esdTrackCuts->SetMinDCAToVertexXY(0.);
1172 esdTrackCuts->SetEtaRange(-0.8,0.8);
1173 esdTrackCuts->SetPtRange(0.3,1.e10);
1175 AddTrackCuts(esdTrackCuts);
1178 const Int_t nptbins =14;
1179 const Double_t ptmax = 9999.;
1180 const Int_t nvars=11;
1181 Float_t ptbins[nptbins+1];
1198 SetGlobalIndex(nvars,nptbins);
1199 SetPtBins(nptbins+1,ptbins);
1201 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*/
1202 {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*/
1203 {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 */
1204 {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 */
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.},/* 3<pt<4 */
1206 {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 */
1207 {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 */
1208 {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 */
1209 {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 */
1210 {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 */
1211 {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 */
1212 {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 */
1213 {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 */
1214 {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 */
1217 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1218 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1219 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1221 for (Int_t ibin=0;ibin<nptbins;ibin++){
1222 for (Int_t ivar = 0; ivar<nvars; ivar++){
1223 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1227 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1228 SetUseSpecialCuts(kTRUE);
1229 SetRemoveDaughtersFromPrim(kTRUE);
1231 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1232 delete [] cutsMatrixTransposeStand;
1233 cutsMatrixTransposeStand=NULL;
1236 AliAODPidHF* pidObj=new AliAODPidHF();
1237 //pidObj->SetName("pid4D0");
1239 const Int_t nlims=2;
1240 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1241 Bool_t compat=kTRUE; //effective only for this mode
1243 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1244 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1245 pidObj->SetMatch(mode);
1246 pidObj->SetPLimit(plims,nlims);
1247 pidObj->SetSigma(sigmas);
1248 pidObj->SetCompat(compat);
1249 pidObj->SetTPC(kTRUE);
1250 pidObj->SetTOF(kTRUE);
1251 pidObj->SetPCompatTOF(1.5);
1252 pidObj->SetSigmaForTPCCompat(3.);
1253 pidObj->SetSigmaForTOFCompat(3.);
1254 pidObj->SetOldPid(kTRUE);
1258 SetUseDefaultPID(kFALSE);
1272 void AliRDHFCutsD0toKpi::SetStandardCutsPP2011_276TeV() {
1274 // STANDARD CUTS USED FOR 2011 pp analysis at 2.76TeV
1277 SetName("D0toKpiCutsStandard");
1278 SetTitle("Standard Cuts for D0 analysis in pp2011 at 2.76TeV run");
1283 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1284 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1286 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1287 esdTrackCuts->SetRequireITSRefit(kTRUE);
1288 esdTrackCuts->SetEtaRange(-0.8,0.8);
1289 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1290 AliESDtrackCuts::kAny);
1291 // default is kBoth, otherwise kAny
1292 esdTrackCuts->SetMinDCAToVertexXY(0.);
1293 esdTrackCuts->SetPtRange(0.3,1.e10);
1295 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1296 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1297 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1299 AddTrackCuts(esdTrackCuts);
1302 const Int_t nvars=11;
1303 const Int_t nptbins=13;
1304 Float_t ptbins[nptbins+1];
1320 SetPtBins(nptbins+1,ptbins);
1323 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*/
1324 {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*/
1325 {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 */
1326 {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 */
1327 {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 */
1328 {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 */
1329 {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 */
1330 {0.400,0.09,0.85,0.7,0.7,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* 6<pt<8 */
1331 {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 */
1332 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 12<pt<16 */
1333 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 16<pt<20 */
1334 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 20<pt<24 */
1335 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.}};/* pt>24 */
1337 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1338 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1339 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1340 for (Int_t ibin=0;ibin<nptbins;ibin++){
1341 for (Int_t ivar = 0; ivar<nvars; ivar++){
1342 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1345 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1346 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1347 delete [] cutsMatrixTransposeStand;
1351 AliAODPidHF* pidObj=new AliAODPidHF();
1353 const Int_t nlims=2;
1354 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1355 Bool_t compat=kTRUE; //effective only for this mode
1357 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1358 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1359 pidObj->SetMatch(mode);
1360 pidObj->SetPLimit(plims,nlims);
1361 pidObj->SetSigma(sigmas);
1362 pidObj->SetCompat(compat);
1363 pidObj->SetTPC(kTRUE);
1364 pidObj->SetTOF(kTRUE);
1365 pidObj->SetOldPid(kTRUE);
1368 SetUseDefaultPID(kFALSE); //to use the AliAODPidHF
1372 //activate pileup rejection (for pp)
1373 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1375 //Do recalculate the vertex
1376 SetRemoveDaughtersFromPrim(kTRUE);
1381 // Use the kFirst selection for tracks with candidate D with pt<2
1382 SetSelectCandTrackSPDFirst(kTRUE,2.);
1384 // Use special cuts for D candidates with pt<2
1385 SetUseSpecialCuts(kTRUE);
1386 SetMaximumPtSpecialCuts(2.);
1397 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1399 // Final CUTS USED FOR 2010 PbPb analysis of central events
1400 // REMEMBER TO EVENTUALLY SWITCH ON
1401 // SetUseAOD049(kTRUE);
1404 SetName("D0toKpiCutsStandard");
1405 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1408 // CENTRALITY SELECTION
1409 SetMinCentrality(0.);
1410 SetMaxCentrality(80.);
1411 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.7,1.e10);
1435 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1436 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1437 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*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(2.);
1468 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*/
1469 {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*/
1470 {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 */
1471 {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 */
1472 {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 */
1473 {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 */
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.998,5.},/* 8<pt<12 */
1477 {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 */
1478 {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 */
1479 {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 */
1480 {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 */
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.);
1519 pidObj->SetOldPid(kTRUE);
1524 SetUseDefaultPID(kFALSE);
1537 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010Peripherals() {
1538 // CUTS USED FOR D0 RAA for the CENTRALITY RANGE 20-80%
1541 SetName("D0toKpiCutsStandard");
1542 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run, for peripheral events");
1545 // CENTRALITY SELECTION
1546 SetMinCentrality(40.);
1547 SetMaxCentrality(80.);
1548 SetUseCentrality(AliRDHFCuts::kCentV0M);
1555 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1556 // PILE UP REJECTION
1557 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1559 // TRACKS ON SINGLE TRACKS
1560 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1561 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1562 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1563 esdTrackCuts->SetRequireITSRefit(kTRUE);
1564 // esdTrackCuts->SetMinNClustersITS(4);
1565 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1566 esdTrackCuts->SetMinDCAToVertexXY(0.);
1567 esdTrackCuts->SetEtaRange(-0.8,0.8);
1568 esdTrackCuts->SetPtRange(0.5,1.e10);
1570 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1571 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1572 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0025*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1575 AddTrackCuts(esdTrackCuts);
1576 // SPD k FIRST for Pt<3 GeV/c
1577 SetSelectCandTrackSPDFirst(kTRUE, 3);
1580 const Int_t nptbins =13;
1581 const Double_t ptmax = 9999.;
1582 const Int_t nvars=11;
1583 Float_t ptbins[nptbins+1];
1599 SetGlobalIndex(nvars,nptbins);
1600 SetPtBins(nptbins+1,ptbins);
1601 SetMinPtCandidate(0.);
1603 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*/
1604 {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*/
1605 {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 */
1606 {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 */
1607 {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 */
1608 {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 */
1609 {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 */
1610 {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 */
1611 {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 */
1612 {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 */
1613 {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 */
1614 {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 */
1615 {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 */
1618 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1619 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1620 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1622 for (Int_t ibin=0;ibin<nptbins;ibin++){
1623 for (Int_t ivar = 0; ivar<nvars; ivar++){
1624 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1628 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1629 SetUseSpecialCuts(kTRUE);
1630 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1631 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1632 delete [] cutsMatrixTransposeStand;
1633 cutsMatrixTransposeStand=NULL;
1636 AliAODPidHF* pidObj=new AliAODPidHF();
1637 //pidObj->SetName("pid4D0");
1639 const Int_t nlims=2;
1640 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1641 Bool_t compat=kTRUE; //effective only for this mode
1643 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1644 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1645 pidObj->SetMatch(mode);
1646 pidObj->SetPLimit(plims,nlims);
1647 pidObj->SetSigma(sigmas);
1648 pidObj->SetCompat(compat);
1649 pidObj->SetTPC(kTRUE);
1650 pidObj->SetTOF(kTRUE);
1651 pidObj->SetPCompatTOF(2.);
1652 pidObj->SetSigmaForTPCCompat(3.);
1653 pidObj->SetSigmaForTOFCompat(3.);
1654 pidObj->SetOldPid(kTRUE);
1658 SetUseDefaultPID(kFALSE);
1673 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2011() {
1675 // Default 2010 PbPb cut object
1676 SetStandardCutsPbPb2010();
1677 AliAODPidHF *pidobj=GetPidHF();
1679 pidobj->SetOldPid(kFALSE);
1682 // Enable all 2011 PbPb run triggers
1684 SetTriggerClass("");
1685 ResetMaskAndEnableMBTrigger();
1686 EnableCentralTrigger();
1687 EnableSemiCentralTrigger();