]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TOFTPC.C
TPC PID 2011
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / configs / PbPb / ConfigHFE_FLOW_TOFTPC.C
CommitLineData
bab17338 1TF1* GetCentralityCorrection(TString listname="LHC11h"){
2
3 TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/CentCorrMapsTPC.root";
4
5 if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){
6 Error("ConfigHFEpbpb","Eta map not found: %s",etaMap.Data());
7 return 0;
8 }
9
10 TFile f(etaMap.Data());
11 if (!f.IsOpen()) return 0;
12 gROOT->cd();
13 TList *keys=f.GetListOfKeys();
14
15 for (Int_t i=0; i<keys->GetEntries(); ++i){
16 TString kName=keys->At(i)->GetName();
17 TPRegexp reg(kName);
18 if (reg.MatchB(listname)){
19 printf("Using Eta Correction Function: %s\n",kName.Data());
20 return (TF1*)f.Get(kName.Data());
21 }
22 }
23 return 0;
24}
2747660f 25TF1* GetEtaCorrection(TString listname="LHC11h"){
26
bab17338 27 TString etaMap="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/EtaCorrMapsTPC.root";
2747660f 28
29 if (gSystem->AccessPathName(gSystem->ExpandPathName(etaMap.Data()))){
30 Error("ConfigHFEpbpb","Eta map not found: %s",etaMap.Data());
31 return 0;
32 }
33
34 TFile f(etaMap.Data());
35 if (!f.IsOpen()) return 0;
36 gROOT->cd();
37 TList *keys=f.GetListOfKeys();
38
39 for (Int_t i=0; i<keys->GetEntries(); ++i){
40 TString kName=keys->At(i)->GetName();
41 TPRegexp reg(kName);
42 if (reg.MatchB(listname)){
43 printf("Using Eta Correction Function: %s\n",kName.Data());
44 return (TF1*)f.Get(kName.Data());
45 }
46 }
47 return 0;
48}
6b2521a4 49TF1* Getv2Contamination_30_40(){
50
51 TString v2Map="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/raw_TF1_pi_v2_3040.root";
2747660f 52 //TString v2Map="$TRAIN_ROOT/bailhach_backgroundhfe/raw_TF1_pi_v2_3040.root";
6b2521a4 53 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
54
55 if (gSystem->AccessPathName(gSystem->ExpandPathName(v2Map.Data()))){
56 //Error("ConfigPbPb2010_Cent","v2 map not found: %s",v2Map.Data());
57 return 0;
58 }
59
60 TFile f(v2Map.Data());
61 if (!f.IsOpen()) return 0;
62 gROOT->cd();
63 TF1 *fg = (TF1 *) f.Get("flogisticTadd");
64 return fg;
65
66}
67
68TF1* Getv2Contamination_40_50(){
69
70 TString v2Map="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/raw_TF1_pi_v2_4050.root";
2747660f 71 //TString v2Map="$TRAIN_ROOT/bailhach_backgroundhfe/raw_TF1_pi_v2_4050.root";
6b2521a4 72 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
73
74 if (gSystem->AccessPathName(gSystem->ExpandPathName(v2Map.Data()))){
75 //Error("ConfigPbPb2010_Cent","v2 map not found: %s",v2Map.Data());
76 return 0;
77 }
78
79 TFile f(v2Map.Data());
80 if (!f.IsOpen()) return 0;
81 gROOT->cd();
82 TF1 *fg = (TF1 *) f.Get("flogisticTadd");
83 return fg;
84
85}
86
87
88TF1* Getv2Contamination_20_30(){
89
90 TString v2Map="$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/raw_TF1_pi_v2_2030.root";
2747660f 91 //TString v2Map="$TRAIN_ROOT/bailhach_backgroundhfe/raw_TF1_pi_v2_2030.root";
6b2521a4 92 TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
93
94 if (gSystem->AccessPathName(gSystem->ExpandPathName(v2Map.Data()))){
95 //Error("ConfigPbPb2010_Cent","v2 map not found: %s",v2Map.Data());
96 return 0;
97 }
98
99 TFile f(v2Map.Data());
100 if (!f.IsOpen()) return 0;
101 gROOT->cd();
102 TF1 *fg = (TF1 *) f.Get("flogisticTadd");
103 return fg;
104
105}
106
48a7dac2 107Double_t Contamination_40_50(const Double_t *x, const Double_t *par)
108{
109
110 if(x[0] < 2.5) return 0.0326072;
111 Double_t value = -0.00908646-0.00201815*x[0]+0.0026871*x[0]*x[0];
112 if(x[0] >= 2.5) return value;
113
2747660f 114
48a7dac2 115}
109ed76d 116AliAnalysisTaskFlowTPCTOFEPSP* ConfigHFE_FLOW_TOFTPC(Bool_t useMC, TString appendix,Int_t trigger,Int_t aodfilter=-1,Bool_t scalarProduct=kFALSE,Bool_t cutPileup=kTRUE,Int_t variableM = 1,Int_t tpcCls=110, Double_t tpcClsr=60.,Int_t tpcClspid=80, Int_t itsCls=4, Int_t pixellayer=2, Double_t dcaxy=100., Double_t dcaz=200., Double_t tofsig=30., Double_t *tpcdedx=NULL, Int_t vzero=1, Int_t debuglevel=0, Double_t etarange=80, Bool_t withetacorrection=kFALSE, Bool_t withmultcorrection=kFALSE, Double_t ITSclustersback=0,Double_t minTPCback=-2.0,Double_t maxTPCback=5.0)
d84c68e9 117{
118 //
119 // HFE flow task
120 //
f66a9089 121 Double_t tpcsharedfraction=11;
122 Double_t chi2peritscl=36.;
123
d84c68e9 124 printf("Summary settings flow task\n");
2747660f 125 printf("filter %d\n",aodfilter);
d84c68e9 126 printf("TPC number of tracking clusters %d\n",tpcCls);
c216e461 127 printf("TPC ratio clusters %f\n",tpcClsr*0.01);
d84c68e9 128 printf("TPC number of pid clusters %d\n",tpcClspid);
c216e461 129 printf("Maximal fraction of TPC shared cluster %f\n",tpcsharedfraction*0.01);
d84c68e9 130 printf("ITS number of clusters %d\n",itsCls);
c216e461 131 printf("Maximal chi2 per ITS cluster %f\n",chi2peritscl);
132 printf("Requirement on the pixel layer %d\n",pixellayer);
133 printf("dcaxy %f\n",dcaxy*0.01);
134 printf("dcaz %f\n",dcaz*0.01);
d84c68e9 135 printf("TOF sigma %f\n",tofsig*0.1);
ae23886f 136 printf("TPC min sigma cut 0: %f\n",tpcdedx[0]);
137 printf("TPC min sigma cut 1: %f\n",tpcdedx[1]);
138 printf("TPC min sigma cut 2: %f\n",tpcdedx[2]);
139 printf("TPC min sigma cut 3: %f\n",tpcdedx[3]);
140 printf("TPC min sigma cut 4: %f\n",tpcdedx[4]);
141 printf("TPC min sigma cut 5: %f\n",tpcdedx[5]);
142 printf("TPC min sigma cut 6: %f\n",tpcdedx[6]);
143 printf("TPC min sigma cut 7: %f\n",tpcdedx[7]);
d84c68e9 144 printf("VZERO event plane %d\n",vzero);
c216e461 145 printf("Debug level %d\n",debuglevel);
7d001adf 146 printf("Etarange %f\n",etarange*0.01);
2747660f 147 printf("TPC dE/dx Eta correction %d\n",withetacorrection);
bab17338 148 printf("TPC dE/dx multiplicity correction %d\n",withmultcorrection);
2747660f 149 printf("Number of ITS back clusters %d\n",(Int_t)ITSclustersback);
150 printf("Min TPC back %f\n",minTPCback);
151 printf("Max TPC back %f\n",maxTPCback);
f66a9089 152 printf("PileUp cut %d\n",cutPileup);
153 printf("Scalar Product %d\n",scalarProduct);
26c85092 154
d84c68e9 155 // Cut HFE
156 AliHFEcuts *hfecuts = new AliHFEcuts("hfeCuts","HFE Standard Cuts");
157 hfecuts->CreateStandardCuts();
7d001adf 158 hfecuts->SetEtaRange(etarange*0.01);
d84c68e9 159 hfecuts->SetMinNClustersTPC(tpcCls);
160 hfecuts->SetMinNClustersTPCPID(tpcClspid);
c216e461 161 hfecuts->SetMinRatioTPCclusters(tpcClsr*0.01);
d84c68e9 162 hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
c216e461 163 hfecuts->SetFractionOfSharedTPCClusters(tpcsharedfraction*0.01);
d84c68e9 164 hfecuts->SetMinNClustersITS(itsCls);
c216e461 165 hfecuts->SetCutITSpixel(pixellayer);
d84c68e9 166 hfecuts->SetCheckITSLayerStatus(kFALSE);
c216e461 167 hfecuts->SetMaxImpactParam(dcaxy*0.01,dcaz*0.01);
5a30a273 168 hfecuts->SetPtRange(0.1,10.);
169 hfecuts->SetAcceptKinkMothers();
d84c68e9 170
d84c68e9 171 hfecuts->SetVertexRange(10.);
f66a9089 172 hfecuts->SetUseSPDVertex(kTRUE);
173 hfecuts->SetUseCorrelationVertex();
d84c68e9 174
175 hfecuts->SetTOFPIDStep(kTRUE);
176
0e30407a 177 // Cut HFE background
178 AliESDtrackCuts *hfeBackgroundCuts = new AliESDtrackCuts();
179 hfeBackgroundCuts->SetName("backgroundcuts");
2747660f 180 //hfeBackgroundCuts->SetAcceptKinkDaughters(kFALSE);
0e30407a 181 hfeBackgroundCuts->SetRequireTPCRefit(kTRUE);
2747660f 182 hfeBackgroundCuts->SetRequireITSRefit(kTRUE);
183 if(ITSclustersback>0) hfeBackgroundCuts->SetMinNClustersITS(ITSclustersback);
184 hfeBackgroundCuts->SetEtaRange(-0.8,0.8);
0e30407a 185 hfeBackgroundCuts->SetRequireSigmaToVertex(kTRUE);
2747660f 186 hfeBackgroundCuts->SetMaxChi2PerClusterTPC(3.5);
187 hfeBackgroundCuts->SetMinNClustersTPC(100);
188 hfeBackgroundCuts->SetPtRange(0.5,1e10);
ae23886f 189
d84c68e9 190 // Name
d84c68e9 191 printf("appendix %s\n", appendix.Data());
192
193 // The task
785288a1 194 AliAnalysisTaskFlowTPCTOFEPSP *task = new AliAnalysisTaskFlowTPCTOFEPSP(Form("HFE_%s", appendix.Data()));
109ed76d 195 //task->SelectCollisionCandidates(trigger);
196 task->SetTriggerUsed(trigger);
d84c68e9 197 task->SetDebugLevel(1);
109ed76d 198 task->SetVariableMultiplicity(variableM);
bab17338 199 task->GetPIDQAManager()->SetHighResolutionEtaHistos();
200 task->GetPIDQAManager()->SetMidResolutionHistos();
201 task->GetPIDQAManager()->SetFillMultiplicity();
d84c68e9 202 task->SetHFECuts(hfecuts);
0e30407a 203 task->SetHFEBackgroundCuts(hfeBackgroundCuts);
2747660f 204 if(aodfilter > 0) {
205 printf("ON AOD filter %d\n",aodfilter);
2747660f 206 task->SetFilter(aodfilter);
207 }
208 else {
5a30a273 209 printf("Default AOD filter 1<<4\n");
2747660f 210 }
d84c68e9 211 if(useMC) {
212 task->SetMCPID(kTRUE);
ae23886f 213 //task->SetUseMCReactionPlane(kTRUE);
d84c68e9 214 task->SetAfterBurnerOn(kTRUE);
215 task->SetV1V2V3V4V5(0.0,0.2,0.0,0.0,0.0);
216 }
217 if(vzero>=1) task->SetVZEROEventPlane(kTRUE);
218 if(vzero==2) task->SetVZEROEventPlaneA(kTRUE);
219 if(vzero==3) task->SetVZEROEventPlaneC(kTRUE);
ae23886f 220 if((vzero==4) && useMC) task->SetUseMCReactionPlane(kTRUE);
221
222 // Debug level
c216e461 223 task->SetDebugLevel(debuglevel);
ae23886f 224 if(debuglevel==1) task->SetMonitorEventPlane(kTRUE);
225 if(debuglevel==2) task->SetMonitorContamination(kTRUE);
226 if(debuglevel==3) task->SetMonitorPhotonic(kTRUE);
227 if(debuglevel==4) task->SetMonitorWithoutPID(kTRUE);
228 if(debuglevel==5) task->SetMonitorTrackCuts(kTRUE);
229 if(debuglevel==6) task->SetMonitorQCumulant(kTRUE);
230
d84c68e9 231
232 // Define PID
233 AliHFEpid *pid = task->GetPID();
234 if(useMC) pid->SetHasMCData(kTRUE);
235 pid->AddDetector("TOF", 0);
236 pid->AddDetector("TPC", 1);
bab17338 237
238 if(withetacorrection || withmultcorrection) {
239 AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
240 TF1 *etaCorr = GetEtaCorrection();
241 if(etaCorr && withetacorrection){
242 tpcpid->SetEtaCorrection(etaCorr);
243 printf("TPC dE/dx Eta correction %p\n",etaCorr);
244 }
245 TF1 *centCorr = GetCentralityCorrection();
246 if(centCorr && withmultcorrection){
247 tpcpid->SetCentralityCorrection(centCorr);
248 printf("TPC dE/dx multiplicity correction %p\n",centCorr);
249 }
250 }
251
f66a9089 252 task->SetPileUpCut(cutPileup);
253 task->SetUseSP(scalarProduct);
2747660f 254
ae23886f 255 //pid->AddDetector("BAYES", 0);
256 //pid->ConfigureBayesDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF+AliPIDResponse::kDetTRD);
257 //pid->ConfigureBayesPIDThreshold(0.9);
258
259
260 TString datatype=gSystem->Getenv("CONFIG_FILE");
261
d84c68e9 262 if(!useMC) {
263
264 Double_t params_centr_0_5[1];
265 Double_t params_centr_5_10[1];
266 Double_t params_centr_10_20[1];
267 Double_t params_centr_20_30[1];
26c85092 268 Double_t params_centr_30_40[1];
269 Double_t params_centr_40_50[1];
270 Double_t params_centr_50_60[1];
d84c68e9 271 Double_t params_centr_per[1];
ae23886f 272
273 params_centr_0_5[0]=tpcdedx[0]; // cut tuned for 0-5%
274 params_centr_5_10[0]=tpcdedx[1]; // cut tuned for 5-10%
275 params_centr_10_20[0]=tpcdedx[2];
276 params_centr_20_30[0]=tpcdedx[3];
277 params_centr_30_40[0]=tpcdedx[4];
278 params_centr_40_50[0]=tpcdedx[5];
279 params_centr_50_60[0]=tpcdedx[6];
280 params_centr_per[0]=tpcdedx[7];
d84c68e9 281
282 char *cutmodel;
283 cutmodel="pol0";
284
285 for(Int_t a=0;a<11;a++)
286 {
26c85092 287 if(a>6) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_per,3.0); // 60-80%
288 if(a==0) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_0_5,3.0); // 0-5%
289 if(a==1) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_5_10,3.0); // 5-10%
d84c68e9 290 if(a==2) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_10_20,3.0); // 10-20%
291 if(a==3) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_20_30,3.0); // 20-30%
26c85092 292 if(a==4) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_30_40,3.0); // 30-40%
293 if(a==5) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_40_50,3.0); // 40-50%
294 if(a==6) pid->ConfigureTPCcentralityCut(a,cutmodel,params_centr_50_60,3.0); // 50-60%
d84c68e9 295 }
296
297 }
298
ae23886f 299 if(tofsig>0.) pid->ConfigureTOF(tofsig*0.1);
300
301 AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
302 if(tofsig<=0.) {
303 Double_t uppercuttof = TMath::Abs(tofsig)*0.1;
304 Double_t paramsTOFlowercut[12] ={-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0};
305 Double_t paramsTOFuppercut[12] ={uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof,uppercuttof};
306 for(Int_t a=0;a<11;a++)
307 {
308 tofpid->SetTOFnSigmaBandCentrality(paramsTOFlowercut[a],paramsTOFuppercut[a],a);
309 }
310 }
0e30407a 311
2747660f 312
313 // Define hadron contamination (Only for 2011, TPC middle)
48a7dac2 314 TF1 *hBackground_20_30 = new TF1("hadronicBackgroundFunction_20_30","[0]+[1]*x+[2]*x*x+[3]*x*x*x", 0., 200.);
315 hBackground_20_30->SetParameter(0, -0.165789);
316 hBackground_20_30->SetParameter(1, 0.218694);
317 hBackground_20_30->SetParameter(2, -0.076635);
318 hBackground_20_30->SetParameter(3, 0.00947502);
319 task->SetContamination(hBackground_20_30,3);
320 TF1 *fv2_20_30 = Getv2Contamination_20_30();
2747660f 321 if(fv2_20_30) {
322 fv2_20_30->SetName("fv2_20_30");
323 task->SetV2Contamination(fv2_20_30,3);
324 }
6733d981 325 // 30-40%
48a7dac2 326 TF1 *hBackground_30_40 = new TF1("hadronicBackgroundFunction_30_40","[0]+[1]*x+[2]*x*x+[3]*x*x*x", 0., 200.);
327 hBackground_30_40->SetParameter(0, -0.072222);
328 hBackground_30_40->SetParameter(1, 0.132098);
329 hBackground_30_40->SetParameter(2, -0.0561759);
330 hBackground_30_40->SetParameter(3, 0.00789356);
331 task->SetContamination(hBackground_30_40,4);
332 TF1 *fv2_30_40 = Getv2Contamination_30_40();
2747660f 333 if(fv2_30_40) {
334 fv2_30_40->SetName("fv2_30_40");
335 task->SetV2Contamination(fv2_30_40,4);
336 }
6b2521a4 337 // 40-50%
48a7dac2 338 TF1 *hBackground_40_50 = new TF1("hadronicBackgroundFunction_40_50",Contamination_40_50,0.,200.,0);
2747660f 339 printf("contamination 5 in pt range 0.5 %f\n",hBackground_40_50->Eval(0.5));
340 printf("contamination 5 in pt range 1.5 %f\n",hBackground_40_50->Eval(1.5));
341 printf("contamination 5 in pt range 3.5 %f\n",hBackground_40_50->Eval(3.5));
48a7dac2 342 task->SetContamination(hBackground_40_50,5);
343 TF1 *fv2_40_50 = Getv2Contamination_40_50();
2747660f 344 if(fv2_40_50) {
345 fv2_40_50->SetName("fv2_40_50");
346 task->SetV2Contamination(fv2_40_50,5);
347 }
6733d981 348
26c85092 349 // Define PID TOF Only
350 AliHFEpid *pidTOFOnly = task->GetPIDTOFOnly();
351 if(useMC) pidTOFOnly->SetHasMCData(kTRUE);
352 pidTOFOnly->AddDetector("TOF", 0);
353 pidTOFOnly->ConfigureTOF(tofsig*0.1);
ae23886f 354
0e30407a 355 // Define PID background
356 AliHFEpid *pidbackground = task->GetPIDBackground();
357 if(useMC) pidbackground->SetHasMCData(kTRUE);
26c85092 358 //pidbackground->AddDetector("TOF", 0);
5a30a273 359 pidbackground->AddDetector("TPC", 0);
26c85092 360 //pidbackground->ConfigureTOF(3.0);
2747660f 361 pidbackground->ConfigureTPCasymmetric(0.0,9999.,minTPCback,maxTPCback);
0e30407a 362 task->SetMaxopeningtheta(9999.0);
363 task->SetMaxopeningphi(9999.0);
2747660f 364 task->SetMaxopening3D(0.1);
365 // Always AliKF and no mass constraint
366 task->SetAlgorithmMA(kFALSE);
367 task->SetMassConstraint(kFALSE);
d84c68e9 368
369 printf("*************************************\n");
370 printf("Configuring standard Task:\n");
371 task->Print();
372 pid->PrintStatus();
373 printf("*************************************\n");
374 return task;
2747660f 375
d84c68e9 376}