]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGPP/pid/doeffAllSpecies.C
macro to extract efficiency: small fix
[u/mrichter/AliRoot.git] / PWGPP / pid / doeffAllSpecies.C
CommitLineData
bf2e05d5 1doeffAllSpecies(Int_t isp=1){
2 if(isp==1) performAllPi();
3 else if(isp==2) performAllKa();
4 else if(isp == 3) performAllPr();
7484404e 5}
6
7performAllPi(){
8 gSystem->Load("libVMC.so");
9 gSystem->Load("libPhysics.so");
10 gSystem->Load("libTree.so");
11 gSystem->Load("libMinuit.so");
12 gSystem->Load("libSTEERBase.so");
13 gSystem->Load("libANALYSIS.so");
14 gSystem->Load("libAOD.so");
15 gSystem->Load("libESD.so");
16 gSystem->Load("libANALYSIS.so");
17 gSystem->Load("libANALYSISalice.so");
18 gSystem->Load("libCORRFW.so");
19 gSystem->Load("libNetx.so");
20 gSystem->Load("libPWGPPpid.so");
bf2e05d5 21
7484404e 22 gSystem->AddIncludePath("-I$ALICE_ROOT/PWGPP/pid");
bf2e05d5 23
7484404e 24 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/pid/doeffPi.C++");
bf2e05d5 25
7484404e 26 // tune these parameters
27 cmin = 1; // centrality min 1
28 cmax = 10;// centrality max 10
29 Float_t etamin = -0.8;
bf2e05d5 30 Float_t etamax = 0.8;
7484404e 31
32 // reset all flags
33 rebinsize = 1; // don't change this, not choice here!!!
34 kGoodMatch=kFALSE;
35 kSigma2vs3 = kFALSE;
754154d5 36 kSigma2vs3TPC = kFALSE;
7484404e 37 require5sigma = kFALSE;
38 bayesVsigma = kFALSE;
39 kTOFmatch = kFALSE;
40 kOverAll = kFALSE;
41 kOverAllTOFmatch = kFALSE;
42 kOverAll2Sigma = kFALSE;
43 isMC = kFALSE;
44 selectTrue = kTRUE;
45 keepTrue = kFALSE;
bf2e05d5 46
7484404e 47 if(! LoadLib()) return;
bf2e05d5 48
7484404e 49 // matching and PID eff.
50 doeffPi(1,0.1,etamin,etamax);
51 doeffPi(0,0.1,etamin,etamax);
52 doeffPi(1,0.2,etamin,etamax);
53 doeffPi(1,0.4,etamin,etamax);
54 doeffPi(1,0.6,etamin,etamax);
55 doeffPi(1,0.8,etamin,etamax);
56 doeffPi(0,0.2,etamin,etamax);
57 doeffPi(0,0.4,etamin,etamax);
58 doeffPi(0,0.6,etamin,etamax);
59 doeffPi(0,0.8,etamin,etamax);
60
61 // Good matching eff (1 - TOF mism)
62 kGoodMatch=kTRUE;
63 doeffPi(1,0.1,etamin,etamax);
64 doeffPi(0,0.1,etamin,etamax);
65 kGoodMatch=kFALSE;
66
67 // eff 2 sigma / eff 3 sigma
68 kSigma2vs3=kTRUE;
69 doeffPi(1,0.1,etamin,etamax);
70 doeffPi(0,0.1,etamin,etamax);
71 kSigma2vs3=kFALSE;
754154d5 72
73 // eff 2 sigma / eff 3 sigma TPC
74 kSigma2vs3TPC=kTRUE;
75 doeffPi(1,0.1,etamin,etamax);
76 doeffPi(0,0.1,etamin,etamax);
77 kSigma2vs3TPC=kFALSE;
bf2e05d5 78
7484404e 79 kOverAll=kTRUE;
80 // TPC|TOF overall eff
81 doeffPi(1,0.2,etamin,etamax);
82 doeffPi(1,0.4,etamin,etamax);
83 doeffPi(1,0.6,etamin,etamax);
84 doeffPi(1,0.8,etamin,etamax);
85 doeffPi(0,0.2,etamin,etamax);
86 doeffPi(0,0.4,etamin,etamax);
87 doeffPi(0,0.6,etamin,etamax);
88 doeffPi(0,0.8,etamin,etamax);
bf2e05d5 89
7484404e 90 kOverAllTOFmatch=kTRUE;
91 // TPC&TOF overall eff
92 doeffPi(1,0.2,etamin,etamax);
93 doeffPi(1,0.4,etamin,etamax);
94 doeffPi(1,0.6,etamin,etamax);
95 doeffPi(1,0.8,etamin,etamax);
96 doeffPi(0,0.2,etamin,etamax);
97 doeffPi(0,0.4,etamin,etamax);
98 doeffPi(0,0.6,etamin,etamax);
99 doeffPi(0,0.8,etamin,etamax);
100 kOverAllTOFmatch=kFALSE;
bf2e05d5 101
7484404e 102 kOverAll2Sigma=kTRUE;
103 // TPC&TOF 2 TOF sigma cut
104 doeffPi(1,0.1,etamin,etamax);
105 doeffPi(0,0.1,etamin,etamax);
106 kOverAll2Sigma=kFALSE;
107 kOverAll=kFALSE;
108 gSystem->Unload("$ALICE_ROOT/PWGPP/pid/doeffPi_C.so");
109}
110
111performAllPr(){
112 gSystem->Load("libVMC.so");
113 gSystem->Load("libPhysics.so");
114 gSystem->Load("libTree.so");
115 gSystem->Load("libMinuit.so");
116 gSystem->Load("libSTEERBase.so");
117 gSystem->Load("libANALYSIS.so");
118 gSystem->Load("libAOD.so");
119 gSystem->Load("libESD.so");
120 gSystem->Load("libANALYSIS.so");
121 gSystem->Load("libANALYSISalice.so");
122 gSystem->Load("libCORRFW.so");
123 gSystem->Load("libNetx.so");
124 gSystem->Load("libPWGPPpid.so");
bf2e05d5 125
7484404e 126 gSystem->AddIncludePath("-I$ALICE_ROOT/PWGPP/pid");
bf2e05d5 127
7484404e 128 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/pid/doeffPr.C++");
bf2e05d5 129
7484404e 130 // tune these parameters
131 cmin = 1; // centrality min 1
132 cmax = 10;// centrality max 10
133 Float_t etamin = -0.8;
bf2e05d5 134 Float_t etamax = 0.8;
135
7484404e 136 // reset all flags
137 rebinsize = 1; // don't change this, not choice here!!!
138 kGoodMatch=kFALSE;
139 kSigma2vs3 = kFALSE;
80d8d480 140 //kSigma2vs3TPC = kFALSE;
7484404e 141 require5sigma = kFALSE;
142 bayesVsigma = kFALSE;
143 kTOFmatch = kFALSE;
144 kOverAll = kFALSE;
145 kOverAllTOFmatch = kFALSE;
146 kOverAll2Sigma = kFALSE;
147 isMC = kFALSE;
148 selectTrue = kTRUE;
149 keepTrue = kFALSE;
bf2e05d5 150
7484404e 151 if(! LoadLib()) return;
bf2e05d5 152
7484404e 153 // matching and PID eff.
154 doeffPr(1,0.1,etamin,etamax);
155 doeffPr(0,0.1,etamin,etamax);
156 doeffPr(1,0.2,etamin,etamax);
157 doeffPr(1,0.4,etamin,etamax);
158 doeffPr(1,0.6,etamin,etamax);
159 doeffPr(1,0.8,etamin,etamax);
160 doeffPr(0,0.2,etamin,etamax);
161 doeffPr(0,0.4,etamin,etamax);
162 doeffPr(0,0.6,etamin,etamax);
163 doeffPr(0,0.8,etamin,etamax);
164
165 // Good matching eff (1 - TOF mism)
166 kGoodMatch=kTRUE;
167 doeffPr(1,0.1,etamin,etamax);
168 doeffPr(0,0.1,etamin,etamax);
169 kGoodMatch=kFALSE;
170
171 // eff 2 sigma / eff 3 sigma
172 kSigma2vs3=kTRUE;
173 doeffPr(1,0.1,etamin,etamax);
174 doeffPr(0,0.1,etamin,etamax);
175 kSigma2vs3=kFALSE;
176
754154d5 177 // eff 2 sigma / eff 3 sigma TPC
80d8d480 178 //kSigma2vs3TPC=kTRUE;
179 //doeffPr(1,0.1,etamin,etamax);
180 //doeffPr(0,0.1,etamin,etamax);
181 //kSigma2vs3TPC=kFALSE;
754154d5 182
7484404e 183 kOverAll=kTRUE;
184 // TPC|TOF overall eff
185 doeffPr(1,0.2,etamin,etamax);
186 doeffPr(1,0.4,etamin,etamax);
187 doeffPr(1,0.6,etamin,etamax);
188 doeffPr(1,0.8,etamin,etamax);
189 doeffPr(0,0.2,etamin,etamax);
190 doeffPr(0,0.4,etamin,etamax);
191 doeffPr(0,0.6,etamin,etamax);
192 doeffPr(0,0.8,etamin,etamax);
193
194 kOverAllTOFmatch=kTRUE;
195 // TPC&TOF overall eff
196 doeffPr(1,0.2,etamin,etamax);
197 doeffPr(1,0.4,etamin,etamax);
198 doeffPr(1,0.6,etamin,etamax);
199 doeffPr(1,0.8,etamin,etamax);
200 doeffPr(0,0.2,etamin,etamax);
201 doeffPr(0,0.4,etamin,etamax);
202 doeffPr(0,0.6,etamin,etamax);
203 doeffPr(0,0.8,etamin,etamax);
204 kOverAllTOFmatch=kFALSE;
205
206 kOverAll2Sigma=kTRUE;
207 // TPC&TOF 2 TOF sigma cut
208 doeffPr(1,0.1,etamin,etamax);
209 doeffPr(0,0.1,etamin,etamax);
210 kOverAll2Sigma=kFALSE;
211 kOverAll=kFALSE;
212 gSystem->Unload("$ALICE_ROOT/PWGPP/pid/doeffPr_C.so");
213}
214
215performAllKa(){
216 gSystem->Load("libVMC.so");
217 gSystem->Load("libPhysics.so");
218 gSystem->Load("libTree.so");
219 gSystem->Load("libMinuit.so");
220 gSystem->Load("libSTEERBase.so");
221 gSystem->Load("libANALYSIS.so");
222 gSystem->Load("libAOD.so");
223 gSystem->Load("libESD.so");
224 gSystem->Load("libANALYSIS.so");
225 gSystem->Load("libANALYSISalice.so");
226 gSystem->Load("libCORRFW.so");
227 gSystem->Load("libNetx.so");
228 gSystem->Load("libPWGPPpid.so");
229
230 gSystem->AddIncludePath("-I$ALICE_ROOT/PWGPP/pid");
231
232 gROOT->LoadMacro("$ALICE_ROOT/PWGPP/pid/doeffKa.C++");
233
234 // tune these parameters
235 cmin = 1; // centrality min 1
236 cmax = 10;// centrality max 10
237 Float_t etamin = -0.8;
bf2e05d5 238 Float_t etamax = 0.8;
7484404e 239
240 // reset all flags
241 rebinsize = 1; // don't change this, not choice here!!!
242 kGoodMatch=kFALSE;
243 kSigma2vs3 = kFALSE;
754154d5 244 kSigma2vs3TPC = kFALSE;
7484404e 245 require5sigma = kFALSE;
246 bayesVsigma = kFALSE;
247 kTOFmatch = kFALSE;
248 kOverAll = kFALSE;
249 kOverAllTOFmatch = kFALSE;
250 kOverAll2Sigma = kFALSE;
251 isMC = kFALSE;
252 selectTrue = kTRUE;
253 keepTrue = kFALSE;
254
255 if(! LoadLib()) return;
256
257 // matching and PID eff.
258 doeffKa(1,0.1,etamin,etamax);
259 doeffKa(0,0.1,etamin,etamax);
260 doeffKa(1,0.2,etamin,etamax);
261 doeffKa(1,0.4,etamin,etamax);
262 doeffKa(1,0.6,etamin,etamax);
263 doeffKa(1,0.8,etamin,etamax);
264 doeffKa(0,0.2,etamin,etamax);
265 doeffKa(0,0.4,etamin,etamax);
266 doeffKa(0,0.6,etamin,etamax);
267 doeffKa(0,0.8,etamin,etamax);
268
269 // Good matching eff (1 - TOF mism)
270 kGoodMatch=kTRUE;
271 doeffKa(1,0.1,etamin,etamax);
272 doeffKa(0,0.1,etamin,etamax);
273 kGoodMatch=kFALSE;
274
275 // eff 2 sigma / eff 3 sigma
276 kSigma2vs3=kTRUE;
277 doeffKa(1,0.1,etamin,etamax);
278 doeffKa(0,0.1,etamin,etamax);
279 kSigma2vs3=kFALSE;
280
754154d5 281 // eff 2 sigma / eff 3 sigma TPC
282 kSigma2vs3TPC=kTRUE;
283 doeffKa(1,0.1,etamin,etamax);
284 doeffKa(0,0.1,etamin,etamax);
285 kSigma2vs3TPC=kFALSE;
286
7484404e 287 kOverAll=kTRUE;
288 // TPC|TOF overall eff
289 doeffKa(1,0.2,etamin,etamax);
290 doeffKa(1,0.4,etamin,etamax);
291 doeffKa(1,0.6,etamin,etamax);
292 doeffKa(1,0.8,etamin,etamax);
293 doeffKa(0,0.2,etamin,etamax);
294 doeffKa(0,0.4,etamin,etamax);
295 doeffKa(0,0.6,etamin,etamax);
296 doeffKa(0,0.8,etamin,etamax);
297
298 kOverAllTOFmatch=kTRUE;
299 // TPC&TOF overall eff
300 doeffKa(1,0.2,etamin,etamax);
301 doeffKa(1,0.4,etamin,etamax);
302 doeffKa(1,0.6,etamin,etamax);
303 doeffKa(1,0.8,etamin,etamax);
304 doeffKa(0,0.2,etamin,etamax);
305 doeffKa(0,0.4,etamin,etamax);
306 doeffKa(0,0.6,etamin,etamax);
307 doeffKa(0,0.8,etamin,etamax);
308 kOverAllTOFmatch=kFALSE;
309
310 kOverAll2Sigma=kTRUE;
311 // TPC&TOF 2 TOF sigma cut
312 doeffKa(1,0.1,etamin,etamax);
313 doeffKa(0,0.1,etamin,etamax);
314 kOverAll2Sigma=kFALSE;
315 kOverAll=kFALSE;
316 gSystem->Unload("$ALICE_ROOT/PWGPP/pid/doeffKa_C.so");
317}
bf2e05d5 318
319TGraphErrors *MakeRatio(const char *nf1,const char *nf2,const char *nfo=""/*output file*/,const char *title=""/*title*/){
320 TFile *f1 = new TFile(nf1);
321 TFile *f2 = new TFile(nf2);
322
323 TGraphErrors *g1 = (TGraphErrors *) f1->Get("Graph");
324 TGraphErrors *g2 = (TGraphErrors *) f2->Get("Graph");
325 if(!(g1 && g2)) return NULL;
326 if(!(g1 && g2)) return NULL;
327
328 Int_t n1= g1->GetN();
329 Int_t n2= g2->GetN();
330
331 if(n1 != n2) return NULL;
332
333 if(n1 > 100) n1 = 100;
334
335 Float_t x[100],y[100],ex[100],ey[100];
336
337 for(Int_t i=0;i < n1;i++){
338 x[i] = g1->GetX()[i];
339 ex[i] = g1->GetEX()[i];
340 if(g1->GetY()[i] > 0 && g2->GetY()[i] > 0){
341 y[i] = g1->GetY()[i] / g2->GetY()[i];
342 ey[i] = (g1->GetEY()[i] / g1->GetY()[i])**2 + (g2->GetEY()[i] / g2->GetY()[i])**2;
343 ey[i] = sqrt(ey[i])*y[i];
344 }
345 else{
346 y[i] = 0.5;
347 ey[i] = 0.5;
348 }
349 }
350 TGraphErrors *gr = new TGraphErrors(n1,x,y,ex,ey);
351 gr->SetTitle(title);
352
353 if(nfo[0] != '\0'){ // write output
354 printf("written in %s\n",nfo);
355 TFile *fo = new TFile(nfo,"RECREATE");
356 gr->Write();
357 fo->Close();
358 }
359
360 return gr;
361}