-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSeminar.cpp
More file actions
251 lines (179 loc) · 8.04 KB
/
Copy pathSeminar.cpp
File metadata and controls
251 lines (179 loc) · 8.04 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#include <TFile.h>
#include <TH1D.h>
#include <TF1.h>
#include <TCanvas.h>
#include <TString.h>
#include <TStyle.h>
#include <TLegend.h>
#include <TLatex.h>
#include <TMath.h>
#include <TLine.h>
#include <TPad.h>
#include <TGaxis.h>
#include <iostream>
#include <vector>
using namespace std;
#include "/home/afroditi/Dropbox/PhD/Secondary_Code/CenterAxisTitle.cpp"
#include "/home/afroditi/Dropbox/PhD/Secondary_Code/SetOffsetAndSize.cpp"
#include "/home/afroditi/Dropbox/PhD/Secondary_Code/ToString.cpp"
// ----------------------------------------------------------------------------------------------------------------
// Accounting for the fact that the bin width is not constant
void ReweightPlots(TH1D* h) {
double NBins = h->GetNbinsX();
for (int i = 1; i <= NBins; i++) {
double content = h->GetBinContent(i);
double error = h->GetBinError(i);
double width = h->GetBinWidth(i);
double newcontent = content / width;
double newerror = error / width;
h->SetBinContent(i,newcontent);
h->SetBinError(i,newerror);
}
}
// ----------------------------------------------------------------------------------------------------------------
void ApplySystUnc(TH1D* h, double systunc) {
double NBins = h->GetNbinsX();
for (int i = 1; i <= NBins; i++) {
double error = h->GetBinError(i);
double newerror = error * (1. + systunc);
h->SetBinError(i,newerror);
}
}
// ----------------------------------------------------------------------------------------------------------------
void Seminar() {
// ------------------------------------------------------------------------
SetOffsetAndSize();
TGaxis::SetMaxDigits(4);
int Ndivisions = 6;
int LineWidth = 3;
int FontStyle = 132;
double TextSize = 0.08;
// From Mariana's analysis note
double SystUnc1GeV = 0.02; // 2% syst uncertainty at 1.161 GeV
double SystUnc2GeV = 0.021; // 2.1% syst uncertainty at 2.261 GeV
double SystUnc4GeV = 0.047; // 4.7% syst uncertainty at 4.461 GeV
// ------------------------------------------------------------------------
// TString nucleus = "4He"; TString LabelsOfSamples = "^{4}He"; TString JustNucleus = "He";
TString nucleus = "12C"; TString LabelsOfSamples = "^{12}C"; TString JustNucleus = "C";
// TString nucleus = "56Fe"; TString LabelsOfSamples = "^{56}Fe"; TString JustNucleus = "Fe";
TString E = "1_161"; double DoubleE = 1.159;
// TString E = "2_261"; double DoubleE = 2.257;
// TString E = "4_461"; double DoubleE = 4.453;
TString xBCut = "NoxBCut";
TString FSIModel = "Data_Final"; TString FSILabel = "Data"; TString DirNames = "Data";
// ------------------------------------------------------------------------
TCanvas* PlotCanvas = new TCanvas(nucleus+"_"+E+"_"+xBCut,nucleus+"_"+E+"_"+xBCut,205,34,1024,768);
PlotCanvas->SetTopMargin(0.11);
PlotCanvas->SetBottomMargin(0.19);
PlotCanvas->SetLeftMargin(0.15);
// ------------------------------------------------------------------------
TLegend* leg = new TLegend(0.17,0.48,0.37,0.87);
leg->SetBorderSize(0);
leg->SetTextFont(FontStyle);
leg->SetTextSize(TextSize);
// ------------------------------------------------------------------------
TString ECalName = "epRecoEnergy_slice_0"; TString ECalLabel = "(e,e'p)_{1p0#pi} E^{cal}";
//TString InclusiveEQEName = "h_Erec_subtruct_piplpimi_noprot_3pi"; TString InclusiveEQELabel = "(e,e')_{0#pi} E^{QE}";
TString EQEName = "eRecoEnergy_slice_0"; TString EQELabel = "(e,e'p)_{1p0#pi} E^{QE}";
// ------------------------------------------------------------------------
TString PathToFiles = "../myFiles/"+ E + "/"+FSIModel+"/"+xBCut+"/";
TString FileName = PathToFiles+nucleus+"_"+E+"_"+FSIModel+"_Plots_FSI_em.root";
TFile* FileSample = TFile::Open(FileName);
// ------------------------------------------------------------------------
TH1D* ECalPlot = (TH1D*)( FileSample->Get(ECalName));
ReweightPlots(ECalPlot);
// ------------------------------------------------------------------------
// X-axis label
ECalPlot->GetXaxis()->SetLabelFont(FontStyle);
ECalPlot->GetXaxis()->SetTitleFont(FontStyle);
ECalPlot->GetXaxis()->SetLabelSize(TextSize);
ECalPlot->GetXaxis()->SetTitleSize(TextSize);
ECalPlot->GetXaxis()->SetTitleOffset(1.05);
ECalPlot->GetXaxis()->SetNdivisions(Ndivisions);
ECalPlot->GetXaxis()->SetTitle("E_{reconstructed} [GeV]");
ECalPlot->GetXaxis()->SetLabelOffset(0.014);
if (E == "4_461") { ECalPlot->GetXaxis()->SetRangeUser(1.,10.); }
TLegendEntry* lECal = leg->AddEntry(ECalPlot,ECalLabel, "");
lECal->SetTextColor(kBlue);
TString TitleLabel = ToString(DoubleE)+ " GeV " + LabelsOfSamples;
ECalPlot->SetTitle(TitleLabel);
gStyle->SetTitleTextColor(kBlack);
// gStyle->SetTitleTextColor(kOrange+7);
gStyle->SetTitleFont(FontStyle,"t");
gStyle->SetTitleSize(TextSize,"t");
// ------------------------------------------------------------------------
// Y-axis label
ECalPlot->GetYaxis()->SetLabelFont(FontStyle);
ECalPlot->GetYaxis()->SetTitleFont(FontStyle);
ECalPlot->GetYaxis()->SetLabelSize(TextSize);
ECalPlot->GetYaxis()->SetTitleSize(TextSize);
ECalPlot->GetYaxis()->SetTitleOffset(0.95);
ECalPlot->GetYaxis()->SetNdivisions(Ndivisions);
ECalPlot->GetYaxis()->SetTitle("Weighted Events/GeV");
ECalPlot->GetYaxis()->SetLabelOffset(0.014);
ECalPlot->GetYaxis()->SetRangeUser(0.,1.05*ECalPlot->GetMaximum());
// ------------------------------------------------------------------------
// Calorimetric Reconstruction
ECalPlot->SetLineColor(kBlue);
ECalPlot->SetLineWidth(3);
CenterAxisTitle(ECalPlot);
ECalPlot->Draw("hist same");
// ------------------------------------------------------------------------
// Inclusive QE Reconstruction
/*
TH1D* InclusiveEQEPlot = (TH1D*)( FileSample->Get(InclusiveEQEName));
ReweightPlots(InclusiveEQEPlot);
InclusiveEQEPlot->SetLineColor(kRed);
InclusiveEQEPlot->SetLineWidth(3);
CenterAxisTitle(InclusiveEQEPlot);
InclusiveEQEPlot->Draw("hist same");
TLegendEntry* lInclusiveQE = leg->AddEntry(InclusiveEQEPlot,InclusiveEQELabel, "");
lInclusiveQE->SetTextColor(kRed);
*/
// ------------------------------------------------------------------------
// Exclusive QE Reconstruction
TH1D* EQEPlot = (TH1D*)( FileSample->Get(EQEName));
ReweightPlots(EQEPlot);
EQEPlot->SetLineColor(kGreen-2);
EQEPlot->SetLineWidth(3);
CenterAxisTitle(EQEPlot);
EQEPlot->Draw("hist same");
TLegendEntry* lQE = leg->AddEntry(EQEPlot,EQELabel, "");
lQE->SetTextColor(kGreen-2);
// ------------------------------------------------------------------------
//leg->Draw();
// ------------------------------------------------------------------------
TLatex latexIntChannel;
latexIntChannel.SetTextFont(FontStyle);
latexIntChannel.SetTextSize(TextSize);
latexIntChannel.SetTextColor(kBlack);
latexIntChannel.DrawLatexNDC(0.2,0.8,"(e,e'p)_{1p0#pi}");
// ------------------------------------------------------------------------
TLatex latexECal;
latexECal.SetTextFont(FontStyle);
latexECal.SetTextSize(TextSize);
latexECal.SetTextColor(kBlue);
double XCoordCal = 0.6;
double YCoordCal = 0.7;
if (E == "1_161" && nucleus == "12C") { XCoordCal = 0.55; }
latexECal.DrawLatexNDC(XCoordCal,YCoordCal,"E_{Cal}");
// ------------------------------------------------------------------------
TLatex latexEQE;
latexEQE.SetTextFont(FontStyle);
latexEQE.SetTextSize(TextSize);
latexEQE.SetTextColor(kGreen-2);
double XCoordQE = 0.55;
double YCoordQE = 0.35;
if (E == "1_161" && nucleus == "12C") { XCoordQE = 0.45; }
if (E == "2_261" && nucleus == "56Fe") { YCoordQE = 0.4; }
if (E == "4_461" && nucleus == "56Fe") { YCoordQE = 0.47; }
latexEQE.DrawLatexNDC(XCoordQE,YCoordQE,"E_{QE}");
// ------------------------------------------------------------------------
TLine* line = new TLine(DoubleE,0.,DoubleE,ECalPlot->GetMaximum());
line->SetLineColor(kBlack);
line->SetLineWidth(3);
line->Draw();
// ------------------------------------------------------------------------
PlotCanvas->SaveAs("SeminarPlots/Ereco_"+nucleus+"_"+E+".pdf");
}
// ----------------------------------------------------------------------------------------------------------------