]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliRDHFCutsDStartoKpipi.cxx
Merge branch 'feature-movesplit'
[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: AliRDHFCutsDStartoKpipi.cxx 61203 2013-03-02 22:52:17Z fprino $ */
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 #include "AliAODRecoDecayHF2Prong.h"
31 #include "AliAODRecoCascadeHF.h"
32 #include "AliRDHFCutsD0toKpi.h"
33 #include "AliRDHFCutsDStartoKpipi.h"
34 #include "AliAODTrack.h"
35 #include "AliESDtrack.h"
36 #include "AliAODPid.h"
37 #include "AliTPCPIDResponse.h"
38 #include "AliAODVertex.h"
39 #include "AliESDVertex.h"
40
41 using std::cout;
42 using std::endl;
43
44 ClassImp(AliRDHFCutsDStartoKpipi)
45
46 //--------------------------------------------------------------------------
47 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const char* name) : 
48   AliRDHFCuts(name),
49   fTrackCutsSoftPi(0),
50   fMaxPtPid(9999.),
51   fTPCflag(999.)
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   fTPCflag(999.)
121 {
122   //
123   // Copy constructor
124   //
125   
126   if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
127   
128 }
129 //--------------------------------------------------------------------------
130 AliRDHFCutsDStartoKpipi &AliRDHFCutsDStartoKpipi::operator=(const AliRDHFCutsDStartoKpipi &source)
131 {
132   //
133   // assignment operator
134   //
135   if(&source == this) return *this;
136
137   AliRDHFCuts::operator=(source);
138   if(source.GetTrackCutsSoftPi()) {
139     delete fTrackCutsSoftPi;
140     fTrackCutsSoftPi = new AliESDtrackCuts(*(source.GetTrackCutsSoftPi()));
141   }
142
143   return *this;
144 }
145
146
147 //---------------------------------------------------------------------------
148 void AliRDHFCutsDStartoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
149   // 
150   // Fills in vars the values of the variables 
151   //
152   if(nvars!=fnVarsForOpt) {
153     printf("AliRDHFCutsDStartoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
154     return;
155   }
156   
157  
158   AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)d;
159
160   AliAODTrack *softPi = (AliAODTrack*)dstarD0pi->GetBachelor();
161
162   AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
163   
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, AliAODEvent* aod) {
263   //
264   // Apply selection for D*.
265   // Added functionality to remove the D0 daughters from primary vertex (not dafult) 
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, aod);
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, AliAODEvent* aod) const {
364   //
365   // Apply selection for D0 from D*. The selection in on D0 prongs
366   // added functionality to recalculate the primary vertex without D0 prongs (not default)
367   // 
368   
369   if(!fCutsRD){
370     cout<<"Cut matrice not inizialized. Exit..."<<endl;
371     return 0;
372   }
373   
374   AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)obj;
375   
376   if(!dd){
377     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
378     return 0;
379   }
380
381   // selection on daughter tracks is done in IsSelected()
382   
383   Int_t returnvalue=1;
384   
385   // selection on candidate
386   if(selectionLevel==AliRDHFCuts::kAll || 
387      selectionLevel==AliRDHFCuts::kCandidate) {
388     
389     // D0 mass
390     Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
391     // delta mass PDG
392  
393     // add vertex recalculation without daughters
394     AliAODVertex *origownvtx=0x0;
395     if(fRemoveDaughtersFromPrimary  && !fUseMCVertex) {
396       if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
397       if(!RecalcOwnPrimaryVtx(dd,aod)) { 
398         CleanOwnPrimaryVtx(dd,aod,origownvtx);
399         return 0;
400       }
401     }
402     
403     
404     if(fUseMCVertex) {
405       if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
406       if(!SetMCPrimaryVtx(dd,aod)) {
407         CleanOwnPrimaryVtx(dd,aod,origownvtx);
408         return 0;
409       }
410     }
411     
412     Int_t ptbin=PtBin(pt);
413     if (ptbin==-1) {
414       CleanOwnPrimaryVtx(dd,aod,origownvtx);
415       return 0;
416     }
417     
418     Double_t mD0,mD0bar,ctsD0,ctsD0bar;
419   
420     Int_t okD0     =0;
421     Int_t okD0bar  =0;
422     okD0=1; okD0bar=1;
423
424     if(dd->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
425     if(dd->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
426     
427     if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
428     
429     if(TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] || 
430        TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
431     if(TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
432        TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
433     if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
434     
435     if(dd->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
436     
437     dd->InvMassD0(mD0,mD0bar);
438     if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
439     if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
440     if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
441     
442     dd->CosThetaStarD0(ctsD0,ctsD0bar);
443     if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
444     if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
445     if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
446     
447     if(dd->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
448     
449     if(dd->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
450
451     if(TMath::Abs(dd->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(14,ptbin)]) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
452         
453     Double_t normalDecayLengXY=(dd->NormalizedDecayLengthXY()*(dd->P()/dd->Pt()));
454     if (normalDecayLengXY < fCutsRD[GetGlobalIndex(15, ptbin)]) {CleanOwnPrimaryVtx(dd,aod,origownvtx); return 0;}
455
456     if (okD0) returnvalue=1; //cuts passed as D0
457     if (okD0bar) returnvalue=2; //cuts passed as D0bar
458     if (okD0 && okD0bar) returnvalue=3; //both
459
460     // unset recalculated primary vertex when not needed any more
461     CleanOwnPrimaryVtx(dd,aod,origownvtx);
462
463   }
464  
465   return returnvalue;
466 }
467 //----------------------------------------------------------------------------------
468 Bool_t AliRDHFCutsDStartoKpipi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
469 {
470   //
471   // D* fiducial acceptance region 
472   //
473
474   if(fMaxRapidityCand>-998.){
475     if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
476     else return kTRUE;
477   }
478
479   if(pt > 5.) {
480     // applying cut for pt > 5 GeV
481     AliDebug(4,Form("pt of D* = %f (> 5), cutting at |y| < 0.8\n",pt)); 
482     if (TMath::Abs(y) > 0.8){
483       return kFALSE;
484     }
485   } else {    
486     // appliying smooth cut for pt < 5 GeV
487     Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5; 
488     Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;         
489     AliDebug(2,Form("pt of D* = %f (< 5), cutting  according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY)); 
490     if (y < minFiducialY || y > maxFiducialY){
491       return kFALSE;
492     }
493   }
494     
495   return kTRUE;
496 }
497
498 //_______________________________________________________________________________-
499 Int_t AliRDHFCutsDStartoKpipi::IsSelectedPID(AliAODRecoDecayHF* obj)
500 {
501   //
502   // PID method, n signa approach default
503   //
504   
505   AliAODRecoCascadeHF* dstar = (AliAODRecoCascadeHF*)obj;
506   if(!dstar){
507     cout<<"AliAODRecoCascadeHF null"<<endl;
508     return 0;
509   } 
510  
511   if(!fUsePID || dstar->Pt() > fMaxPtPid) return 3;
512   
513   AliAODRecoDecayHF2Prong* d0 = (AliAODRecoDecayHF2Prong*)dstar->Get2Prong();  
514   if(!d0){
515     cout<<"AliAODRecoDecayHF2Prong null"<<endl;
516     return 0;
517   }
518
519   //  here the PID
520   AliAODTrack *pos = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(0);
521   AliAODTrack *neg = (AliAODTrack*)dstar->Get2Prong()->GetDaughter(1);
522
523   if (dstar->Charge()>0){
524     if(!SelectPID(pos,2)) return 0;//pion+
525     if(!SelectPID(neg,3)) return 0;//kaon-
526   }else{
527     if(!SelectPID(pos,3)) return 0;//kaon+
528     if(!SelectPID(neg,2)) return 0;//pion-
529   }
530
531   return 3;
532 }
533
534 //_______________________________________________________________________________-
535 Int_t AliRDHFCutsDStartoKpipi::SelectPID(AliAODTrack *track, Int_t type)
536 {
537   //
538   //  here the PID
539     
540   Bool_t isParticle=kTRUE;
541
542   if(fPidHF->GetMatch()==1){//n-sigma
543     Bool_t TPCon=TMath::Abs(2)>1e-4?kTRUE:kFALSE;
544     Bool_t TOFon=TMath::Abs(3)>1e-4?kTRUE:kFALSE;
545     
546     Bool_t isTPC=kTRUE;
547     Bool_t isTOF=kTRUE;
548
549     if (TPCon){//TPC
550       if(fPidHF->CheckStatus(track,"TPC")){
551         if(type==2) isTPC=fPidHF->IsPionRaw(track,"TPC");
552         if(type==3) isTPC=fPidHF->IsKaonRaw(track,"TPC");
553       }
554     }
555     if (TOFon){//TOF
556       if(fPidHF->CheckStatus(track,"TOF")){
557         if(type==2) isTOF=fPidHF->IsPionRaw(track,"TOF");
558         if(type==3) isTOF=fPidHF->IsKaonRaw(track,"TOF");
559       }
560     }
561
562     //--------------------------------
563     // cut on high momentum in the TPC
564     //--------------------------------
565     Double_t pPIDcut = track->P();
566     if(pPIDcut>fTPCflag) isTPC=1;
567     
568     isParticle = isTPC&&isTOF;
569   }
570   
571   if(fPidHF->GetMatch()==2){//bayesian
572     //Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
573     Double_t prob[5]={1.,1.,1.,1.,1.};
574     
575     //fPidHF->SetPriors(priors);
576     //    fPidHF->BayesianProbability(track,prob);
577     
578     Double_t max=0.;
579     Int_t k=-1;
580     for (Int_t i=0; i<5; i++) {
581       if (prob[i]>max) {k=i; max=prob[i];}
582     }
583     isParticle = Bool_t(k==type);
584   }
585   
586
587   return isParticle;
588   
589 }
590 //__________________________________________________________________________________-
591 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPP2010() {
592   //
593   //STANDARD CUTS USED FOR 2010 pp analysis 
594   //                                           
595   // Need to be updated for the final cut version
596   //
597
598   SetName("DStartoD0piCutsStandard");
599   SetTitle("Standard Cuts for D* analysis");
600   
601   // PILE UP REJECTION
602   SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
603
604   // EVENT CUTS
605   SetMinVtxContr(1);
606   
607   // CUTS ON SINGLE TRACKS
608   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
609   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
610   esdTrackCuts->SetRequireTPCRefit(kTRUE);
611   esdTrackCuts->SetRequireITSRefit(kTRUE);
612   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
613   esdTrackCuts->SetMinDCAToVertexXY(0.);
614   esdTrackCuts->SetEtaRange(-0.8,0.8);
615   esdTrackCuts->SetPtRange(0.3,1.e10);
616   
617   // CUTS on SOFT PION
618   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
619   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
620   esdSoftPicuts->SetRequireTPCRefit(kFALSE);
621   esdSoftPicuts->SetRequireITSRefit(kFALSE);
622   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
623                                           AliESDtrackCuts::kAny); 
624   esdSoftPicuts->SetPtRange(0.0,1.e10);
625
626   AddTrackCuts(esdTrackCuts);
627   AddTrackCutsSoftPi(esdSoftPicuts);
628   delete esdTrackCuts;
629   esdTrackCuts=NULL;
630   delete esdSoftPicuts;
631   esdSoftPicuts=NULL;
632
633   const Int_t nptbins =13;
634   const Double_t ptmax = 9999.;
635   const Int_t nvars=16;
636   Float_t ptbins[nptbins+1];
637   ptbins[0]=0.;
638   ptbins[1]=0.5;        
639   ptbins[2]=1.;
640   ptbins[3]=2.;
641   ptbins[4]=3.;
642   ptbins[5]=4.;
643   ptbins[6]=5.;
644   ptbins[7]=6.;
645   ptbins[8]=7.;
646   ptbins[9]=8.;
647   ptbins[10]=12.;
648   ptbins[11]=16.;
649   ptbins[12]=24.;
650   ptbins[13]=ptmax;
651
652   SetGlobalIndex(nvars,nptbins);
653   SetPtBins(nptbins+1,ptbins);
654   
655   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*/
656                                                   {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*/
657                                                   {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 */
658                                                   {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 */
659                                                   {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 */
660                                                   {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 */
661                                                   {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 */
662                                                   {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 */
663                                                   {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 */
664                                                   {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 */
665                                                   {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 */
666                                                   {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 */
667                                                   {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 */
668   
669   
670   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
671   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
672   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
673   
674   for (Int_t ibin=0;ibin<nptbins;ibin++){
675     for (Int_t ivar = 0; ivar<nvars; ivar++){
676       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
677     }
678   }
679   
680   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
681
682   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
683   delete [] cutsMatrixTransposeStand;
684   cutsMatrixTransposeStand=NULL;
685
686   // PID SETTINGS FOR D* analysis
687   AliAODPidHF* pidObj=new AliAODPidHF();
688   //pidObj->SetName("pid4DSatr");
689   Int_t mode=1;
690   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
691   pidObj->SetPriors(priors);
692   pidObj->SetMatch(mode);
693   pidObj->SetSigma(0,2); // TPC
694   pidObj->SetSigma(3,3); // TOF
695   pidObj->SetTPC(kTRUE);
696   pidObj->SetTOF(kTRUE);
697   
698   SetPidHF(pidObj);
699   SetUsePID(kTRUE);
700
701   PrintAll();
702
703   delete pidObj;
704   pidObj=NULL;
705
706   return;
707 }
708 //_____________________________________________________________________________-
709 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2010(){  
710   //
711   // TEMPORARY, WORK IN PROGRESS ... BUT WORKING! 
712   //
713   //  Lead Lead
714   //
715
716   SetName("DStartoD0piCutsStandard");
717   SetTitle("Standard Cuts for D* analysis in PbPb 2010");
718
719   // EVENT CUTS
720   SetMinVtxContr(1);
721   
722   // CUTS ON SINGLE TRACKS
723   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
724   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
725   esdTrackCuts->SetRequireTPCRefit(kTRUE);
726   esdTrackCuts->SetRequireITSRefit(kTRUE);
727   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
728   esdTrackCuts->SetMinDCAToVertexXY(0.);
729   esdTrackCuts->SetEtaRange(-0.8,0.8);
730   esdTrackCuts->SetPtRange(0.3,1.e10);
731   
732   // CUTS on SOFT PION
733   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
734   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
735   esdSoftPicuts->SetRequireTPCRefit(kTRUE);
736   esdSoftPicuts->SetRequireITSRefit(kTRUE);
737   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
738                                           AliESDtrackCuts::kAny); //test d0 asimmetry
739   esdSoftPicuts->SetPtRange(0.25,5);
740
741   AddTrackCuts(esdTrackCuts);
742   AddTrackCutsSoftPi(esdSoftPicuts);
743   delete esdTrackCuts;
744   esdTrackCuts=NULL;
745   delete esdSoftPicuts;
746   esdSoftPicuts=NULL;
747
748   const Int_t nptbins =13;
749   const Double_t ptmax = 9999.;
750   const Int_t nvars=16;
751   Float_t ptbins[nptbins+1];
752   ptbins[0]=0.;
753   ptbins[1]=0.5;        
754   ptbins[2]=1.;
755   ptbins[3]=2.;
756   ptbins[4]=3.;
757   ptbins[5]=4.;
758   ptbins[6]=5.;
759   ptbins[7]=6.;
760   ptbins[8]=7.;
761   ptbins[9]=8.;
762   ptbins[10]=12.;
763   ptbins[11]=16.;
764   ptbins[12]=24.;
765   ptbins[13]=ptmax;
766
767   SetGlobalIndex(nvars,nptbins);
768   SetPtBins(nptbins+1,ptbins);
769   
770   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*/
771                                                   {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*/
772                                                   {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 */
773                                                   {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 */
774                                                   {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 */
775                                                   {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 */
776                                                   {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 */
777                                                   {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 */
778                                                   {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 */
779                                                   {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 */
780                                                   {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 */
781                                                   {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 */
782                                                   {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 */
783   
784   
785   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
786   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
787   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
788   
789   for (Int_t ibin=0;ibin<nptbins;ibin++){
790     for (Int_t ivar = 0; ivar<nvars; ivar++){
791       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
792     }
793   }
794   
795   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
796
797   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
798   delete [] cutsMatrixTransposeStand;
799   cutsMatrixTransposeStand=NULL;
800   
801   // PID SETTINGS
802   AliAODPidHF* pidObj=new AliAODPidHF();
803   // pidObj->SetName("pid4DSatr");
804   Int_t mode=1;
805   Double_t priors[5]={0.01,0.001,0.3,0.3,0.3};
806   pidObj->SetPriors(priors);
807   pidObj->SetMatch(mode);
808   pidObj->SetSigma(0,2); // TPC
809   pidObj->SetSigma(3,3); // TOF
810   pidObj->SetTPC(kTRUE);
811   pidObj->SetTOF(kTRUE);
812   
813   SetPidHF(pidObj);
814   SetUsePID(kTRUE);
815
816   PrintAll();
817
818   delete pidObj;
819   pidObj=NULL;
820
821   return;
822
823 }
824
825 //_____________________________________________________________________________
826 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2011(){
827   //
828   // Not implemented !!
829   //
830   SetStandardCutsPbPb2011DStar(0);
831   return;
832 }
833 //_________________________________here the PbPb vs pt _________________________________________
834 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPbPb2011DStar(TH1F *hfl){
835
836   // Default 2010 PbPb cut object
837
838   SetName("DStartoD0piCutsStandard2011");
839   SetTitle("Standard Cuts for D* analysis in PbPb 2011");
840
841   // EVENT CUTS
842   SetMinVtxContr(1);
843   // MAX Z-VERTEX CUT
844   SetMaxVtxZ(10.);
845
846   SetTriggerClass("");
847   ResetMaskAndEnableMBTrigger();
848   EnableCentralTrigger();
849   EnableSemiCentralTrigger();
850
851   // CENTRALITY SELECTION
852   SetMinCentrality(0.);
853   SetMaxCentrality(10.);
854   SetUseCentrality(AliRDHFCuts::kCentV0M);
855
856   // CUTS ON SINGLE TRACKS
857   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
858   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
859   esdTrackCuts->SetRequireTPCRefit(kTRUE);
860   esdTrackCuts->SetRequireITSRefit(kTRUE);
861   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
862   esdTrackCuts->SetMinDCAToVertexXY(0.);
863   esdTrackCuts->SetEtaRange(-0.8,0.8);
864   esdTrackCuts->SetPtRange(0.3,1.e10);
865   
866   esdTrackCuts->SetMaxDCAToVertexXY(1.);  
867   esdTrackCuts->SetMaxDCAToVertexZ(1.);
868
869
870   // CUTS on SOFT PION
871   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
872   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
873   esdSoftPicuts->SetRequireTPCRefit(kTRUE);
874   esdSoftPicuts->SetRequireITSRefit(kTRUE);
875   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
876                                           AliESDtrackCuts::kAny); //test d0 asimmetry
877   esdSoftPicuts->SetPtRange(0.1,10);
878
879   esdSoftPicuts->SetMaxDCAToVertexXY(1.);  
880   esdSoftPicuts->SetMaxDCAToVertexZ(1.);
881
882   SetSelectCandTrackSPDFirst(kTRUE, 4);
883
884   //nothing below 3 GeV/c, speed up the calculation
885   SetMinPtCandidate(3.0);
886
887   AddTrackCuts(esdTrackCuts);
888   AddTrackCutsSoftPi(esdSoftPicuts);
889   delete esdTrackCuts;
890   esdTrackCuts=NULL;
891   delete esdSoftPicuts;
892   esdSoftPicuts=NULL;
893
894   const Int_t nptbins =14;
895   const Double_t ptmax = 36.;
896   const Int_t nvars=16;
897   Float_t ptbins[nptbins+1];
898   ptbins[0]=0.5;        
899   ptbins[1]=1.;
900   ptbins[2]=2.;
901   ptbins[3]=3.;
902   ptbins[4]=4.;
903   ptbins[5]=5.;
904   ptbins[6]=6.;
905   ptbins[7]=7.;
906   ptbins[8]=8.;
907   ptbins[9]=10.;
908   ptbins[10]=12.;
909   ptbins[11]=16.;
910   ptbins[12]=20.;
911   ptbins[13]=24.;
912   ptbins[14]=ptmax;
913
914   SetGlobalIndex(nvars,nptbins);
915   SetPtBins(nptbins+1,ptbins);
916   
917   Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.032,220.*1E-4,0.9,0.5,0.5,500.*1E-4,500.*1E-4,-16000.*1E-8,0.85,0.3,0.1,0.05,100,0.5,-1.,9.},/* 0.5<pt<1*/
918                                                   {0.032,350.*1E-4,0.9,0.5,0.5,800.*1E-4,800.*1E-4,-20000.*1E-8,0.96,0.3,0.15,0.05,100,0.5,0.99,10.},/* 1<pt<2 */
919                                                   {0.032,300.*1E-4,0.9,0.5,0.5,900.*1E-4,900.*1E-4,-42000.*1E-8,0.96,0.3,0.15,0.05,100,0.5,0.99,9.},/* 2<pt<3 */
920                                                   {0.036,300.*1E-4,0.8,0.8,0.8,900.*1E-4,900.*1E-4,-39000.*1E-8,0.99,0.3,0.15,0.05,100,0.5,0.998,8.},/* 3<pt<4 */
921                                                   {0.038,225.*1E-4,0.8,1.0,1.0,1000.*1E-4,1000.*1E-4,-30000.*1E-8,0.99,0.3,0.15,0.05,100,0.5,0.998,7.5},/* 4<pt<5 */
922                                                   {0.045,200.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,-23000.*1E-8,0.99,0.3,0.15,0.05,100,0.5,0.998,7.},/* 5<pt<6 */
923                                                   {0.045,210.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.982,0.3,0.15,0.05,100,0.5,0.998,6.4},/* 6<pt<7 */
924                                                   {0.050,230.*1E-4,1.0,1.0,1.0,1000.*1E-4,1000.*1E-4,-12700.*1E-8,0.98,0.3,0.15,0.05,100,0.5,0.998,6.4},/* 7<pt<8 */
925                                                   {0.060,200.*1E-4,1.0,0.9,0.9,1000.*1E-4,1000.*1E-4,-7500.*1E-8,0.98,0.3,0.15,0.05,100,0.5,0.998,4.7},/* 8<pt<10 */
926                                                   {0.060,200.*1E-4,1.0,0.9,0.9,1000.*1E-4,1000.*1E-4,-7500.*1E-8,0.97,0.3,0.15,0.05,100,1.0,0.998,4.7},/* 10<pt<12 */
927                                                   {0.074,200.*1E-4,1.0,0.5,0.5,1500.*1E-4,1500.*1E-4,-7500.*1E-8,0.95,0.3,0.15,0.05,100,1.0,0.998,3},/* 12<pt<16 */
928                                                   {0.074,210.*1E-4,1.0,0.5,0.5,1500.*1E-4,1500.*1E-4,-5000.*1E-8,0.95,0.3,0.15,0.05,100,1.0,0.998,2.},/* 16<pt<20 */
929                                                   {0.074,220.*1E-4,1.0,0.5,0.5,1500.*1E-4,1500.*1E-4,-5000.*1E-8,0.93,0.3,0.15,0.05,100,1.0,0.995,2.},/* 20<pt<24 */
930                                                   {0.074,400.*1E-4,1.0,0.5,0.5,2000.*1E-4,2000.*1E-4,40000.*1E-8,0.7,0.3,0.15,0.05,100,1.0,0.9,1.}};/* 24<pt<36 */
931   
932   
933   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
934   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
935   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
936   
937   for (Int_t ibin=0;ibin<nptbins;ibin++){
938     for (Int_t ivar = 0; ivar<nvars; ivar++){
939       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
940     }
941   }
942   
943   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
944
945   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
946   delete [] cutsMatrixTransposeStand;
947   cutsMatrixTransposeStand=NULL;
948   
949   // PID SETTINGS // --- 
950   AliAODPidHF* pidObj=new AliAODPidHF();
951   // pidObj->SetName("pid4DSatr");
952   Int_t mode=1;
953
954   pidObj->SetMatch(mode);
955   pidObj->SetSigma(0,3); // TPC -- 2 sigma for pt < 4
956   pidObj->SetSigma(3,3); // TOF
957   pidObj->SetTPC(kTRUE);
958   pidObj->SetTOF(kTRUE);
959   pidObj->SetOldPid(kFALSE);
960   
961   SetPidHF(pidObj);
962   SetUsePID(kTRUE);
963
964   // PID off for tracks with pt above 4 GeV/c
965   SetOffHighPtPIDinTPC(4.0);
966   SetRemoveDaughtersFromPrim(kFALSE);
967   // flattening
968   SetHistoForCentralityFlattening(hfl,0.,10,0.,0);
969
970   PrintAll();
971
972   delete pidObj;
973   pidObj=NULL;
974
975
976   return;
977 }
978 //-----------------------------------Here the multiplicity pp--------------------------------
979
980 void  AliRDHFCutsDStartoKpipi::SetStandardCutsPP2010DStarMult(Bool_t rec){
981
982
983  //
984   // STANDARD CUTS USED FOR 2010 pp analysis (multiplicity)
985   //                                           
986   //
987
988   SetName("DStartoD0piCutsStandard");
989   SetTitle("Standard Cuts for D* analysis pp mult");
990   
991   // PILE UP REJECTION
992   SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
993
994   // EVENT CUTS
995   SetMinVtxContr(1);
996    // MAX Z-VERTEX CUT
997   SetMaxVtxZ(10.);
998
999   // CUTS ON SINGLE TRACKS
1000   AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1001   esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1002   esdTrackCuts->SetRequireTPCRefit(kTRUE);
1003   esdTrackCuts->SetRequireITSRefit(kTRUE);
1004   esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1005   esdTrackCuts->SetMinDCAToVertexXY(0.);
1006   esdTrackCuts->SetEtaRange(-0.8,0.8);
1007   esdTrackCuts->SetPtRange(0.3,1.e10);
1008
1009   esdTrackCuts->SetMaxDCAToVertexXY(1.);  
1010   esdTrackCuts->SetMaxDCAToVertexZ(1.);
1011
1012   
1013   // CUTS on SOFT PION
1014   AliESDtrackCuts* esdSoftPicuts=new AliESDtrackCuts();
1015   esdSoftPicuts->SetRequireSigmaToVertex(kFALSE);
1016   esdSoftPicuts->SetRequireTPCRefit(kFALSE);
1017   esdSoftPicuts->SetRequireITSRefit(kTRUE);
1018   esdSoftPicuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1019                                           AliESDtrackCuts::kAny); 
1020   esdSoftPicuts->SetPtRange(0.08,1.e10);
1021   SetUseCentrality(kFALSE);
1022
1023   AddTrackCuts(esdTrackCuts);
1024   AddTrackCutsSoftPi(esdSoftPicuts);
1025   delete esdTrackCuts;
1026   esdTrackCuts=NULL;
1027   delete esdSoftPicuts;
1028   esdSoftPicuts=NULL;
1029
1030   const Int_t nptbins =14;
1031   const Double_t ptmax = 9999.;
1032   const Int_t nvars=16;
1033   Float_t ptbins[nptbins+1];
1034   ptbins[0]=0.;
1035   ptbins[1]=0.5;        
1036   ptbins[2]=1.;
1037   ptbins[3]=2.;
1038   ptbins[4]=3.;
1039   ptbins[5]=4.;
1040   ptbins[6]=5.;
1041   ptbins[7]=6.;
1042   ptbins[8]=7.;
1043   ptbins[9]=8.;
1044   ptbins[10]=10.;
1045   ptbins[11]=12.;
1046   ptbins[12]=16.;
1047   ptbins[13]=20.;
1048   ptbins[14]=ptmax;
1049
1050   SetGlobalIndex(nvars,nptbins);
1051   SetPtBins(nptbins+1,ptbins);
1052   
1053   Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.026,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*/
1054                                                   {0.039,300.*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*/
1055                                                   {0.022,400.*1E-4,0.8,0.7,0.7,800.*1E-4,800.*1E-4,-20000.*1E-8,0.8,0.3,0.3,0.05,100,0.5,-1.,0.},/* 1<pt<2 */
1056                                                   {0.032,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-13000.*1E-8,0.9,0.3,0.3,0.05,100,0.8,-1.,0.},/* 2<pt<3 */
1057                                                   {0.032,500.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.9,0.3,0.3,0.05,100,0.8,-1.,0.},/* 3<pt<4 */
1058                                                   {0.032,700.*1E-4,0.9,0.9,0.9,1000.*1E-4,1000.*1E-4,10000.*1E-8,0.9,0.3,0.3,0.05,100,1.0,-1.,0.},/* 4<pt<5 */
1059                                                   {0.036,1000.*1E-4,1.0,0.8,0.8,1000.*1E-4,1000.*1E-4,50000.*1E-8,0.9,0.3,0.3,0.05,100,1.0,-1.,0.},/* 5<pt<6 */
1060                                                   {0.036,1000.*1E-4,1.0,0.8,0.8,1000.*1E-4,1000.*1E-4,100000.*1E-8,0.7,0.3,0.3,0.05,100,1.0,-1.,0.},/* 6<pt<7 */
1061                                                   {0.036,1000.*1E-4,1.0,0.8,0.8,1200.*1E-4,1200.*1E-4,100000.*1E-8,0.6,0.3,0.3,0.05,100,1.0,-1.,0.},/* 7<pt<8 */
1062                                                   {0.065,2000.*1E-4,1.0,0.3,0.3,2000.*1E-4,2000.*1E-4,1000000.*1E-8,0.5,0.3,0.3,0.05,100,1.0,-1.,0.},/* 8<pt<10 */
1063                                                   {0.075,2000.*1E-4,1.0,0.3,0.3,2000.*1E-4,2000.*1E-4,1000000.*1E-8,0.3,0.3,0.3,0.05,100,1.0,-1.,0.},/* 10<pt<12 */
1064                                                   {0.084,6000.*1E-4,1.0,0.3,0.3,1500.*1E-4,1500.*1E-4,1000000.*1E-8,0.1,0.3,0.1,0.05,100,1.0,-1.,0.},/* 12<pt<16 */
1065                                                   {0.084,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,1.0,-1.,0.},/* 16<pt<20 */
1066                                                   {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,1.0,-1.,0.}};/* pt>24 */
1067   
1068   
1069   //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1070   Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1071   for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1072   
1073   for (Int_t ibin=0;ibin<nptbins;ibin++){
1074     for (Int_t ivar = 0; ivar<nvars; ivar++){
1075       cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];      
1076     }
1077   }
1078   
1079   SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1080
1081   for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1082   delete [] cutsMatrixTransposeStand;
1083   cutsMatrixTransposeStand=NULL;
1084
1085   // remove daughters from primary vertex
1086   SetRemoveDaughtersFromPrim(rec);
1087
1088   // PID SETTINGS FOR D* analysis
1089   AliAODPidHF* pidObj=new AliAODPidHF();
1090   //pidObj->SetName("pid4DSatr");
1091   Int_t mode=1;
1092   pidObj->SetMatch(mode);
1093   pidObj->SetSigma(0,3); // TPC
1094   pidObj->SetSigma(3,3); // TOF
1095   pidObj->SetTPC(kTRUE);
1096   pidObj->SetTOF(kTRUE);
1097   
1098   SetPidHF(pidObj);
1099   SetUsePID(kTRUE);
1100   pidObj->SetOldPid(kTRUE);
1101
1102   PrintAll();
1103
1104   delete pidObj;
1105   pidObj=NULL;
1106
1107   return;
1108
1109
1110 }