forked from uboone/xsec_analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPionAngleInMomentumBins.C
471 lines (371 loc) · 26.1 KB
/
PionAngleInMomentumBins.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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
#include <TChain.h>
#include <TH1D.h>
#include <TCanvas.h>
#include <TLegend.h>
void FillHistogram(TTree* tree, TH1D* hist, const std::string& variable, const std::string& condition, const float runWeight)
{
TH1D* hist_tmp = (TH1D*)hist->Clone("hist");
hist_tmp->Reset();
std::string hist_tmp_name = hist_tmp->GetName();
std::string weight = "(std::isfinite(spline_weight*tuned_cv_weight) && spline_weight*tuned_cv_weight >= 0 && spline_weight*tuned_cv_weight <= 30 ? spline_weight*tuned_cv_weight : 1)*" + std::to_string(runWeight);
// Fill the histograms with weights
tree->Project(hist_tmp_name.c_str(), variable.c_str(), ("(" + condition + ")*" + weight).c_str());
hist_tmp->Sumw2();
// Add the tmp histograms to the main histograms
hist->Add(hist_tmp);
delete hist_tmp;
}
void FillHistogram2D(TTree* tree, TH2D* hist, const std::string& variable1, const std::string& variable2, const std::string& condition, const float runWeight)
{
TH2D* hist_tmp = (TH2D*)hist->Clone("hist2D");
hist_tmp->Reset();
std::string hist_tmp_name = hist_tmp->GetName();
std::string weight = "(std::isfinite(spline_weight*tuned_cv_weight) && spline_weight*tuned_cv_weight >= 0 && spline_weight*tuned_cv_weight <= 30 ? spline_weight*tuned_cv_weight : 1)*" + std::to_string(runWeight);
// Fill the histograms with weights
tree->Project(hist_tmp_name.c_str(), (variable2+":"+variable1).c_str(), ("(" + condition + ")*" + weight).c_str());
// hist_tmp->Sumw2();
// Add the tmp histograms to the main histograms
hist->Add(hist_tmp);
delete hist_tmp;
}
template <typename T>
void FillParticleHistogram(TTree* tree, TH1D* hist, const std::string& variable, const std::string& condition, const float runWeight)
{
std::vector<T> *values = nullptr;
// tree->SetBranchAddress(variable.c_str(), &values);
tree->SetBranchAddress("trueCC1pi_recoParticle_muonBDTScore_vector", &values);
// Check if values is null
if (!values)
{
std::cerr << "Error: No branch named " << variable << " found in the tree." << std::endl;
return;
}
// Loop over the entries in the tree
for (Long64_t i = 0; i < tree->GetEntries(); i++)
{
tree->GetEntry(i);
std::cout << "DEBUG FillParticleHistogram Point values->size(): " << values->size() << std::endl;
// Apply the condition
if (condition.empty() || tree->GetLeaf(condition.c_str())->GetValue() != 0)
{
// Loop over the values in the vector and fill the histogram
for (const auto& value : *values)
{
hist->Fill(value, runWeight);
}
}
}
}
void MakePlot(TH1D* hist, const std::string& name)
{
// Set the color and line thickness of the histograms
hist->SetLineColor(kGreen);
hist->SetLineWidth(3);
// Remove the stats box
hist->SetStats(0);
// Draw the histogram
TCanvas* c1 = new TCanvas("c1", "c1", 800, 600);
hist->Draw("E hist");
// Add a legend
// TLegend* legend = new TLegend(0.2, 0.1);
// legend->AddEntry(hist, "CC0pi", "l");
// legend->AddEntry(cc1pi_hist, "CC1pi", "l");
// legend->Draw();
c1->SaveAs(("plots/PionAngleInMomentumBins_" + name + "_testingOnly_lowPiMomThreshold.pdf").c_str());
// Delete the TCanvas
delete c1;
}
void MakePlot2D(TH2D* hist, const std::string& name, const bool drawDiagonal = false, const bool axisTicks = true, const bool drawText = false, const std::vector<float>& binEdges = {})
{
// // Set the color and line thickness of the histograms
// hist->SetLineColor(kGreen);
// hist->SetLineWidth(3);
// Remove the stats box
hist->SetStats(0);
// Draw the histogram
TCanvas* c1 = new TCanvas(name.c_str(), name.c_str(), 800, 600);
if(!axisTicks)
{
hist->GetXaxis()->SetNdivisions(hist->GetNbinsX(), kFALSE);
hist->GetYaxis()->SetNdivisions(hist->GetNbinsY(), kFALSE);
}
if (drawText)
{
// Set the text format to 2 digits after the decimal point
gStyle->SetPaintTextFormat("4.2f");
// Increase the text size
gStyle->SetTextSize(0.2);
// Draw the histogram with text
hist->Draw("COLZ TEXT");
}
else
{
hist->Draw("COLZ");
}
if (drawDiagonal)
{
// Add a diagonal line
double x1 = hist->GetXaxis()->GetXmin();
double y1 = hist->GetYaxis()->GetXmin();
double x2 = hist->GetXaxis()->GetXmax();
double y2 = hist->GetYaxis()->GetXmax();
TLine *line = new TLine(x1, y1, x2, y2);
line->SetLineColor(kBlack); // Set line color to black
line->SetLineStyle(2); // Set line style to dashed
line->SetLineWidth(2); // Set line width
line->Draw("same"); // Draw line on the same canvas
}
// Draw vertical and horizontal lines at bin edges when binEdges is not empty
if (!binEdges.empty()) {
auto previousEdge = binEdges.at(0);
for (int i = 0; i < binEdges.size(); i++) {
const auto edge = binEdges.at(i);
// const auto nextEdge = binEdges.at(i+1);
// Draw vertical line
// TLine* vLine = new TLine(edge, previousEdge, edge, nextEdge);
TLine* vLine = new TLine(edge, hist->GetYaxis()->GetXmin(), edge, hist->GetYaxis()->GetXmax());
vLine->SetLineColor(kRed);
vLine->SetLineStyle(2);
vLine->SetLineWidth(2);
vLine->Draw("same");
// Draw horizontal line
// TLine* hLine = new TLine(previousEdge, edge, nextEdge, edge);
TLine* hLine = new TLine(hist->GetXaxis()->GetXmin(), edge, hist->GetXaxis()->GetXmax(), edge);
hLine->SetLineColor(kRed);
hLine->SetLineStyle(2);
hLine->SetLineWidth(2);
hLine->Draw("same");
previousEdge = edge;
}
}
gStyle->SetPadRightMargin(0.15);
// Print out hist title
std::cout << "DEBUG - hist title 0: " << hist->GetTitle() << std::endl;
const auto title = hist->GetTitle();
const auto xTitle = hist->GetXaxis()->GetTitle();
const auto yTitle = hist->GetYaxis()->GetTitle();
// Add plot title
hist->SetTitle(title);
// Add axis labels title
hist->GetXaxis()->SetTitle(xTitle);
hist->GetYaxis()->SetTitle(yTitle);
std::cout << "DEBUG - hist title 1: " << hist->GetTitle() << std::endl;
c1->SaveAs(("plots/PionAngleInMomentumBins_" + name + "_testingOnly_lowPiMomThreshold.pdf").c_str());
// Delete the TCanvas
delete c1;
}
void PionAngleInMomentumBins()
{
// // List of files
const std::vector<std::tuple<std::string, std::string, std::string, float>> files = {
std::make_tuple("nu mc", "1", "/exp/uboone/data/users/jdetje/ubcc1piPelee/27March24_pionMomThreshold/overlay_peleeTuple_uboone_v08_00_00_70_run1_nu_ubcc1pi_only_testing.root", 0.13011*2.0), // Times two because the scaling is for the full MC and this is only half
std::make_tuple("nu mc", "2", "/exp/uboone/data/users/jdetje/ubcc1piPelee/27March24_pionMomThreshold/overlay_peleeTuple_uboone_v08_00_00_70_run2_nu_ubcc1pi_only_testing.root", 0.25750*2.0),
std::make_tuple("nu mc", "3", "/exp/uboone/data/users/jdetje/ubcc1piPelee/27March24_pionMomThreshold/overlay_peleeTuple_uboone_v08_00_00_70_run3_nu_ubcc1pi_only_testing.root", 0.20113*2.0),
std::make_tuple("nu mc", "4bcd", "/exp/uboone/data/users/jdetje/ubcc1piPelee/27March24_pionMomThreshold/overlay_peleeTuple_uboone_run4bcd_nu_ubcc1pi_only_testing.root", 0.13074*2.0),
std::make_tuple("nu mc", "5", "/exp/uboone/data/users/jdetje/ubcc1piPelee/27March24_pionMomThreshold/overlay_nu_peleeTuple_uboone_v08_00_00_73_weightFix_run5_ubcc1pi_only_testing.root", 0.15196*2.0),
};
// 2d histograms
std::vector<double> phi_bin_edges = {-3.141592654, -2.513274123, -1.884955592, -1.256637061, -0.6283185307, 0, 0.6283185307, 1.256637061, 1.884955592, 2.513274123, 3.141592654};
TH2D* h_piPhi_0 = new TH2D("pi_phi_h0", "True vs Reco #phi_{#pi} for Selected Signal Events with true p_{#pi} < 0 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_1 = new TH2D("pi_phi_h1", "True vs Reco #phi_{#pi} for Selected Signal Events with 100 MeV <= true p_{#pi} < 160 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_2 = new TH2D("pi_phi_h2", "True vs Reco #phi_{#pi} for Selected Signal Events with 160 MeV <= true p_{#pi} < 190 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_3 = new TH2D("pi_phi_h3", "True vs Reco #phi_{#pi} for Selected Signal Events with 190 MeV <= true p_{#pi} < 220 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_4 = new TH2D("pi_phi_h4", "True vs Reco #phi_{#pi} for Selected Signal Events with 220 MeV <= true p_{#pi} < 600 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_5 = new TH2D("pi_phi_h5", "True vs Reco #phi_{#pi} for Selected Signal Events with 600 MeV <= true p_{#pi}; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_0 = new TH2D("pi_phi_reco_h0", "True vs Reco #phi_{#pi} for Selected Signal Events with reco p_{#pi} < 0 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_1 = new TH2D("pi_phi_reco_h1", "True vs Reco #phi_{#pi} for Selected Signal Events with 100 MeV <= reco p_{#pi} < 160 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_2 = new TH2D("pi_phi_reco_h2", "True vs Reco #phi_{#pi} for Selected Signal Events with 160 MeV <= reco p_{#pi} < 190 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_3 = new TH2D("pi_phi_reco_h3", "True vs Reco #phi_{#pi} for Selected Signal Events with 190 MeV <= reco p_{#pi} < 220 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_4 = new TH2D("pi_phi_reco_h4", "True vs Reco #phi_{#pi} for Selected Signal Events with 220 MeV <= reco p_{#pi} < 600 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_reco_5 = new TH2D("pi_phi_reco_h5", "True vs Reco #phi_{#pi} for Selected Signal Events with 600 MeV <= reco p_{#pi}; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_true_00 = new TH2D("h_piPhi_fineBinning_true_00", "True vs Reco #phi_{#pi} for Selected Signal Events with 0 MeV <= true p_{#pi} < 80 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_true_80 = new TH2D("h_piPhi_fineBinning_true_80", "True vs Reco #phi_{#pi} for Selected Signal Events with 80 MeV <= true p_{#pi} < 100 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_true_100 = new TH2D("h_piPhi_fineBinning_true_100", "True vs Reco #phi_{#pi} for Selected Signal Events with 100 MeV <= true p_{#pi} < 120 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_true_120 = new TH2D("h_piPhi_fineBinning_true_120", "True vs Reco #phi_{#pi} for Selected Signal Events with 120 MeV <= true p_{#pi} < 140 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_reco_00 = new TH2D("h_piPhi_fineBinning_reco_00", "True vs Reco #phi_{#pi} for Selected Signal Events with reco p_{#pi} < 100 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_reco_100 = new TH2D("h_piPhi_fineBinning_reco_100", "True vs Reco #phi_{#pi} for Selected Signal Events with 100 MeV <= reco p_{#pi} < 120 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_reco_120 = new TH2D("h_piPhi_fineBinning_reco_120", "True vs Reco #phi_{#pi} for Selected Signal Events with 120 MeV <= reco p_{#pi} < 140 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_reco_140 = new TH2D("h_piPhi_fineBinning_reco_140", "True vs Reco #phi_{#pi} for Selected Signal Events with 140 MeV <= reco p_{#pi} < 160 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piPhi_fineBinning_reco_160 = new TH2D("h_piPhi_fineBinning_reco_160", "True vs Reco #phi_{#pi} for Selected Signal Events with 160 MeV <= reco p_{#pi} < 180 MeV; True #phi_{#pi}; Reco #phi_{#pi}", phi_bin_edges.size() - 1, &phi_bin_edges[0], phi_bin_edges.size() - 1, &phi_bin_edges[0]);
TH2D* h_piMom_recoGolden = new TH2D("h_piMom_recoGolden", "True vs Reco p_{#pi} for Golden Selection Signal Events; True p_{#pi}; Reco p_{#pi}", 100, 0, 0.6, 100, 0, 0.6);
TH2D* h_piMom_reco = new TH2D("h_piMom_reco", "True vs Reco p_{#pi} for Generic Selection Signal Events; True p_{#pi}; Reco p_{#pi}", 100, 0, 0.6, 100, 0, 0.6);
TH2D* h_piMom_trueGolden = new TH2D("h_piMom_trueGolden", "True vs Reco p_{#pi} for Golden Selection Golden Signal Events; True p_{#pi}; Reco p_{#pi}", 100, 0, 0.6, 100, 0, 0.6);
// std::vector<double> cosTheta_bin_edges = {-1, -0.47, 0, 0.39, 0.65, 0.84, 0.93, 1};
// Loop over the files
for (int f = 0; f < files.size(); f++)
{
const auto [sampleType, run, filePath, runWeight] = files.at(f);
std::cout<<"DEBUG - filePath: "<<filePath<<std::endl;
// Open the file and get the tree
TFile* tFile = TFile::Open(filePath.c_str());
TTree* tree = (TTree*)tFile->Get("stv_tree");
FillHistogram2D(tree, h_piPhi_0,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.0 && cc1pi_truth_pionMomentum < 0.1", runWeight);
FillHistogram2D(tree, h_piPhi_1,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.1 && cc1pi_truth_pionMomentum < 0.16", runWeight);
FillHistogram2D(tree, h_piPhi_2,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.16 && cc1pi_truth_pionMomentum < 0.19", runWeight);
FillHistogram2D(tree, h_piPhi_3,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.19 && cc1pi_truth_pionMomentum < 0.22", runWeight);
FillHistogram2D(tree, h_piPhi_4,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.22 && cc1pi_truth_pionMomentum < 0.6", runWeight);
FillHistogram2D(tree, h_piPhi_5,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.6", runWeight);
// **********************************
// Reco pion momentum
// **********************************
FillHistogram2D(tree, h_piPhi_reco_0,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.0 && cc1pi_reco_pionMomentum < 0.1", runWeight);
FillHistogram2D(tree, h_piPhi_reco_1,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.1 && cc1pi_reco_pionMomentum < 0.16", runWeight);
FillHistogram2D(tree, h_piPhi_reco_2,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.16 && cc1pi_reco_pionMomentum < 0.19", runWeight);
FillHistogram2D(tree, h_piPhi_reco_3,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.19 && cc1pi_reco_pionMomentum < 0.22", runWeight);
FillHistogram2D(tree, h_piPhi_reco_4,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.22 && cc1pi_reco_pionMomentum < 0.6", runWeight);
FillHistogram2D(tree, h_piPhi_reco_5,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.6", runWeight);
// **********************************
// True momentum fine binnin around 100 MeV
// **********************************
FillHistogram2D(tree, h_piPhi_fineBinning_true_00,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.00 && cc1pi_truth_pionMomentum < 0.08", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_true_80,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.08 && cc1pi_truth_pionMomentum < 0.1", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_true_100,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.1 && cc1pi_truth_pionMomentum < 0.12", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_true_120,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.12 && cc1pi_truth_pionMomentum < 0.14", runWeight);
// **********************************
// Reco momentum fine binnin around 100 MeV
// **********************************
FillHistogram2D(tree, h_piPhi_fineBinning_reco_00,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum < 0.1", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_reco_100,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.1 && cc1pi_reco_pionMomentum < 0.12", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_reco_120,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.12 && cc1pi_reco_pionMomentum < 0.14", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_reco_140,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.14 && cc1pi_reco_pionMomentum < 0.16", runWeight);
FillHistogram2D(tree, h_piPhi_fineBinning_reco_160,
/*variable1*/ "cc1pi_truth_pionPhi",
/*variable2*/ "cc1pi_reco_pionPhi",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_reco_pionMomentum >= 0.16 && cc1pi_reco_pionMomentum < 0.18", runWeight);
// **********************************
// Golden Selection
// **********************************
FillHistogram2D(tree, h_piMom_recoGolden,
/*variable1*/ "cc1pi_truth_pionMomentum",
/*variable2*/ "cc1pi_reco_pionMomentum",
/*Condition*/ "cc1pi_signal && cc1pi_selected_golden", runWeight);
FillHistogram2D(tree, h_piMom_reco,
/*variable1*/ "cc1pi_truth_pionMomentum",
/*variable2*/ "cc1pi_reco_pionMomentum",
/*Condition*/ "cc1pi_signal && cc1pi_selected_generic", runWeight);
FillHistogram2D(tree, h_piMom_trueGolden,
/*variable1*/ "cc1pi_truth_pionMomentum",
/*variable2*/ "cc1pi_reco_pionMomentum",
/*Condition*/ "cc1pi_signal && true_golden_cc1pi && cc1pi_selected_golden", runWeight);
// **********************************
// CosTheta
// **********************************
// FillHistogram2D(tree, h_thetaPhi_0,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.0 && cc1pi_truth_pionMomentum < 0.1", runWeight);
// FillHistogram2D(tree, h_thetaPhi_1,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.1 && cc1pi_truth_pionMomentum < 0.16", runWeight);
// FillHistogram2D(tree, h_thetaPhi_2,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.16 && cc1pi_truth_pionMomentum < 0.19", runWeight);
// FillHistogram2D(tree, h_thetaPhi_3,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.19 && cc1pi_truth_pionMomentum < 0.22", runWeight);
// FillHistogram2D(tree, h_thetaPhi_4,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.22 && cc1pi_truth_pionMomentum < 0.6", runWeight);
// FillHistogram2D(tree, h_thetaPhi_5,
// /*variable1*/ "cc1pi_reco_pionCosTheta",
// /*variable2*/ "cc1pi_truth_pionCosTheta",
// /*Condition*/ "cc1pi_signal && cc1pi_selected_generic && cc1pi_truth_pionMomentum >= 0.6", runWeight);
tFile->Close();
}
std::cout<<"DEBUG - Done with file loop"<<std::endl;
MakePlot2D(h_piPhi_0, "recoVsTruePiPhi_bin0", false, true, false);
MakePlot2D(h_piPhi_1, "recoVsTruePiPhi_bin1", false, true, false);
MakePlot2D(h_piPhi_2, "recoVsTruePiPhi_bin2", false, true, false);
MakePlot2D(h_piPhi_3, "recoVsTruePiPhi_bin3", false, true, false);
MakePlot2D(h_piPhi_4, "recoVsTruePiPhi_bin4", false, true, false);
MakePlot2D(h_piPhi_5, "recoVsTruePiPhi_bin5", false, true, false);
MakePlot2D(h_piPhi_reco_0, "recoVsTruePiPhi_recoBin0", false, true, false);
MakePlot2D(h_piPhi_reco_1, "recoVsTruePiPhi_recoBin1", false, true, false);
MakePlot2D(h_piPhi_reco_2, "recoVsTruePiPhi_recoBin2", false, true, false);
MakePlot2D(h_piPhi_reco_3, "recoVsTruePiPhi_recoBin3", false, true, false);
MakePlot2D(h_piPhi_reco_4, "recoVsTruePiPhi_recoBin4", false, true, false);
MakePlot2D(h_piPhi_reco_5, "recoVsTruePiPhi_recoBin5", false, true, false);
MakePlot2D(h_piPhi_fineBinning_true_00, "recoVsTruePiPhi_fineBinning_true_00", false, true, false);
MakePlot2D(h_piPhi_fineBinning_true_80, "recoVsTruePiPhi_fineBinning_true_80", false, true, false);
MakePlot2D(h_piPhi_fineBinning_true_100, "recoVsTruePiPhi_fineBinning_true_100", false, true, false);
MakePlot2D(h_piPhi_fineBinning_true_120, "recoVsTruePiPhi_fineBinning_true_120", false, true, false);
MakePlot2D(h_piPhi_fineBinning_reco_00, "recoVsTruePiPhi_fineBinning_reco_80", false, true, false);
MakePlot2D(h_piPhi_fineBinning_reco_100, "recoVsTruePiPhi_fineBinning_reco_100", false, true, false);
MakePlot2D(h_piPhi_fineBinning_reco_120, "recoVsTruePiPhi_fineBinning_reco_120", false, true, false);
MakePlot2D(h_piPhi_fineBinning_reco_140, "recoVsTruePiPhi_fineBinning_reco_140", false, true, false);
MakePlot2D(h_piPhi_fineBinning_reco_160, "recoVsTruePiPhi_fineBinning_reco_160", false, true, false);
const std::vector<float> binEdges = {0.1, 0.16, 0.19, 0.22, 0.6};
MakePlot2D(h_piMom_recoGolden, "recoVsTruePiMom_goldenSelection", false, true, false, binEdges);
MakePlot2D(h_piMom_reco, "recoVsTruePiMom_genericSelection", false, true, false, binEdges);
MakePlot2D(h_piMom_trueGolden, "recoVsTruePiMom_goldenSelection_trueGolden", false, true, false, binEdges);
// MakePlot2D(h_thetaPhi_0, "recoVsTruePiCosTheta_bin0", false, true, false);
// MakePlot2D(h_thetaPhi_1, "recoVsTruePiCosTheta_bin1", false, true, false);
// MakePlot2D(h_thetaPhi_2, "recoVsTruePiCosTheta_bin2", false, true, false);
// MakePlot2D(h_thetaPhi_3, "recoVsTruePiCosTheta_bin3", false, true, false);
// MakePlot2D(h_thetaPhi_4, "recoVsTruePiCosTheta_bin4", false, true, false);
// MakePlot2D(h_thetaPhi_5, "recoVsTruePiCosTheta_bin5", false, true, false);
}