]>
Commit | Line | Data |
---|---|---|
7484404e | 1 | #include"TF1.h" |
2 | #include"TH1D.h" | |
3 | #include"TH2F.h" | |
4 | #include"TMath.h" | |
5 | #include"TSystem.h" | |
6 | #include"TCanvas.h" | |
7 | #include"TFile.h" | |
8 | #include"TGraphErrors.h" | |
9 | #include"AliPIDperfContainer.h" | |
cd9f95f6 | 10 | #include"TRandom.h" |
7484404e | 11 | |
12 | Int_t LoadLib(); | |
13 | void doeffPr(Int_t pos=1,Float_t prob=0.1,Float_t etaminkp=-0.8,Float_t etamaxkp=0.8); | |
14 | TH2F *GetHistoPrp(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); | |
15 | TH2F *GetHistoPrn(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); | |
bf2e05d5 | 16 | void fit(TH1D *h,Float_t *a=NULL,char *opt="",char *opt2="",Float_t pt=1.5); |
7484404e | 17 | void AddHisto(TH2F *h1,TH2F *h2,Float_t w); |
18 | ||
a8ad4709 | 19 | TObject* fContPid1; |
20 | TObject* fContPid2; | |
21 | const Int_t nBinPid = 14; // pt,eta, ptPip, ptPin, PPip, PPin, TOF3sigmaPip, TOF3sigmaPin, isPhiTrue, nsigmaPip, nsigmaPin | |
22 | // 0.985 < mass < 1.045 (60) and 0 < centrality < 100 (10) | |
23 | 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*/}; | |
24 | 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}; | |
25 | 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}; | |
26 | ||
27 | TF1 *fsign; | |
28 | TF1 *fall; | |
29 | TF1 *fback; | |
30 | ||
31 | Int_t ifunc=0; | |
32 | ||
9309a88b | 33 | Float_t fitmin = 1.1; |
08b5b548 | 34 | Float_t fitmax = 1.15; |
a8ad4709 | 35 | |
08b5b548 | 36 | Int_t cmin = 1; // min 1 |
37 | Int_t cmax = 10; // max 10 | |
a8ad4709 | 38 | |
6490e37e | 39 | Float_t weightS = -1.; |
a8ad4709 | 40 | |
08b5b548 | 41 | Int_t rebinsize = 1; |
a8ad4709 | 42 | |
43 | Int_t parplotted = 2; | |
44 | ||
45 | Bool_t isMC = kFALSE; // don't change this (is set automatically) | |
46 | Bool_t selectTrue = kTRUE; // put it to true to remove background (only for MC) | |
47 | Bool_t keepTrue = kFALSE; // put it to false to fit only background (only for MC) | |
48 | ||
49 | Bool_t kGoodMatch = kFALSE; // to check good matching | |
50 | ||
51 | Bool_t kSigma2vs3 = kFALSE; // to check good matching | |
52 | ||
53 | Bool_t require5sigma = kFALSE; // don't touch this flag | |
54 | ||
55 | Bool_t bayesVsigma = kFALSE; // only to do checks | |
56 | ||
57 | Bool_t kTOFmatch = kFALSE; // for combined PID requires TOF matching | |
58 | ||
08b5b548 | 59 | Bool_t kOverAll = kFALSE; |
e34b28fe | 60 | Bool_t kOverAllTOFmatch = kFALSE; |
08b5b548 | 61 | Bool_t kOverAll2Sigma = kFALSE; |
167b8b0a | 62 | Bool_t kPid2Sigma = kFALSE; |
63 | Bool_t kPid3Sigma = kFALSE; | |
08b5b548 | 64 | |
65 | TH2F *hmatched; | |
66 | TH2F *htracked; | |
a8ad4709 | 67 | |
68 | Bool_t kLoaded=kFALSE; | |
7484404e | 69 | Int_t LoadLib(){ |
6490e37e | 70 | weightS = -1.; |
a8ad4709 | 71 | |
bf2e05d5 | 72 | require5sigma = kFALSE; |
73 | ||
a8ad4709 | 74 | if(! kLoaded){ |
75 | gSystem->Load("libVMC.so"); | |
76 | gSystem->Load("libPhysics.so"); | |
77 | gSystem->Load("libTree.so"); | |
78 | gSystem->Load("libMinuit.so"); | |
79 | gSystem->Load("libSTEERBase.so"); | |
80 | gSystem->Load("libANALYSIS.so"); | |
81 | gSystem->Load("libAOD.so"); | |
82 | gSystem->Load("libESD.so"); | |
83 | gSystem->Load("libANALYSIS.so"); | |
84 | gSystem->Load("libANALYSISalice.so"); | |
85 | gSystem->Load("libCORRFW.so"); | |
86 | gSystem->Load("libNetx.so"); | |
87 | gSystem->Load("libPWGPPpid.so"); | |
88 | ||
89 | TFile *f = new TFile("AnalysisResults.root"); | |
a8ad4709 | 90 | TList *l = (TList *) f->Get("contLambdaBayes1"); |
7484404e | 91 | TList *l2 = (TList *) f->Get("contLambdaBayes2"); |
92 | ||
93 | if(!(l && l2)) return 0; | |
94 | ||
08b5b548 | 95 | fContPid1 = (AliPIDperfContainer *) l->FindObject("contPID"); |
96 | fContPid2 = (AliPIDperfContainer *) l->FindObject("contPID2"); | |
7484404e | 97 | |
08b5b548 | 98 | hmatched = (TH2F *) l2->FindObject("hMatchPr"); |
99 | htracked = (TH2F *) l2->FindObject("hTrackingPr"); | |
a8ad4709 | 100 | } |
101 | kLoaded = kTRUE; | |
102 | ||
103 | // check if MC | |
476e3d92 FN |
104 | 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],xmin[11],xmin[12],xmin[13]}; |
105 | 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],xmax[11],xmax[12],xmax[13]}; | |
a8ad4709 | 106 | |
9309a88b | 107 | AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid2; |
a8ad4709 | 108 | TH1D *h = tmp->GetQA(0, x, x2)->ProjectionX("checkMC"); |
109 | ||
110 | if(h->GetEntries()) isMC = kTRUE; | |
111 | else isMC=kFALSE; | |
112 | ||
113 | if(!isMC){ | |
114 | selectTrue = kFALSE; | |
115 | keepTrue = kTRUE; | |
116 | } | |
117 | else{ | |
118 | printf("MC truth found!!!!!!\nIt is MC!!!!!!"); | |
119 | } | |
120 | ||
9309a88b | 121 | fsign = new TF1("fsign","gaus(0) +0*0.5*[0]*TMath::Exp(-[3]*TMath::Abs(x-[1]))",fitmin,fitmax); |
122 | fback = new TF1("fback","pol2*(x-0.938-0.139)*(x > 0.938+0.139)",fitmin,fitmax); | |
123 | fall = new TF1("fall","gaus(0) +0*0.5*[0]*TMath::Exp(-[3]*TMath::Abs(x-[1])) + pol2(4)*(x-0.938-0.139)*(x > 0.938+0.139)",fitmin,fitmax); | |
a8ad4709 | 124 | |
125 | fsign->SetLineColor(2); | |
126 | fback->SetLineColor(4); | |
127 | ||
128 | if(kSigma2vs3){ | |
129 | kGoodMatch=kFALSE; | |
130 | kOverAll = 0; | |
131 | } | |
132 | ||
133 | if(bayesVsigma){ | |
134 | kOverAll = 0; | |
135 | kGoodMatch=kFALSE; | |
136 | kSigma2vs3=kFALSE; | |
137 | kTOFmatch=kTRUE; | |
138 | weightS = -0.7; | |
139 | } | |
7484404e | 140 | |
141 | return 1; | |
a8ad4709 | 142 | } |
143 | ||
7484404e | 144 | void doeffPr(Int_t pos,Float_t prob,Float_t etaminkp,Float_t etamaxkp){ |
a8ad4709 | 145 | LoadLib(); |
08b5b548 | 146 | TH1D *hm = hmatched->ProjectionX("matchingPrEff",cmin,cmax); |
147 | TH1D *ht = htracked->ProjectionX("tracking",cmin,cmax); | |
148 | ||
149 | hm->GetYaxis()->SetTitle("TOF matching eff."); | |
150 | hm->SetTitle("Using probability as weights"); | |
151 | ||
152 | hm->Sumw2(); | |
153 | ht->Sumw2(); | |
a8ad4709 | 154 | |
08b5b548 | 155 | hm->Divide(hm,ht,1,1,"B"); |
156 | ||
a8ad4709 | 157 | Int_t nptbin = binPid[2]; |
158 | Float_t minptbin = xmin[2]; | |
159 | Float_t maxptbin = xmax[2]; | |
160 | ||
161 | if(pos == 0){ | |
162 | nptbin = binPid[3]; | |
163 | minptbin = xmin[3]; | |
164 | maxptbin = xmax[3]; | |
165 | } | |
166 | ||
167b8b0a | 167 | if(prob > 0.1999|| kPid3Sigma ||kPid2Sigma){ |
a8ad4709 | 168 | kGoodMatch = kFALSE; |
169 | kSigma2vs3 = kFALSE; | |
80d8d480 | 170 | // if(! kOverAll) require5sigma = kTRUE; |
6490e37e | 171 | if(!isMC) weightS = -0.95; |
a8ad4709 | 172 | } |
173 | ||
7484404e | 174 | TCanvas *c1 = new TCanvas(); |
175 | c1->Divide((nptbin+1)/2,2); | |
176 | TH2F *hh,*hh2; | |
177 | TH1D *h; | |
a8ad4709 | 178 | char name[100]; |
179 | Float_t b[50][3]; | |
180 | ||
181 | Double_t xx[50],yy[50]; | |
182 | Double_t exx[50],eyy[50]; | |
183 | ||
184 | for(Int_t i=0;i < nptbin;i++){ | |
7484404e | 185 | c1->cd(i+1);//->SetLogy(); |
a8ad4709 | 186 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); |
187 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
188 | ||
189 | xx[i] = (ptmin+ptmax)/2; | |
190 | exx[i] = (-ptmin+ptmax)/2; | |
191 | ||
192 | Float_t pp=0.1; | |
193 | if(prob < 0.2) pp = 0.; | |
7484404e | 194 | if(pos) hh=GetHistoPrp(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); |
195 | else hh=GetHistoPrn(ptmin,ptmax,pp,0.0); | |
a8ad4709 | 196 | sprintf(name,"TOF matched: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax); |
197 | hh->SetTitle(name); | |
198 | sprintf(name,"hNoPid%i",i); | |
199 | ||
200 | pp=prob; | |
201 | if(prob < 0.2) pp = 0.1; | |
7484404e | 202 | if(pos) hh2=GetHistoPrp(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); |
203 | else hh2=GetHistoPrn(ptmin,ptmax,pp,0.0); | |
a8ad4709 | 204 | AddHisto(hh,hh2,weightS); |
205 | ||
206 | h = hh->ProjectionX(name,cmin,cmax); | |
207 | h->RebinX(rebinsize); | |
208 | h->Draw("ERR"); | |
209 | h->SetMarkerStyle(24); | |
210 | b[i][0]=-1; | |
211 | Int_t ntrial = 0; | |
212 | Float_t chi2 = 10000; | |
08b5b548 | 213 | while(ntrial < 3 && (chi2 > 20 + 1000*selectTrue)){ |
bf2e05d5 | 214 | fit(h,b[i],"WW","",xx[i]); |
a8ad4709 | 215 | c1->Update(); |
216 | // getchar(); | |
bf2e05d5 | 217 | fit(h,b[i],"","",xx[i]); |
a8ad4709 | 218 | ntrial++; |
219 | chi2 = b[i][2]; | |
220 | printf("chi2 = %f\n",chi2); | |
221 | c1->Update(); | |
222 | // getchar(); | |
223 | ||
224 | } | |
225 | ||
226 | yy[i] = fall->GetParameter(parplotted); | |
227 | eyy[i] = fall->GetParError(parplotted); | |
228 | } | |
229 | ||
230 | TGraphErrors *gpar = new TGraphErrors(nptbin,xx,yy,exx,eyy); | |
7484404e | 231 | c1->cd(8); |
08b5b548 | 232 | // gpar->Draw("AP"); |
a8ad4709 | 233 | gpar->SetMarkerStyle(20); |
234 | ||
235 | TCanvas *c2 = new TCanvas(); | |
236 | c2->Divide((nptbin+1)/2,2); | |
237 | Float_t b2[50][3]; | |
238 | ||
239 | for(Int_t i=0;i < nptbin;i++){ | |
240 | c2->cd(i+1); | |
241 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); | |
242 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
243 | ||
244 | Float_t pp=prob; | |
245 | if(prob < 0.2) pp = 0.1; | |
7484404e | 246 | if(pos) hh=GetHistoPrp(ptmin,ptmax,pp,0.0,etaminkp,etamaxkp); |
247 | else hh=GetHistoPrn(ptmin,ptmax,pp,0.0); | |
a8ad4709 | 248 | sprintf(name,"P_{TOF} > 0.8: %f < p_{T} < %f GeV/#it{c}",ptmin,ptmax); |
249 | hh->SetTitle(name); | |
250 | sprintf(name,"hPid60_%i",i); | |
251 | h = hh->ProjectionX(name,cmin,cmax); | |
252 | h->RebinX(rebinsize); | |
253 | h->Draw("ERR"); | |
254 | h->SetMarkerStyle(24); | |
255 | b2[i][0]=-1; | |
256 | Int_t ntrial = 0; | |
257 | Float_t chi2 = 10000; | |
08b5b548 | 258 | while(ntrial < 3 && (chi2 > 20 + 1000*selectTrue)){ |
bf2e05d5 | 259 | fit(h,b2[i],"WW","",xx[i]); |
260 | fit(h,b2[i],"","",xx[i]); | |
a8ad4709 | 261 | ntrial++; |
262 | chi2 = b2[i][2]; | |
263 | printf("chi2 = %f\n",chi2); | |
264 | } | |
265 | yy[i] = fall->GetParameter(parplotted); | |
266 | eyy[i] = fall->GetParError(parplotted); | |
267 | ||
268 | } | |
269 | ||
270 | TGraphErrors *gpar2 = new TGraphErrors(nptbin,xx,yy,exx,eyy); | |
271 | c2->cd(8); | |
08b5b548 | 272 | // gpar2->Draw("AP"); |
a8ad4709 | 273 | gpar2->SetMarkerStyle(20); |
274 | ||
275 | Double_t xpt[50],expt[50],eff[50],efferr[50]; | |
276 | for(Int_t i=0;i<nptbin;i++){ | |
277 | printf("%f +/- %f - %f +/- %f\n",b[i][0],b[i][1],b2[i][0],b2[i][1]); | |
278 | ||
279 | Float_t ptmin = minptbin+(maxptbin-minptbin)/nptbin*(i); | |
280 | Float_t ptmax = minptbin+(maxptbin-minptbin)/nptbin*(i+1); | |
281 | ||
282 | xpt[i] = (ptmin+ptmax)/2; | |
283 | expt[i] = (-ptmin+ptmax)/2; | |
284 | eff[i] = b2[i][0]/(b[i][0]-b2[i][0]*weightS); | |
285 | ||
ca4825ae | 286 | // b[i][0] = b[i][0]-b2[i][0]*weightS; |
a8ad4709 | 287 | |
ca4825ae | 288 | // 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])); |
289 | ||
290 | efferr[i] = 1./(b[i][0]-b2[i][0]*weightS)/(b[i][0]-b2[i][0]*weightS)*TMath::Sqrt(b[i][0]*b[i][0]*b2[i][1]*b2[i][1] + b2[i][0]*b2[i][0]*b[i][1]*b[i][1]); | |
a8ad4709 | 291 | |
292 | if(TMath::Abs(efferr[i]) > 1)efferr[i]=1; | |
293 | } | |
294 | new TCanvas(); | |
295 | TGraphErrors *geff = new TGraphErrors(nptbin,xpt,eff,expt,efferr); | |
296 | geff->Draw("AP"); | |
297 | ||
298 | char flag[100]; | |
7484404e | 299 | flag[0] = '\0'; |
a8ad4709 | 300 | |
301 | if(isMC){ | |
302 | if(selectTrue) sprintf(flag,"true"); | |
303 | else if(!keepTrue) sprintf(flag,"back"); | |
304 | } | |
305 | ||
306 | char flag2[100]; | |
7484404e | 307 | flag2[0] = '\0'; |
a8ad4709 | 308 | |
08b5b548 | 309 | Bool_t kWriteME = kFALSE; |
310 | ||
a8ad4709 | 311 | char etarange[100]; |
312 | sprintf(etarange,"_%.1f-%.1f_",etaminkp,etamaxkp); | |
313 | ||
314 | if(kGoodMatch) | |
315 | sprintf(flag2,"GM"); | |
316 | ||
317 | if(bayesVsigma) | |
318 | sprintf(flag2,"BayesVsSigma"); | |
319 | ||
320 | if(kSigma2vs3) | |
321 | sprintf(flag2,"Sigma2vs3"); | |
322 | ||
323 | if(kOverAll) | |
324 | sprintf(flag2,"OverAll"); | |
e34b28fe | 325 | if(kOverAllTOFmatch) |
326 | sprintf(flag2,"OverAllTOF"); | |
327 | if(kOverAll2Sigma) | |
328 | sprintf(flag2,"OverAll2sigma"); | |
a8ad4709 | 329 | |
167b8b0a | 330 | if(kPid3Sigma) |
331 | sprintf(flag2,"pid3sigma"); | |
332 | if(kPid2Sigma) | |
333 | sprintf(flag2,"pid2sigma"); | |
334 | ||
a8ad4709 | 335 | if(pos){ |
336 | 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); | |
08b5b548 | 337 | else{ |
338 | sprintf(name,"protonPos%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2); | |
6490e37e | 339 | if(!(kOverAll || bayesVsigma || kGoodMatch || kSigma2vs3)) kWriteME = kTRUE; |
08b5b548 | 340 | } |
a8ad4709 | 341 | } |
342 | else{ | |
343 | 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); | |
344 | else sprintf(name,"protonNeg%sMatchEff%i_%i%s%s.root",etarange,(cmin-1)*10,cmax*10,flag,flag2); | |
345 | } | |
346 | ||
08b5b548 | 347 | geff->SetTitle("p efficiency (from (anti)#Lambda);p_{T} (GeV/#it{c};efficiency"); |
a8ad4709 | 348 | TFile *fout = new TFile(name,"RECREATE"); |
349 | geff->Write(); | |
08b5b548 | 350 | if(kWriteME) hm->Write(); |
a8ad4709 | 351 | fout->Close(); |
352 | ||
08b5b548 | 353 | if(kWriteME) hm->Draw("SAME"); |
a8ad4709 | 354 | } |
355 | ||
7484404e | 356 | TH2F *GetHistoPrp(Float_t pt,Float_t ptM,Float_t pMinkp,Float_t pMinkn,Float_t etaminkp,Float_t etamaxkp){ |
a8ad4709 | 357 | |
167b8b0a | 358 | 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 || kPid3Sigma||kPid2Sigma)+0.001,kTOFmatch+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]}; |
a8ad4709 | 359 | 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]}; |
360 | ||
e34b28fe | 361 | if(kOverAll){ |
362 | x[6] = 0.0001; | |
363 | x2[9] = 5.9; | |
364 | if(pMinkp > 0.19) x2[9] = 4.9; | |
365 | } | |
366 | ||
367 | if(kOverAllTOFmatch && pMinkp > 0.19){ | |
368 | x[6] = 1.0001; | |
6490e37e | 369 | x2[9] = 4.9; |
370 | } | |
e34b28fe | 371 | |
372 | if(kOverAll2Sigma && pMinkp > 0.09){ | |
373 | x2[9] = 2; | |
374 | x[6] = 1.0001; | |
375 | } | |
376 | ||
a8ad4709 | 377 | if(kGoodMatch){ |
378 | x[6] = 1.0001; | |
379 | if(pMinkp > 0) | |
380 | x2[9] = 4.9; | |
381 | ||
382 | } | |
383 | ||
384 | if(kTOFmatch){ | |
385 | x[6] = 1.0001; | |
386 | } | |
387 | ||
388 | if(kSigma2vs3){ | |
389 | x[6] = 1.0001; | |
390 | x2[9] = 3; | |
391 | if(pMinkp > 0) | |
392 | x2[9] = 2; | |
393 | } | |
394 | ||
395 | if(bayesVsigma){ | |
396 | if(pMinkp > 0){ | |
397 | x[4] = 0.2001; | |
398 | x2[9] = 5; | |
399 | } | |
400 | else{ | |
401 | x2[9] = 3; | |
402 | } | |
403 | ||
404 | ||
405 | } | |
406 | ||
407 | if(require5sigma) x2[9] = 4.9; | |
167b8b0a | 408 | if(kPid3Sigma && pMinkp>0.09) x2[9] = 2.9; |
409 | if(kPid2Sigma && pMinkp>0.09) x2[9] = 1.9; | |
a8ad4709 | 410 | |
7484404e | 411 | AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid1; |
a8ad4709 | 412 | |
413 | TH2F *h = tmp->GetQA(0, x, x2); | |
414 | ||
415 | h->GetXaxis()->SetTitle("M_{#Lambda} (GeV/#it{c}^{2})"); | |
416 | h->GetYaxis()->SetTitle("centrality [%]"); | |
417 | ||
418 | return h; | |
419 | } | |
420 | ||
7484404e | 421 | TH2F *GetHistoPrn(Float_t pt,Float_t ptM,Float_t pMinkn,Float_t pMinkp,Float_t etaminkp,Float_t etamaxkp){ |
a8ad4709 | 422 | |
167b8b0a | 423 | 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 || kPid3Sigma||kPid2Sigma)+0.001,selectTrue,xmin[9],xmin[10],xmin[11],xmin[12],xmin[13]}; |
a8ad4709 | 424 | 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]}; |
425 | ||
e34b28fe | 426 | if(kOverAll){ |
427 | x[7] = 0.0001; | |
428 | x2[10] = 5.9; | |
429 | if(pMinkn > 0.19) x2[10] = 4.9; | |
430 | } | |
431 | ||
432 | if(kOverAllTOFmatch && pMinkn > 0.19){ | |
433 | x[7] = 1.0001; | |
6490e37e | 434 | x2[10] = 4.9; |
e34b28fe | 435 | } |
436 | ||
437 | if(kOverAll2Sigma && pMinkn > 0.09){ | |
438 | x2[10] = 2; | |
439 | x[7] = 1.0001; | |
440 | } | |
441 | ||
a8ad4709 | 442 | if(kGoodMatch){ |
443 | x[7] = 1.0001; | |
444 | if(pMinkn > 0) | |
445 | x2[10] = 4.9; | |
446 | ||
447 | } | |
448 | ||
449 | if(kTOFmatch){ | |
450 | x[7] = 1.0001; | |
451 | } | |
452 | ||
453 | if(kSigma2vs3){ | |
454 | x[7] = 1.0001; | |
455 | x2[10] = 3; | |
456 | if(pMinkn > 0) | |
457 | x2[10] = 2; | |
458 | } | |
459 | ||
460 | if(bayesVsigma){ | |
461 | if(pMinkn > 0){ | |
462 | x[5] = 0.2001; | |
463 | x2[10] = 5; | |
464 | } | |
465 | else{ | |
466 | x2[10] = 3; | |
467 | } | |
468 | } | |
469 | ||
470 | if(require5sigma) x2[10] = 4.9; | |
167b8b0a | 471 | if(kPid3Sigma && pMinkn>0.09) x2[10] = 2.9; |
472 | if(kPid2Sigma && pMinkn>0.09) x2[10] = 1.9; | |
a8ad4709 | 473 | |
7484404e | 474 | AliPIDperfContainer *tmp = (AliPIDperfContainer *) fContPid2; |
a8ad4709 | 475 | |
476 | TH2F *h = tmp->GetQA(0, x, x2); | |
477 | ||
478 | h->GetXaxis()->SetTitle("M_{#Lambda} (GeV/#it{c}^{2})"); | |
479 | h->GetYaxis()->SetTitle("centrality [%]"); | |
480 | ||
481 | return h; | |
482 | } | |
483 | ||
bf2e05d5 | 484 | void fit(TH1D *h,Float_t *a,char *opt,char *opt2,Float_t pt){ |
a8ad4709 | 485 | if(h->Integral(1,h->GetNbinsX()) < 1){ |
486 | if(a){ | |
487 | a[0]=0.01; | |
488 | a[1]=1; | |
489 | } | |
490 | return; | |
491 | } | |
492 | ||
493 | ||
494 | fall->SetParameter(0,100); | |
495 | fall->SetParameter(1,1.115); | |
bf2e05d5 | 496 | fall->SetParameter(2,2.89748e-03); |
9309a88b | 497 | fall->FixParameter(3,1000+350+600/pt); |
a8ad4709 | 498 | |
7ae044be | 499 | fall->SetParLimits(0,0.00001,10000000); |
a8ad4709 | 500 | fall->SetParLimits(1,1.105,1.125);//1.01898 + 2.4e-04*pt-1e-03,1.01898 + 2.4e-04*pt+1e-03); |
bf2e05d5 | 501 | fall->SetParLimits(2,0.0005,0.0015); |
502 | //fall->SetParLimits(3,200,350); | |
a8ad4709 | 503 | |
504 | // fall->FixParameter(2,5E-4); | |
505 | ||
506 | // fall->FixParameter(1,1.01884 + 2.9891e-04*pt); | |
507 | // fall->FixParameter(2,0.0044); | |
508 | // fall->FixParameter(3,7.57574e-04 + 3.85408e-04*pt); | |
509 | ||
510 | fall->ReleaseParameter(4); | |
511 | fall->ReleaseParameter(5); | |
512 | fall->ReleaseParameter(6); | |
513 | ||
514 | if(selectTrue){ | |
515 | fall->FixParameter(4,0); | |
516 | fall->FixParameter(5,0); | |
517 | fall->FixParameter(6,0); | |
518 | } | |
519 | ||
cd9f95f6 | 520 | char namenew[100]; |
521 | sprintf(namenew,"%s_%i",h->GetName(),Int_t(gRandom->Rndm()*10000)); | |
522 | TH1D *h2 = new TH1D(*h); | |
523 | h2->SetName(namenew); | |
524 | ||
525 | // Float_t entries = h2->GetBinContent(h2->FindBin(0.497)); | |
526 | // printf("entries under the peak = %f, pt = %f\n",entries,pt); | |
527 | // getchar(); | |
528 | ||
529 | if(pt > 2.5){ | |
9309a88b | 530 | if(pt < 2.4) h2->RebinX(1); |
531 | else if(pt < 3) h2->RebinX(2); | |
532 | else h2->RebinX(2); | |
cd9f95f6 | 533 | } |
534 | ||
535 | h=h2; | |
536 | ||
a8ad4709 | 537 | char name[100]; |
538 | TF1 *ftmp=fall; | |
539 | ||
540 | TF1 *ftmp2=new TF1(*fsign); | |
541 | sprintf(name,"fsign%i",ifunc); | |
542 | ftmp2->SetName(name); | |
543 | ||
544 | TF1 *ftmp3=new TF1(*fback); | |
545 | sprintf(name,"ftmp3%i",ifunc); | |
546 | ftmp3->SetName(name); | |
547 | ||
548 | ifunc++; | |
549 | ||
550 | h->Fit(ftmp,opt,opt2,fitmin,fitmax); | |
551 | h->Draw("ERR"); | |
552 | ||
553 | ftmp2->SetParameter(0,ftmp->GetParameter(0)); | |
554 | ftmp2->SetParameter(1,ftmp->GetParameter(1)); | |
555 | ftmp2->SetParameter(2,ftmp->GetParameter(2)); | |
556 | ftmp2->SetParameter(3,ftmp->GetParameter(3)); | |
557 | ftmp2->Draw("SAME"); | |
558 | ftmp3->SetParameter(0,ftmp->GetParameter(4)); | |
559 | ftmp3->SetParameter(1,ftmp->GetParameter(5)); | |
560 | ftmp3->SetParameter(2,ftmp->GetParameter(6)); | |
561 | ftmp3->Draw("SAME"); | |
562 | ||
563 | Float_t mean = ftmp->GetParameter(1); | |
bf2e05d5 | 564 | Float_t sigma = TMath::Abs(ftmp->GetParameter(2)); |
a8ad4709 | 565 | |
566 | Float_t signI = ftmp2->Integral(mean-10*sigma,mean+10*sigma)/h->GetBinWidth(1); | |
567 | Float_t backI = ftmp3->Integral(mean-3*sigma,mean+3*sigma)/h->GetBinWidth(1); | |
568 | ||
476e3d92 FN |
569 | Float_t errI = TMath::Abs(ftmp->GetParError(0)*ftmp->GetParError(0)/(0.001+ftmp->GetParameter(0))/(0.001+ftmp->GetParameter(0))); |
570 | ||
571 | errI = TMath::Sqrt(errI); | |
572 | ||
d82096df | 573 | if(signI < 0) signI = 0; |
476e3d92 | 574 | if(backI < 1) backI = 1; |
a8ad4709 | 575 | |
576 | printf("signal(5 sigma) = %f +/- %f(fit) +/- %f(stat)\n",signI,errI*signI,TMath::Sqrt(signI)); | |
577 | printf("backgr(3sigma) = %f\n",backI); | |
578 | printf("significance(3 sigma) = %f\n",signI/sqrt(signI+backI)); | |
579 | ||
580 | if(a){ | |
581 | a[0]=signI; | |
582 | a[1]=signI*errI*signI*errI + signI; | |
583 | a[1] = TMath::Sqrt(a[1]); | |
584 | if(ftmp->GetNDF()) a[2] = ftmp->GetChisquare()/ftmp->GetNDF(); | |
585 | ||
586 | ||
587 | if(selectTrue){ | |
588 | a[0] = h->Integral(1,h->GetNbinsX()); | |
589 | a[1] = TMath::Sqrt(a[0]); | |
590 | } | |
591 | } | |
592 | } | |
593 | ||
7484404e | 594 | void AddHisto(TH2F *h1,TH2F *h2,Float_t w){ |
a8ad4709 | 595 | Int_t nbinx = h1->GetNbinsX(); |
596 | Int_t nbiny = h1->GetNbinsY(); | |
597 | ||
598 | for(Int_t i=1;i<=nbinx;i++){ | |
599 | for(Int_t j=1;j<=nbiny;j++){ | |
7484404e | 600 | Double_t val = h1->GetBinContent(i,j) + h2->GetBinContent(i,j)*w; |
a8ad4709 | 601 | Float_t err = TMath::Min(TMath::Sqrt(val),val); |
602 | h1->SetBinContent(i,j,val); | |
603 | h1->SetBinError(i,j,err); | |
604 | } | |
605 | } | |
606 | } |