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