]>
Commit | Line | Data |
---|---|---|
a8ad4709 | 1 | TObject* fContPid1; |
2 | TObject* fContPid2; | |
3 | const Int_t nBinPid = 14; // pt,eta, ptPip, ptPin, PPip, PPin, TOF3sigmaPip, TOF3sigmaPin, isPhiTrue, nsigmaPip, nsigmaPin | |
4 | // 0.985 < mass < 1.045 (60) and 0 < centrality < 100 (10) | |
5 | Int_t binPid[nBinPid] = {1/*ptPhi*/,8/*EtaPr*/,20/*pt+*/,20/*pt-*/,5/*P+*/,1/*P-*/,2/*TOFmatch+*/,2/*TOFmatch-*/,2/*istrue*/,4/*Nsigma+*/,4/*Nsigma-*/,1/*DeltaPhi+*/,1/*DeltaPhi-*/,1/*Psi*/}; | |
6 | Float_t xmin[nBinPid] = {1,-0.8,0.3,0.3,0,0,-0.5,-0.5,-0.5,0,0,-TMath::Pi(),-TMath::Pi(),-TMath::Pi()/2}; | |
7 | Float_t xmax[nBinPid] = {5,0.8,4.3,4.3,1,1,1.5,1.5,1.5,7.5,7.5,TMath::Pi(),TMath::Pi(),TMath::Pi()/2}; | |
8 | ||
9 | TF1 *fsign; | |
10 | TF1 *fall; | |
11 | TF1 *fback; | |
12 | ||
13 | Int_t ifunc=0; | |
14 | ||
15 | Float_t fitmin = 1.08; | |
16 | Float_t fitmax = 1.155; | |
17 | ||
18 | Int_t cmin = 1; | |
19 | Int_t cmax = 8; | |
20 | ||
21 | Float_t weightS = -1.; | |
22 | ||
23 | Int_t rebinsize = 2; | |
24 | ||
25 | Int_t parplotted = 2; | |
26 | ||
27 | Bool_t isMC = kFALSE; // don't change this (is set automatically) | |
28 | Bool_t selectTrue = kTRUE; // put it to true to remove background (only for MC) | |
29 | Bool_t keepTrue = kFALSE; // put it to false to fit only background (only for MC) | |
30 | ||
31 | Bool_t kGoodMatch = kFALSE; // to check good matching | |
32 | ||
33 | Bool_t kSigma2vs3 = kFALSE; // to check good matching | |
34 | ||
35 | Bool_t require5sigma = kFALSE; // don't touch this flag | |
36 | ||
37 | Bool_t bayesVsigma = kFALSE; // only to do checks | |
38 | ||
39 | Bool_t kTOFmatch = kFALSE; // for combined PID requires TOF matching | |
40 | ||
41 | Bool_t kOverAll = kFALSE; | |
42 | ||
43 | Bool_t kLoaded=kFALSE; | |
44 | LoadLib(){ | |
45 | weightS = -1.; | |
46 | ||
47 | if(! kLoaded){ | |
48 | gSystem->Load("libVMC.so"); | |
49 | gSystem->Load("libPhysics.so"); | |
50 | gSystem->Load("libTree.so"); | |
51 | gSystem->Load("libMinuit.so"); | |
52 | gSystem->Load("libSTEERBase.so"); | |
53 | gSystem->Load("libANALYSIS.so"); | |
54 | gSystem->Load("libAOD.so"); | |
55 | gSystem->Load("libESD.so"); | |
56 | gSystem->Load("libANALYSIS.so"); | |
57 | gSystem->Load("libANALYSISalice.so"); | |
58 | gSystem->Load("libCORRFW.so"); | |
59 | gSystem->Load("libNetx.so"); | |
60 | gSystem->Load("libPWGPPpid.so"); | |
61 | ||
62 | TFile *f = new TFile("AnalysisResults.root"); | |
63 | f->ls(); | |
64 | TList *l = (TList *) f->Get("contLambdaBayes1"); | |
65 | l->ls(); | |
66 | fContPid1 = (AliPIDperfContainer *) l->At(0); | |
67 | fContPid2 = (AliPIDperfContainer *) l->At(1); | |
68 | } | |
69 | kLoaded = kTRUE; | |
70 | ||
71 | // check if MC | |
72 | Float_t x[] = {xmin[0]+0.001,xmin[1]+0.001,xmin[2]+0.001,xmin[3]+0.001,xmin[4]+0.001,xmin[5]+0.001,xmin[6]+0.001,xmin[7]+0.001,1/*trueMC*/,xmin[9],xmin[10]}; | |
73 | Float_t x2[] = {xmax[0],xmax[1],xmax[2],xmax[3],xmax[4],xmax[5],xmax[6],xmax[7],xmax[8],xmax[9],xmax[10]}; | |
74 | ||
75 | AliPIDperfContainer *tmp = fContPid1; | |
76 | TH1D *h = tmp->GetQA(0, x, x2)->ProjectionX("checkMC"); | |
77 | ||
78 | if(h->GetEntries()) isMC = kTRUE; | |
79 | else isMC=kFALSE; | |
80 | ||
81 | if(!isMC){ | |
82 | selectTrue = kFALSE; | |
83 | keepTrue = kTRUE; | |
84 | } | |
85 | else{ | |
86 | printf("MC truth found!!!!!!\nIt is MC!!!!!!"); | |
87 | } | |
88 | ||
89 | fsign = new TF1("fsign","[0]*TMath::Voigt(x-[1],[3],[2])",fitmin,fitmax); | |
90 | fback = new TF1("fback","pol2",fitmin,fitmax); | |
91 | fall = new TF1("fall","[0]*TMath::Voigt(x-[1],[3],[2]) + pol2(4)",fitmin,fitmax); | |
92 | ||
93 | fsign->SetLineColor(2); | |
94 | fback->SetLineColor(4); | |
95 | ||
96 | if(kSigma2vs3){ | |
97 | kGoodMatch=kFALSE; | |
98 | kOverAll = 0; | |
99 | } | |
100 | ||
101 | if(bayesVsigma){ | |
102 | kOverAll = 0; | |
103 | kGoodMatch=kFALSE; | |
104 | kSigma2vs3=kFALSE; | |
105 | kTOFmatch=kTRUE; | |
106 | weightS = -0.7; | |
107 | } | |
108 | } | |
109 | ||
110 | doeffPr(Int_t pos=1,Float_t prob=0.1,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8){ | |
111 | LoadLib(); | |
112 | ||
113 | Int_t nptbin = binPid[2]; | |
114 | Float_t minptbin = xmin[2]; | |
115 | Float_t maxptbin = xmax[2]; | |
116 | ||
117 | if(pos == 0){ | |
118 | nptbin = binPid[3]; | |
119 | minptbin = xmin[3]; | |
120 | maxptbin = xmax[3]; | |
121 | } | |
122 | ||
123 | if(prob > 0.1999){ | |
124 | kGoodMatch = kFALSE; | |
125 | kSigma2vs3 = kFALSE; | |
126 | if(! kOverAll) require5sigma = kTRUE; | |
127 | if(!isMC) weightS = -0.95; | |
128 | } | |
129 | ||
130 | TCanvas *c = new TCanvas(); | |
131 | c->Divide((nptbin+1)/2,2); | |
132 | TH2F *hh.*hh2; | |
133 | TH1D *h,*h2; | |
134 | char name[100]; | |
135 | Float_t b[50][3]; | |
136 | ||
137 | Double_t xx[50],yy[50]; | |
138 | Double_t exx[50],eyy[50]; | |
139 | ||
140 | for(Int_t i=0;i < nptbin;i++){ | |
141 | c->cd(i+1)->SetLogy(); | |
142 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); | |
143 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
144 | ||
145 | xx[i] = (ptmin+ptmax)/2; | |
146 | exx[i] = (-ptmin+ptmax)/2; | |
147 | ||
148 | Float_t pp=0.1; | |
149 | if(prob < 0.2) pp = 0.; | |
150 | if(pos) hh=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); | |
151 | else hh=GetHistoPin(ptmin,ptmax,pp,0.0); | |
152 | sprintf(name,"TOF matched: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax); | |
153 | hh->SetTitle(name); | |
154 | sprintf(name,"hNoPid%i",i); | |
155 | ||
156 | pp=prob; | |
157 | if(prob < 0.2) pp = 0.1; | |
158 | if(pos) hh2=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); | |
159 | else hh2=GetHistoPin(ptmin,ptmax,pp,0.0); | |
160 | AddHisto(hh,hh2,weightS); | |
161 | ||
162 | h = hh->ProjectionX(name,cmin,cmax); | |
163 | h->RebinX(rebinsize); | |
164 | h->Draw("ERR"); | |
165 | h->SetMarkerStyle(24); | |
166 | b[i][0]=-1; | |
167 | Int_t ntrial = 0; | |
168 | Float_t chi2 = 10000; | |
169 | while(ntrial < 10 && (chi2 > 20 + 1000*selectTrue)){ | |
170 | fit(h,b[i],"WW","",xx[i]); | |
171 | c1->Update(); | |
172 | // getchar(); | |
173 | fit(h,b[i],"","",xx[i]); | |
174 | ntrial++; | |
175 | chi2 = b[i][2]; | |
176 | printf("chi2 = %f\n",chi2); | |
177 | c1->Update(); | |
178 | // getchar(); | |
179 | ||
180 | } | |
181 | ||
182 | yy[i] = fall->GetParameter(parplotted); | |
183 | eyy[i] = fall->GetParError(parplotted); | |
184 | } | |
185 | ||
186 | TGraphErrors *gpar = new TGraphErrors(nptbin,xx,yy,exx,eyy); | |
187 | c->cd(8); | |
188 | gpar->Draw("AP"); | |
189 | gpar->SetMarkerStyle(20); | |
190 | ||
191 | TCanvas *c2 = new TCanvas(); | |
192 | c2->Divide((nptbin+1)/2,2); | |
193 | Float_t b2[50][3]; | |
194 | ||
195 | for(Int_t i=0;i < nptbin;i++){ | |
196 | c2->cd(i+1); | |
197 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); | |
198 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
199 | ||
200 | Float_t pp=prob; | |
201 | if(prob < 0.2) pp = 0.1; | |
202 | if(pos) hh=GetHistoPip(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); | |
203 | else hh=GetHistoPin(ptmin,ptmax,pp,0.0); | |
204 | sprintf(name,"P_{TOF} > 0.8: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax); | |
205 | hh->SetTitle(name); | |
206 | sprintf(name,"hPid60_%i",i); | |
207 | h = hh->ProjectionX(name,cmin,cmax); | |
208 | h->RebinX(rebinsize); | |
209 | h->Draw("ERR"); | |
210 | h->SetMarkerStyle(24); | |
211 | b2[i][0]=-1; | |
212 | Int_t ntrial = 0; | |
213 | Float_t chi2 = 10000; | |
214 | while(ntrial < 40 && (chi2 > 20 + 1000*selectTrue)){ | |
215 | fit(h,b2[i],"WW",""); | |
216 | fit(h,b2[i],"",""); | |
217 | ntrial++; | |
218 | chi2 = b2[i][2]; | |
219 | printf("chi2 = %f\n",chi2); | |
220 | } | |
221 | yy[i] = fall->GetParameter(parplotted); | |
222 | eyy[i] = fall->GetParError(parplotted); | |
223 | ||
224 | } | |
225 | ||
226 | TGraphErrors *gpar2 = new TGraphErrors(nptbin,xx,yy,exx,eyy); | |
227 | c2->cd(8); | |
228 | gpar2->Draw("AP"); | |
229 | gpar2->SetMarkerStyle(20); | |
230 | ||
231 | Double_t xpt[50],expt[50],eff[50],efferr[50]; | |
232 | for(Int_t i=0;i<nptbin;i++){ | |
233 | printf("%f +/- %f - %f +/- %f\n",b[i][0],b[i][1],b2[i][0],b2[i][1]); | |
234 | ||
235 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); | |
236 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
237 | ||
238 | xpt[i] = (ptmin+ptmax)/2; | |
239 | expt[i] = (-ptmin+ptmax)/2; | |
240 | eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS); | |
241 | ||
242 | b[i][0] = b[i][0]-b2[i][0]*weightS; | |
243 | ||
244 | efferr[i] = TMath::Sqrt(b[i][1]*b[i][1]/b[i][0]/b[i][0] + b2[i][1]*b2[i][1]/b2[i][0]/b2[i][0])*(b2[i][0]+b2[i][1])*(1+weightS*(b2[i][0]-b2[i][1])/b[i][0])/b[i][0];//*(1-eff[i]);//der2*der2*(b[i][1]*b[i][1] - b2[i][1]*b2[i][1])); | |
245 | ||
246 | if(TMath::Abs(efferr[i]) > 1)efferr[i]=1; | |
247 | } | |
248 | new TCanvas(); | |
249 | TGraphErrors *geff = new TGraphErrors(nptbin,xpt,eff,expt,efferr); | |
250 | geff->Draw("AP"); | |
251 | ||
252 | char flag[100]; | |
253 | sprintf(flag,""); | |
254 | ||
255 | if(isMC){ | |
256 | if(selectTrue) sprintf(flag,"true"); | |
257 | else if(!keepTrue) sprintf(flag,"back"); | |
258 | } | |
259 | ||
260 | char flag2[100]; | |
261 | sprintf(flag2,""); | |
262 | ||
263 | char etarange[100]; | |
264 | sprintf(etarange,"_%.1f-%.1f_",etaminkp,etamaxkp); | |
265 | ||
266 | if(kGoodMatch) | |
267 | sprintf(flag2,"GM"); | |
268 | ||
269 | if(bayesVsigma) | |
270 | sprintf(flag2,"BayesVsSigma"); | |
271 | ||
272 | if(kSigma2vs3) | |
273 | sprintf(flag2,"Sigma2vs3"); | |
274 | ||
275 | if(kOverAll) | |
276 | sprintf(flag2,"OverAll"); | |
277 | ||
278 | if(pos){ | |
279 | if(prob >=0.2) sprintf(name,"protonPos%sP%iEff%i_%i%s%s.root",etarange,Int_t(prob*100),(cmin-1)*10,cmax*10,flag,flag2); | |
280 | else sprintf(name,"protonPos%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2); | |
281 | } | |
282 | else{ | |
283 | if(prob >=0.2) sprintf(name,"protonNeg%sP%iEff%i_%i%s%s.root",etarange,Int_t(prob*100),(cmin-1)*10,cmax*10,flag,flag2); | |
284 | else sprintf(name,"protonNeg%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2); | |
285 | } | |
286 | ||
287 | TFile *fout = new TFile(name,"RECREATE"); | |
288 | geff->Write(); | |
289 | fout->Close(); | |
290 | ||
291 | ||
292 | TF1 *ff = new TF1("ff","[0] - [1]*TMath::Exp([2]*x)",0,3); | |
293 | ff->SetParameter(0,0.67); | |
294 | ff->SetParameter(1,1.14383e+00); | |
295 | ff->SetParameter(2,-2.29910); | |
296 | ff->SetLineColor(4); | |
297 | ff->SetLineColor(2); | |
298 | ff->Draw("SAME"); | |
299 | ||
300 | TF1 *ff2 = new TF1("ff2","[0] - [1]*TMath::Exp([2]*x)",0,3); | |
301 | ff2->SetParameter(0,0.67); | |
302 | ff2->SetParameter(1,9.23126e-01); | |
303 | ff2->SetParameter(2,-1.851); | |
304 | ff2->SetLineColor(4); | |
305 | ff2->Draw("SAME"); | |
306 | } | |
307 | ||
308 | TH2F *GetHistoPip(Float_t pt=1,Float_t ptM=1.1,Float_t pMinkp=0,Float_t pMinkn=0.,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8){ | |
309 | ||
310 | Float_t x[] = {xmin[0]+0.001,etaminkp+0.001,pt+0.001,xmin[3]+0.001,pMinkp+0.001,pMinkn+0.001,(pMinkp>0.09)+0.001,kTOFmatch+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]}; | |
311 | Float_t x2[] = {xmax[0],etamaxkp-0.001,ptM-0.001,xmax[3],xmax[4],xmax[5],xmax[6],xmax[7],keepTrue,xmax[9],xmax[10],xmax[11],xmax[12],xmax[13]}; | |
312 | ||
313 | if(kGoodMatch){ | |
314 | x[6] = 1.0001; | |
315 | if(pMinkp > 0) | |
316 | x2[9] = 4.9; | |
317 | ||
318 | } | |
319 | ||
320 | if(kTOFmatch){ | |
321 | x[6] = 1.0001; | |
322 | } | |
323 | ||
324 | if(kSigma2vs3){ | |
325 | x[6] = 1.0001; | |
326 | x2[9] = 3; | |
327 | if(pMinkp > 0) | |
328 | x2[9] = 2; | |
329 | } | |
330 | ||
331 | if(bayesVsigma){ | |
332 | if(pMinkp > 0){ | |
333 | x[4] = 0.2001; | |
334 | x2[9] = 5; | |
335 | } | |
336 | else{ | |
337 | x2[9] = 3; | |
338 | } | |
339 | ||
340 | ||
341 | } | |
342 | ||
343 | if(require5sigma) x2[9] = 4.9; | |
344 | ||
345 | AliPIDperfContainer *tmp = fContPid1; | |
346 | ||
347 | TH2F *h = tmp->GetQA(0, x, x2); | |
348 | ||
349 | h->GetXaxis()->SetTitle("M_{#Lambda} (GeV/#it{c}^{2})"); | |
350 | h->GetYaxis()->SetTitle("centrality [%]"); | |
351 | ||
352 | return h; | |
353 | } | |
354 | ||
355 | TH2F *GetHistoPin(Float_t pt=1,Float_t ptM=1.1,Float_t pMinkn=0,Float_t pMinkp=0.,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8){ | |
356 | ||
357 | Float_t x[] = {xmin[0]+0.001,etaminkp+0.001,xmin[2]+0.001,pt+0.001,pMinkp+0.001,pMinkn+0.001,kTOFmatch+0.001,(pMinkn>0.09)+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]}; | |
358 | Float_t x2[] = {xmax[0],etamaxkp-0.001,xmax[2],ptM-0.001,xmax[4],xmax[5],xmax[6],xmax[7],keepTrue,xmax[9],xmax[10],xmax[11],xmax[12],xmax[13]}; | |
359 | ||
360 | if(kGoodMatch){ | |
361 | x[7] = 1.0001; | |
362 | if(pMinkn > 0) | |
363 | x2[10] = 4.9; | |
364 | ||
365 | } | |
366 | ||
367 | if(kTOFmatch){ | |
368 | x[7] = 1.0001; | |
369 | } | |
370 | ||
371 | if(kSigma2vs3){ | |
372 | x[7] = 1.0001; | |
373 | x2[10] = 3; | |
374 | if(pMinkn > 0) | |
375 | x2[10] = 2; | |
376 | } | |
377 | ||
378 | if(bayesVsigma){ | |
379 | if(pMinkn > 0){ | |
380 | x[5] = 0.2001; | |
381 | x2[10] = 5; | |
382 | } | |
383 | else{ | |
384 | x2[10] = 3; | |
385 | } | |
386 | } | |
387 | ||
388 | if(require5sigma) x2[10] = 4.9; | |
389 | ||
390 | AliPIDperfContainer *tmp = fContPid2; | |
391 | ||
392 | TH2F *h = tmp->GetQA(0, x, x2); | |
393 | ||
394 | h->GetXaxis()->SetTitle("M_{#Lambda} (GeV/#it{c}^{2})"); | |
395 | h->GetYaxis()->SetTitle("centrality [%]"); | |
396 | ||
397 | return h; | |
398 | } | |
399 | ||
400 | fit(TH1D *h,Float_t *a=NULL,char *opt="",char *opt2="",Float_t pt=1.5){ | |
401 | if(h->Integral(1,h->GetNbinsX()) < 1){ | |
402 | if(a){ | |
403 | a[0]=0.01; | |
404 | a[1]=1; | |
405 | } | |
406 | return; | |
407 | } | |
408 | ||
409 | ||
410 | fall->SetParameter(0,100); | |
411 | fall->SetParameter(1,1.115); | |
412 | fall->SetParameter(2,0.0003); | |
413 | fall->SetParameter(3,0.001); | |
414 | ||
415 | fall->SetParLimits(0,0.00001,10000); | |
416 | fall->SetParLimits(1,1.105,1.125);//1.01898 + 2.4e-04*pt-1e-03,1.01898 + 2.4e-04*pt+1e-03); | |
417 | fall->SetParLimits(2,0.00001,0.001); | |
418 | fall->SetParLimits(3,0.0005,0.01); | |
419 | ||
420 | // fall->FixParameter(2,5E-4); | |
421 | ||
422 | // fall->FixParameter(1,1.01884 + 2.9891e-04*pt); | |
423 | // fall->FixParameter(2,0.0044); | |
424 | // fall->FixParameter(3,7.57574e-04 + 3.85408e-04*pt); | |
425 | ||
426 | fall->ReleaseParameter(4); | |
427 | fall->ReleaseParameter(5); | |
428 | fall->ReleaseParameter(6); | |
429 | ||
430 | if(selectTrue){ | |
431 | fall->FixParameter(4,0); | |
432 | fall->FixParameter(5,0); | |
433 | fall->FixParameter(6,0); | |
434 | } | |
435 | ||
436 | char name[100]; | |
437 | TF1 *ftmp=fall; | |
438 | ||
439 | TF1 *ftmp2=new TF1(*fsign); | |
440 | sprintf(name,"fsign%i",ifunc); | |
441 | ftmp2->SetName(name); | |
442 | ||
443 | TF1 *ftmp3=new TF1(*fback); | |
444 | sprintf(name,"ftmp3%i",ifunc); | |
445 | ftmp3->SetName(name); | |
446 | ||
447 | ifunc++; | |
448 | ||
449 | h->Fit(ftmp,opt,opt2,fitmin,fitmax); | |
450 | h->Draw("ERR"); | |
451 | ||
452 | ftmp2->SetParameter(0,ftmp->GetParameter(0)); | |
453 | ftmp2->SetParameter(1,ftmp->GetParameter(1)); | |
454 | ftmp2->SetParameter(2,ftmp->GetParameter(2)); | |
455 | ftmp2->SetParameter(3,ftmp->GetParameter(3)); | |
456 | ftmp2->Draw("SAME"); | |
457 | ftmp3->SetParameter(0,ftmp->GetParameter(4)); | |
458 | ftmp3->SetParameter(1,ftmp->GetParameter(5)); | |
459 | ftmp3->SetParameter(2,ftmp->GetParameter(6)); | |
460 | ftmp3->Draw("SAME"); | |
461 | ||
462 | Float_t mean = ftmp->GetParameter(1); | |
463 | Float_t sigma = TMath::Abs(ftmp->GetParameter(3)) + TMath::Abs(ftmp->GetParameter(2)); | |
464 | ||
465 | Float_t signI = ftmp2->Integral(mean-10*sigma,mean+10*sigma)/h->GetBinWidth(1); | |
466 | Float_t backI = ftmp3->Integral(mean-3*sigma,mean+3*sigma)/h->GetBinWidth(1); | |
467 | ||
468 | Float_t errI = TMath::Sqrt(ftmp->GetParError(0)*ftmp->GetParError(0)/(0.001+ftmp->GetParameter(0))/(0.001+ftmp->GetParameter(0))); | |
469 | ||
470 | printf("signal(5 sigma) = %f +/- %f(fit) +/- %f(stat)\n",signI,errI*signI,TMath::Sqrt(signI)); | |
471 | printf("backgr(3sigma) = %f\n",backI); | |
472 | printf("significance(3 sigma) = %f\n",signI/sqrt(signI+backI)); | |
473 | ||
474 | if(a){ | |
475 | a[0]=signI; | |
476 | a[1]=signI*errI*signI*errI + signI; | |
477 | a[1] = TMath::Sqrt(a[1]); | |
478 | if(ftmp->GetNDF()) a[2] = ftmp->GetChisquare()/ftmp->GetNDF(); | |
479 | ||
480 | ||
481 | if(selectTrue){ | |
482 | a[0] = h->Integral(1,h->GetNbinsX()); | |
483 | a[1] = TMath::Sqrt(a[0]); | |
484 | } | |
485 | } | |
486 | } | |
487 | ||
488 | AddHisto(TH2F *h1,TH2F *h2,Float_t w){ | |
489 | Int_t nbinx = h1->GetNbinsX(); | |
490 | Int_t nbiny = h1->GetNbinsY(); | |
491 | ||
492 | for(Int_t i=1;i<=nbinx;i++){ | |
493 | for(Int_t j=1;j<=nbiny;j++){ | |
494 | Float_t val = h1->GetBinContent(i,j) + h2->GetBinContent(i,j)*w; | |
495 | Float_t err = TMath::Min(TMath::Sqrt(val),val); | |
496 | h1->SetBinContent(i,j,val); | |
497 | h1->SetBinError(i,j,err); | |
498 | } | |
499 | } | |
500 | } |