changes from gsi. Using mult if no centrality. testfilterbit 128
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / Plot_Pi0_Characteristics.C
CommitLineData
baf06eb6 1#include <fstream>
2#include <Riostream.h>
3/*
4 *
5 *
6 *
7 */
8
9extern TRandom *gRandom;
10extern TBenchmark *gBenchmark;
11extern TSystem *gSystem;
12
13void Plot_Pi0_Characteristics(const char *inputRootFile = "Pi0Characteristics",const char *path = "./Output/"){
14
15 gROOT->Reset();
16 gROOT->SetStyle("Plain");
17 gStyle->SetOptFit(0);
0b045862 18 gStyle->SetPalette(1);
baf06eb6 19 TString filename = Form("%s%s.root",path,inputRootFile);
20 TFile f(filename.Data());
21
22 TList *histograms = f.GetListOfKeys(); // get the list of directories in the file
23
24 TString cutSelectionArray[15];
25 Int_t cutsAdded=0;
26 //Per pt bin histograms:
27 TH1F* YieldPerBin[32];
28 TH1F* StoBPerBin[32];
29 TH1F* SignificancePerBin[32];
30 TH1F* MassPerBin[32];
31 TH1F* FWHMPerBin[32];
32
10e3319b 33 Double_t BGFit_range[2] = {0.6,0.69};
34
baf06eb6 35 Float_t lowBinLimits[32];
36 Float_t highBinLimits[32];
37
38 TH1F * Raw_Yield;
39 TH1F * StoB;
40 TH1F * Significance;
41 TH1F * Mass;
42 TH1F * FWHM;
43
44
45
46 Int_t colorCounterRawYield=1;
47 Int_t histogramCounterRawYield=2;
48 TCanvas *canvasRawYield = new TCanvas("canvasRawYield","",200,10,600,600);
49 canvasRawYield->SetFillColor(0);
50 canvasRawYield->SetLogy();
51 TLegend *legRawYield= new TLegend(0.7,0.7,1.,1.);
52 legRawYield->SetFillColor(0);
53
54 Int_t colorCounterStoB=1;
55 Int_t histogramCounterStoB=2;
56 TCanvas *canvasStoB = new TCanvas("canvasStoB","",200,10,600,600);
57 canvasStoB->SetFillColor(0);
58 canvasStoB->SetLogy();
59 TLegend *legStoB= new TLegend(0.7,0.7,1.,1.);
60 legStoB->SetFillColor(0);
61
62 Int_t colorCounterSignificance=1;
63 Int_t histogramCounterSignificance=2;
64 TCanvas *canvasSignificance = new TCanvas("canvasSignificance","",200,10,600,600);
65 canvasSignificance->SetFillColor(0);
66 canvasSignificance->SetLogy();
67 TLegend *legSignificance= new TLegend(0.7,0.7,1.,1.);
68 legSignificance->SetFillColor(0);
69
70 Int_t colorCounterMass=1;
71 Int_t histogramCounterMass=2;
72 TCanvas *canvasMass = new TCanvas("canvasMass","",200,10,600,600);
73 canvasMass->SetFillColor(0);
74 // canvasMass->SetLogy();
75 TLegend *legMass= new TLegend(0.7,0.7,1.,1.);
76 legMass->SetFillColor(0);
77
78 Int_t colorCounterFWHM=1;
79 Int_t histogramCounterFWHM=2;
80 TCanvas *canvasFWHM = new TCanvas("canvasFWHM","",200,10,600,600);
81 canvasFWHM->SetFillColor(0);
82 // canvasFWHM->SetLogy();
83 TLegend *legFWHM= new TLegend(0.7,0.7,1.,1.);
84 legFWHM->SetFillColor(0);
85
86
87 for(Int_t entFile=0;entFile<histograms->GetEntries();entFile++){
88
89 TString histoname = histograms->At(entFile)->GetName();
90 if(histoname.Contains("Raw_Yield")){
91 canvasRawYield->cd();
92 cout<<"Histogram contains Raw_Yield: "<<histoname.Data()<<endl;
93 if(Raw_Yield==NULL){
94 cout<<"Setting first histogram"<<endl;
95 Raw_Yield = (TH1F*)f.Get(histoname.Data());
96 cout<<"Histoname: "<<histoname.Data()<<endl;
97 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
98 cutSelectionArray[cutsAdded]= cutValue;
99 cutsAdded++;
100 cout<<"Cut Value is: "<<cutValue.Data()<<endl;
101 for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
102 TString perBinHistoName = Form("Raw Yield %f <pt <%f",Raw_Yield->GetBinLowEdge(bin),Raw_Yield->GetBinLowEdge(bin)+Raw_Yield->GetBinWidth(bin));
103 lowBinLimits[bin]=Raw_Yield->GetBinLowEdge(bin);
104 highBinLimits[bin]=Raw_Yield->GetBinLowEdge(bin)+Raw_Yield->GetBinWidth(bin);
105 YieldPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
106 YieldPerBin[bin]->SetBinContent(histogramCounterRawYield,Raw_Yield->GetBinContent(bin));
107 YieldPerBin[bin]->SetBinError(histogramCounterRawYield,Raw_Yield->GetBinError(bin));
108 YieldPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterRawYield,cutValue.Data());
109 }
110 cout<<"Raw_Yield: "<<Raw_Yield<<endl;
111 legRawYield->AddEntry(Raw_Yield,cutValue.Data(),"l");
112 // Raw_Yield->DrawCopy();
113 Raw_Yield->Draw();
114 canvasRawYield->Update();
115 }
116 else{
117 colorCounterRawYield++;
118 TH1F* histogram = (TH1F*)f.Get(histoname.Data());
119 cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
120 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
121 cutSelectionArray[cutsAdded]= cutValue;
122 cutsAdded++;
123 for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
124 // YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
125 YieldPerBin[bin]->SetBinContent(histogramCounterRawYield,histogram->GetBinContent(bin));
126 YieldPerBin[bin]->SetBinError(histogramCounterRawYield,histogram->GetBinError(bin));
127 YieldPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterRawYield,cutValue.Data());
128 }
129
130 histogram->SetLineColor(colorCounterRawYield);
131 legRawYield->AddEntry(histogram,cutValue.Data(),"l");
132 legRawYield->Draw();
133 // histogram->DrawCopy("same");
134 histogram->Draw("same");
135 canvasRawYield->Update();
136 }
137 histogramCounterRawYield+=2;
138
139 }
140
141 if(histoname.Contains("SB_Pi0")){
142 canvasStoB->cd();
143 cout<<"Histogram contains SB: "<<histoname.Data()<<endl;
144 if(StoB==NULL){
145 cout<<"Setting first histogram"<<endl;
146 StoB = (TH1F*)f.Get(histoname.Data());
147 cout<<"Histoname: "<<histoname.Data()<<endl;
148 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
149 cout<<"Cut Value is: "<<cutValue.Data()<<endl;
150 for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
151 TString perBinHistoName = Form("S/B %f <pt <%f",StoB->GetBinLowEdge(bin),StoB->GetBinLowEdge(bin)+StoB->GetBinWidth(bin));
152 StoBPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
153 StoBPerBin[bin]->SetBinContent(histogramCounterStoB,StoB->GetBinContent(bin));
154 StoBPerBin[bin]->SetBinError(histogramCounterStoB,StoB->GetBinError(bin));
155 StoBPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterStoB,cutValue.Data());
156 }
157 legStoB->AddEntry(StoB,cutValue.Data(),"l");
158 StoB->DrawCopy();
159 canvasStoB->Update();
160 }
161 else{
162 colorCounterStoB++;
163 TH1F* histogram = (TH1F*)f.Get(histoname.Data());
164 cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
165 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
166 for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
167 // YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
168 StoBPerBin[bin]->SetBinContent(histogramCounterStoB,histogram->GetBinContent(bin));
169 StoBPerBin[bin]->SetBinError(histogramCounterStoB,histogram->GetBinError(bin));
170 StoBPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterStoB,cutValue.Data());
171 }
172
173 histogram->SetLineColor(colorCounterStoB);
174 legStoB->AddEntry(histogram,cutValue.Data(),"l");
175 legStoB->Draw();
176 histogram->DrawCopy("same");
177 canvasStoB->Update();
178 }
179 histogramCounterStoB+=2;
180 }
181
182 if(histoname.Contains("Significance_Pi0")){
183 canvasSignificance->cd();
184 cout<<"Histogram contains Significance: "<<histoname.Data()<<endl;
185 if(Significance==NULL){
186 cout<<"Setting first histogram"<<endl;
187 Significance = (TH1F*)f.Get(histoname.Data());
188 cout<<"Histoname: "<<histoname.Data()<<endl;
189 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
190 cout<<"Cut Value is: "<<cutValue.Data()<<endl;
191 for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
192 TString perBinHistoName = Form("Significance %f <pt <%f",Significance->GetBinLowEdge(bin),Significance->GetBinLowEdge(bin)+Significance->GetBinWidth(bin));
193 SignificancePerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
194 SignificancePerBin[bin]->SetBinContent(histogramCounterSignificance,Significance->GetBinContent(bin));
195 SignificancePerBin[bin]->SetBinError(histogramCounterSignificance,Significance->GetBinError(bin));
196 SignificancePerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterSignificance,cutValue.Data());
197 }
198 legSignificance->AddEntry(Significance,cutValue.Data(),"l");
199 Significance->DrawCopy();
200 canvasSignificance->Update();
201 // Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
202 }
203 else{
204 colorCounterSignificance++;
205 TH1F* histogram = (TH1F*)f.Get(histoname.Data());
206 cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
207 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
208 for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
209 // YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
210 SignificancePerBin[bin]->SetBinContent(histogramCounterSignificance,histogram->GetBinContent(bin));
211 SignificancePerBin[bin]->SetBinError(histogramCounterSignificance,histogram->GetBinError(bin));
212 SignificancePerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterSignificance,cutValue.Data());
213 }
214
215 histogram->SetLineColor(colorCounterSignificance);
216 legSignificance->AddEntry(histogram,cutValue.Data(),"l");
217 legSignificance->Draw();
218 histogram->DrawCopy("same");
219 canvasSignificance->Update();
220 }
221 histogramCounterSignificance+=2;
222 }
223
224 if(histoname.Contains("Mass_Pi0")){
225 canvasMass->cd();
226 cout<<"Histogram contains Mass: "<<histoname.Data()<<endl;
227 if(Mass==NULL){
228 cout<<"Setting first histogram"<<endl;
229 Mass = (TH1F*)f.Get(histoname.Data());
230 Mass->SetMinimum(0.1);
231 Mass->SetMaximum(.16);
232 cout<<"Histoname: "<<histoname.Data()<<endl;
233 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
234 cout<<"Cut Value is: "<<cutValue.Data()<<endl;
235 for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
236 TString perBinHistoName = Form("Mass %f <pt <%f",Mass->GetBinLowEdge(bin),Mass->GetBinLowEdge(bin)+Mass->GetBinWidth(bin));
237 MassPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
238 MassPerBin[bin]->SetBinContent(histogramCounterMass,Mass->GetBinContent(bin));
239 MassPerBin[bin]->SetBinError(histogramCounterMass,Mass->GetBinError(bin));
240 MassPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterMass,cutValue.Data());
241 }
242 legMass->AddEntry(Mass,cutValue.Data(),"l");
243 Mass->DrawCopy();
244 canvasMass->Update();
245 // Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
246 }
247 else{
248 colorCounterMass++;
249 TH1F* histogram = (TH1F*)f.Get(histoname.Data());
250 cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
251 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
252 for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
253 // YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
254 MassPerBin[bin]->SetBinContent(histogramCounterMass,histogram->GetBinContent(bin));
255 MassPerBin[bin]->SetBinError(histogramCounterMass,histogram->GetBinError(bin));
256 MassPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterMass,cutValue.Data());
257 }
258
259 histogram->SetLineColor(colorCounterMass);
260 legMass->AddEntry(histogram,cutValue.Data(),"l");
261 legMass->Draw();
262 histogram->DrawCopy("same");
263 canvasMass->Update();
264 }
265 histogramCounterMass+=2;
266 }
267
268 if(histoname.Contains("FWHM_Pi0")){
269 canvasFWHM->cd();
270 cout<<"Histogram contains FWHM: "<<histoname.Data()<<endl;
271 if(FWHM==NULL){
272 cout<<"Setting first histogram"<<endl;
273 FWHM = (TH1F*)f.Get(histoname.Data());
274 cout<<"Histoname: "<<histoname.Data()<<endl;
275 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
276 cout<<"Cut Value is: "<<cutValue.Data()<<endl;
277 for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
278 TString perBinHistoName = Form("FWHM %f <pt <%f",FWHM->GetBinLowEdge(bin),FWHM->GetBinLowEdge(bin)+FWHM->GetBinWidth(bin));
279 FWHMPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
280 FWHMPerBin[bin]->SetBinContent(histogramCounterFWHM,FWHM->GetBinContent(bin));
281 FWHMPerBin[bin]->SetBinError(histogramCounterFWHM,FWHM->GetBinError(bin));
282 FWHMPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterFWHM,cutValue.Data());
283 }
284 legFWHM->AddEntry(FWHM,cutValue.Data(),"l");
285 FWHM->DrawCopy();
286 canvasFWHM->Update();
287 // Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
288 }
289 else{
290 colorCounterFWHM++;
291 TH1F* histogram = (TH1F*)f.Get(histoname.Data());
292 cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
293 TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
294 for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
295 // YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
296 FWHMPerBin[bin]->SetBinContent(histogramCounterFWHM,histogram->GetBinContent(bin));
297 FWHMPerBin[bin]->SetBinError(histogramCounterFWHM,histogram->GetBinError(bin));
298 FWHMPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterFWHM,cutValue.Data());
299 }
300
301 histogram->SetLineColor(colorCounterFWHM);
302 legFWHM->AddEntry(histogram,cutValue.Data(),"l");
303 legFWHM->Draw();
304 histogram->DrawCopy("same");
305 canvasFWHM->Update();
306 }
307 histogramCounterFWHM+=2;
308 }
309
310 }//end of for loop over histograms
311
312
313
314 TPostScript *ps_characteristics;
315 ps_characteristics = new TPostScript(Form("%sPi0Characteristics.ps",path),111);
316 ps_characteristics->NewPage();
317
318
319 canvasRawYield->Update();
320 canvasRawYield->Draw();
321 ps_characteristics->NewPage();
322 canvasSignificance->Update();
323 canvasSignificance->Draw();
324 ps_characteristics->NewPage();
325 canvasStoB->Update();
326 canvasStoB->Draw();
327 ps_characteristics->NewPage();
328 canvasMass->Update();
329 canvasMass->Draw();
330 ps_characteristics->NewPage();
331 canvasFWHM->Update();
332 canvasFWHM->Draw();
333 ps_characteristics->NewPage();
334
335
336
337
338 /*
339
340 TCanvas *canvas1 = new TCanvas("Integrated1","",10,10,700,1000);
341 TPad *pad1 = new TPad("pad1","",0.,0.,1.,1.,0);
342 pad1->SetFillColor(0);
343 pad1->GetFrame()->SetFillColor(0);
344 pad1->SetBorderMode(0);
345 pad1->Divide(1,2);
346 pad1->Draw();
347
348 pad1->cd(1);
349 Raw_Yield->Draw();
350
351 pad1->cd(2);
352 StoB->Draw();
353 ps_characteristics->NewPage();
354
355
356 TCanvas *canvas2 = new TCanvas("Integrated2","",10,10,700,1000);
357 TPad *pad2 = new TPad("pad2","",0.,0.,1.,1.,0);
358 pad2->SetFillColor(0);
359 pad2->GetFrame()->SetFillColor(0);
360 pad2->SetBorderMode(0);
361 pad2->Divide(1,2);
362 pad2->Draw();
363
364 pad2->cd(1);
365 Significance->Draw();
366
367 pad2->cd(2);
368 Mass->Draw();
369
370 ps_characteristics->NewPage();
371
372 TCanvas *canvas3 = new TCanvas("Integrated3","",10,10,700,1000);
373 TPad *pad3 = new TPad("pad3","",0.,0.,1.,1.,0);
374 pad3->SetFillColor(0);
375 pad3->GetFrame()->SetFillColor(0);
376 pad3->SetBorderMode(0);
377 pad3->Divide(1,2);
378 pad3->Draw();
379
380 pad3->cd(1);
381 FWHM->Draw();
382
383 pad3->cd(2);
384 // Mass->Draw();
385 */
386 ps_characteristics->NewPage();
387
388 for(Int_t bin=2;bin<Raw_Yield->GetNbinsX();bin++){
389 TString canvasname= Form("bin %d",bin);
390 TCanvas *binC = new TCanvas(canvasname.Data(),"",10,10,700,1000);
391 TString padname= Form("pad %d",bin);
392 // TPad *pad = new TPad(padname.Data(),"",0.05,0.05,0.95,0.95,0);
393 TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
394 pad->SetFillColor(0);
395 pad->GetFrame()->SetFillColor(0);
396 pad->SetBorderMode(0);
397 pad->Divide(1,5);
398 pad->Draw();
399
400 pad->cd(1);
401 YieldPerBin[bin]->Draw();
402
403 pad->cd(2);
404 StoBPerBin[bin]->Draw();
405
406 pad->cd(3);
407 SignificancePerBin[bin]->Draw();
408
409 pad->cd(4);
410 MassPerBin[bin]->Draw();
411
412 pad->cd(5);
413 FWHMPerBin[bin]->Draw();
414
415 binC->Update();
416 binC->Close();
417
418 ps_characteristics->NewPage();
419 binC->Close();
420 }
421
422 Int_t rebinValue=4;
423
424 for(Int_t cuts=0;cuts<cutsAdded;cuts++){
425 cout<<"CUT: "<<cutSelectionArray[cuts].Data()<<endl;
0b045862 426 // for(Int_t bin=2;bin<15;bin++){
baf06eb6 427 TCanvas *canvasTest = new TCanvas("canvastest","",200,10,600,600);
428 TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
429 pad->SetFillColor(0);
430 pad->GetFrame()->SetFillColor(0);
431 pad->SetBorderMode(0);
0b045862 432 pad->Divide(4,4);
baf06eb6 433 pad->Draw();
0b045862 434 for(Int_t bin=2;bin<18;bin++){
435 pad->cd(bin-1);
baf06eb6 436 TString namet= Form("Mapping_Reco_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
437 cout<<"Getting histogram: "<<namet.Data()<<endl;
438 TH1F * signalt = (TH1F*)f.Get(namet.Data());
439 signalt->Rebin(rebinValue);
440 TString titlet= Form("Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
441 signalt->SetTitle(titlet.Data());
442 signalt->Sumw2();
0b045862 443 signalt->SetAxisRange(0.,0.7);
baf06eb6 444 signalt->Draw();
445
10e3319b 446
baf06eb6 447 TString nameb= Form("Mapping_Back_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
448 cout<<"Getting histogram: "<<nameb.Data()<<endl;
449 TH1F * signalb = (TH1F*)f.Get(nameb.Data());
450 signalb->Rebin(rebinValue);
451 TString titleb= Form("Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
452 signalb->SetTitle(titleb.Data());
0b045862 453 signalb->SetAxisRange(0.,0.7);
baf06eb6 454 signalb->SetLineColor(4);
10e3319b 455
456 TLine *lowline= new TLine(BGFit_range[0],0,BGFit_range[0],signalt->GetMaximum());
457 lowline->SetLineColor(3);
458 lowline->Draw("same");
459 TLine *highline= new TLine(BGFit_range[1],0,BGFit_range[1],signalt->GetMaximum());
460 highline->SetLineColor(3);
461 highline->Draw("same");
462 //normalixation
463 TAxis *xaxis_reco = signalt->GetXaxis();
464 Int_t r_1 = xaxis_reco->FindBin(BGFit_range[0]);
465 Int_t r_2 = xaxis_reco->FindBin(BGFit_range[1]);
466 Double_t r = signalt->Integral(r_1,r_2); // Integral(75,125)
467 TAxis *xaxis_back = signalb->GetXaxis();
468 Int_t b_1 = xaxis_back->FindBin(BGFit_range[0]);
469 Int_t b_2 = xaxis_back->FindBin(BGFit_range[1]);
470 Double_t b = signalb->Integral(b_1,b_2);
471 Double_t norm = 1;
472 if(b != 0) norm = r/b;
473 signalb->Sumw2();
474 signalb->Scale(norm);
475
baf06eb6 476 signalb->Draw("same");
0b045862 477 canvasTest->Update();
478
479 // ps_characteristics->NewPage();
480 }
481 ps_characteristics->NewPage();
482
483 TCanvas *canvasTestDiff = new TCanvas("canvastestdiff","",200,10,600,600);
484 TPad *padD = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
485 canvasTestDiff->SetFillColor(0);
486 padD->SetFillColor(0);
487 padD->GetFrame()->SetFillColor(0);
488 padD->SetBorderMode(0);
489 padD->Divide(4,4);
490 padD->Draw();
491 for(Int_t bin=2;bin<18;bin++){
492 padD->cd(bin-1);
baf06eb6 493 TString name= Form("Mapping_Signal_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
494 cout<<"Getting histogram: "<<name.Data()<<endl;
495 TH1F * signal = (TH1F*)f.Get(name.Data());
496 signal->Rebin(rebinValue);
497 TString title= Form("Signal_Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
498 signal->SetTitle(title.Data());
0b045862 499 signal->SetAxisRange(0.,0.7);
baf06eb6 500 signal->Draw();
0b045862 501
502 canvasTestDiff->Update();
baf06eb6 503
0b045862 504 // ps_characteristics->NewPage();
baf06eb6 505 }
0b045862 506 ps_characteristics->NewPage();
507 }
508
509 TCanvas *canvasTest = new TCanvas("canvastest","",200,10,600,600);
510 TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
511 pad->SetFillColor(0);
512 pad->GetFrame()->SetFillColor(0);
513 pad->SetBorderMode(0);
514 pad->Divide(3,3);
515 pad->Draw();
516 for(Int_t bin=0;bin<cutsAdded;bin++){
517 cout<<"CUT: "<<cutSelectionArray[bin].Data()<<endl;
518 pad->cd(bin+1);
10e3319b 519 // pad->cd(bin+1)->SetLogz(1);
0b045862 520 TString namet= Form("ESD_Mother_InvMass_%s",cutSelectionArray[bin].Data());
521 cout<<"Getting histogram: "<<namet.Data()<<endl;
522 TH1F * massAll = (TH1F*)f.Get(namet.Data());
523
524 TString titlet= Form("CutId%s",cutSelectionArray[bin].Data());
525 massAll->SetTitle(titlet.Data());
526 massAll->Draw();
10e3319b 527
528 TString nameb= Form("ESD_Background_InvMass_%s",cutSelectionArray[bin].Data());
529 TH1F * massAllBG = (TH1F*)f.Get(nameb.Data());
530 /*
531 TLine *lowline= new TLine(BGFit_range[0],0,BGFit_range[0],signalt->GetMaximum());
532 lowline->SetLineColor(3);
533 lowline->Draw("same");
534 TLine *highline= new TLine(BGFit_range[1],0,BGFit_range[1],signalt->GetMaximum());
535 highline->SetLineColor(3);
536 highline->Draw("same");
537 */
538
539 //normalixation
540 TAxis *xaxis_reco = massAll->GetXaxis();
541 Int_t r_1 = xaxis_reco->FindBin(BGFit_range[0]);
542 Int_t r_2 = xaxis_reco->FindBin(BGFit_range[1]);
543 Double_t r = massAll->Integral(r_1,r_2); // Integral(75,125)
544 TAxis *xaxis_back = massAllBG->GetXaxis();
545 Int_t b_1 = xaxis_back->FindBin(BGFit_range[0]);
546 Int_t b_2 = xaxis_back->FindBin(BGFit_range[1]);
547 Double_t b = massAllBG->Integral(b_1,b_2);
548 Double_t norm = 1;
549 if(b != 0) norm = r/b;
550 massAllBG->Sumw2();
551 massAllBG->Scale(norm);
552
553
554 TString titleb= Form("CutId%s",cutSelectionArray[bin].Data());
555 massAllBG->SetTitle(titleb.Data());
556 massAllBG->SetLineColor(4);
557 massAllBG->Draw("same");
558 /*
0b045862 559 canvasTest->Update();
10e3319b 560 canvasTest->Print(Form("%smassAllAndBG%s.gif",path,cutSelectionArray[bin].Data()));
561 */
0b045862 562 }
10e3319b 563 canvasTest->Update();
564 canvasTest->Print(Form("%smassAll%s.gif",path,cutSelectionArray[bin].Data()));
565
0b045862 566 ps_characteristics->NewPage();
baf06eb6 567
10e3319b 568 delete canvasTest;
0b045862 569 // for(Int_t bin=2;bin<15;bin++){
570 TCanvas *canvasTest = new TCanvas("canvastest","",200,10,600,600);
571 TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
572 pad->SetFillColor(0);
573 pad->GetFrame()->SetFillColor(0);
574 pad->SetBorderMode(0);
575 pad->Divide(3,3);
576 pad->Draw();
577 for(Int_t bin=0;bin<cutsAdded;bin++){
578 cout<<"CUT: "<<cutSelectionArray[bin].Data()<<endl;
579 pad->cd(bin+1);
580 pad->cd(bin+1)->SetLogx(1);
581 pad->cd(bin+1)->SetLogz(1);
582 TString namet= Form("ESD_ConvGamma_E_dEdxP_%s",cutSelectionArray[bin].Data());
583 cout<<"Getting histogram: "<<namet.Data()<<endl;
10e3319b 584 TH2F * dedxp = (TH2F*)f.Get(namet.Data());
0b045862 585
586 TString titlet= Form("CutId%s",cutSelectionArray[bin].Data());
587 dedxp->SetTitle(titlet.Data());
588 dedxp->Draw("col2");
baf06eb6 589 }
10e3319b 590 canvasTest->Update();
591 canvasTest->Print(Form("%sdedxp%s.gif",path,cutSelectionArray[bin].Data()));
592
0b045862 593 ps_characteristics->NewPage();
10e3319b 594
0b045862 595 TCanvas *canvasTest = new TCanvas("canvastest","",200,10,600,600);
596 TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
597 pad->SetFillColor(0);
598 pad->GetFrame()->SetFillColor(0);
599 pad->SetBorderMode(0);
600 pad->Divide(3,3);
601 pad->Draw();
602 for(Int_t bin=0;bin<cutsAdded;bin++){
603 cout<<"CUT: "<<cutSelectionArray[bin].Data()<<endl;
604 pad->cd(bin+1);
605 pad->cd(bin+1)->SetLogz(1);
606 TString namet= Form("ESD_ConvGamma_alfa_qt_%s",cutSelectionArray[bin].Data());
607 cout<<"Getting histogram: "<<namet.Data()<<endl;
608 TH1F * armen = (TH1F*)f.Get(namet.Data());
609
610 TString titlet= Form("CutId%s",cutSelectionArray[bin].Data());
611 armen->SetTitle(titlet.Data());
612 armen->Draw("col2");
613 canvasTest->Update();
10e3319b 614 canvasTest->Print(Form("%sarmen%s.gif",path,cutSelectionArray[bin].Data()));
0b045862 615 }
616
baf06eb6 617 ps_characteristics->Close();
618}