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