Configuration
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / configs / PbPb / ConfigHFE_FLOW_TOFTPC.C
1 AliAnalysisTaskHFEFlow* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, Int_t tpcCls, Double_t tpcClsr,Int_t tpcClspid, Double_t tpcsharedfraction, Int_t itsCls, Double_t chi2peritscl, Int_t pixellayer, Double_t dcaxy, Double_t dcaz,  Double_t tofsig, Double_t tpcdedx0, Double_t tpcdedx1, Double_t tpcdedx2, Double_t tpcdedx3, Double_t tpcdedx4,Double_t tpcdedx5, Double_t tpcdedx6, Double_t tpcdedx7, Int_t vzero, Int_t debuglevel,Bool_t algorithmMA=kFALSE, Bool_t massconstraint=kFALSE)
2 {
3   //
4   // HFE flow task 
5   //
6   printf("Summary settings flow task\n");
7   printf("TPC number of tracking clusters %d\n",tpcCls);
8   printf("TPC ratio clusters %f\n",tpcClsr*0.01);
9   printf("TPC number of pid clusters %d\n",tpcClspid);
10   printf("Maximal fraction of TPC shared cluster %f\n",tpcsharedfraction*0.01);
11   printf("ITS number of clusters %d\n",itsCls);
12   printf("Maximal chi2 per ITS cluster %f\n",chi2peritscl);
13   printf("Requirement on the pixel layer %d\n",pixellayer);
14   printf("dcaxy %f\n",dcaxy*0.01);
15   printf("dcaz %f\n",dcaz*0.01);
16   printf("TOF sigma %f\n",tofsig*0.1);
17   printf("TPC min sigma cut 0: %f\n",tpcdedx0*0.001);
18   printf("TPC min sigma cut 1: %f\n",tpcdedx1*0.001);
19   printf("TPC min sigma cut 2: %f\n",tpcdedx2*0.001);
20   printf("TPC min sigma cut 3: %f\n",tpcdedx3*0.001);
21   printf("TPC min sigma cut 4: %f\n",tpcdedx4*0.001);
22   printf("TPC min sigma cut 5: %f\n",tpcdedx5*0.001);
23   printf("TPC min sigma cut 6: %f\n",tpcdedx6*0.001);
24   printf("TPC min sigma cut 7: %f\n",tpcdedx7*0.001);
25   printf("VZERO event plane %d\n",vzero);
26   printf("Debug level %d\n",debuglevel);
27   printf("AlgorithmMA %d\n",(Int_t)algorithmMA);
28   printf("Mass constraint %d\n",(Int_t)massconstraint);
29
30   Int_t nameTPCcut = 50; // 50% at the moment
31   // can be adjusting looking at the value of the cut
32
33   
34   // Cut HFE
35   AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
36   hfecuts->CreateStandardCuts();
37   hfecuts->SetMinNClustersTPC(tpcCls);
38   hfecuts->SetMinNClustersTPCPID(tpcClspid);
39   hfecuts->SetMinRatioTPCclusters(tpcClsr*0.01);
40   hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
41   hfecuts->SetFractionOfSharedTPCClusters(tpcsharedfraction*0.01);
42   hfecuts->SetMinNClustersITS(itsCls);
43   hfecuts->SetCutITSpixel(pixellayer);
44   hfecuts->SetCheckITSLayerStatus(kFALSE);
45   hfecuts->SetMaxImpactParam(dcaxy*0.01,dcaz*0.01);
46       
47   //hfecuts->UnsetVertexRequirement();
48   hfecuts->SetVertexRange(10.);
49   
50   hfecuts->SetTOFPIDStep(kTRUE);
51
52   // Cut HFE background
53   AliESDtrackCuts *hfeBackgroundCuts = new AliESDtrackCuts();
54   hfeBackgroundCuts->SetName("backgroundcuts");
55   hfeBackgroundCuts->SetAcceptKinkDaughters(kFALSE);
56   hfeBackgroundCuts->SetRequireTPCRefit(kTRUE);
57   hfeBackgroundCuts->SetEtaRange(-0.9,0.9);
58   hfeBackgroundCuts->SetRequireSigmaToVertex(kTRUE);
59   hfeBackgroundCuts->SetMaxChi2PerClusterTPC(4.0);
60   hfeBackgroundCuts->SetMinNClustersTPC(50);
61   hfeBackgroundCuts->SetPtRange(0.3,1e10);
62
63   // Name
64   TString appendix(TString::Format("TPC%dTPCr%dTPCpid%dTPCShared%dITScl%dChi2perITS%dPixelLayer%dDCAr%dz%dTOFsig%dTPCeff%dVZERO%dDebugLevel%dalgo%dm%d",tpcCls,(Int_t)tpcClsr,tpcClspid,(Int_t) tpcsharedfraction,itsCls,(Int_t) chi2peritscl,(Int_t) pixellayer,(Int_t)dcaxy,(Int_t)dcaz,(Int_t)tofsig,(Int_t)nameTPCcut,vzero,debuglevel,(Int_t)algorithmMA,(Int_t)massconstraint));
65   printf("appendix %s\n", appendix.Data());
66   
67   // The task
68   AliAnalysisTaskHFEFlow *task = new AliAnalysisTaskHFEFlow(Form("HFEFlowtask_%s", appendix.Data()));
69   task->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral); 
70   task->SetDebugLevel(1);
71   task->GetPIDQAManager()->SetHighResolutionHistos();
72   task->SetHFECuts(hfecuts);
73   task->SetHFEBackgroundCuts(hfeBackgroundCuts);
74   if(useMC) {
75     task->SetMCPID(kTRUE);
76     task->SetUseMCReactionPlane(kTRUE);
77     task->SetAfterBurnerOn(kTRUE);
78     task->SetV1V2V3V4V5(0.0,0.2,0.0,0.0,0.0);
79   }
80   if(vzero>=1) task->SetVZEROEventPlane(kTRUE);
81   if(vzero==2) task->SetVZEROEventPlaneA(kTRUE);
82   if(vzero==3) task->SetVZEROEventPlaneC(kTRUE);
83   task->SetDebugLevel(debuglevel);
84
85   // Define PID
86   AliHFEpid *pid = task->GetPID();
87   if(useMC) pid->SetHasMCData(kTRUE);
88   pid->AddDetector("TOF", 0);
89   pid->AddDetector("TPC", 1);
90
91   if(!useMC) {
92     
93     Double_t params_centr_0_5[1];
94     Double_t params_centr_5_10[1];
95     Double_t params_centr_10_20[1];
96     Double_t params_centr_20_30[1];
97     Double_t params_centr_30_40[1];
98     Double_t params_centr_40_50[1];
99     Double_t params_centr_50_60[1];
100     Double_t params_centr_per[1];
101     params_centr_0_5[0]=tpcdedx0*0.001;  // cut tuned for 0-10%
102     params_centr_5_10[0]=tpcdedx1*0.001; // cut tuned for 0-10%
103     params_centr_10_20[0]=tpcdedx2*0.001;
104     params_centr_20_30[0]=tpcdedx3*0.001;
105     params_centr_30_40[0]=tpcdedx4*0.001;
106     params_centr_40_50[0]=tpcdedx5*0.001;
107     params_centr_50_60[0]=tpcdedx6*0.001;
108     params_centr_per[0]=tpcdedx4*0.001;
109     
110     char *cutmodel;
111     cutmodel="pol0";
112     
113     for(Int_t a=0;a<11;a++)
114       {
115         
116         if(a>6)  pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,3.0);      //  60-80%
117         if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,3.0);      //  0-5%
118         if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,3.0);     //  5-10%
119         if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,3.0);    //  10-20%
120         if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,3.0);    //  20-30%
121         if(a==4) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_30_40,3.0);    //  30-40%
122         if(a==5) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_40_50,3.0);    //  40-50%
123         if(a==6) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_50_60,3.0);    //  50-60%
124       
125       }
126     
127   }
128
129   pid->ConfigureTOF(tofsig*0.1);
130
131   // Define PID TOF Only
132   AliHFEpid *pidTOFOnly = task->GetPIDTOFOnly();
133   if(useMC) pidTOFOnly->SetHasMCData(kTRUE);
134   pidTOFOnly->AddDetector("TOF", 0);
135   pidTOFOnly->ConfigureTOF(tofsig*0.1);
136
137   // Define PID background
138   AliHFEpid *pidbackground = task->GetPIDBackground();
139   if(useMC) pidbackground->SetHasMCData(kTRUE);
140   //pidbackground->AddDetector("TOF", 0);
141   pidbackground->AddDetector("TPC", 1);
142   //pidbackground->ConfigureTOF(3.0);
143   pidbackground->ConfigureTPCasymmetric(0.0,9999.,-2.0,5.0);
144   task->SetMaxopeningtheta(9999.0);
145   task->SetMaxopeningphi(9999.0);
146   task->SetMaxopening3D(0.5);
147   task->SetAlgorithmMA(algorithmMA);
148   task->SetMassConstraint(massconstraint);
149   
150   printf("*************************************\n");
151   printf("Configuring standard Task:\n");
152   task->Print();
153   pid->PrintStatus();
154   printf("*************************************\n"); 
155   return task;
156
157 }