-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeFastJetPlots_Jet.C
132 lines (103 loc) · 3.66 KB
/
makeFastJetPlots_Jet.C
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include "TH1F.h"
#include "TH2F.h"
#include "TH1I.h"
#include "TFile.h"
#include "TDatime.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TLatex.h"
#include "TLegend.h"
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
const std::string bBins[5] = {"0.0", "8.5", "11.6", "14.0", "20.0"};
void claverCanvasSaving(TCanvas* c, TString s,TString format="gif") {
TDatime* date = new TDatime();
c->SaveAs(Form("%s_%d.%s",s.Data(),date->GetDate(), format.Data()));
}
void handsomeTH1( TH1 *a=0, Int_t col =1, Float_t size=1, Int_t markerstyle=20)
{
a->SetMarkerColor(col);
a->SetMarkerSize(size);
a->SetMarkerStyle(markerstyle);
a->SetLineColor(col);
}
void niceTH1(TH1* uglyTH1, float max , float min, float ndivX, float ndivY)
{
handsomeTH1(uglyTH1);
uglyTH1->SetMaximum(max);
uglyTH1->SetMinimum(min);
uglyTH1->GetXaxis()->SetNdivisions(ndivX);
uglyTH1->GetYaxis()->SetNdivisions(ndivY);
return;
}
void handsomeTH2( TH2 *a=0)
{
a->GetYaxis()->SetTitleOffset(1.25);
a->GetXaxis()->CenterTitle();
a->GetYaxis()->CenterTitle();
}
void makeFastJetPlots_Jet(const std::string inName, const std::string outName)
{
TFile* inFile_p = new TFile(inName.c_str(), "READ");
TH2F* getImpact_p = (TH2F*)inFile_p->Get("impactCut_h");
handsomeTH2(getImpact_p);
getImpact_p->SetXTitle("b (fm)");
getImpact_p->SetYTitle("p_{T}^{SK} Cut (GeV/c)");
TH1F* getGenSubeRaw[4];
TH1F* getGenSubeSK[4];
for(Int_t iter = 0; iter < 4; iter++){
getGenSubeRaw[iter] = (TH1F*)inFile_p->Get(Form("genSubeRaw_b%d_h", iter));
niceTH1(getGenSubeRaw[iter], 1.1999, 0.0001, 505, 505);
getGenSubeSK[iter] = (TH1F*)inFile_p->Get(Form("genSubeSK_b%d_h", iter));
getGenSubeSK[iter]->SetXTitle("Signal == 0/Bkgd == 1");
getGenSubeSK[iter]->SetYTitle("Momentum Fraction");
niceTH1(getGenSubeSK[iter], 1.1999, 0.0001, 505, 505);
getGenSubeSK[iter]->GetYaxis()->SetTitleOffset(1.25);
getGenSubeSK[iter]->GetXaxis()->SetTitleFont(43);
getGenSubeSK[iter]->GetYaxis()->SetTitleFont(43);
getGenSubeSK[iter]->GetXaxis()->SetTitleSize(22);
getGenSubeSK[iter]->GetYaxis()->SetTitleSize(22);
getGenSubeSK[iter]->SetMarkerColor(kRed);
getGenSubeRaw[iter]->SetLineColor(kBlue);
}
TCanvas* c1 = new TCanvas("impactCanv", "impactCanv", 2*300, 2*350);
c1->SetLogz();
getImpact_p->DrawCopy("COL");
TLatex* label_p = new TLatex();
label_p->SetNDC();
label_p->SetTextFont(43);
label_p->SetTextSizePixels(23);
label_p->DrawLatex(.4, .9, "PYTHIA+HYDJET, Gen. Level");
TCanvas *c2 = new TCanvas("genSubeCanv", "genSubeCanv", 4*300, 1*350);
c2->Divide(4, 1, 0, 0);
const Float_t xPos[4] = {.3, .15, .15, .15};
for(Int_t iter = 0; iter < 4; iter++){
c2->cd(iter+1);
getGenSubeSK[3-iter]->DrawCopy("P");
getGenSubeRaw[3-iter]->DrawCopy("HIST SAME");
label_p->DrawLatex(xPos[iter], .9, "PYTHIA+HYDJET (Gen)");
label_p->DrawLatex(xPos[iter], .82, Form("%s < b < %s", bBins[3-iter].c_str(), bBins[3-iter+1].c_str()));
}
c2->cd(1);
TLegend* leg_p = new TLegend(0.70, 0.45, 0.95, 0.75);
leg_p->SetFillColor(0);
leg_p->SetFillStyle(0);
leg_p->SetTextFont(43);
leg_p->SetTextSizePixels(16);
leg_p->SetBorderSize(0);
leg_p->AddEntry(getGenSubeRaw[0], "Uncut", "L");
leg_p->AddEntry(getGenSubeSK[0], "SK Cut", "P");
leg_p->Draw();
TFile* outFile_p = new TFile(outName.c_str(), "UPDATE");
c1->Write("", TObject::kOverwrite);
claverCanvasSaving(c1, Form("../FastJetHists/pdfDir/impactCanv"), "pdf");
c2->Write("", TObject::kOverwrite);
claverCanvasSaving(c2, Form("../FastJetHists/pdfDir/genSubeCanv"), "pdf");
outFile_p->Close();
delete outFile_p;
delete c1;
delete inFile_p;
return;
}