]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliRDHFCutsDStartoKpipi.cxx
Setter and getter for centrality estimator (Chiara Bianchin)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliRDHFCutsDStartoKpipi.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 /////////////////////////////////////////////////////////////
19 //
20 // Class for cuts on AOD reconstructed DStar->Kpipi
21 //
22 // Author: A.Grelli, alessandro.grelli@uu.nl
23 //
24 // PID method implemented by   Y.Wang, yifei@physi.uni-heidelberg.de
25 //           
26 /////////////////////////////////////////////////////////////
27
28 #include <TDatabasePDG.h>
29 #include <Riostream.h>
30
31 #include "AliAODRecoDecayHF2Prong.h"
32 #include "AliAODRecoCascadeHF.h"
33 #include "AliRDHFCutsD0toKpi.h"
34 #include "AliRDHFCutsDStartoKpipi.h"
35 #include "AliAODTrack.h"
36 #include "AliESDtrack.h"
37 #include "AliAODPid.h"
38 #include "AliTPCPIDResponse.h"
39 #include "AliAODVertex.h"
40 #include "AliESDVertex.h"
41
42 using std::cout;
43 using std::endl;
44
45 ClassImp(AliRDHFCutsDStartoKpipi)
46
47 //--------------------------------------------------------------------------
48 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const char* name) : 
49   AliRDHFCuts(name),
50   fTrackCutsSoftPi(0),
51   fMaxPtPid(9999.),
52   fTPCflag(999.)
53 {
54   //
55   // Default Constructor
56   //
57   
58   Int_t nvars=16;
59   SetNVars(nvars);
60   TString varNames[16]={
61     "inv. mass [GeV]",   
62     "dca [cm]",
63     "cosThetaStar", 
64     "pTK [GeV/c]",
65     "pTPi [GeV/c]",
66     "d0K [cm]",
67     "d0Pi [cm]",
68     "d0d0 [cm^2]",
69     "cosThetaPoint",
70     "inv. mass half width of D* [GeV]",
71     "half width of (M_Kpipi-M_D0) [GeV]",
72     "PtMin of pi_s [GeV/c]",
73     "PtMax of pi_s [GeV/c]",
74     "theta, angle between the pi_s and decay plane of the D0 [rad]",
75     "|cosThetaPointXY|", 
76     "NormDecayLenghtXY"};
77   Bool_t isUpperCut[16]={
78     kTRUE,
79     kTRUE,
80     kTRUE,
81     kFALSE,
82     kFALSE,
83     kTRUE,
84     kTRUE,
85     kTRUE,
86     kFALSE,
87     kTRUE,
88     kTRUE,
89     kTRUE,
90     kTRUE,
91     kFALSE,
92     kFALSE, 
93     kFALSE};
94   SetVarNames(nvars,varNames,isUpperCut);
95   Bool_t forOpt[16]={
96     kFALSE,
97     kTRUE,
98     kTRUE,
99     kFALSE,
100     kFALSE,
101     kFALSE,
102     kFALSE,
103     kTRUE,
104     kTRUE,
105     kFALSE,
106     kTRUE,
107     kFALSE,
108     kFALSE,
109     kFALSE,
110     kFALSE,
111     kFALSE};
112   SetVarsForOpt(5,forOpt);
113   Float_t limits[2]={0,999999999.};
114   SetPtBins(2,limits);
115 }
116 //--------------------------------------------------------------------------
117 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const AliRDHFCutsDStartoKpipi &source) :
118   AliRDHFCuts(source),
119   fTrackCutsSoftPi(0),
120   fMaxPtPid(9999.),
121   fTPCflag(999.)
122 {
123   //
124   // Copy constructor
125   //
126   
127   if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
128   
129 }
130 //--------------------------------------------------------------------------
131 AliRDHFCutsDStartoKpipi &AliRDHFCutsDStartoKpipi::operator=(const AliRDHFCutsDStartoKpipi &source)
132 {
133   //
134   // assignment operator
135   //
136   if(&source == this) return *this;
137
138   AliRDHFCuts::operator=(source);
139   if(source.GetTrackCutsSoftPi()) {
140     delete fTrackCutsSoftPi;
141     fTrackCutsSoftPi = new AliESDtrackCuts(*(source.GetTrackCutsSoftPi()));
142   }
143
144   return *this;
145 }
146
147
148 //---------------------------------------------------------------------------
149 void AliRDHFCutsDStartoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
150   // 
151   // Fills in vars the values of the variables 
152   //
153   if(nvars!=fnVarsForOpt) {
154     printf("AliRDHFCutsDStartoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
155     return;
156   }
157   
158  
159   AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)d;
160
161   AliAODTrack *softPi = (AliAODTrack*)dstarD0pi->GetBachelor();
162
163   AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
164   
165    Int_t iter=-1;
166   if(fVarsForOpt[0]){
167     iter++;
168     if(TMath::Abs(pdgdaughters[0])==211) {
169       vars[iter]=dd->InvMassD0();
170     } else {
171       vars[iter]=dd->InvMassD0bar();
172     }
173   }
174   if(fVarsForOpt[1]){
175     iter++;
176     vars[iter]=dd->GetDCA();
177   }
178   if(fVarsForOpt[2]){
179     iter++;
180     if(TMath::Abs(pdgdaughters[0])==211) {
181       vars[iter] = dd->CosThetaStarD0();
182     } else {
183       vars[iter] = dd->CosThetaStarD0bar();
184     }
185   }
186   if(fVarsForOpt[3]){
187     iter++;
188    if(TMath::Abs(pdgdaughters[0])==321) {
189      vars[iter]=dd->PtProng(0);
190    }
191    else{
192      vars[iter]=dd->PtProng(1);
193    }
194   }
195   if(fVarsForOpt[4]){
196     iter++;
197    if(TMath::Abs(pdgdaughters[0])==211) {
198      vars[iter]=dd->PtProng(0);
199    }
200    else{
201      vars[iter]=dd->PtProng(1);
202    }
203   }
204   if(fVarsForOpt[5]){
205     iter++;
206     if(TMath::Abs(pdgdaughters[0])==321) {
207      vars[iter]=dd->Getd0Prong(0);
208    }
209    else{
210      vars[iter]=dd->Getd0Prong(1);
211    }
212   }
213   if(fVarsForOpt[6]){
214     iter++;
215      if(TMath::Abs(pdgdaughters[0])==211) {
216      vars[iter]=dd->Getd0Prong(0);
217    }
218    else{
219      vars[iter]=dd->Getd0Prong(1);
220    }
221   }
222   if(fVarsForOpt[7]){
223     iter++;
224     vars[iter]= dd->Prodd0d0();
225   }
226   if(fVarsForOpt[8]){
227     iter++;
228     vars[iter]=dd->CosPointingAngle();
229   }
230   if(fVarsForOpt[9]){
231     iter++;
232     vars[iter]=dstarD0pi->InvMassDstarKpipi();
233   }
234   if(fVarsForOpt[10]){
235     iter++;
236     vars[iter]=dstarD0pi->DeltaInvMass();
237   }
238   if(fVarsForOpt[11]){
239     iter++;
240     vars[iter] = softPi->Pt();
241   }
242   if(fVarsForOpt[12]){
243     iter++;
244     vars[iter] = softPi->Pt();
245   }
246   if(fVarsForOpt[13]){
247     iter++;
248     vars[iter] =dstarD0pi->AngleD0dkpPisoft();
249   }
250   if(fVarsForOpt[14]){
251     iter++;
252     vars[iter]=TMath::Abs(dd->CosPointingAngleXY());
253   }
254   if(fVarsForOpt[15]){
255     iter++;
256     vars[iter]=(dd->NormalizedDecayLengthXY()*(dd->P()/dd->Pt()));
257   }
258  
259   return;
260 }
261 //---------------------------------------------------------------------------
262 Int_t AliRDHFCutsDStartoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
263   //
264   // Apply selection for D*.
265   //
266
267   fIsSelectedCuts=0;
268   fIsSelectedPID=0;
269
270   if(!fCutsRD){
271     cout<<"Cut matrice not inizialized. Exit..."<<endl;
272     return 0;
273   }
274   
275   AliAODRecoCascadeHF* d = (AliAODRecoCascadeHF*)obj;
276   if(!d){
277     cout<<"AliAODRecoCascadeHF null"<<endl;
278     return 0;
279   }
280   
281   Double_t ptD=d->Pt();
282   if(ptD<fMinPtCand) return 0;
283   if(ptD>fMaxPtCand) return 0;
284   
285
286   AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)d->Get2Prong();  
287   if(!dd){
288     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
289     return 0;
290   }
291
292   if(fUseTrackSelectionWithFilterBits && dd->HasBadDaughters()) return 0;
293
294   AliAODTrack *b = (AliAODTrack*)d->GetBachelor();
295   if(fTrackCutsSoftPi && fTrackCutsSoftPi->GetRequireTPCRefit()){
296     if(!(b->TestFilterMask(BIT(4)))) return 0;
297   }
298   
299   Int_t returnvalue=1;
300   Int_t returnvaluePID=3;
301
302
303   // selection on candidate
304   if(selectionLevel==AliRDHFCuts::kAll || 
305      selectionLevel==AliRDHFCuts::kCandidate) {
306     
307     Double_t pt=d->Pt();
308     Int_t ptbin=PtBin(pt);
309  
310     // DStarMass and D0mass
311     Double_t mDSPDG = TDatabasePDG::Instance()->GetParticle(413)->Mass();
312     Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
313     // delta mass PDG
314     Double_t deltaPDG = mDSPDG-mD0PDG;
315    
316     // Half width DStar mass
317     if(TMath::Abs(mDSPDG - (d->InvMassDstarKpipi()))>fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
318     // Half width Delta mass
319     
320     if(TMath::Abs(deltaPDG-(d->DeltaInvMass())) > fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
321     
322     // cut on soft pion pt
323     if(b->Pt() < fCutsRD[GetGlobalIndex(11,ptbin)] || b->Pt() > fCutsRD[GetGlobalIndex(12,ptbin)]) return 0;
324     // cut on the angle between D0 decay plane and soft pion
325     if(d->AngleD0dkpPisoft() > fCutsRD[GetGlobalIndex(13,ptbin)]) return 0;
326   
327     // select D0 that passes D* cuts
328     returnvalue = IsD0FromDStarSelected(pt,dd,selectionLevel);
329     if((b->Charge()==+1 && returnvalue==2) || (b->Charge()==-1 && returnvalue==1)) return 0; 
330     
331   }
332
333   fIsSelectedCuts = returnvalue;
334
335   // selection on PID 
336   if(selectionLevel==AliRDHFCuts::kAll || 
337      selectionLevel==AliRDHFCuts::kCandidate ||
338      selectionLevel==AliRDHFCuts::kPID) {
339     returnvaluePID = IsSelectedPID(d);
340     fIsSelectedPID = returnvaluePID;
341   }
342   if(returnvaluePID!=3) returnvalue =0;
343
344
345   // selection on daughter tracks 
346   if(selectionLevel==AliRDHFCuts::kAll || 
347      selectionLevel==AliRDHFCuts::kTracks) {
348     if(!AreDaughtersSelected(dd)) return 0;
349     if(fTrackCutsSoftPi) {
350       AliAODVertex *vAOD = d->GetPrimaryVtx();
351       Double_t pos[3],cov[6];
352       vAOD->GetXYZ(pos);
353       vAOD->GetCovarianceMatrix(cov);
354       const AliESDVertex vESD(pos,cov,100.,100);
355       if(!IsDaughterSelected(b,&vESD,fTrackCutsSoftPi)) return 0;
356     }
357   }
358   
359   return returnvalue;
360
361 }
362 //_________________________________________________________________________________________________
363 Int_t AliRDHFCutsDStartoKpipi::IsD0FromDStarSelected(Double_t pt, TObject* obj,Int_t selectionLevel) const {
364   //
365   // Apply selection for D0 from D*. The selection in on D0 prongs
366   //
367   
368   if(!fCutsRD){
369     cout<<"Cut matrice not inizialized. Exit..."<<endl;
370     return 0;
371   }
372   
373   AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)obj;
374   
375   if(!dd){
376     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
377     return 0;
378   }
379
380   // selection on daughter tracks is done in IsSelected()
381   
382   Int_t returnvalue=1;
383   
384   // selection on candidate
385   if(selectionLevel==AliRDHFCuts::kAll || 
386      selectionLevel==AliRDHFCuts::kCandidate) {
387     
388     // D0 mass
389     Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
390     // delta mass PDG
391  
392     Int_t ptbin=PtBin(pt);
393     
394     Double_t mD0,mD0bar,ctsD0,ctsD0bar;
395   
396     Int_t okD0     =0;
397     Int_t okD0bar  =0;
398     okD0=1; okD0bar=1;
399
400     if(dd->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
401     if(dd->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
402     
403     if(!okD0 && !okD0bar) return 0;
404     
405     if(TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] || 
406        TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
407     if(TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
408        TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
409     if(!okD0 && !okD0bar) return 0;
410     
411     if(dd->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
412     
413     dd->InvMassD0(mD0,mD0bar);
414     if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
415     if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
416     if(!okD0 && !okD0bar) return 0;
417     
418     dd->CosThetaStarD0(ctsD0,ctsD0bar);
419     if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
420     if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
421     if(!okD0 && !okD0bar) return 0;
422     
423     if(dd->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
424     
425     if(dd->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
426
427     if(TMath::Abs(dd->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(14,ptbin)])  return 0;
428         
429     Double_t normalDecayLengXY=(dd->NormalizedDecayLengthXY()*(dd->P()/dd->Pt()));
430     if (normalDecayLengXY < fCutsRD[GetGlobalIndex(15, ptbin)]) return 0;
431
432     if (okD0) returnvalue=1; //cuts passed as D0
433     if (okD0bar) returnvalue=2; //cuts passed as D0bar
434     if (okD0 && okD0bar) returnvalue=3; //both
435   }
436  
437   return returnvalue;
438 }
439 //----------------------------------------------------------------------------------
440 Bool_t AliRDHFCutsDStartoKpipi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
441 {
442   //
443   // D* fiducial acceptance region 
444   //
445
446   if(pt > 5.) {
447     // applying cut for pt > 5 GeV
448     AliDebug(4,Form("pt of D* = %f (> 5), cutting at |y| < 0.8\n",pt)); 
449     if (TMath::Abs(y) > 0.8){
450       return kFALSE;
451     }
452   } else {    
453     // appliying smooth cut for pt < 5 GeV
454     Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5; 
455     Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;         
456     AliDebug(2,Form("pt of D* = %f (< 5), cutting  according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY)); 
457     if (y < minFiducialY || y > maxFiducialY){
458       return kFALSE;
459     }
460   }
461     
462   return kTRUE;
463 }
464
465 //_______________________________________________________________________________-
466 Int_t AliRDHFCutsDStartoKpipi::IsSelectedPID(AliAODRecoDecayHF* obj)
467 {
468   //
469   // PID method, n signa approach default
470   //
471   
472   AliAODRecoCascadeHF* dstar = (AliAODRecoCascadeHF*)obj;
473   if(!dstar){
474     cout<<"AliAODRecoCascadeHF null"<<endl;
475     return 0;
476   } 
477  
478   if(!fUsePID || dstar->Pt() > fMaxPtPid) return 3;
479   
480   AliAODRecoDecayHF2Prong* d0 = (AliAODRecoDecayHF2Prong*)dstar->Get2Prong();  
481   if(!d0){
482     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
483     return 0;
484   }
485
486   //  here the PID
487   AliAODTrack *pos = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(0);
488   AliAODTrack *neg = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(1);
489
490   if (dstar->Charge()>0){
491     if(!SelectPID(pos,2)) return 0;//pion+
492     if(!SelectPID(neg,3)) return 0;//kaon-
493   }else{
494     if(!SelectPID(pos,3)) return 0;//kaon+
495     if(!SelectPID(neg,2)) return 0;//pion-
496   }
497
498   return 3;
499 }
500
501 //_______________________________________________________________________________-
502 Int_t AliRDHFCutsDStartoKpipi::SelectPID(AliAODTrack *track, Int_t type)
503 {
504   //
505   //  here the PID
506     
507   Bool_t isParticle=kTRUE;
508
509   if(fPidHF->GetMatch()==1){//n-sigma
510     Bool_t TPCon=TMath::Abs(2)>1e-4?kTRUE:kFALSE;
511     Bool_t TOFon=TMath::Abs(3)>1e-4?kTRUE:kFALSE;
512     
513     Bool_t isTPC=kTRUE;
514     Bool_t isTOF=kTRUE;
515
516     if (TPCon){//TPC
517       if(fPidHF->CheckStatus(track,"TPC")){
518         if(type==2) isTPC=fPidHF->IsPionRaw(track,"TPC");
519         if(type==3) isTPC=fPidHF->IsKaonRaw(track,"TPC");
520       }
521     }
522     if (TOFon){//TOF
523       if(fPidHF->CheckStatus(track,"TOF")){
524         if(type==2) isTOF=fPidHF->IsPionRaw(track,"TOF");
525         if(type==3) isTOF=fPidHF->IsKaonRaw(track,"TOF");
526       }
527     }
528
529     //--------------------------------
530     // cut on high momentum in the TPC
531     //--------------------------------
532     Double_t pPIDcut = track->P();
533     if(pPIDcut>fTPCflag) isTPC=1;
534     
535     isParticle = isTPC&&isTOF;
536   }
537   
538   if(fPidHF->GetMatch()==2){//bayesian
539     //Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
540     Double_t prob[5]={1.,1.,1.,1.,1.};
541     
542     //fPidHF->SetPriors(priors);
543     //    fPidHF->BayesianProbability(track,prob);
544     
545     Double_t max=0.;
546     Int_t k=-1;
547     for (Int_t i=0; i<5; i++) {
548       if (prob[i]>max) {k=i; max=prob[i];}
549     }
550     isParticle = Bool_t(k==type);
551   }
552   
553
554   return isParticle;
555   
556 }
557 //__________________________________________________________________________________-
558 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPP2010() {
559   //
560   //STANDARD CUTS USED FOR 2010 pp analysis 
561   //                                           
562   // Need to be updated for the final cut version
563   //
564
565   SetName("DStartoD0piCutsStandard");
566   SetTitle("Standard Cuts for D* analysis");
567   
568   // PILE UP REJECTION
569   SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
570
571   // EVENT CUTS
572   SetMinVtxContr(1);
573   
574   // CUTS ON SINGLE TRACKS
575   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
576   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
577   esdTrackCuts->SetRequireTPCRefit(kTRUE);
578   esdTrackCuts->SetRequireITSRefit(kTRUE);
579   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
580   esdTrackCuts->SetMinDCAToVertexXY(0.);
581   esdTrackCuts->SetEtaRange(-0.8,0.8);
582   esdTrackCuts->SetPtRange(0.3,1.e10);
583   
584   // CUTS on SOFT PION
585   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
586   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
587   esdSoftPicuts->SetRequireTPCRefit(kFALSE);
588   esdSoftPicuts->SetRequireITSRefit(kFALSE);
589   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
590                                           AliESDtrackCuts::kAny); 
591   esdSoftPicuts->SetPtRange(0.0,1.e10);
592
593   AddTrackCuts(esdTrackCuts);
594   AddTrackCutsSoftPi(esdSoftPicuts);
595
596   const Int_t nptbins =13;
597   const Double_t ptmax = 9999.;
598   const Int_t nvars=16;
599   Float_t ptbins[nptbins+1];
600   ptbins[0]=0.;
601   ptbins[1]=0.5;        
602   ptbins[2]=1.;
603   ptbins[3]=2.;
604   ptbins[4]=3.;
605   ptbins[5]=4.;
606   ptbins[6]=5.;
607   ptbins[7]=6.;
608   ptbins[8]=7.;
609   ptbins[9]=8.;
610   ptbins[10]=12.;
611   ptbins[11]=16.;
612   ptbins[12]=24.;
613   ptbins[13]=ptmax;
614
615   SetGlobalIndex(nvars,nptbins);
616   SetPtBins(nptbins+1,ptbins);
617   
618   Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.7,220.*1E-4,0.7,0.21,0.21,500.*1E-4,500.*1E-4,-2000.*1E-8,0.85,0.3,0.1,0.05,100,0.5,-1.,0.},/* pt<0.5*/
619                                                   {0.7,220.*1E-4,0.7,0.21,0.21,500.*1E-4,500.*1E-4,-16000.*1E-8,0.85,0.3,0.1,0.05,100,0.5,-1.,0.},/* 0.5<pt<1*/
620                                                   {0.7,400.*1E-4,0.8,0.7,0.7,400.*1E-4,400.*1E-4,-36000.*1E-8,0.82,0.3,0.1,0.05,100,0.5,-1.,0.},/* 1<pt<2 */
621                                                   {0.7,200.*1E-4,0.8,0.7,0.7,800.*1E-4,800.*1E-4,-16000.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 2<pt<3 */
622                                                   {0.7,500.*1E-4,0.8,1.0,1.0,420.*1E-4,560.*1E-4,-6500.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 3<pt<4 */
623                                                   {0.7,800.*1E-4,0.9,1.2,1.2,700.*1E-4,700.*1E-4,1000.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 4<pt<5 */
624                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,800.*1E-4,800.*1E-4,50000.*1E-8,0.8,0.3,0.1,0.05,100,0.5,-1.,0.},/* 5<pt<6 */
625                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,100000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 6<pt<7 */
626                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,100000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 7<pt<8 */
627                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,600000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 8<pt<12 */
628                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 12<pt<16 */
629                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 16<pt<20 */
630                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.}};/* pt>24 */
631   
632   
633   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
634   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
635   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
636   
637   for (Int_t ibin=0;ibin<nptbins;ibin++){
638     for (Int_t ivar = 0; ivar<nvars; ivar++){
639       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
640     }
641   }
642   
643   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
644
645   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
646   delete [] cutsMatrixTransposeStand;
647   cutsMatrixTransposeStand=NULL;
648
649   // PID SETTINGS FOR D* analysis
650   AliAODPidHF* pidObj=new AliAODPidHF();
651   //pidObj->SetName("pid4DSatr");
652   Int_t mode=1;
653   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
654   pidObj->SetPriors(priors);
655   pidObj->SetMatch(mode);
656   pidObj->SetSigma(0,2); // TPC
657   pidObj->SetSigma(3,3); // TOF
658   pidObj->SetTPC(kTRUE);
659   pidObj->SetTOF(kTRUE);
660   
661   SetPidHF(pidObj);
662   SetUsePID(kTRUE);
663
664   PrintAll();
665
666   delete pidObj;
667   pidObj=NULL;
668
669   return;
670 }
671 //_____________________________________________________________________________-
672 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2010(){  
673   //
674   // TEMPORARY, WORK IN PROGRESS ... BUT WORKING! 
675   //
676   //  Lead Lead
677   //
678
679   SetName("DStartoD0piCutsStandard");
680   SetTitle("Standard Cuts for D* analysis in PbPb 2010");
681
682   // EVENT CUTS
683   SetMinVtxContr(1);
684   
685   // CUTS ON SINGLE TRACKS
686   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
687   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
688   esdTrackCuts->SetRequireTPCRefit(kTRUE);
689   esdTrackCuts->SetRequireITSRefit(kTRUE);
690   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
691   esdTrackCuts->SetMinDCAToVertexXY(0.);
692   esdTrackCuts->SetEtaRange(-0.8,0.8);
693   esdTrackCuts->SetPtRange(0.3,1.e10);
694   
695   // CUTS on SOFT PION
696   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
697   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
698   esdSoftPicuts->SetRequireTPCRefit(kTRUE);
699   esdSoftPicuts->SetRequireITSRefit(kTRUE);
700   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
701                                           AliESDtrackCuts::kAny); //test d0 asimmetry
702   esdSoftPicuts->SetPtRange(0.25,5);
703
704   AddTrackCuts(esdTrackCuts);
705   AddTrackCutsSoftPi(esdSoftPicuts);
706
707   const Int_t nptbins =13;
708   const Double_t ptmax = 9999.;
709   const Int_t nvars=16;
710   Float_t ptbins[nptbins+1];
711   ptbins[0]=0.;
712   ptbins[1]=0.5;        
713   ptbins[2]=1.;
714   ptbins[3]=2.;
715   ptbins[4]=3.;
716   ptbins[5]=4.;
717   ptbins[6]=5.;
718   ptbins[7]=6.;
719   ptbins[8]=7.;
720   ptbins[9]=8.;
721   ptbins[10]=12.;
722   ptbins[11]=16.;
723   ptbins[12]=24.;
724   ptbins[13]=ptmax;
725
726   SetGlobalIndex(nvars,nptbins);
727   SetPtBins(nptbins+1,ptbins);
728   
729   Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.7,220.*1E-4,0.7,0.21,0.21,500.*1E-4,500.*1E-4,-2000.*1E-8,0.85,0.3,0.1,0.05,100,0.5,-1.,0.},/* pt<0.5*/
730                                                   {0.7,220.*1E-4,0.7,0.21,0.21,500.*1E-4,500.*1E-4,-16000.*1E-8,0.85,0.3,0.1,0.05,100,0.5,-1.,0.},/* 0.5<pt<1*/
731                                                   {0.7,400.*1E-4,0.8,0.7,0.7,800.*1E-4,800.*1E-4,-36000.*1E-8,0.82,0.3,0.1,0.05,100,0.5,-1.,0.},/* 1<pt<2 */
732                                                   {0.7,200.*1E-4,0.8,0.7,0.7,800.*1E-4,800.*1E-4,-16000.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 2<pt<3 */
733                                                   {0.7,500.*1E-4,0.8,1.0,1.0,420.*1E-4,560.*1E-4,-6500.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 3<pt<4 */
734                                                   {0.7,800.*1E-4,0.9,1.2,1.2,700.*1E-4,700.*1E-4,1000.*1E-8,0.9,0.3,0.1,0.05,100,0.5,-1.,0.},/* 4<pt<5 */
735                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,800.*1E-4,800.*1E-4,50000.*1E-8,0.8,0.3,0.1,0.05,100,0.5,-1.,0.},/* 5<pt<6 */
736                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,100000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 6<pt<7 */
737                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,100000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 7<pt<8 */
738                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,600000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 8<pt<12 */
739                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 12<pt<16 */
740                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.},/* 16<pt<24 */
741                                                   {0.7,1000.*1E-4,1.0,1.0,1.0,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.7,0.3,0.1,0.05,100,0.5,-1.,0.}};/* pt>24 */
742   
743   
744   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
745   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
746   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
747   
748   for (Int_t ibin=0;ibin<nptbins;ibin++){
749     for (Int_t ivar = 0; ivar<nvars; ivar++){
750       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
751     }
752   }
753   
754   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
755
756   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
757   delete [] cutsMatrixTransposeStand;
758   cutsMatrixTransposeStand=NULL;
759   
760   // PID SETTINGS
761   AliAODPidHF* pidObj=new AliAODPidHF();
762   // pidObj->SetName("pid4DSatr");
763   Int_t mode=1;
764   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
765   pidObj->SetPriors(priors);
766   pidObj->SetMatch(mode);
767   pidObj->SetSigma(0,2); // TPC
768   pidObj->SetSigma(3,3); // TOF
769   pidObj->SetTPC(kTRUE);
770   pidObj->SetTOF(kTRUE);
771   
772   SetPidHF(pidObj);
773   SetUsePID(kTRUE);
774
775   PrintAll();
776
777   delete pidObj;
778   pidObj=NULL;
779
780   return;
781
782 }
783
784 //_____________________________________________________________________________
785 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2011(){
786
787   // Default 2010 PbPb cut object
788   SetStandardCutsPbPb2010();
789
790   // Enable all 2011 PbPb run triggers
791   //  
792   SetTriggerClass("");
793   ResetMaskAndEnableMBTrigger();
794   EnableCentralTrigger();
795   EnableSemiCentralTrigger();
796
797 }