]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliRDHFCutsDStartoKpipi.cxx
o add track alpha to tree
[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(fMaxRapidityCand>-998.){
447     if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
448     else return kTRUE;
449   }
450
451   if(pt > 5.) {
452     // applying cut for pt > 5 GeV
453     AliDebug(4,Form("pt of D* = %f (> 5), cutting at |y| < 0.8\n",pt)); 
454     if (TMath::Abs(y) > 0.8){
455       return kFALSE;
456     }
457   } else {    
458     // appliying smooth cut for pt < 5 GeV
459     Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5; 
460     Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;         
461     AliDebug(2,Form("pt of D* = %f (< 5), cutting  according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY)); 
462     if (y < minFiducialY || y > maxFiducialY){
463       return kFALSE;
464     }
465   }
466     
467   return kTRUE;
468 }
469
470 //_______________________________________________________________________________-
471 Int_t AliRDHFCutsDStartoKpipi::IsSelectedPID(AliAODRecoDecayHF* obj)
472 {
473   //
474   // PID method, n signa approach default
475   //
476   
477   AliAODRecoCascadeHF* dstar = (AliAODRecoCascadeHF*)obj;
478   if(!dstar){
479     cout<<"AliAODRecoCascadeHF null"<<endl;
480     return 0;
481   } 
482  
483   if(!fUsePID || dstar->Pt() > fMaxPtPid) return 3;
484   
485   AliAODRecoDecayHF2Prong* d0 = (AliAODRecoDecayHF2Prong*)dstar->Get2Prong();  
486   if(!d0){
487     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
488     return 0;
489   }
490
491   //  here the PID
492   AliAODTrack *pos = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(0);
493   AliAODTrack *neg = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(1);
494
495   if (dstar->Charge()>0){
496     if(!SelectPID(pos,2)) return 0;//pion+
497     if(!SelectPID(neg,3)) return 0;//kaon-
498   }else{
499     if(!SelectPID(pos,3)) return 0;//kaon+
500     if(!SelectPID(neg,2)) return 0;//pion-
501   }
502
503   return 3;
504 }
505
506 //_______________________________________________________________________________-
507 Int_t AliRDHFCutsDStartoKpipi::SelectPID(AliAODTrack *track, Int_t type)
508 {
509   //
510   //  here the PID
511     
512   Bool_t isParticle=kTRUE;
513
514   if(fPidHF->GetMatch()==1){//n-sigma
515     Bool_t TPCon=TMath::Abs(2)>1e-4?kTRUE:kFALSE;
516     Bool_t TOFon=TMath::Abs(3)>1e-4?kTRUE:kFALSE;
517     
518     Bool_t isTPC=kTRUE;
519     Bool_t isTOF=kTRUE;
520
521     if (TPCon){//TPC
522       if(fPidHF->CheckStatus(track,"TPC")){
523         if(type==2) isTPC=fPidHF->IsPionRaw(track,"TPC");
524         if(type==3) isTPC=fPidHF->IsKaonRaw(track,"TPC");
525       }
526     }
527     if (TOFon){//TOF
528       if(fPidHF->CheckStatus(track,"TOF")){
529         if(type==2) isTOF=fPidHF->IsPionRaw(track,"TOF");
530         if(type==3) isTOF=fPidHF->IsKaonRaw(track,"TOF");
531       }
532     }
533
534     //--------------------------------
535     // cut on high momentum in the TPC
536     //--------------------------------
537     Double_t pPIDcut = track->P();
538     if(pPIDcut>fTPCflag) isTPC=1;
539     
540     isParticle = isTPC&&isTOF;
541   }
542   
543   if(fPidHF->GetMatch()==2){//bayesian
544     //Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
545     Double_t prob[5]={1.,1.,1.,1.,1.};
546     
547     //fPidHF->SetPriors(priors);
548     //    fPidHF->BayesianProbability(track,prob);
549     
550     Double_t max=0.;
551     Int_t k=-1;
552     for (Int_t i=0; i<5; i++) {
553       if (prob[i]>max) {k=i; max=prob[i];}
554     }
555     isParticle = Bool_t(k==type);
556   }
557   
558
559   return isParticle;
560   
561 }
562 //__________________________________________________________________________________-
563 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPP2010() {
564   //
565   //STANDARD CUTS USED FOR 2010 pp analysis 
566   //                                           
567   // Need to be updated for the final cut version
568   //
569
570   SetName("DStartoD0piCutsStandard");
571   SetTitle("Standard Cuts for D* analysis");
572   
573   // PILE UP REJECTION
574   SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
575
576   // EVENT CUTS
577   SetMinVtxContr(1);
578   
579   // CUTS ON SINGLE TRACKS
580   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
581   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
582   esdTrackCuts->SetRequireTPCRefit(kTRUE);
583   esdTrackCuts->SetRequireITSRefit(kTRUE);
584   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
585   esdTrackCuts->SetMinDCAToVertexXY(0.);
586   esdTrackCuts->SetEtaRange(-0.8,0.8);
587   esdTrackCuts->SetPtRange(0.3,1.e10);
588   
589   // CUTS on SOFT PION
590   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
591   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
592   esdSoftPicuts->SetRequireTPCRefit(kFALSE);
593   esdSoftPicuts->SetRequireITSRefit(kFALSE);
594   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
595                                           AliESDtrackCuts::kAny); 
596   esdSoftPicuts->SetPtRange(0.0,1.e10);
597
598   AddTrackCuts(esdTrackCuts);
599   AddTrackCutsSoftPi(esdSoftPicuts);
600
601   const Int_t nptbins =13;
602   const Double_t ptmax = 9999.;
603   const Int_t nvars=16;
604   Float_t ptbins[nptbins+1];
605   ptbins[0]=0.;
606   ptbins[1]=0.5;        
607   ptbins[2]=1.;
608   ptbins[3]=2.;
609   ptbins[4]=3.;
610   ptbins[5]=4.;
611   ptbins[6]=5.;
612   ptbins[7]=6.;
613   ptbins[8]=7.;
614   ptbins[9]=8.;
615   ptbins[10]=12.;
616   ptbins[11]=16.;
617   ptbins[12]=24.;
618   ptbins[13]=ptmax;
619
620   SetGlobalIndex(nvars,nptbins);
621   SetPtBins(nptbins+1,ptbins);
622   
623   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*/
624                                                   {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*/
625                                                   {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 */
626                                                   {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 */
627                                                   {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 */
628                                                   {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 */
629                                                   {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 */
630                                                   {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 */
631                                                   {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 */
632                                                   {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 */
633                                                   {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 */
634                                                   {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 */
635                                                   {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 */
636   
637   
638   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
639   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
640   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
641   
642   for (Int_t ibin=0;ibin<nptbins;ibin++){
643     for (Int_t ivar = 0; ivar<nvars; ivar++){
644       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
645     }
646   }
647   
648   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
649
650   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
651   delete [] cutsMatrixTransposeStand;
652   cutsMatrixTransposeStand=NULL;
653
654   // PID SETTINGS FOR D* analysis
655   AliAODPidHF* pidObj=new AliAODPidHF();
656   //pidObj->SetName("pid4DSatr");
657   Int_t mode=1;
658   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
659   pidObj->SetPriors(priors);
660   pidObj->SetMatch(mode);
661   pidObj->SetSigma(0,2); // TPC
662   pidObj->SetSigma(3,3); // TOF
663   pidObj->SetTPC(kTRUE);
664   pidObj->SetTOF(kTRUE);
665   
666   SetPidHF(pidObj);
667   SetUsePID(kTRUE);
668
669   PrintAll();
670
671   delete pidObj;
672   pidObj=NULL;
673
674   return;
675 }
676 //_____________________________________________________________________________-
677 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2010(){  
678   //
679   // TEMPORARY, WORK IN PROGRESS ... BUT WORKING! 
680   //
681   //  Lead Lead
682   //
683
684   SetName("DStartoD0piCutsStandard");
685   SetTitle("Standard Cuts for D* analysis in PbPb 2010");
686
687   // EVENT CUTS
688   SetMinVtxContr(1);
689   
690   // CUTS ON SINGLE TRACKS
691   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
692   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
693   esdTrackCuts->SetRequireTPCRefit(kTRUE);
694   esdTrackCuts->SetRequireITSRefit(kTRUE);
695   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
696   esdTrackCuts->SetMinDCAToVertexXY(0.);
697   esdTrackCuts->SetEtaRange(-0.8,0.8);
698   esdTrackCuts->SetPtRange(0.3,1.e10);
699   
700   // CUTS on SOFT PION
701   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
702   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
703   esdSoftPicuts->SetRequireTPCRefit(kTRUE);
704   esdSoftPicuts->SetRequireITSRefit(kTRUE);
705   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
706                                           AliESDtrackCuts::kAny); //test d0 asimmetry
707   esdSoftPicuts->SetPtRange(0.25,5);
708
709   AddTrackCuts(esdTrackCuts);
710   AddTrackCutsSoftPi(esdSoftPicuts);
711
712   const Int_t nptbins =13;
713   const Double_t ptmax = 9999.;
714   const Int_t nvars=16;
715   Float_t ptbins[nptbins+1];
716   ptbins[0]=0.;
717   ptbins[1]=0.5;        
718   ptbins[2]=1.;
719   ptbins[3]=2.;
720   ptbins[4]=3.;
721   ptbins[5]=4.;
722   ptbins[6]=5.;
723   ptbins[7]=6.;
724   ptbins[8]=7.;
725   ptbins[9]=8.;
726   ptbins[10]=12.;
727   ptbins[11]=16.;
728   ptbins[12]=24.;
729   ptbins[13]=ptmax;
730
731   SetGlobalIndex(nvars,nptbins);
732   SetPtBins(nptbins+1,ptbins);
733   
734   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*/
735                                                   {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*/
736                                                   {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 */
737                                                   {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 */
738                                                   {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 */
739                                                   {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 */
740                                                   {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 */
741                                                   {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 */
742                                                   {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 */
743                                                   {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 */
744                                                   {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 */
745                                                   {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 */
746                                                   {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 */
747   
748   
749   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
750   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
751   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
752   
753   for (Int_t ibin=0;ibin<nptbins;ibin++){
754     for (Int_t ivar = 0; ivar<nvars; ivar++){
755       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
756     }
757   }
758   
759   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
760
761   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
762   delete [] cutsMatrixTransposeStand;
763   cutsMatrixTransposeStand=NULL;
764   
765   // PID SETTINGS
766   AliAODPidHF* pidObj=new AliAODPidHF();
767   // pidObj->SetName("pid4DSatr");
768   Int_t mode=1;
769   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
770   pidObj->SetPriors(priors);
771   pidObj->SetMatch(mode);
772   pidObj->SetSigma(0,2); // TPC
773   pidObj->SetSigma(3,3); // TOF
774   pidObj->SetTPC(kTRUE);
775   pidObj->SetTOF(kTRUE);
776   
777   SetPidHF(pidObj);
778   SetUsePID(kTRUE);
779
780   PrintAll();
781
782   delete pidObj;
783   pidObj=NULL;
784
785   return;
786
787 }
788
789 //_____________________________________________________________________________
790 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2011(){
791
792   // Default 2010 PbPb cut object
793   SetStandardCutsPbPb2010();
794
795   // Enable all 2011 PbPb run triggers
796   //  
797   SetTriggerClass("");
798   ResetMaskAndEnableMBTrigger();
799   EnableCentralTrigger();
800   EnableSemiCentralTrigger();
801
802 }