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