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),
49 // Default Constructor
53 TString varNames[9]={"inv. mass [GeV]",
62 Bool_t isUpperCut[9]={kTRUE,
71 SetVarNames(nvars,varNames,isUpperCut);
72 Bool_t forOpt[9]={kFALSE,
81 SetVarsForOpt(4,forOpt);
82 Float_t limits[2]={0,999999999.};
86 //--------------------------------------------------------------------------
87 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
89 fUseSpecialCuts(source.fUseSpecialCuts),
90 fLowPt(source.fLowPt),
91 fDefaultPID(source.fDefaultPID),
99 //--------------------------------------------------------------------------
100 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
103 // assignment operator
105 if(&source == this) return *this;
107 AliRDHFCuts::operator=(source);
108 fUseSpecialCuts=source.fUseSpecialCuts;
109 fLowPt=source.fLowPt;
110 fDefaultPID=source.fDefaultPID;
116 //---------------------------------------------------------------------------
117 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
119 // Fills in vars the values of the variables
122 if(nvars!=fnVarsForOpt) {
123 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
127 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
132 if(TMath::Abs(pdgdaughters[0])==211) {
133 vars[iter]=dd->InvMassD0();
135 vars[iter]=dd->InvMassD0bar();
140 vars[iter]=dd->GetDCA();
144 if(TMath::Abs(pdgdaughters[0])==211) {
145 vars[iter] = dd->CosThetaStarD0();
147 vars[iter] = dd->CosThetaStarD0bar();
152 if(TMath::Abs(pdgdaughters[0])==321) {
153 vars[iter]=dd->PtProng(0);
156 vars[iter]=dd->PtProng(1);
161 if(TMath::Abs(pdgdaughters[0])==211) {
162 vars[iter]=dd->PtProng(0);
165 vars[iter]=dd->PtProng(1);
170 if(TMath::Abs(pdgdaughters[0])==321) {
171 vars[iter]=dd->Getd0Prong(0);
174 vars[iter]=dd->Getd0Prong(1);
179 if(TMath::Abs(pdgdaughters[0])==211) {
180 vars[iter]=dd->Getd0Prong(0);
183 vars[iter]=dd->Getd0Prong(1);
188 vars[iter]= dd->Prodd0d0();
192 vars[iter]=dd->CosPointingAngle();
197 //---------------------------------------------------------------------------
198 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
208 cout<<"Cut matrice not inizialized. Exit..."<<endl;
212 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
215 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
219 Double_t ptD=d->Pt();
220 if(ptD<fMinPtCand) return 0;
221 if(ptD>fMaxPtCand) return 0;
223 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
224 Int_t returnvaluePID=3;
225 Int_t returnvalueCuts=3;
227 // selection on candidate
228 if(selectionLevel==AliRDHFCuts::kAll ||
229 selectionLevel==AliRDHFCuts::kCandidate) {
233 //recalculate vertex w/o daughters
234 AliAODVertex *origownvtx=0x0;
235 AliAODVertex *recvtx=0x0;
236 if(fRemoveDaughtersFromPrimary) {
237 if(!RecalcOwnPrimaryVtx(d,aod,origownvtx,recvtx)) return 0;
243 Int_t okD0=0,okD0bar=0;
245 Int_t ptbin=PtBin(pt);
247 CleanOwnPrimaryVtx(d,origownvtx);
251 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
254 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
256 d->InvMassD0(mD0,mD0bar);
257 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
258 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
259 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
261 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
264 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;
265 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;
266 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
269 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
270 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
271 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
272 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
273 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
275 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
278 d->CosThetaStarD0(ctsD0,ctsD0bar);
279 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
280 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
281 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
283 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
285 if (returnvalueCuts!=0) {
286 if (okD0) returnvalueCuts=1; //cuts passed as D0
287 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
288 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
293 if(fUseSpecialCuts) special=IsSelectedSpecialCuts(d);
294 if(!special) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
296 // unset recalculated primary vertex when not needed any more
297 CleanOwnPrimaryVtx(d,origownvtx);
300 // go to selection with Kalman vertexing, if requested
301 returnvalueCuts = IsSelectedKF(d,aod);
304 fIsSelectedCuts=returnvalueCuts;
305 if(!returnvalueCuts) return 0;
310 if(selectionLevel==AliRDHFCuts::kAll ||
311 selectionLevel==AliRDHFCuts::kCandidate ||
312 selectionLevel==AliRDHFCuts::kPID) {
313 returnvaluePID = IsSelectedPID(d);
314 fIsSelectedPID=returnvaluePID;
315 if(!returnvaluePID) return 0;
318 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
320 if(!returnvalueComb) return 0;
322 // selection on daughter tracks
323 if(selectionLevel==AliRDHFCuts::kAll ||
324 selectionLevel==AliRDHFCuts::kTracks) {
325 if(!AreDaughtersSelected(d)) return 0;
328 // cout<<"Pid = "<<returnvaluePID<<endl;
329 return returnvalueComb;
332 //------------------------------------------------------------------------------------------
333 Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
334 AliAODEvent* aod) const {
336 // Apply selection using KF-vertexing
339 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
340 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
342 if(!track0 || !track1) {
343 cout<<"one or two D0 daughters missing!"<<endl;
347 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
348 Int_t returnvalueCuts=3;
350 // candidate selection with AliKF
351 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
353 Int_t okD0=0,okD0bar=0;
356 // convert tracks into AliKFParticles
358 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
359 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
360 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
361 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
363 // build D0 candidates
365 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
366 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
368 // create kf primary vertices
370 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
371 AliKFVertex primVtx(*vtx1);
372 AliKFVertex aprimVtx(*vtx1);
374 if(primVtx.GetNContributors()<=0) okD0 = 0;
375 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
376 if(!okD0 && !okD0bar) returnvalueCuts=0;
380 Double_t d0mass = d0c.GetMass();
381 Double_t ad0mass = ad0c.GetMass();
383 // calculate P of D0 and D0bar
384 Double_t d0P = d0c.GetP();
385 Double_t d0Px = d0c.GetPx();
386 Double_t d0Py = d0c.GetPy();
387 Double_t d0Pz = d0c.GetPz();
388 Double_t ad0P = ad0c.GetP();
389 Double_t ad0Px = ad0c.GetPx();
390 Double_t ad0Py = ad0c.GetPy();
391 Double_t ad0Pz = ad0c.GetPz();
393 //calculate Pt of D0 and D0bar
395 Double_t pt=d0c.GetPt();
396 Double_t apt=ad0c.GetPt();
398 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
400 if(track0->GetUsedForPrimVtxFit()) {
405 if(track1->GetUsedForPrimVtxFit()) {
413 if(primVtx.GetNContributors()<=0) okD0 = 0;
414 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
415 if(!okD0 && !okD0bar) returnvalueCuts=0;
417 //calculate cut variables
419 // calculate impact params of daughters w.r.t recalculated vertices
421 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
422 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
423 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
424 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
426 // calculate Product of Impact Params
428 Double_t prodParam = impactPi*impactKa;
429 Double_t aprodParam = aimpactPi*aimpactKa;
431 // calculate cosine of pointing angles
433 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
434 TVector3 fline(d0c.GetX()-primVtx.GetX(),
435 d0c.GetY()-primVtx.GetY(),
436 d0c.GetZ()-primVtx.GetZ());
437 Double_t pta = mom.Angle(fline);
438 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
440 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
441 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
442 ad0c.GetY()-aprimVtx.GetY(),
443 ad0c.GetZ()-aprimVtx.GetZ());
444 Double_t apta = amom.Angle(afline);
445 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
447 // calculate P of Pions at Decay Position of D0 and D0bar candidates
448 negKKF.TransportToParticle(d0c);
449 posPiKF.TransportToParticle(d0c);
450 posKKF.TransportToParticle(ad0c);
451 negPiKF.TransportToParticle(ad0c);
453 Double_t pxPi = posPiKF.GetPx();
454 Double_t pyPi = posPiKF.GetPy();
455 Double_t pzPi = posPiKF.GetPz();
456 Double_t ptPi = posPiKF.GetPt();
458 Double_t apxPi = negPiKF.GetPx();
459 Double_t apyPi = negPiKF.GetPy();
460 Double_t apzPi = negPiKF.GetPz();
461 Double_t aptPi = negPiKF.GetPt();
463 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
465 Double_t ptK = negKKF.GetPt();
466 Double_t aptK = posKKF.GetPt();
468 //calculate cos(thetastar)
469 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
471 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
472 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
473 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
474 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
476 // cos(thetastar) for D0 and Pion
478 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
479 Double_t beta = d0P/d0E;
480 Double_t gamma = d0E/massvtx;
481 TVector3 momPi(pxPi,pyPi,pzPi);
482 TVector3 momTot(d0Px,d0Py,d0Pz);
483 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
484 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
486 // cos(thetastar) for D0bar and Pion
488 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
489 Double_t abeta = ad0P/ad0E;
490 Double_t agamma = ad0E/massvtx;
491 TVector3 amomPi(apxPi,apyPi,apzPi);
492 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
493 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
494 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
496 // calculate reduced Chi2 for the full D0 fit
497 d0c.SetProductionVertex(primVtx);
498 ad0c.SetProductionVertex(aprimVtx);
499 negKKF.SetProductionVertex(d0c);
500 posPiKF.SetProductionVertex(d0c);
501 posKKF.SetProductionVertex(ad0c);
502 negPiKF.SetProductionVertex(ad0c);
503 d0c.TransportToProductionVertex();
504 ad0c.TransportToProductionVertex();
506 // calculate the decay length
507 Double_t decayLengthD0 = d0c.GetDecayLength();
508 Double_t adecayLengthD0 = ad0c.GetDecayLength();
510 Double_t chi2D0 = 50.;
511 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
512 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
515 Double_t achi2D0 = 50.;
516 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
517 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
521 Int_t ptbin=PtBin(pt);
522 Int_t aptbin=PtBin(apt);
524 if(ptbin < 0) okD0 = 0;
525 if(aptbin < 0) okD0bar = 0;
526 if(!okD0 && !okD0bar) returnvalueCuts=0;
528 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
529 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
530 if(!okD0 && !okD0bar) returnvalueCuts=0;
533 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
534 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
536 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
537 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
539 if(!okD0 && !okD0bar) returnvalueCuts=0;
541 // for the moment via the standard method due to bug in AliKF
542 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
543 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
544 if(!okD0 && !okD0bar) returnvalueCuts=0;
547 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
548 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
549 if(!okD0 && !okD0bar) returnvalueCuts=0;
552 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
553 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
554 if(!okD0 && !okD0bar) returnvalueCuts=0;
556 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
557 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
558 if(!okD0 && !okD0bar) returnvalueCuts=0;
560 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
561 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
562 if(!okD0 && !okD0bar) returnvalueCuts=0;
564 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
565 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
566 if(!okD0 && !okD0bar) returnvalueCuts=0;
568 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
569 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
570 if(!okD0 && !okD0bar) returnvalueCuts=0;
572 if(returnvalueCuts!=0) {
573 if(okD0) returnvalueCuts=1; //cuts passed as D0
574 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
575 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
578 return returnvalueCuts;
581 //---------------------------------------------------------------------------
583 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
586 // Checking if D0 is in fiducial acceptance region
590 // applying cut for pt > 5 GeV
591 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
592 if (TMath::Abs(y) > 0.8){
596 // appliying smooth cut for pt < 5 GeV
597 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
598 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
599 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
600 if (y < minFiducialY || y > maxFiducialY){
607 //---------------------------------------------------------------------------
608 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
610 // ############################################################
612 // Apply PID selection
615 // ############################################################
617 if(!fUsePID) return 3;
618 if(fDefaultPID) return IsSelectedPIDdefault(d);
620 Int_t isD0D0barPID[2]={1,2};
621 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
623 // values convention -1 = discarded
624 // 0 = not identified (but compatible) || No PID (->hasPID flag)
626 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
627 // Initial hypothesis: unknwon (but compatible)
628 combinedPID[0][0]=0; // prima figlia, Kaon
629 combinedPID[0][1]=0; // prima figlia, pione
630 combinedPID[1][0]=0; // seconda figlia, Kaon
631 combinedPID[1][1]=0; // seconda figlia, pion
633 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
634 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
635 for(Int_t daught=0;daught<2;daught++){
637 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
639 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
640 checkPIDInfo[daught]=kFALSE;
645 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
649 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
650 combinedPID[daught][1]=0;
652 fPidHF->SetTOF(kFALSE);
653 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
654 fPidHF->SetTOF(kTRUE);
655 fPidHF->SetCompat(kTRUE);
659 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
663 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
664 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
665 else isD0D0barPID[0]=0;// if K+ D0 excluded
667 else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
671 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
672 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
673 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
675 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
676 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
677 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
680 if(fLowPt && d->Pt()<2.){
681 Double_t sigmaTPC[3]={3.,2.,0.};
682 fPidHF->SetSigmaForTPC(sigmaTPC);
684 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
686 Double_t ptProng=aodtrack->P();
689 fPidHF->SetCompat(kFALSE);
690 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
691 fPidHF->SetCompat(kTRUE);
694 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
695 combinedPID[daught][1]=0;
697 fPidHF->SetTOF(kFALSE);
698 Double_t sigmaTPCpi[3]={3.,3.,0.};
699 fPidHF->SetSigmaForTPC(sigmaTPCpi);
700 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
701 fPidHF->SetTOF(kTRUE);
703 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
705 combinedPID[daught][1]=1;
707 combinedPID[daught][1]=-1;
713 fPidHF->SetSigmaForTPC(sigma_tmp);
714 }// END OF LOOP ON DAUGHTERS
716 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
717 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
722 // FURTHER PID REQUEST (both daughter info is needed)
723 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
724 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
725 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
730 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
731 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
732 fWhyRejection=32;// reject cases where the Kaon is not identified
736 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
738 // cout<<"Why? "<<fWhyRejection<<endl;
739 return isD0D0barPID[0]+isD0D0barPID[1];
741 //---------------------------------------------------------------------------
742 Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
744 // ############################################################
746 // Apply PID selection
749 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
751 // d must be a AliAODRecoDecayHF2Prong object
752 // returns 0 if both D0 and D0bar are rejectecd
753 // 1 if D0 is accepted while D0bar is rejected
754 // 2 if D0bar is accepted while D0 is rejected
755 // 3 if both are accepted
756 // fWhyRejection variable (not returned for the moment, print it if needed)
757 // keeps some information on why a candidate has been
758 // rejected according to the following (unfriendly?) scheme
759 // if more rejection cases are considered interesting, just add numbers
761 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
762 // from 20 to 30: "detector" selection (PID acceptance)
765 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
767 // from 30 to 40: PID selection
768 // 31: no Kaon compatible tracks found between daughters
769 // 32: no Kaon identified tracks found (strong sel. at low momenta)
770 // 33: both mass hypotheses are rejected
772 // ############################################################
774 if(!fUsePID) return 3;
776 Int_t isD0D0barPID[2]={1,2};
777 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
778 Double_t tofSig,times[5];// used fot TOF pid
779 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
780 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
781 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
783 // values convention -1 = discarded
784 // 0 = not identified (but compatible) || No PID (->hasPID flag)
786 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
787 // Initial hypothesis: unknwon (but compatible)
788 isKaonPionTOF[0][0]=0;
789 isKaonPionTOF[0][1]=0;
790 isKaonPionTOF[1][0]=0;
791 isKaonPionTOF[1][1]=0;
793 isKaonPionTPC[0][0]=0;
794 isKaonPionTPC[0][1]=0;
795 isKaonPionTPC[1][0]=0;
796 isKaonPionTPC[1][1]=0;
805 for(Int_t daught=0;daught<2;daught++){
808 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
810 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
812 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
816 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
821 AliAODPid *pid=aodtrack->GetDetPid();
828 // ########### Step 1- Check of TPC and TOF response ####################
830 Double_t ptrack=aodtrack->P();
831 //#################### TPC PID #######################
832 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
833 // NO TPC PID INFO FOR THIS TRACK
837 static AliTPCPIDResponse theTPCpid;
838 AliAODPid *pidObj = aodtrack->GetDetPid();
839 Double_t ptProng=pidObj->GetTPCmomentum();
840 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
841 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
844 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
845 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
846 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
847 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
849 //else if(ptrack<.8){
851 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
852 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
853 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
854 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
857 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
858 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
859 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
860 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
865 // ##### TOF PID: do not ask nothing for pion/protons ############
866 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
867 // NO TOF PID INFO FOR THIS TRACK
871 tofSig=pid->GetTOFsignal();
872 pid->GetIntegratedTimes(times);
873 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
874 if(TMath::Abs(tofSig-times[3])>3.*160.){
875 isKaonPionTOF[daught][0]=-1;
879 isKaonPionTOF[daught][0]=1;
884 //######### Step 2: COMBINE TOF and TPC PID ###############
885 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
886 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
887 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
890 //######### Step 3: USE PID INFO
892 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
896 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
897 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
898 else isD0D0barPID[0]=0;// if K+ D0 excluded
900 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
904 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
905 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
906 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
908 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
909 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
910 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
913 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
914 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
915 // ############### NOT OPTIMIZED YET ###################################
917 isKaonPionTPC[daught][0]=0;
918 isKaonPionTPC[daught][1]=0;
919 AliAODPid *pidObj = aodtrack->GetDetPid();
920 Double_t ptProng=pidObj->GetTPCmomentum();
923 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
924 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
925 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
926 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
928 //else if(ptrack<.8){
930 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
931 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
932 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
933 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
936 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
937 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
941 }// END OF LOOP ON DAUGHTERS
943 // FURTHER PID REQUEST (both daughter info is needed)
944 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
945 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
948 else if(hasPID[0]==0&&hasPID[1]==0){
949 fWhyRejection=28;// reject cases in which no PID info is available
953 // request of K identification at low D0 pt
959 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
960 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
961 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
962 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
964 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
965 fWhyRejection=32;// reject cases where the Kaon is not identified
970 // cout<<"Why? "<<fWhyRejection<<endl;
971 return isD0D0barPID[0]+isD0D0barPID[1];
976 //---------------------------------------------------------------------------
977 Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
978 Int_t selectionvalCand,
979 Int_t selectionvalPID) const
982 // This method combines the tracks, PID and cuts selection results
984 if(selectionvalTrack==0) return 0;
988 switch(selectionvalPID) {
993 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
996 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
999 returnvalue=selectionvalCand;
1008 //----------------------------------------------------------------------------
1009 Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1012 // Note: this method is temporary
1013 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1018 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1019 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1020 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1022 Int_t returnvalue=3; //cut passed
1023 for(Int_t i=0;i<2/*prongs*/;i++){
1024 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1026 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1027 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
1033 //----------------------------------------------
1034 void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1036 //switch on candidate selection via AliKFparticle
1042 TString varNamesKF[11]={"inv. mass [GeV]",
1053 Bool_t isUpperCutKF[11]={kTRUE,
1064 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1066 Bool_t forOpt[11]={kFALSE,
1077 SetVarsForOpt(4,forOpt);
1083 void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1085 //STANDARD CUTS USED FOR 2010 pp analysis
1086 //dca cut will be enlarged soon to 400 micron
1089 SetName("D0toKpiCutsStandard");
1090 SetTitle("Standard Cuts for D0 analysis");
1092 // PILE UP REJECTION
1093 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1099 // TRACKS ON SINGLE TRACKS
1100 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1101 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1102 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1103 esdTrackCuts->SetRequireITSRefit(kTRUE);
1104 // esdTrackCuts->SetMinNClustersITS(4);
1105 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1106 esdTrackCuts->SetMinDCAToVertexXY(0.);
1107 esdTrackCuts->SetEtaRange(-0.8,0.8);
1108 esdTrackCuts->SetPtRange(0.3,1.e10);
1110 AddTrackCuts(esdTrackCuts);
1112 const Int_t nptbins =13;
1113 const Double_t ptmax = 9999.;
1114 const Int_t nvars=9;
1115 Float_t ptbins[nptbins+1];
1131 SetGlobalIndex(nvars,nptbins);
1132 SetPtBins(nptbins+1,ptbins);
1134 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.73},/* pt<0.5*/
1135 {0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.73},/* 0.5<pt<1*/
1136 {0.400,200.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.75},/* 1<pt<2 */
1137 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-15000.*1E-8,0.8},/* 2<pt<3 */
1138 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 3<pt<4 */
1139 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 4<pt<5 */
1140 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 5<pt<6 */
1141 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 6<pt<8 */
1142 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85},/* 8<pt<12 */
1143 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.85},/* 12<pt<16 */
1144 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85},/* 16<pt<20 */
1145 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85},/* 20<pt<24 */
1146 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85}};/* pt>24 */
1149 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1150 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1151 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1153 for (Int_t ibin=0;ibin<nptbins;ibin++){
1154 for (Int_t ivar = 0; ivar<nvars; ivar++){
1155 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1159 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1160 SetUseSpecialCuts(kTRUE);
1161 SetRemoveDaughtersFromPrim(kTRUE);
1163 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1164 delete [] cutsMatrixTransposeStand;
1165 cutsMatrixTransposeStand=NULL;
1168 AliAODPidHF* pidObj=new AliAODPidHF();
1169 //pidObj->SetName("pid4D0");
1171 const Int_t nlims=2;
1172 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1173 Bool_t compat=kTRUE; //effective only for this mode
1175 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1176 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1177 pidObj->SetMatch(mode);
1178 pidObj->SetPLimit(plims,nlims);
1179 pidObj->SetSigma(sigmas);
1180 pidObj->SetCompat(compat);
1181 pidObj->SetTPC(kTRUE);
1182 pidObj->SetTOF(kTRUE);
1186 SetUseDefaultPID(kFALSE);
1199 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1201 //PRELIMINARY CUTS USED FOR 2010 PbPb analysis
1205 SetName("D0toKpiCutsStandard");
1206 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1208 // PILE UP REJECTION
1209 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1215 // TRACKS ON SINGLE TRACKS
1216 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1217 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1218 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1219 esdTrackCuts->SetRequireITSRefit(kTRUE);
1220 // esdTrackCuts->SetMinNClustersITS(4);
1221 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1222 esdTrackCuts->SetMinDCAToVertexXY(0.);
1223 esdTrackCuts->SetEtaRange(-0.8,0.8);
1224 esdTrackCuts->SetPtRange(0.3,1.e10);
1226 AddTrackCuts(esdTrackCuts);
1228 const Int_t nptbins =13;
1229 const Double_t ptmax = 9999.;
1230 const Int_t nvars=9;
1231 Float_t ptbins[nptbins+1];
1247 SetGlobalIndex(nvars,nptbins);
1248 SetPtBins(nptbins+1,ptbins);
1250 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.8},/* pt<0.5*/
1251 {0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.8},/* 0.5<pt<1*/
1252 {0.400,250.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-32000.*1E-8,0.8},/* 1<pt<2 */
1253 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-26000.*1E-8,0.94},/* 2<pt<3 */
1254 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-1500.*1E-8,0.88},/* 3<pt<4 */
1255 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-1500.*1E-8,0.88},/* 4<pt<5 */
1256 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 5<pt<6 */
1257 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 6<pt<8 */
1258 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 8<pt<12 */
1259 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.90},/* 12<pt<16 */
1260 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85},/* 16<pt<20 */
1261 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.85},/* 20<pt<24 */
1262 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.82}};/* pt>24 */
1265 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1266 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1267 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1269 for (Int_t ibin=0;ibin<nptbins;ibin++){
1270 for (Int_t ivar = 0; ivar<nvars; ivar++){
1271 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1275 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1276 SetUseSpecialCuts(kTRUE);
1277 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1278 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1279 delete [] cutsMatrixTransposeStand;
1280 cutsMatrixTransposeStand=NULL;
1283 AliAODPidHF* pidObj=new AliAODPidHF();
1284 //pidObj->SetName("pid4D0");
1286 const Int_t nlims=2;
1287 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1288 Bool_t compat=kTRUE; //effective only for this mode
1290 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1291 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1292 pidObj->SetMatch(mode);
1293 pidObj->SetPLimit(plims,nlims);
1294 pidObj->SetSigma(sigmas);
1295 pidObj->SetCompat(compat);
1296 pidObj->SetTPC(kTRUE);
1297 pidObj->SetTOF(kTRUE);
1301 SetUseDefaultPID(kTRUE);// TEMPORARY: PROTON EXCLUSION SET ONLY IN DEFAULT PID