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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // Class for cuts on AOD reconstructed D0->Kpi
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
26 #include "AliRDHFCutsD0toKpi.h"
27 #include "AliAODRecoDecayHF2Prong.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
30 #include "AliAODPid.h"
31 #include "AliTPCPIDResponse.h"
32 #include "AliAODVertex.h"
33 #include "AliKFVertex.h"
34 #include "AliKFParticle.h"
36 ClassImp(AliRDHFCutsD0toKpi)
38 //--------------------------------------------------------------------------
39 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
41 fUseSpecialCuts(kFALSE),
47 // Default Constructor
51 TString varNames[9]={"inv. mass [GeV]",
60 Bool_t isUpperCut[9]={kTRUE,
69 SetVarNames(nvars,varNames,isUpperCut);
70 Bool_t forOpt[9]={kFALSE,
79 SetVarsForOpt(4,forOpt);
80 Float_t limits[2]={0,999999999.};
84 //--------------------------------------------------------------------------
85 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
87 fUseSpecialCuts(source.fUseSpecialCuts),
88 fLowPt(source.fLowPt),
89 fDefaultPID(source.fDefaultPID),
97 //--------------------------------------------------------------------------
98 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
101 // assignment operator
103 if(&source == this) return *this;
105 AliRDHFCuts::operator=(source);
106 fUseSpecialCuts=source.fUseSpecialCuts;
107 fLowPt=source.fLowPt;
108 fDefaultPID=source.fDefaultPID;
114 //---------------------------------------------------------------------------
115 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
117 // Fills in vars the values of the variables
120 if(nvars!=fnVarsForOpt) {
121 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
125 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
130 if(TMath::Abs(pdgdaughters[0])==211) {
131 vars[iter]=dd->InvMassD0();
133 vars[iter]=dd->InvMassD0bar();
138 vars[iter]=dd->GetDCA();
142 if(TMath::Abs(pdgdaughters[0])==211) {
143 vars[iter] = dd->CosThetaStarD0();
145 vars[iter] = dd->CosThetaStarD0bar();
150 if(TMath::Abs(pdgdaughters[0])==321) {
151 vars[iter]=dd->PtProng(0);
154 vars[iter]=dd->PtProng(1);
159 if(TMath::Abs(pdgdaughters[0])==211) {
160 vars[iter]=dd->PtProng(0);
163 vars[iter]=dd->PtProng(1);
168 if(TMath::Abs(pdgdaughters[0])==321) {
169 vars[iter]=dd->Getd0Prong(0);
172 vars[iter]=dd->Getd0Prong(1);
177 if(TMath::Abs(pdgdaughters[0])==211) {
178 vars[iter]=dd->Getd0Prong(0);
181 vars[iter]=dd->Getd0Prong(1);
186 vars[iter]= dd->Prodd0d0();
190 vars[iter]=dd->CosPointingAngle();
195 //---------------------------------------------------------------------------
196 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
205 cout<<"Cut matrice not inizialized. Exit..."<<endl;
209 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
212 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
217 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
218 Int_t returnvaluePID=3;
219 Int_t returnvalueCuts=3;
221 // selection on candidate
222 if(selectionLevel==AliRDHFCuts::kAll ||
223 selectionLevel==AliRDHFCuts::kCandidate) {
227 //recalculate vertex w/o daughters
228 AliAODVertex *origownvtx=0x0;
229 AliAODVertex *recvtx=0x0;
230 if(fRemoveDaughtersFromPrimary) {
231 if(!RecalcOwnPrimaryVtx(d,aod,origownvtx,recvtx)) return 0;
237 Int_t okD0=0,okD0bar=0;
239 Int_t ptbin=PtBin(pt);
241 CleanOwnPrimaryVtx(d,origownvtx);
245 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
248 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
250 d->InvMassD0(mD0,mD0bar);
251 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
252 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
253 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
255 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
257 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
259 if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
260 if(d->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
261 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
264 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
265 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
266 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
267 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
268 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
270 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
273 d->CosThetaStarD0(ctsD0,ctsD0bar);
274 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
275 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
276 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
279 if (returnvalueCuts!=0) {
280 if (okD0) returnvalueCuts=1; //cuts passed as D0
281 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
282 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
287 if(fUseSpecialCuts) special=IsSelectedSpecialCuts(d);
288 if(!special) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
290 // unset recalculated primary vertex when not needed any more
291 CleanOwnPrimaryVtx(d,origownvtx);
294 // go to selection with Kalman vertexing, if requested
295 returnvalueCuts = IsSelectedKF(d,aod);
298 fIsSelectedCuts=returnvalueCuts;
299 if(!returnvalueCuts) return 0;
304 if(selectionLevel==AliRDHFCuts::kAll ||
305 selectionLevel==AliRDHFCuts::kCandidate ||
306 selectionLevel==AliRDHFCuts::kPID) {
307 returnvaluePID = IsSelectedPID(d);
308 fIsSelectedPID=returnvaluePID;
309 if(!returnvaluePID) return 0;
312 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
314 if(!returnvalueComb) return 0;
316 // selection on daughter tracks
317 if(selectionLevel==AliRDHFCuts::kAll ||
318 selectionLevel==AliRDHFCuts::kTracks) {
319 if(!AreDaughtersSelected(d)) return 0;
322 // cout<<"Pid = "<<returnvaluePID<<endl;
323 return returnvalueComb;
326 //------------------------------------------------------------------------------------------
327 Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
328 AliAODEvent* aod) const {
330 // Apply selection using KF-vertexing
333 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
334 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
336 if(!track0 || !track1) {
337 cout<<"one or two D0 daughters missing!"<<endl;
341 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
342 Int_t returnvalueCuts=3;
344 // candidate selection with AliKF
345 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
347 Int_t okD0=0,okD0bar=0;
350 // convert tracks into AliKFParticles
352 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
353 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
354 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
355 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
357 // build D0 candidates
359 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
360 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
362 // create kf primary vertices
364 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
365 AliKFVertex primVtx(*vtx1);
366 AliKFVertex aprimVtx(*vtx1);
368 if(primVtx.GetNContributors()<=0) okD0 = 0;
369 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
370 if(!okD0 && !okD0bar) returnvalueCuts=0;
374 Double_t d0mass = d0c.GetMass();
375 Double_t ad0mass = ad0c.GetMass();
377 // calculate P of D0 and D0bar
378 Double_t d0P = d0c.GetP();
379 Double_t d0Px = d0c.GetPx();
380 Double_t d0Py = d0c.GetPy();
381 Double_t d0Pz = d0c.GetPz();
382 Double_t ad0P = ad0c.GetP();
383 Double_t ad0Px = ad0c.GetPx();
384 Double_t ad0Py = ad0c.GetPy();
385 Double_t ad0Pz = ad0c.GetPz();
387 //calculate Pt of D0 and D0bar
389 Double_t pt=d0c.GetPt();
390 Double_t apt=ad0c.GetPt();
392 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
394 if(track0->GetUsedForPrimVtxFit()) {
399 if(track1->GetUsedForPrimVtxFit()) {
407 if(primVtx.GetNContributors()<=0) okD0 = 0;
408 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
409 if(!okD0 && !okD0bar) returnvalueCuts=0;
411 //calculate cut variables
413 // calculate impact params of daughters w.r.t recalculated vertices
415 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
416 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
417 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
418 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
420 // calculate Product of Impact Params
422 Double_t prodParam = impactPi*impactKa;
423 Double_t aprodParam = aimpactPi*aimpactKa;
425 // calculate cosine of pointing angles
427 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
428 TVector3 fline(d0c.GetX()-primVtx.GetX(),
429 d0c.GetY()-primVtx.GetY(),
430 d0c.GetZ()-primVtx.GetZ());
431 Double_t pta = mom.Angle(fline);
432 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
434 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
435 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
436 ad0c.GetY()-aprimVtx.GetY(),
437 ad0c.GetZ()-aprimVtx.GetZ());
438 Double_t apta = amom.Angle(afline);
439 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
441 // calculate P of Pions at Decay Position of D0 and D0bar candidates
442 negKKF.TransportToParticle(d0c);
443 posPiKF.TransportToParticle(d0c);
444 posKKF.TransportToParticle(ad0c);
445 negPiKF.TransportToParticle(ad0c);
447 Double_t pxPi = posPiKF.GetPx();
448 Double_t pyPi = posPiKF.GetPy();
449 Double_t pzPi = posPiKF.GetPz();
450 Double_t ptPi = posPiKF.GetPt();
452 Double_t apxPi = negPiKF.GetPx();
453 Double_t apyPi = negPiKF.GetPy();
454 Double_t apzPi = negPiKF.GetPz();
455 Double_t aptPi = negPiKF.GetPt();
457 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
459 Double_t ptK = negKKF.GetPt();
460 Double_t aptK = posKKF.GetPt();
462 //calculate cos(thetastar)
463 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
465 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
466 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
467 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
468 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
470 // cos(thetastar) for D0 and Pion
472 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
473 Double_t beta = d0P/d0E;
474 Double_t gamma = d0E/massvtx;
475 TVector3 momPi(pxPi,pyPi,pzPi);
476 TVector3 momTot(d0Px,d0Py,d0Pz);
477 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
478 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
480 // cos(thetastar) for D0bar and Pion
482 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
483 Double_t abeta = ad0P/ad0E;
484 Double_t agamma = ad0E/massvtx;
485 TVector3 amomPi(apxPi,apyPi,apzPi);
486 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
487 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
488 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
490 // calculate reduced Chi2 for the full D0 fit
491 d0c.SetProductionVertex(primVtx);
492 ad0c.SetProductionVertex(aprimVtx);
493 negKKF.SetProductionVertex(d0c);
494 posPiKF.SetProductionVertex(d0c);
495 posKKF.SetProductionVertex(ad0c);
496 negPiKF.SetProductionVertex(ad0c);
497 d0c.TransportToProductionVertex();
498 ad0c.TransportToProductionVertex();
500 // calculate the decay length
501 Double_t decayLengthD0 = d0c.GetDecayLength();
502 Double_t adecayLengthD0 = ad0c.GetDecayLength();
504 Double_t chi2D0 = 50.;
505 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
506 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
509 Double_t achi2D0 = 50.;
510 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
511 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
515 Int_t ptbin=PtBin(pt);
516 Int_t aptbin=PtBin(apt);
518 if(ptbin < 0) okD0 = 0;
519 if(aptbin < 0) okD0bar = 0;
520 if(!okD0 && !okD0bar) returnvalueCuts=0;
522 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
523 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
524 if(!okD0 && !okD0bar) returnvalueCuts=0;
527 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
528 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
530 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
531 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
533 if(!okD0 && !okD0bar) returnvalueCuts=0;
535 // for the moment via the standard method due to bug in AliKF
536 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
537 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
538 if(!okD0 && !okD0bar) returnvalueCuts=0;
541 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
542 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
543 if(!okD0 && !okD0bar) returnvalueCuts=0;
546 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
547 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
548 if(!okD0 && !okD0bar) returnvalueCuts=0;
550 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
551 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
552 if(!okD0 && !okD0bar) returnvalueCuts=0;
554 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
555 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
556 if(!okD0 && !okD0bar) returnvalueCuts=0;
558 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
559 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
560 if(!okD0 && !okD0bar) returnvalueCuts=0;
562 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
563 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
564 if(!okD0 && !okD0bar) returnvalueCuts=0;
566 if(returnvalueCuts!=0) {
567 if(okD0) returnvalueCuts=1; //cuts passed as D0
568 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
569 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
572 return returnvalueCuts;
575 //---------------------------------------------------------------------------
577 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
580 // Checking if D0 is in fiducial acceptance region
584 // applying cut for pt > 5 GeV
585 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
586 if (TMath::Abs(y) > 0.8){
590 // appliying smooth cut for pt < 5 GeV
591 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
592 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
593 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
594 if (y < minFiducialY || y > maxFiducialY){
601 //---------------------------------------------------------------------------
602 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
604 // ############################################################
606 // Apply PID selection
609 // ############################################################
611 if(!fUsePID) return 3;
612 if(fDefaultPID) return IsSelectedPIDdefault(d);
614 Int_t isD0D0barPID[2]={1,2};
615 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
617 // values convention -1 = discarded
618 // 0 = not identified (but compatible) || No PID (->hasPID flag)
620 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
621 // Initial hypothesis: unknwon (but compatible)
622 combinedPID[0][0]=0; // prima figlia, Kaon
623 combinedPID[0][1]=0; // prima figlia, pione
624 combinedPID[1][0]=0; // seconda figlia, Kaon
625 combinedPID[1][1]=0; // seconda figlia, pion
627 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
628 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
629 for(Int_t daught=0;daught<2;daught++){
631 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
633 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
634 checkPIDInfo[daught]=kFALSE;
639 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
643 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
644 combinedPID[daught][1]=0;
646 fPidHF->SetTOF(kFALSE);
647 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
648 fPidHF->SetTOF(kTRUE);
649 fPidHF->SetCompat(kTRUE);
653 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
657 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
658 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
659 else isD0D0barPID[0]=0;// if K+ D0 excluded
661 else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
665 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
666 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
667 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
669 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
670 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
671 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
674 if(fLowPt && d->Pt()<2.){
675 Double_t sigmaTPC[3]={3.,2.,0.};
676 fPidHF->SetSigmaForTPC(sigmaTPC);
678 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
680 Double_t ptProng=aodtrack->P();
683 fPidHF->SetCompat(kFALSE);
684 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
685 fPidHF->SetCompat(kTRUE);
688 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
689 combinedPID[daught][1]=0;
691 fPidHF->SetTOF(kFALSE);
692 Double_t sigmaTPCpi[3]={3.,3.,0.};
693 fPidHF->SetSigmaForTPC(sigmaTPCpi);
694 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
695 fPidHF->SetTOF(kTRUE);
697 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
699 combinedPID[daught][1]=1;
701 combinedPID[daught][1]=-1;
707 fPidHF->SetSigmaForTPC(sigma_tmp);
708 }// END OF LOOP ON DAUGHTERS
710 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
711 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
716 // FURTHER PID REQUEST (both daughter info is needed)
717 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
718 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
719 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
724 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
725 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
726 fWhyRejection=32;// reject cases where the Kaon is not identified
730 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
732 // cout<<"Why? "<<fWhyRejection<<endl;
733 return isD0D0barPID[0]+isD0D0barPID[1];
735 //---------------------------------------------------------------------------
736 Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
738 // ############################################################
740 // Apply PID selection
743 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
745 // d must be a AliAODRecoDecayHF2Prong object
746 // returns 0 if both D0 and D0bar are rejectecd
747 // 1 if D0 is accepted while D0bar is rejected
748 // 2 if D0bar is accepted while D0 is rejected
749 // 3 if both are accepted
750 // fWhyRejection variable (not returned for the moment, print it if needed)
751 // keeps some information on why a candidate has been
752 // rejected according to the following (unfriendly?) scheme
753 // if more rejection cases are considered interesting, just add numbers
755 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
756 // from 20 to 30: "detector" selection (PID acceptance)
759 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
761 // from 30 to 40: PID selection
762 // 31: no Kaon compatible tracks found between daughters
763 // 32: no Kaon identified tracks found (strong sel. at low momenta)
764 // 33: both mass hypotheses are rejected
766 // ############################################################
768 if(!fUsePID) return 3;
770 Int_t isD0D0barPID[2]={1,2};
771 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
772 Double_t tofSig,times[5];// used fot TOF pid
773 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
774 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
775 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
777 // values convention -1 = discarded
778 // 0 = not identified (but compatible) || No PID (->hasPID flag)
780 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
781 // Initial hypothesis: unknwon (but compatible)
782 isKaonPionTOF[0][0]=0;
783 isKaonPionTOF[0][1]=0;
784 isKaonPionTOF[1][0]=0;
785 isKaonPionTOF[1][1]=0;
787 isKaonPionTPC[0][0]=0;
788 isKaonPionTPC[0][1]=0;
789 isKaonPionTPC[1][0]=0;
790 isKaonPionTPC[1][1]=0;
799 for(Int_t daught=0;daught<2;daught++){
802 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
804 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
806 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
810 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
815 AliAODPid *pid=aodtrack->GetDetPid();
822 // ########### Step 1- Check of TPC and TOF response ####################
824 Double_t ptrack=aodtrack->P();
825 //#################### TPC PID #######################
826 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
827 // NO TPC PID INFO FOR THIS TRACK
831 static AliTPCPIDResponse theTPCpid;
832 AliAODPid *pidObj = aodtrack->GetDetPid();
833 Double_t ptProng=pidObj->GetTPCmomentum();
834 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
835 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
838 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
839 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
840 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
841 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
843 //else if(ptrack<.8){
845 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
846 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
847 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
848 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
851 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
852 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
853 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
854 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
859 // ##### TOF PID: do not ask nothing for pion/protons ############
860 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
861 // NO TOF PID INFO FOR THIS TRACK
865 tofSig=pid->GetTOFsignal();
866 pid->GetIntegratedTimes(times);
867 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
868 if(TMath::Abs(tofSig-times[3])>3.*160.){
869 isKaonPionTOF[daught][0]=-1;
873 isKaonPionTOF[daught][0]=1;
878 //######### Step 2: COMBINE TOF and TPC PID ###############
879 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
880 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
881 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
884 //######### Step 3: USE PID INFO
886 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
890 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
891 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
892 else isD0D0barPID[0]=0;// if K+ D0 excluded
894 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
898 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
899 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
900 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
902 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
903 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
904 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
907 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
908 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
909 // ############### NOT OPTIMIZED YET ###################################
911 isKaonPionTPC[daught][0]=0;
912 isKaonPionTPC[daught][1]=0;
913 AliAODPid *pidObj = aodtrack->GetDetPid();
914 Double_t ptProng=pidObj->GetTPCmomentum();
917 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
918 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
919 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
920 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
922 //else if(ptrack<.8){
924 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
925 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
926 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
927 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
930 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
931 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
935 }// END OF LOOP ON DAUGHTERS
937 // FURTHER PID REQUEST (both daughter info is needed)
938 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
939 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
942 else if(hasPID[0]==0&&hasPID[1]==0){
943 fWhyRejection=28;// reject cases in which no PID info is available
947 // request of K identification at low D0 pt
953 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
954 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
955 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
956 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
958 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
959 fWhyRejection=32;// reject cases where the Kaon is not identified
964 // cout<<"Why? "<<fWhyRejection<<endl;
965 return isD0D0barPID[0]+isD0D0barPID[1];
970 //---------------------------------------------------------------------------
971 Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
972 Int_t selectionvalCand,
973 Int_t selectionvalPID) const
976 // This method combines the tracks, PID and cuts selection results
978 if(selectionvalTrack==0) return 0;
982 switch(selectionvalPID) {
987 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
990 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
993 returnvalue=selectionvalCand;
1002 //----------------------------------------------------------------------------
1003 Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1006 // Note: this method is temporary
1007 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1012 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1013 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1014 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1016 Int_t returnvalue=3; //cut passed
1017 for(Int_t i=0;i<2/*prongs*/;i++){
1018 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1020 if(d->DecayLength()<decLengthCut) return 0; //decLengthCut not passed
1021 if(d->NormalizedDecayLength()<normDecLengthCut) return 0; //decLengthCut not passed
1027 //----------------------------------------------
1028 void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1030 //switch on candidate selection via AliKFparticle
1036 TString varNamesKF[11]={"inv. mass [GeV]",
1047 Bool_t isUpperCutKF[11]={kTRUE,
1058 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1060 Bool_t forOpt[11]={kFALSE,
1071 SetVarsForOpt(4,forOpt);
1077 void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1079 //STANDARD CUTS USED FOR 2010 pp analysis
1080 //dca cut will be enlarged soon to 400 micron
1083 SetName("D0toKpiCutsStandard");
1084 SetTitle("Standard Cuts for D0 analysis");
1086 // PILE UP REJECTION
1087 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1093 // TRACKS ON SINGLE TRACKS
1094 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1095 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1096 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1097 esdTrackCuts->SetRequireITSRefit(kTRUE);
1098 // esdTrackCuts->SetMinNClustersITS(4);
1099 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1100 esdTrackCuts->SetMinDCAToVertexXY(0.);
1101 esdTrackCuts->SetEtaRange(-0.8,0.8);
1102 esdTrackCuts->SetPtRange(0.3,1.e10);
1104 AddTrackCuts(esdTrackCuts);
1106 const Int_t nptbins =13;
1107 const Double_t ptmax = 9999.;
1108 const Int_t nvars=9;
1109 Float_t ptbins[nptbins+1];
1125 SetGlobalIndex(nvars,nptbins);
1126 SetPtBins(nptbins+1,ptbins);
1128 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*/
1129 {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*/
1130 {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 */
1131 {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 */
1132 {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 */
1133 {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 */
1134 {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 */
1135 {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 */
1136 {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 */
1137 {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 */
1138 {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 */
1139 {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 */
1140 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85}};/* pt>24 */
1143 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1144 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1145 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1147 for (Int_t ibin=0;ibin<nptbins;ibin++){
1148 for (Int_t ivar = 0; ivar<nvars; ivar++){
1149 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1153 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1154 SetUseSpecialCuts(kTRUE);
1155 SetRemoveDaughtersFromPrim(kTRUE);
1157 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1158 delete [] cutsMatrixTransposeStand;
1159 cutsMatrixTransposeStand=NULL;
1162 AliAODPidHF* pidObj=new AliAODPidHF();
1163 //pidObj->SetName("pid4D0");
1165 const Int_t nlims=2;
1166 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1167 Bool_t compat=kTRUE; //effective only for this mode
1169 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1170 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1171 pidObj->SetMatch(mode);
1172 pidObj->SetPLimit(plims,nlims);
1173 pidObj->SetSigma(sigmas);
1174 pidObj->SetCompat(compat);
1175 pidObj->SetTPC(kTRUE);
1176 pidObj->SetTOF(kTRUE);
1180 SetUseDefaultPID(kFALSE);
1193 void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1195 //PRELIMINARY CUTS USED FOR 2010 PbPb analysis
1199 SetName("D0toKpiCutsStandard");
1200 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1202 // PILE UP REJECTION
1203 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1209 // TRACKS ON SINGLE TRACKS
1210 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1211 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1212 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1213 esdTrackCuts->SetRequireITSRefit(kTRUE);
1214 // esdTrackCuts->SetMinNClustersITS(4);
1215 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1216 esdTrackCuts->SetMinDCAToVertexXY(0.);
1217 esdTrackCuts->SetEtaRange(-0.8,0.8);
1218 esdTrackCuts->SetPtRange(0.3,1.e10);
1220 AddTrackCuts(esdTrackCuts);
1222 const Int_t nptbins =13;
1223 const Double_t ptmax = 9999.;
1224 const Int_t nvars=9;
1225 Float_t ptbins[nptbins+1];
1241 SetGlobalIndex(nvars,nptbins);
1242 SetPtBins(nptbins+1,ptbins);
1244 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*/
1245 {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*/
1246 {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 */
1247 {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 */
1248 {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 */
1249 {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 */
1250 {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 */
1251 {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 */
1252 {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 */
1253 {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 */
1254 {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 */
1255 {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 */
1256 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.82}};/* pt>24 */
1259 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1260 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1261 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1263 for (Int_t ibin=0;ibin<nptbins;ibin++){
1264 for (Int_t ivar = 0; ivar<nvars; ivar++){
1265 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1269 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1270 SetUseSpecialCuts(kTRUE);
1271 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1272 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1273 delete [] cutsMatrixTransposeStand;
1274 cutsMatrixTransposeStand=NULL;
1277 AliAODPidHF* pidObj=new AliAODPidHF();
1278 //pidObj->SetName("pid4D0");
1280 const Int_t nlims=2;
1281 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1282 Bool_t compat=kTRUE; //effective only for this mode
1284 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1285 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1286 pidObj->SetMatch(mode);
1287 pidObj->SetPLimit(plims,nlims);
1288 pidObj->SetSigma(sigmas);
1289 pidObj->SetCompat(compat);
1290 pidObj->SetTPC(kTRUE);
1291 pidObj->SetTOF(kTRUE);
1295 SetUseDefaultPID(kTRUE);// TEMPORARY: PROTON EXCLUSION SET ONLY IN DEFAULT PID