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