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