-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlotCentralitySelection.cpp
67 lines (59 loc) · 2.16 KB
/
PlotCentralitySelection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// PlotCentralitySelection.cpp
#include <Riostream.h>
#include <TFile.h>
#include <TH1D.h>
#include <TH2F.h>
#include <TCanvas.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TLegend.h>
#include <TPad.h>
#include <TSystem.h>
#include "utils/Utils.h"
#include "utils/Config.h"
using utils::TTList;
void PlotCentralitySelection(const char *outFileName = "CentralitySelectionPlotProton", const char *inFileName = "AnalysisResults_kINT7_10_30_50_90")
{
gStyle->SetOptStat(0);
// TFile *inFile_q = TFile::Open(Form("data/He3_PbPb/%s_q.root", inFileName));
// TFile *inFile_r = TFile::Open(Form("data/He3_PbPb/%s_r.root", inFileName));
// if (!inFile_q || !inFile_r)
// {
// std::cout << "Input files do not exist!" << std::endl;
// return;
// }
// auto inList_q = (TTList *)inFile_q->Get("mpuccio_he3_");
// auto inList_r = (TTList *)inFile_r->Get("mpuccio_he3_");
// auto fNormalisationHist_q = (TH2F *)inList_q->Get("fNormalisationHist");
// auto fNormalisationHist_r = (TH2F *)inList_r->Get("fNormalisationHist");
// TH1D *fCent_q = fNormalisationHist_q->ProjectionX("fCent_1", 4, 4);
// TH1D *fCent_r = fNormalisationHist_r->ProjectionX("fCent_2", 4, 4);
// TH1D *fCent = new TH1D(*fCent_q);
// fCent->Clear();
// fCent->Add(fCent_q,fCent_r,1,1);
TFile *inFile = TFile::Open(Form("data/Proton_PbPb/%s.root", inFileName));
if (!inFile)
{
std::cout << "Input file does not exist!" << std::endl;
return;
}
auto inList = (TTList *)inFile->Get("nuclei_proton_noitspid_");
auto fNormalisationHist = (TH2F *)inList->Get("fNormalisationHist");
TH1D *fCent = fNormalisationHist->ProjectionX("fCent", 4, 4);
TFile outFile(Form("%s.root", outFileName), "recreate");
TCanvas cCent("cCent_LHC18qr", "cCent_LHC18qr");
cCent.SetTicks(1, 1);
fCent->SetDrawOption("histo");
fCent->GetXaxis()->SetTitle("Centrality (%)");
fCent->GetXaxis()->SetTitleSize(0.05);
fCent->GetXaxis()->SetRangeUser(0,100);
fCent->GetYaxis()->SetTitle("Events");
fCent->SetLineWidth(2);
fCent->SetLineColor(kRed);
fCent->SetFillStyle(3345);
fCent->SetFillColor(kRed);
fCent->Draw("");
cCent.Write();
cCent.Print("cCent_LHC18qr.pdf");
outFile.Close();
}