PlotResolution.C
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/Spectrum.h"
6 
9 
10 #include "TStyle.h"
11 #include "TH1.h"
12 #include "TH2.h"
13 #include "TCanvas.h"
14 #include "TFile.h"
15 #include "TLegend.h"
16 #include "TGaxis.h"
17 #include "TF1.h"
18 using namespace ana;
19 
20 TH2 * Rebin(TH2 * hist, std::vector<double> edges)
21 {
22  int NY = hist->GetNbinsY();
23  double y_0 = hist->GetYaxis()->GetBinLowEdge(1);
24  double y_1 = hist->GetYaxis()->GetBinLowEdge(NY+1);
25 
26  TH2D * rebin = new TH2D(UniqueName().c_str(),
27  "",
28  edges.size() - 1,
29  &edges[0],
30  NY,
31  y_0,
32  y_1);
33 
34  int s = 1;
35  for(auto j = 1; j <= rebin->GetNbinsY(); j++) {
36  double lower_bound = 1;
37  for(auto irebin = 1; irebin <= rebin->GetNbinsX(); irebin++) {
38  double rebin_edge = rebin->GetXaxis()->GetBinLowEdge(irebin+1);
39  for(auto i = 1; i <= hist->GetNbinsX(); i++) {
40  int gid = rebin->FindBin(hist->GetXaxis()->GetBinCenter(i),
41  hist->GetYaxis()->GetBinCenter(j));
42  int x, y, z;
43  rebin->GetBinXYZ(gid, x, y, z);
44  rebin->SetBinContent(x, y, z, rebin->GetBinContent(x, y, z) + hist->GetBinContent(i, j));
45  }
46  }
47  }
48 
49  return rebin;
50 
51 }
52 
53 void SignalCountPlot(TH1 * reco, TH1 * truth, std::string name)
54 {
55  double maxval = std::max(reco->GetMaximum(), truth->GetMaximum());
56 
57  TCanvas * c = new TCanvas();
58  TLegend * leg = new TLegend();
59  reco->SetLineColor(kBlack);
60  truth->SetLineColor(kRed);
61  leg->AddEntry(reco, "Reco", "l");
62  leg->AddEntry(truth, "Truth", "l");
63  reco->GetXaxis()->SetTitle("Double Differential Analysis Bins");
64  reco->GetYaxis()->SetRangeUser(0, maxval*1.2);
65  reco->Draw("hist");
66  truth->Draw("hist same");
67  leg->Draw();
68  c->SaveAs(name.c_str());
69  c->Close();
70 }
71 
72 void SignalCountPlot(TH1 * reco, TH1 * truth, double xmin, double xmax, std::string name)
73 {
74  double maxval = std::max(reco->GetMaximum(), truth->GetMaximum());
75  reco->GetXaxis()->SetRangeUser(xmin, xmax);
76  TCanvas * c = new TCanvas();
77  TLegend * leg = new TLegend();
78  reco->SetLineColor(kBlack);
79  truth->SetLineColor(kRed);
80  leg->AddEntry(reco, "Reco", "l");
81  leg->AddEntry(truth, "Truth", "l");
82  reco->GetYaxis()->SetRangeUser(0, maxval*1.2);
83  reco->Draw("hist");
84  truth->Draw("hist same");
85  leg->Draw();
86  c->SaveAs(name.c_str());
87  c->Close();
88 }
89 
90 void RMSPlot(TH2 * hist, std::vector<double> edges, double xmin, double xmax, std::string name, bool logy = false)
91 {
92  hist->SetTitle("");
93  hist->GetYaxis()->CenterTitle();
94 
95  int NX = hist->GetNbinsX();
96  // fit only in the range of .3 fractional bias
97  double maxx = hist->GetXaxis()->GetBinLowEdge(NX+1);
98  double range = 0.5 * maxx;
99 
100 
101  auto rms = new TH1D(UniqueName().c_str(),"", NX, hist->GetXaxis()->GetXbins()->GetArray());
102  rms->GetXaxis()->SetTitle(hist->GetXaxis()->GetTitle());
103  rms->GetXaxis()->CenterTitle();
104  for( int i = 1; i <= hist->GetNbinsX(); ++i){
105  auto projection = (TH1F*) hist->ProjectionY("",i,i);
106  int lowbin = projection->FindBin(-range);
107  int highbin = projection->FindBin(range);
108  if(projection->Integral(lowbin, highbin)) {
109  projection->Fit("gaus", "+Q", "", -range, range);
110  double irms = projection->GetFunction("gaus")->GetParameter(2);
111  rms->SetBinContent(i,irms);
112  rms->SetBinError(i, 0);
113  }
114  }
115 
116  auto bin_boxes = new TH1D(UniqueName().c_str(), "", edges.size() -1, &edges[0]);
117  bin_boxes->SetLineColor(kRed);
118  rms->SetLineColor(kBlack);
119  for(auto i = 1; i <= NX; i++) {
120  bin_boxes->SetBinContent(i, bin_boxes->GetBinWidth(i));
121  }
122 
123  double ymax = rms->GetMaximum() * 1.2;
124  rms->GetYaxis()->SetRangeUser(0, ymax);
125  rms->GetXaxis()->SetRangeUser(xmin, xmax);
126  rms->GetYaxis()->SetTitle("Resolution");
127  rms->GetYaxis()->CenterTitle();
128  rms->GetYaxis()->SetTitleOffset(0.65);
129 
130 
131  TCanvas * c = new TCanvas();
132  rms->Draw("hist e");
133  bin_boxes->Draw("hist same");
134 
135 
136  TGaxis * right_axis = new TGaxis(xmax,
137  0,
138  xmax,
139  ymax,
140  0, ymax,
141  rms->GetNdivisions(),
142  "+L");
143  right_axis->SetLabelSize(rms->GetYaxis()->GetLabelSize());
144  right_axis->SetLabelFont(rms->GetYaxis()->GetLabelFont());
145  right_axis->SetLabelColor(kRed);
146  right_axis->SetTitleSize(rms->GetYaxis()->GetTitleSize());
147  right_axis->SetTitleFont(rms->GetYaxis()->GetTitleFont());
148  right_axis->SetLineColor(kRed);
149  right_axis->SetTitleColor(kRed);
150  right_axis->SetTitleOffset(0.75);
151  right_axis->SetTitle("Bin Width");
152  right_axis->CenterTitle();
153 
154  // right_axis->Draw("+L");
155  right_axis->Draw();
156  c->SaveAs(name.c_str());
157  c->Close();
158 }
159 
160 void PlotProjection(TH1 * hist, std::string name, bool logy = false)
161 {
162 
163  gStyle->SetOptStat(1111);
164  gStyle->SetOptFit(0111);
165  gStyle->SetStatY(0.9);
166  gStyle->SetStatW(0.4);
167  gStyle->SetStatH(0.4);
168  TCanvas * c = new TCanvas();
169  if(logy) c->SetLogy();
170  hist->GetXaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
171  hist->Draw("hist");
172  TF1 * func = hist->GetFunction("gaus");
173  if(func) {
174  func->SetLineColor(kRed);
175  func->Draw("same");
176  }
177  c->SaveAs(name.c_str());
178 
179  gStyle->SetOptStat(0);
180  gStyle->SetOptFit(0);
181  delete c;
182 }
183 
184 void ResolutionPlot(TH2 * hist, double xmin, double xmax, std::string name, bool tight = false, bool logz = false, bool plot_projections = false)
185 {
186  hist->SetTitle("");
187  hist->GetYaxis()->CenterTitle();
188  int NX = hist->GetNbinsX();
189  auto markers = new TH1D(UniqueName().c_str(),"", NX, hist->GetXaxis()->GetXbins()->GetArray());
190  if(hist->GetXaxis()->GetBinLowEdge(NX+1) != markers->GetXaxis()->GetBinLowEdge(NX+1)) {
191  double x0 = hist->GetXaxis()->GetBinLowEdge(1);
192  double x1 = hist->GetXaxis()->GetBinLowEdge(NX+1);
193  markers = new TH1D(UniqueName().c_str(), "", NX, x0, x1);
194  }
195  double range = 0.5 * hist->GetXaxis()->GetBinLowEdge(NX+1);
196  for( int i = 1; i <= hist->GetNbinsX(); ++i){
197  auto projection = (TH1F*) hist->ProjectionY("",i,i);
198  int lowbin = projection->FindBin(-range);
199  int highbin = projection->FindBin(range);
200  if(projection->Integral(lowbin, highbin)) {
201  projection->Fit("gaus", "+Q", "", -range, range);
202  // double mean = projection->GetMean();
203  // double rms = projection->GetRMS();
204  double mean = projection->GetFunction("gaus")->GetParameter(1);
205  double rms = projection->GetFunction("gaus")->GetParameter(2);
206  markers->SetBinContent(i,mean);
207  markers->SetBinError(i,rms);
208  }
209 
210  if(plot_projections) {
211  projection->SetTitle(TString::Format("%.3f < cos#theta_{e} < %.3f",
212  hist->GetXaxis()->GetBinLowEdge(i),
213  hist->GetXaxis()->GetBinLowEdge(i+1)));
214  projection->GetXaxis()->SetTitle(hist->GetYaxis()->GetTitle());
215  projection->GetYaxis()->SetTitle("Events");
216  projection->GetXaxis()->CenterTitle();
217  projection->GetYaxis()->CenterTitle();
218  projection->SetStats(true);
219  size_t pos = name.find(".pdf");
220  std::string proj_name = name;
221  proj_name.replace(pos, 4, "_projection_" + std::to_string(i) + ".pdf");
222  PlotProjection(projection, proj_name, false);
223  }
224  }
225 
226  TCanvas *c1 = new TCanvas();
227  c1->SetRightMargin(0.15);
228 
229  if(logz) c1->SetLogz();
230 
231  // hist->GetYaxis()->SetRangeUser(-0.4,0.4);
232  hist->GetXaxis()->SetRangeUser(xmin, xmax);
233  if(tight) hist->GetYaxis()->SetRangeUser(-1, 1);
234  hist->Draw("COLZ");
235  markers->Draw("e1 same");
236 
237  c1->SaveAs(name.c_str());
238  c1->Close();
239 }
240 
241 
242 void PlotResolution(std::string input_file_name="/nova/ana/users/ddoyle/NuebarResolutionStudy/resolution_plots.root",
243  std::string plot_dump="/nova/ana/users/ddoyle/NuebarResolutionStudy/plots")
244 {
245  TFile *file_resolution = new TFile(input_file_name.c_str(), "READ");
246 
247  if( !(file_resolution) ){
248  std::cout << "ResolutionSpectra.root does not exist"
249  << " run resolutionscript.C first" << std::endl;
250  return;
251  }
252 
253  size_t pos = input_file_name.find(".root");
254  std::string output_file_name = input_file_name;
255  output_file_name.replace(pos, 5, "_hists.root");
256 
257  //Load Spectra From the ROOT File
258  auto reco_angular_frac =*Spectrum::LoadFrom(file_resolution, "reco_angular_frac" );
259  auto truth_angular_frac =*Spectrum::LoadFrom(file_resolution, "truth_angular_frac");
260  auto reco_energy_frac =*Spectrum::LoadFrom(file_resolution, "reco_energy_frac" );
261  auto truth_energy_frac =*Spectrum::LoadFrom(file_resolution, "truth_energy_frac" );
262 
263  auto reco_angular_abs =*Spectrum::LoadFrom(file_resolution, "reco_angular_abs" );
264  auto truth_angular_abs =*Spectrum::LoadFrom(file_resolution, "truth_angular_abs");
265  auto reco_energy_abs =*Spectrum::LoadFrom(file_resolution, "reco_energy_abs" );
266  auto truth_energy_abs =*Spectrum::LoadFrom(file_resolution, "truth_energy_abs" );
267 
268  auto standard_axis_reco_angular_abs =*Spectrum::LoadFrom(file_resolution, "standard_axis_reco_angular_abs" );
269  auto standard_axis_truth_angular_abs =*Spectrum::LoadFrom(file_resolution, "standard_axis_truth_angular_abs");
270  auto standard_axis_reco_energy_abs =*Spectrum::LoadFrom(file_resolution, "standard_axis_reco_energy_abs" );
271  auto standard_axis_truth_energy_abs =*Spectrum::LoadFrom(file_resolution, "standard_axis_truth_energy_abs" );
272 
273  auto signal_reco_energy_vs_cos =*Spectrum::LoadFrom(file_resolution, "signal_reco_energy_vs_cos" );
274  auto signal_truth_energy_vs_cos =*Spectrum::LoadFrom(file_resolution, "signal_truth_energy_vs_cos");
275 
276  double MCPOT = reco_angular_frac.POT();
277  double DATAPOT = kAna2019RHCPOT;
278 
279  TH2 * hreco_angular_frac = reco_angular_frac .ToTH2(MCPOT);
280  TH2 * htruth_angular_frac = truth_angular_frac.ToTH2(MCPOT);
281  TH2 * hreco_energy_frac = reco_energy_frac .ToTH2(MCPOT);
282  TH2 * htruth_energy_frac = truth_energy_frac .ToTH2(MCPOT);
283 
284  TH2 * hreco_angular_abs = reco_angular_abs .ToTH2(MCPOT);
285  TH2 * htruth_angular_abs = truth_angular_abs .ToTH2(MCPOT);
286  TH2 * hreco_energy_abs = reco_energy_abs .ToTH2(MCPOT);
287  TH2 * htruth_energy_abs = truth_energy_abs .ToTH2(MCPOT);
288 
289  TH2 * hstandard_axis_reco_angular_abs = standard_axis_reco_angular_abs .ToTH2(MCPOT);
290  TH2 * hstandard_axis_truth_angular_abs = standard_axis_truth_angular_abs .ToTH2(MCPOT);
291  TH2 * hstandard_axis_reco_energy_abs = standard_axis_reco_energy_abs .ToTH2(MCPOT);
292  TH2 * hstandard_axis_truth_energy_abs = standard_axis_truth_energy_abs .ToTH2(MCPOT);
293 
294  std::vector<double> cosedges(nuebarccinc::angedges.begin()+1, nuebarccinc::angedges.end());
295  std::vector<double> engedges(nuebarccinc::eelecedges.begin(), nuebarccinc::eelecedges.end()-1);
296 // TH2 * standard_axis_reco_angular_abs = Rebin(hreco_angular_abs , nuebarccinc::cosedges );
297 // TH2 * standard_axis_truth_angular_abs = Rebin(htruth_angular_abs, nuebarccinc::cosedges );
298 // TH2 * standard_axis_reco_energy_abs = Rebin(hreco_energy_abs , nuebarccinc::eelecedges);
299 // TH2 * standard_axis_truth_energy_abs = Rebin(htruth_energy_abs , nuebarccinc::eelecedges);
300 
301 // TH2 * standard_axis_reco_angular_frac = Rebin(hreco_angular_frac , nuebarccinc::cosedges );
302 // TH2 * standard_axis_truth_angular_frac = Rebin(htruth_angular_frac, nuebarccinc::cosedges );
303 // TH2 * standard_axis_reco_energy_frac = Rebin(hreco_energy_frac , nuebarccinc::eelecedges);
304 // TH2 * standard_axis_truth_energy_frac = Rebin(htruth_energy_frac , nuebarccinc::eelecedges);
305 
306 
307  TH1 * hsignal_reco_energy_vs_cos = signal_reco_energy_vs_cos .ToTH1(DATAPOT);
308  TH1 * hsignal_truth_energy_vs_cos = signal_truth_energy_vs_cos.ToTH1(DATAPOT);
309 
310 
311  //Now Print out the resolution plots
312  hreco_angular_frac ->GetYaxis()->SetTitle("Fractional Bias (Reco - True)/True");
313  htruth_angular_frac ->GetYaxis()->SetTitle("Fractional Bias (Reco - True)/True");
314  hreco_energy_frac ->GetYaxis()->SetTitle("Fractional Bias (Reco - True)/True");
315  htruth_energy_frac ->GetYaxis()->SetTitle("Fractional Bias (Reco - True)/True");
316  ResolutionPlot(hreco_angular_frac , 0, 1 , plot_dump + "/angular_reco_res_frac.pdf", true, true);
317  ResolutionPlot(htruth_angular_frac , 0, 1 , plot_dump + "/angular_true_res_frac.pdf", true, true);
318  ResolutionPlot(hreco_energy_frac , 0, 10, plot_dump + "/energy_reco_res_frac.pdf" , true, true);
319  ResolutionPlot(htruth_energy_frac , 0, 10, plot_dump + "/energy_truth_res_frac.pdf", true, true);
320 
321  hreco_angular_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
322  htruth_angular_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
323  hreco_energy_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
324  htruth_energy_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
325  ResolutionPlot(hreco_angular_abs , 0, 1 , plot_dump + "/angular_reco_res_abs.pdf", false, true);
326  ResolutionPlot(htruth_angular_abs , 0, 1 , plot_dump + "/angular_true_res_abs.pdf", false, true);
327  ResolutionPlot(hreco_energy_abs , 0, 10, plot_dump + "/energy_reco_res_abs.pdf" , false, true);
328  ResolutionPlot(htruth_energy_abs , 0, 10, plot_dump + "/energy_truth_res_abs.pdf", false, true);
329 
330  hstandard_axis_reco_angular_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
331  hstandard_axis_truth_angular_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
332  hstandard_axis_reco_energy_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
333  hstandard_axis_truth_energy_abs ->GetYaxis()->SetTitle("Absolute Bias (Reco - True) [GeV]");
334  ResolutionPlot(hstandard_axis_reco_angular_abs , 0, 1 , plot_dump + "/standard_axis_angular_reco_res_abs.pdf", false, true, true);
335  ResolutionPlot(hstandard_axis_truth_angular_abs , 0, 1 , plot_dump + "/standard_axis_angular_true_res_abs.pdf", false, true, true);
336  ResolutionPlot(hstandard_axis_reco_energy_abs , 0, 10, plot_dump + "/standard_axis_energy_reco_res_abs.pdf" , false, true);
337  ResolutionPlot(hstandard_axis_truth_energy_abs , 0, 10, plot_dump + "/standard_axis_energy_true_res_abs.pdf" , false, true);
338 
339  //ResolutionPlot(standard_axis_reco_angular_abs , 0, 1 , plot_dump + "/standard_axis_angular_reco_res_frac.pdf", true);
340  //ResolutionPlot(standard_axis_truth_angular_abs , 0, 1 , plot_dump + "/standard_axis_angular_true_res_frac.pdf", true);
341  //ResolutionPlot(standard_axis_reco_energy_abs , 0, 10, plot_dump + "/standard_axis_energy_reco_res_frac.pdf" , true);
342  //ResolutionPlot(standard_axis_truth_energy_abs , 0, 10, plot_dump + "/standard_axis_energy_true_res_frac.pdf", true);
343 
344  RMSPlot(hstandard_axis_reco_angular_abs , nuebarccinc::angedges , 0, 1 , plot_dump + "/reco_cos_theta_resolution_binning.pdf" );
345  RMSPlot(hstandard_axis_truth_angular_abs, nuebarccinc::angedges , 0, 1 , plot_dump + "/truth_cos_theta_resolution_binning.pdf" );
346  RMSPlot(hstandard_axis_reco_energy_abs , nuebarccinc::eelecedges, 0, 10, plot_dump + "/reco_energy_resolution_binning.pdf" );
347  RMSPlot(hstandard_axis_truth_energy_abs , nuebarccinc::eelecedges, 0, 10, plot_dump + "/truth_energy_resolution_binning.pdf" );
348 
349  SignalCountPlot(hsignal_reco_energy_vs_cos, hsignal_truth_energy_vs_cos , plot_dump + "/signal_energy_vs_cos.pdf" );
350 
351  Spectrum * signal_reco_energy_vs_cos_2d = new Spectrum(hsignal_reco_energy_vs_cos,
356  DATAPOT, 0);
357  Spectrum * signal_truth_energy_vs_cos_2d = new Spectrum(hsignal_truth_energy_vs_cos,
362  DATAPOT, 0);
363 
364  TH2D* hsignal_reco_energy_vs_cos_2d = (TH2D*) signal_reco_energy_vs_cos_2d ->ToTH2(DATAPOT);
365  TH2D* hsignal_truth_energy_vs_cos_2d = (TH2D*) signal_truth_energy_vs_cos_2d->ToTH2(DATAPOT);
366 
367  TCanvas * c = new TCanvas();
368  hsignal_truth_energy_vs_cos_2d->SetTitle("");
369  hsignal_truth_energy_vs_cos_2d->SetMarkerColor(kWhite);
370  hsignal_truth_energy_vs_cos_2d->GetYaxis()->SetRangeUser(0, 10);
371  hsignal_truth_energy_vs_cos_2d->GetXaxis()->SetRangeUser(.6, 1);
372  hsignal_truth_energy_vs_cos_2d->Draw("colz text");
373  c->SaveAs((plot_dump + "/signal_truth_energy_vs_cos_2d.pdf").c_str());
374 
375  TH1D * hsignal_reco_energy = hsignal_reco_energy_vs_cos_2d->ProjectionY(UniqueName().c_str());
376  TH1D * hsignal_reco_cos = hsignal_reco_energy_vs_cos_2d->ProjectionX(UniqueName().c_str());
377  hsignal_reco_energy ->SetTitle("");
378  hsignal_reco_cos ->SetTitle("");
379 
380  TH1D * hsignal_truth_energy = hsignal_truth_energy_vs_cos_2d->ProjectionY(UniqueName().c_str());
381  TH1D * hsignal_truth_cos = hsignal_truth_energy_vs_cos_2d->ProjectionX(UniqueName().c_str());
382  hsignal_truth_energy ->SetTitle("");
383  hsignal_truth_cos ->SetTitle("");
384 
385  SignalCountPlot(hsignal_reco_energy, hsignal_truth_energy, 0, 10, plot_dump + "/signal_energy.pdf");
386  SignalCountPlot(hsignal_reco_cos , hsignal_truth_cos , 0, 10, plot_dump + "/signal_cos.pdf" );
387 
388  TFile * output = new TFile(output_file_name.c_str(), "recreate");
389  hsignal_reco_energy_vs_cos_2d ->Write("hsignal_reco_energy_vs_cos_2d");
390  hsignal_truth_energy_vs_cos_2d->Write("hsignal_truth_energy_vs_cos_2d");
391  hreco_angular_frac ->Write("hreco_angular_frac");
392  htruth_angular_frac ->Write("htruth_angular_frac");
393  hreco_energy_frac ->Write("hreco_energy_frac");
394  htruth_energy_frac ->Write("htruth_energy_frac");
395 
396  hreco_angular_abs ->Write("hreco_angular_abs");
397  htruth_angular_abs ->Write("htruth_angular_abs");
398  hreco_energy_abs ->Write("hreco_energy_abs");
399  htruth_energy_abs ->Write("htruth_energy_abs");
400  hstandard_axis_reco_angular_abs ->Write("hstandard_axis_reco_angular_abs");
401  hstandard_axis_truth_angular_abs ->Write("hstandard_axis_truth_angular_abs");
402  hstandard_axis_reco_energy_abs ->Write("hstandard_axis_reco_energy_abs");
403  hstandard_axis_truth_energy_abs ->Write("hstandard_axis_truth_energy_abs");
404  hsignal_reco_energy_vs_cos ->Write("hsignal_reco_energy_vs_cos");
405  hsignal_truth_energy_vs_cos ->Write("hsignal_truth_energy_vs_cos");
406  hsignal_reco_energy ->Write("hsignal_reco_energy");
407  hsignal_truth_energy ->Write("hsignal_truth_energy");
408  hsignal_reco_cos ->Write("hsignal_reco_cos");
409  hsignal_truth_cos ->Write("hsignal_truth_cos");
410 
411 }
412 
const std::vector< double > angedges
T max(const caf::Proxy< T > &a, T b)
const XML_Char * name
Definition: expat.h:151
ofstream output
const std::vector< double > eelecedges
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::map< std::string, double > xmax
const ana::HistAxis kTrueElectronEStandardAxis
Float_t x1[n_points_granero]
Definition: compare.C:5
TH2 * Rebin(TH2 *hist, std::vector< double > edges)
void ResolutionPlot(TH2 *hist, double xmin, double xmax, std::string name, bool tight=false, bool logz=false, bool plot_projections=false)
const ana::HistAxis kRecoElectronCosThetaStandardAxis("Reco cos #theta_{e}", costhetabins, kRecoElectronCosTheta)
list markers
Definition: styles.py:7
bool logy
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
Double_t ymax
Definition: plot.C:25
const XML_Char * s
Definition: expat.h:262
const ana::HistAxis kTrueElectronCosThetaStandardAxis
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
double func(double x, double y)
const double j
Definition: BetheBloch.cxx:29
std::vector< float > Spectrum
Definition: Constants.h:610
z
Definition: test.py:28
const ana::HistAxis kRecoElectronEStandardAxis("Reco E_{e} (GeV)", eelecbins, kElectronE)
OStream cout
Definition: OStream.cxx:6
const double kAna2019RHCPOT
Definition: Exposures.h:224
const std::vector< Binning > & GetBinnings() const
Definition: LabelsAndBins.h:69
void PlotResolution(std::string input_file_name="/nova/ana/users/ddoyle/NuebarResolutionStudy/resolution_plots.root", std::string plot_dump="/nova/ana/users/ddoyle/NuebarResolutionStudy/plots")
void RMSPlot(TH2 *hist, std::vector< double > edges, double xmin, double xmax, std::string name, bool logy=false)
c1
Definition: demo5.py:24
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
void PlotProjection(TH1 *hist, std::string name, bool logy=false)
void SignalCountPlot(TH1 *reco, TH1 *truth, std::string name)
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:29
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
Definition: UtilsExt.cxx:115
const std::vector< std::string > & GetLabels() const
Definition: LabelsAndBins.h:68
enum BeamMode string