resolutionplotter.C
Go to the documentation of this file.
1 /* Gets ND Data/MC Numu varaibles spectra and converts them into POT normalized histograms.
2  */
3 #ifdef __CINT__
5 {
6  std::cout<<" Sorry, you must run in compiled mode" <<std::endl;
7 }
8 #else
9 #include "TLine.h"
10 #include "Rtypes.h"
11 
12 #include "TCanvas.h"
13 #include "TFile.h"
14 #include "TGraph.h"
15 #include "TH1.h"
16 #include "TH2.h"
17 #include "TMath.h"
18 #include "TGaxis.h"
19 #include "TMultiGraph.h"
20 #include "TLegend.h"
21 #include "TLegendEntry.h"
22 #include "TLatex.h"
23 #include "TStyle.h"
24 #include "THStack.h"
25 #include "TPaveText.h"
26 #include "TList.h"
27 #include "TGaxis.h"
28 #include "TAttLine.h"
29 #include "TAttMarker.h"
30 
31 #include <cmath>
32 #include <iostream>
33 #include <vector>
34 #include <list>
35 #include <sstream>
36 #include <string>
37 #include <sstream>
38 #include <fstream>
39 #include <iomanip>
40 
41 #include "CAFAna/Core/Binning.h"
42 #include "CAFAna/Cuts/Cuts.h"
43 #include "CAFAna/Core/Spectrum.h"
45 #include "CAFAna/Vars/Vars.h"
46 #include "CAFAna/Core/Utilities.h"
47 #include "CAFAna/Analysis/Plots.h"
48 #include "CAFAna/Cuts/SpillCuts.h"
50 #include "CAFAna/Cuts/TruthCuts.h"
53 #include "CAFAna/Analysis/Style.h"
54 #include "TColor.h"
55 #include "Utilities/rootlogon.C"
56 
57 
58 
59 using namespace ana;
61 {
62  TLatex* prelim = new TLatex(.9, .95, "NOvA Simulation");
63  prelim->SetTextColor(kGray+1);
64  prelim->SetNDC();
65  prelim->SetTextSize(2/30.);
66  prelim->SetTextAlign(32);
67  TGaxis::SetMaxDigits(3);
68  prelim->Draw();
69 }
70 
72 {
73 
74 
75 
76 /*********************************************************************************************************************/
77 
78 ///Read the Spectrum Root file /////
79 
80  TFile *f1= new TFile ("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/ResolutionstudyOptimizedProng1_2_cuts_kPi0updated.root","READ");
81  f1->cd();
82 
83 
84  ///load delta energy 2 prong CVN cuts spectrums (stacked)/////
85  auto sndMC=*Spectrum::LoadFrom(f1->GetDirectory("ndMC"));
86  auto sndMC3P=*Spectrum::LoadFrom(f1->GetDirectory("ndMC3P"));
87  auto sndNCNonPi0=*Spectrum::LoadFrom(f1->GetDirectory("ndNCNonPi0"));
88  //auto sndNCMCSig=*Spectrum::LoadFrom(f1->GetDirectory("ndNCMCSig"));
89  auto sndNCPi0=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0"));
90  auto sndCCPi0=*Spectrum::LoadFrom(f1->GetDirectory("ndCCPi0"));
91  auto sndNCPi0L=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0L"));
92  auto sndCCNonPi0=*Spectrum::LoadFrom(f1->GetDirectory("ndCCNonPi0"));
93 
94  ///load delta energy 2 prong CVN cuts spectrums (unstacked)/////
95  auto sndMC1=*Spectrum::LoadFrom(f1->GetDirectory("ndMC"));
96  auto sndMC3P1=*Spectrum::LoadFrom(f1->GetDirectory("ndMC3P"));
97  auto sndNCNonPi01=*Spectrum::LoadFrom(f1->GetDirectory("ndNCNonPi0"));
98  //auto sndNCMCSig=*Spectrum::LoadFrom(f1->GetDirectory("ndNCMCSig"));
99  auto sndNCPi01=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0"));
100  auto sndCCPi01=*Spectrum::LoadFrom(f1->GetDirectory("ndCCPi0"));
101  auto sndNCPi0L1=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0L"));
102  auto sndCCNonPi01=*Spectrum::LoadFrom(f1->GetDirectory("ndCCNonPi0"));
103 
104  ///load delta energy 1 prong CVN cut spectrums (stacked)/////
105  auto sndMC1Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndMC1Cut"));
106  auto sndMC3P1Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndMC3P1Cut"));
107  auto sndNCNonPi01Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndNCNonPi01Cut"));
108  //auto sndNCMCSig=*Spectrum::LoadFrom(f1->GetDirectory("ndNCMCSig"));
109  auto sndNCPi01Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi01Cut"));
110  auto sndCCPi01Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndCCPi01Cut"));
111  auto sndNCPi0L1Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0L1Cut"));
112  auto sndCCNonPi01Cut=*Spectrum::LoadFrom(f1->GetDirectory("ndCCNonPi01Cut"));
113 
114  ///load reco mass 1 prong CVN cut spectrums (unstacked)/////
115  auto sndMC1Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndMC1Cut"));
116  auto sndMC3P1Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndMC3P1Cut"));
117  auto sndNCNonPi01Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndNCNonPi01Cut"));
118  //auto sndNCMCSig=*Spectrum::LoadFrom(f1->GetDirectory("ndNCMCSig"));
119  auto sndNCPi01Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi01Cut"));
120  auto sndCCPi01Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndCCPi01Cut"));
121  auto sndNCPi0L1Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndNCPi0L1Cut"));
122  auto sndCCNonPi01Cut2=*Spectrum::LoadFrom(f1->GetDirectory("ndCCNonPi01Cut"));
123 
124  // ////2D Plots 2 prong & 3 prong///////
125  auto snd2dplot2prong1cut=*Spectrum::LoadFrom(f1->GetDirectory("nd2dplot2prong1cut"));
126  auto snd2dplot2prong2cuts=*Spectrum::LoadFrom(f1->GetDirectory("nd2dplot2prong2cuts"));
127 
128  /*********************************************************************************************************************/
129 
130  ///How to Scale Histogram////
131 
132  // double myPOT=sndMC.POT();
133  const double myPOT = 8e20;
134 
135 /*********************************************************************************************************************/
136 
137  //------histograms--------//
138 
139  ///load delta energy spectrums 2 prong CVN cuts (stacked) /////
140  auto hndMC = sndMC.ToTH1(myPOT);
141  auto hndMC3P = sndMC3P.ToTH1(myPOT);
142  auto hndNCNonPi0 = sndNCNonPi0.ToTH1(myPOT);
143  auto hndCCPi0 = sndCCPi0.ToTH1(myPOT);
144  auto hndNCPi0 = sndNCPi0.ToTH1(myPOT);
145  auto hndNCPi0L = sndNCPi0L.ToTH1(myPOT);
146  auto hndCCNonPi0 = sndCCNonPi0.ToTH1(myPOT);
147 
148  ///load delta energy spectrums 2 prong CVN cuts (unstacked) /////
149  auto hndMC1 = sndMC.ToTH1(myPOT);
150  auto hndMC3P1 = sndMC3P.ToTH1(myPOT);
151  auto hndNCNonPi01 = sndNCNonPi0.ToTH1(myPOT);
152  auto hndCCPi01 = sndCCPi0.ToTH1(myPOT);
153  auto hndNCPi01 = sndNCPi0.ToTH1(myPOT);
154  auto hndNCPi0L1 = sndNCPi0L.ToTH1(myPOT);
155  auto hndCCNonPi01 = sndCCNonPi0.ToTH1(myPOT);
156 
157 
158  ///load delta energy spectrums 1 prong CVN cut (Stacked) /////
159  auto hndMC1Cut = sndMC1Cut.ToTH1(myPOT);
160  auto hndMC3P1Cut = sndMC3P1Cut.ToTH1(myPOT);
161  auto hndNCNonPi01Cut = sndNCNonPi01Cut.ToTH1(myPOT);
162  auto hndCCPi01Cut = sndCCPi01Cut.ToTH1(myPOT);
163  auto hndNCPi01Cut = sndNCPi01Cut.ToTH1(myPOT);
164  auto hndNCPi0L1Cut = sndNCPi0L1Cut.ToTH1(myPOT);
165  auto hndCCNonPi01Cut = sndCCNonPi01Cut.ToTH1(myPOT);
166 
167  ///load delta energy spectrums 1 prong CVN cut (Unstacked)/////
168  auto hndMC1Cut2 = sndMC1Cut2.ToTH1(myPOT);
169  auto hndMC3P1Cut2 = sndMC3P1Cut2.ToTH1(myPOT);
170  auto hndNCNonPi01Cut2 = sndNCNonPi01Cut2.ToTH1(myPOT);
171  auto hndCCPi01Cut2 = sndCCPi01Cut2.ToTH1(myPOT);
172  auto hndNCPi01Cut2 = sndNCPi01Cut2.ToTH1(myPOT);
173  auto hndNCPi0L1Cut2 = sndNCPi0L1Cut2.ToTH1(myPOT);
174  auto hndCCNonPi01Cut2 = sndCCNonPi01Cut2.ToTH1(myPOT);
175 
176  ////2D Plots 2 prong & 3 prong///////
177 
178  auto hnd2dplot2prong1cut = snd2dplot2prong1cut.ToTH2(myPOT);
179  auto hnd2dplot2prong2cuts = snd2dplot2prong2cuts.ToTH2(myPOT);
180 
181 //****************************Updated Date and string path for saving files **********************************************************///
182  TString outDir2 = "/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/Resolution";
183  struct FileUp{
185  };
186  struct DateUp{
188  };
189 
190  const int File =6;
191  const FileUp CurrentFile[File] = {
192  {"/2cuts_resolution_deltaenergy_Stacked"},
193  {"/2cuts_resolution_deltaenergy_unstacked"},
194  {"/1cut_resolution_deltaenergy_stacked"},
195  {"/1cut_resolution_deltaenergy_unstacked"},
196  {"/1cut_resolution_2DPlot"},
197  {"/2cut_resolution_2DPlot"},
198 
199  };
200 
201  const int Date = 1;
202  const DateUp CurrentDate[Date] = {
203  {"_03-16-18"},
204  };
205 
206 //------------------------------------------------------------
207 
208 
209 /*********************************************************************************************************************/
210  /// Plot 2 /// Stacked Delta Energy 2 P-CVN
211 
212  //gStyle->SetTitleY(0.9);
213  TCanvas *cs2 = new TCanvas("cs2","cs2",10,10,855,500);
214  THStack *hs2 = new THStack("hs2"," ");
215  //TCanvas *c2_ndMC =new TCanvas("c2_ndMC","ndMC",800,500);
216  //TH1D *c2_ndNCMCSig = new TH1D("c2_ndNCMCSig","ndNCMCSig",100,-4,4);
217  // hndNCMCSig->SetLineColor(kBlack);
218  // hndNCMCSig->SetFillColor(kGray);
219  // hndNCMCSig->SetLineWidth(3);
220  // hndNCMCSig->SetMarkerStyle(21);
221  // hndNCMCSig->SetMarkerColor(kGray);
222 
223  // hs2->Add(hndNCMCSig);
224 
225  //TH1D *c2_ndCCMCSig = new TH1D("c2_ndCCMCSig","ndCCMCSig",100,-4,4);
226  hndNCPi0L->SetLineColor(kBlack);
227  hndNCPi0L->SetFillColor(kOrange);
228  hndNCPi0L->SetLineWidth(3);
229  hndNCPi0L->SetMarkerStyle(21);
230  hndNCPi0L->SetMarkerColor(kOrange);
231  hs2->Add(hndNCPi0L);
232 
233  //TH1D *c2_hndCCPi0 = new TH1D("c2_ndCCPi0","ndCCPi0",100,-4,4);
234  hndCCPi0->SetLineColor(kBlack);
235  hndCCPi0->SetFillColor(kMagenta);
236  hndCCPi0->SetLineWidth(3);
237  hndCCPi0->SetMarkerStyle(21);
238  hndCCPi0->SetMarkerColor(kMagenta);
239 
240  hs2->Add(hndCCPi0);
241  //TH1D *c2_hndCCNonPi0 = new TH1D("c2_hndCCNonPi0","hndCCNonPi0",100,-4,4);
242  hndCCNonPi0->SetLineColor(kBlack);
243  hndCCNonPi0->SetFillColor(kAzure);
244  hndCCNonPi0->SetLineWidth(3);
245  hndCCNonPi0->SetMarkerStyle(21);
246  hndCCNonPi0->SetMarkerColor(kAzure);
247  hs2->Add(hndCCNonPi0);
248 
249  //TH1D *c2_hndNCPi0 = new TH1D("c2_ndNCPi0","ndNCPi0",100,-4,4);
250  hndNCNonPi0->SetLineColor(kBlack);
251  hndNCNonPi0->SetFillColor(kCyan);
252  hndNCNonPi0->SetLineWidth(3);
253  hndNCNonPi0->SetMarkerStyle(21);
254  hndNCNonPi0->SetMarkerColor(kCyan);
255  hs2->Add(hndNCNonPi0);
256 
257  //TH1D *c2_hndNCPi0L = new TH1D("c2_ndNCPi0L","ndNCPi0L",100,-4,4);
258  hndNCPi0->SetLineColor(kBlack);
259  hndNCPi0->SetFillColor(kGreen);
260  hndNCPi0->SetLineWidth(3);
261  hndNCPi0->SetMarkerStyle(21);
262  hndNCPi0->SetMarkerColor(kGreen);
263  hs2->Add(hndNCPi0);
264 
265  //TCanvas *cs2 = new TCanvas("cs2","cs2",10,10,855,500);
266  TText T; T.SetTextFont(42); T.SetTextAlign(21);
267  hs2->Draw("hist"); T.DrawTextNDC(.5,.95,"");
268  hs2->GetYaxis()->SetTitle("Events/ 8e20 POT");
269  hs2->GetXaxis()->SetTitle("(Reco-True) #Delta E [GeV]");
270  hs2->SetMaximum(450);
271  hs2->GetXaxis()->SetRangeUser(-1,1);
272  gPad->Modified();
273  cs2->cd();
274  //cs2->SetTopMargin(0.18);
275  hndMC3P->SetLineColor(kRed);
276  hndMC3P->SetLineWidth(3);
277  hndMC3P->Draw("same");
278  TLegend * leg2 = new TLegend(0.62,0.5,0.73,0.82);
279  //leg2->SetTextAlign(40);
280  leg2->SetTextFont(42);
281  leg2->SetTextSize(0.05);
282  leg2->SetFillStyle(0);
283  leg2->AddEntry(hndMC3P,"Total PreSel","kFullDotSmall");
284  // leg2->AddEntry(hndNCMCSig,"Signal","kFullDotSmall");
285  leg2->AddEntry(hndCCPi0,"CCPi0","kFullDotSmall");
286  leg2->AddEntry(hndCCNonPi0,"CCNonPi0","kFullDotSmall");
287  leg2->AddEntry(hndNCPi0L,"NC w/Pi0 < 0.3 E","kFullDotSmall");
288  leg2->AddEntry(hndNCPi0,"NC w/Pi0 > 0.3 E","kFullDotSmall");
289  leg2->AddEntry(hndNCNonPi0,"NCNonPi0","kFullDotSmall");
290 
291  leg2->Draw("same");
292  NDSimulation();
293  //cs2->SaveAs("/nova/app/users/acedeno/tag_releas9-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot3_2Pr_0_3_CVN07__11-02-17.pdf");
294  cs2->SaveAs(outDir2+CurrentFile[0].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
295 
296 // /*********************************************************************************************************************/
297 /// Plot 2 /// Unstacked Delta energy 2 P-CVN cuts
298 
299  //gStyle->SetTitleY(0.9);
300  TCanvas *cs13 = new TCanvas("cs13","cs13",10,10,855,500);
301  cs13->cd();
302 
303  hndMC3P1->SetLineColor(kRed);
304  hndMC3P1->SetLineWidth(3);
305  // hndMC3P1->SetMarkerStyle(21);
306  //hndMC3P1->SetMarkerColor(kRed);
307 
308  hndCCPi01->SetLineColor(kMagenta);
309  hndCCPi01->SetLineWidth(3);
310  // hndCCPi01->SetMarkerStyle(21);
311  // hndCCPi01->SetMarkerColor(kMagenta);
312 
313  hndCCNonPi01->SetLineColor(kAzure);
314  hndCCNonPi01->SetLineWidth(3);
315  // hndCCNonPi01->SetMarkerStyle(21);
316  //hndCCNonPi01->SetMarkerColor(kAzure);
317 
318  hndNCPi0L1->SetLineColor(kOrange);
319  hndNCPi0L1->SetLineWidth(3);
320  // hndNCPi0L1->SetMarkerStyle(21);
321  //hndNCPi0L1->SetMarkerColor(kOrange);
322 
323  hndNCPi01->SetLineColor(kGreen);
324  hndNCPi01->SetLineWidth(3);
325  // hndNCPi01->SetMarkerStyle(21);
326  //hndNCPi01->SetMarkerColor(kGreen);
327 
328 
329  hndNCNonPi01->SetLineColor(kCyan);
330  hndNCNonPi01->SetLineWidth(3);
331  // hndNCNonPi01->SetMarkerStyle(21);
332  //hndNCNonPi01->SetMarkerColor(kCyan);
333 
334  hndMC3P1->Draw("hist E1");
335  hndCCPi01->Draw("hist E1 same");
336  hndCCNonPi01->Draw("hist E1 same");
337  hndNCPi0L1->Draw("hist E1 same");
338  hndNCPi01->Draw("hist E1 same");
339  hndNCNonPi01->Draw("hist E1 same");
340  hndMC3P1->GetYaxis()->SetTitle("Events/8e20 POT");
341  hndMC3P1->GetXaxis()->SetRangeUser(-.5,.5);
342  hndMC3P1->SetTitleOffset(0.95,"Y");
343  // hndMC3P1->SetTitle("2 Prong Event Preselection + RemID < 0.36 + Prong 1 & 2 CVN Gamma ID > 0.7 ");
344 
345  TLegend * leg13 = new TLegend(0.62,0.5,0.73,0.82);
346  leg13->SetTextFont(42);
347  leg13->SetTextSize(0.05);
348  leg13->AddEntry(hndMC3P1,"Total PreSel","l");
349  leg13->AddEntry(hndCCPi01,"CCPi0","l");
350  leg13->AddEntry(hndCCNonPi01,"CCNonPi0","l");
351  leg13->AddEntry(hndNCPi0L1,"NC w/Pi0 < 0.3 E","l");
352  leg13->AddEntry(hndNCPi01,"NC w/Pi0 > 0.3 E","l");
353  leg13->AddEntry(hndNCNonPi01,"NCNonPi0","l");
354 
355  leg13->Draw("same");
356  NDSimulation();
357  //cs13->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot13_2Pr_0_3_CVN07__11-02-17.pdf");
358  cs13->SaveAs(outDir2+CurrentFile[1].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
359 
360 /*********************************************************************************************************************/
361 
362 /// Plot 2b /// delta energy stacked 1 P-CVN cut
363 
364  //gStyle->SetTitleY(0.9);
365  TCanvas *cs2b = new TCanvas("cs2b","cs2b",10,10,855,500);
366  THStack *hs2b = new THStack("hs2b"," ");
367  //TCanvas *c2_ndMC =new TCanvas("c2_ndMC","ndMC",800,500);
368  //TH1D *c2_ndNCMCSig = new TH1D("c2_ndNCMCSig","ndNCMCSig",100,-4,4);
369  // hndNCMCSig->SetLineColor(kBlack);
370  // hndNCMCSig->SetFillColor(kGray);
371  // hndNCMCSig->SetLineWidth(3);
372  // hndNCMCSig->SetMarkerStyle(21);
373  // hndNCMCSig->SetMarkerColor(kGray);
374 
375  // hs2->Add(hndNCMCSig);
376 
377  //TH1D *c2_ndCCMCSig = new TH1D("c2_ndCCMCSig","ndCCMCSig",100,-4,4);
378  hndNCPi0L1Cut->SetLineColor(kBlack);
379  hndNCPi0L1Cut->SetFillColor(kOrange);
380  hndNCPi0L1Cut->SetLineWidth(3);
381  hndNCPi0L1Cut->SetMarkerStyle(21);
382  hndNCPi0L1Cut->SetMarkerColor(kOrange);
383  hs2b->Add(hndNCPi0L1Cut);
384 
385  //TH1D *c2_hndCCPi0 = new TH1D("c2_ndCCPi0","ndCCPi0",100,-4,4);
386  hndCCPi01Cut->SetLineColor(kBlack);
387  hndCCPi01Cut->SetFillColor(kMagenta);
388  hndCCPi01Cut->SetLineWidth(3);
389  hndCCPi01Cut->SetMarkerStyle(21);
390  hndCCPi01Cut->SetMarkerColor(kMagenta);
391 
392  hs2b->Add(hndCCPi01Cut);
393  //TH1D *c2_hndCCNonPi0 = new TH1D("c2_hndCCNonPi0","hndCCNonPi0",100,-4,4);
394  hndCCNonPi01Cut->SetLineColor(kBlack);
395  hndCCNonPi01Cut->SetFillColor(kAzure);
396  hndCCNonPi01Cut->SetLineWidth(3);
397  hndCCNonPi01Cut->SetMarkerStyle(21);
398  hndCCNonPi01Cut->SetMarkerColor(kAzure);
399  hs2b->Add(hndCCNonPi01Cut);
400 
401  //TH1D *c2_hndNCPi0 = new TH1D("c2_ndNCPi0","ndNCPi0",100,-4,4);
402  hndNCNonPi01Cut->SetLineColor(kBlack);
403  hndNCNonPi01Cut->SetFillColor(kCyan);
404  hndNCNonPi01Cut->SetLineWidth(3);
405  hndNCNonPi01Cut->SetMarkerStyle(21);
406  hndNCNonPi01Cut->SetMarkerColor(kCyan);
407  hs2b->Add(hndNCNonPi01Cut);
408 
409  //TH1D *c2_hndNCPi0L = new TH1D("c2_ndNCPi0L","ndNCPi0L",100,-4,4);
410  hndNCPi01Cut->SetLineColor(kBlack);
411  hndNCPi01Cut->SetFillColor(kGreen);
412  hndNCPi01Cut->SetLineWidth(3);
413  hndNCPi01Cut->SetMarkerStyle(21);
414  hndNCPi01Cut->SetMarkerColor(kGreen);
415  hs2b->Add(hndNCPi01Cut);
416 
417  //TCanvas *cs2 = new TCanvas("cs2","cs2",10,10,855,500);
418  TText T99; T99.SetTextFont(42); T99.SetTextAlign(21);
419  hs2b->Draw("hist"); T99.DrawTextNDC(.5,.95,"");
420  hs2b->GetYaxis()->SetTitle("Events/ 8e20 POT");
421  hs2b->GetXaxis()->SetTitle("(Reco-True) #Delta E [GeV]");
422  hs2b->SetMaximum(1200);
423  hs2b->GetXaxis()->SetRangeUser(-1,1);
424  gPad->Modified();
425  cs2b->cd();
426  //cs2->SetTopMargin(0.18);
427  hndMC3P1Cut->SetLineColor(kRed);
428  hndMC3P1Cut->SetLineWidth(3);
429  hndMC3P1Cut->Draw("same");
430  TLegend * leg2b = new TLegend(0.62,0.5,0.73,0.82);
431  //leg2->SetTextAlign(40);
432  leg2b->SetTextFont(42);
433  leg2b->SetTextSize(0.05);
434  leg2b->SetFillStyle(0);
435  leg2b->AddEntry(hndMC3P1Cut,"Total PreSel","kFullDotSmall");
436  // leg2->AddEntry(hndNCMCSig,"Signal","kFullDotSmall");
437  leg2b->AddEntry(hndCCPi01Cut,"CCPi0","kFullDotSmall");
438  leg2b->AddEntry(hndCCNonPi01Cut,"CCNonPi0","kFullDotSmall");
439  leg2b->AddEntry(hndNCPi0L1Cut,"NC w/Pi0 < 0.3 E","kFullDotSmall");
440  leg2b->AddEntry(hndNCPi01Cut,"NC w/Pi0 > 0.3 E","kFullDotSmall");
441  leg2b->AddEntry(hndNCNonPi01Cut,"NCNonPi0","kFullDotSmall");
442 
443  leg2b->Draw("same");
444  NDSimulation();
445  //cs2->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot3_2Pr_0_3_CVN07__11-02-17.pdf");
446  cs2b->SaveAs(outDir2+CurrentFile[2].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
447 
448 /*********************************************************************************************************************/
449 
450 /// Plot 2 /// delta energy unstacked 1 P-CVN cut
451 
452  //gStyle->SetTitleY(0.9);
453  TCanvas *cs13b = new TCanvas("cs13b","cs13b",10,10,855,500);
454  cs13b->cd();
455 
456  hndMC3P1Cut2->SetLineColor(kRed);
457  hndMC3P1Cut2->SetLineWidth(3);
458  // hndMC3P1->SetMarkerStyle(21);
459  //hndMC3P1->SetMarkerColor(kRed);
460 
461  hndCCPi01Cut2->SetLineColor(kMagenta);
462  hndCCPi01Cut2->SetLineWidth(3);
463  // hndCCPi01->SetMarkerStyle(21);
464  // hndCCPi01->SetMarkerColor(kMagenta);
465 
466  hndCCNonPi01Cut2->SetLineColor(kAzure);
467  hndCCNonPi01Cut2->SetLineWidth(3);
468  // hndCCNonPi01->SetMarkerStyle(21);
469  //hndCCNonPi01->SetMarkerColor(kAzure);
470 
471  hndNCPi0L1Cut2->SetLineColor(kOrange);
472  hndNCPi0L1Cut2->SetLineWidth(3);
473  // hndNCPi0L1->SetMarkerStyle(21);
474  //hndNCPi0L1->SetMarkerColor(kOrange);
475 
476  hndNCPi01Cut2->SetLineColor(kGreen);
477  hndNCPi01Cut2->SetLineWidth(3);
478  // hndNCPi01->SetMarkerStyle(21);
479  //hndNCPi01->SetMarkerColor(kGreen);
480 
481 
482  hndNCNonPi01Cut2->SetLineColor(kCyan);
483  hndNCNonPi01Cut2->SetLineWidth(3);
484  // hndNCNonPi01->SetMarkerStyle(21);
485  //hndNCNonPi01->SetMarkerColor(kCyan);
486 
487  hndMC3P1Cut2->Draw("hist E1");
488  hndCCPi01Cut2->Draw("hist E1 same");
489  hndCCNonPi01Cut2->Draw("hist E1 same");
490  hndNCPi0L1Cut2->Draw("hist E1 same");
491  hndNCPi01Cut2->Draw("hist E1 same");
492  hndNCNonPi01Cut2->Draw("hist E1 same");
493  hndMC3P1Cut2->GetYaxis()->SetTitle("Events/8e20 POT");
494  hndMC3P1Cut2->GetXaxis()->SetRangeUser(-.5,.5);
495  hndMC3P1Cut2->SetTitleOffset(0.95,"Y");
496  // hndMC3P1->SetTitle("2 Prong Event Preselection + RemID < 0.36 + Prong 1 & 2 CVN Gamma ID > 0.7 ");
497 
498  TLegend * leg13b = new TLegend(0.62,0.5,0.73,0.82);
499  leg13b->SetTextFont(42);
500  leg13b->SetTextSize(0.05);
501  leg13b->AddEntry(hndMC3P1Cut2,"Total PreSel","l");
502  leg13b->AddEntry(hndCCPi01Cut2,"CCPi0","l");
503  leg13b->AddEntry(hndCCNonPi01Cut2,"CCNonPi0","l");
504  leg13b->AddEntry(hndNCPi0L1Cut2,"NC w/Pi0 < 0.3 E","l");
505  leg13b->AddEntry(hndNCPi01Cut2,"NC w/Pi0 > 0.3 E","l");
506  leg13b->AddEntry(hndNCNonPi01Cut2,"NCNonPi0","l");
507 
508  leg13b->Draw("same");
509  NDSimulation();
510  //cs13->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot13_2Pr_0_3_CVN07__11-02-17.pdf");
511  cs13b->SaveAs(outDir2+CurrentFile[3].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
512 
513 /*********************************************************************************************************************/
514  /// Plot 16 ///
515  TCanvas *cs10 = new TCanvas("cs10","cs10",10,10,855,500);
516  cs10->cd();
517  hnd2dplot2prong1cut->Draw("colz");
518  hnd2dplot2prong1cut->GetXaxis()->SetTitle("#pi^{0} Reco Energy [GeV]");
519  hnd2dplot2prong1cut->GetYaxis()->SetTitle("(Reco-True) #Delta E [GeV]");
520  hnd2dplot2prong1cut->SetTitleOffset(0.9,"Y");
521  // hnd2dplot2prong->SetTitle("2 Prong Event Preselection + RemID < 0.36 + Prong 1 & 2 CVN Gamma ID > 0.7 Cut");
522  NDSimulation();
523  // cs10->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot11_2Pr_2dplot_0_3_CVN07__11-02-17.pdf");
524  cs10->SaveAs(outDir2+CurrentFile[4].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
525 
526 // /*********************************************************************************************************************/
527 
528  /// Plot 16 ///
529  TCanvas *cs14 = new TCanvas("cs14","cs14",10,10,855,500);
530  cs14->cd();
531  hnd2dplot2prong2cuts->Draw("colz");
532  hnd2dplot2prong2cuts->GetXaxis()->SetTitle("#pi^{0} Reco Energy [GeV]");
533  hnd2dplot2prong2cuts->GetYaxis()->SetTitle("(Reco-True) #Delta E [GeV]");
534  hnd2dplot2prong2cuts->SetTitleOffset(0.9,"Y");
535  // hnd2dplot2prong->SetTitle("2 Prong Event Preselection + RemID < 0.36 + Prong 1 & 2 CVN Gamma ID > 0.7 Cut");
536  NDSimulation();
537  // cs10->SaveAs("/nova/app/users/acedeno/tag_releaseS17-09-24/NDAna/ncpi0_Systematics/NcPi0Plots/plot11_2Pr_2dplot_0_3_CVN07__11-02-17.pdf");
538  cs14->SaveAs(outDir2+CurrentFile[5].name.c_str()+CurrentDate[0].date.c_str()+".pdf");
539 
540 // /*********************************************************************************************************************/
541  //////// Bias vs pion total reco/truth energy and Absolute Resolution vs pion total reco/truth energy/////
542 
543 
544  //h=(TH2D*) f->Get("nd2dplot2prong2cuts");
545  auto histo=*Spectrum::LoadFrom(f1->GetDirectory("nd2dplot2prong2cuts"));
546  auto h = histo.ToTH2(myPOT);
547  float datapot = 8.09e20/3.54e21;
548  h->Scale(datapot);
549  h->Sumw2();
550  int nbins = h->GetNbinsX();
551  double xmin = h->GetXaxis()->GetXmin();
552 
553  double xmax = h->GetXaxis()->GetXmax();
554 
555  TH1D *hrms = new TH1D("hrms","hrms",nbins,xmin,xmax);
556  for( int i = 1; i <= nbins; ++i){
557  TH1D *projection = (TH1D*) h->ProjectionY("",i,i);
558  projection->Sumw2();
559  double rms = projection->GetMean();
560  cout<<"rms:"<<rms<<endl;
561  double rmserr = projection->GetMeanError();
562 
563  hrms-> SetBinContent(i,rms);
564  cout<<"hrms:"<<hrms<<endl;
565  hrms-> SetBinError(i,rmserr);
566  }
567  TCanvas *c = new TCanvas();
568  c->SetLeftMargin(0.15);
569  //c->SetLogz();
570  gROOT->SetStyle("novaStyle");
571  c->SetTickx(1);
572  c->SetTicky(1);
573  gStyle->SetTitleX(.39);
574  gStyle->SetTitleY(0.95);
575  hrms->SetLineColor(kBlack);
576  hrms->Draw("e1");
577  //h->Draw();
578  //c->Close();
579  f1->Close();
580 
581 }
582 #endif
const XML_Char * name
Definition: expat.h:151
enum BeamMode kOrange
void NDSimulation()
::xsd::cxx::tree::date< char, simple_type > date
Definition: Database.h:186
enum BeamMode kRed
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::map< std::string, double > xmax
void resolutionplotter()
const DateUp CurrentDate[Date]
const int Date
const FileUp CurrentFile[File]
const int nbins
Definition: cellShifts.C:15
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
Float_t f1
TH2D * histo
TLatex * prelim
Definition: Xsec_final.C:133
std::string date
OStream cout
Definition: OStream.cxx:6
cout<< "--"<< endl;for(Int_t iP=1;iP<=hyz->GetNbinsX();iP++){for(Int_t iC=1;iC<=hyz->GetNbinsY();iC++){if(hyv->GetBinContent(iP, iC)>-999){goal_hyv-> SetBinContent(iP, iC,-(dy[iP-1][iC-1]))
TString outDir2
const int File
double T
Definition: Xdiff_gwt.C:5
enum BeamMode kGreen
enum BeamMode string