Centrality Framework
Loading...
Searching...
No Matches
FitterHelper.hpp
1
7#ifndef GlauberFitterHelper_H
8#define GlauberFitterHelper_H 1
9
10#include "TCanvas.h"
11#include "TFile.h"
12#include "TH1.h"
13#include "TLegend.h"
14#include "TPad.h"
15
16#include "Fitter.hpp"
17
18namespace Glauber {
19inline void DrawHistos(const Fitter& fit, Bool_t isSim, Bool_t isData, Bool_t isGlauber, Bool_t isNBD) {
20 std::unique_ptr<TCanvas> c1{new TCanvas("c1", "canvas", 1500, 900)};
21
22 c1->Divide(2, 2);
23
24 std::unique_ptr<TPad> c1_1{(TPad*) c1->GetListOfPrimitives()->FindObject("c1_1")};
25 std::unique_ptr<TPad> c1_2{(TPad*) c1->GetListOfPrimitives()->FindObject("c1_2")};
26 std::unique_ptr<TPad> c1_4{(TPad*) c1->GetListOfPrimitives()->FindObject("c1_4")};
27
28 c1_1->SetLogy(1);
29 c1_2->SetLogy(1);
30 c1_4->SetLogy(1);
31
32 /*const*/ TH1F hGlaub = fit.GetGlauberFitHisto();
33 /*const*/ TH1F hData = fit.GetDataHisto();
34 /*const*/ TH1F hNBD = fit.GetNBDHisto();
35 /*const*/ TH1F hNcoll = fit.GetNcollHisto();
36 /*const*/ TH1F hNpart = fit.GetNpartHisto();
37 /*const*/ TH1F hBestFit = fit.GetBestFiHisto();
38
39 std::unique_ptr<TFile> fOut{TFile::Open("glauber_qa.root", "recreate")};
40
41 if (isSim) {
42 c1->cd(1);
43 hNcoll.SetLineColor(2);
44
45 hNcoll.Draw();
46 hNpart.Draw("same");
47
48 std::unique_ptr<TLegend> legSim{new TLegend(0.6, 0.75, 0.75, 0.83)};
49 legSim->AddEntry(&hNpart, "Npart", "l");
50 legSim->AddEntry(&hNcoll, "hNcoll", "l");
51 legSim->Draw("same");
52
53 hNcoll.Write();
54 hNpart.Write();
55 }
56
57 if (isData) {
58 c1->cd(2);
59 hData.Draw();
60 hData.Write();
61 if (isGlauber) {
62 hBestFit.SetLineColor(kRed);
63 hBestFit.Draw("same");
64
65 std::unique_ptr<TLegend> legData{new TLegend(0.6, 0.75, 0.75, 0.83)};
66 legData->AddEntry(&hBestFit, "Fit", "l");
67 legData->AddEntry(&hData, "Data", "l");
68 legData->Draw("same");
69 hBestFit.Write();
70 }
71 }
72
73 if (isNBD) {
74 c1->cd(3);
75 hNBD.Draw();
76 hNBD.Write();
77 }
78
79 if (isGlauber) {
80 c1->cd(4);
81 hBestFit.Draw();
82 }
83
84 c1->Write();
85 c1->SaveAs("glauber.pdf");
86 fOut->Close();
87}
88
89}// namespace Glauber
90
91#endif