ProduceCompPlots.C
Go to the documentation of this file.
1 #include "TCanvas.h"
2 #include "TFile.h"
3 #include "TGraph.h"
4 #include "TGraphAsymmErrors.h"
5 #include "TH1D.h"
6 #include "TLine.h"
7 #include "TLatex.h"
8 #include "TLegend.h"
9 #include "TStyle.h"
10 #include "TSystem.h"
11 
13 #include "CAFAna/Analysis/Plots.h"
14 
15 #include "CAFAna/Core/Binning.h"
16 #include "CAFAna/Core/Spectrum.h"
18 
19 #include "OscLib/OscCalcPMNSOpt.h"
20 #include "CAFAna/Analysis/Calcs.h"
22 
23 #include "Utilities/rootlogon.C"
24 
25 #include "TFeldmanCousins.h"
26 
27 #include <iostream>
28 #include <sstream>
29 #include <fstream>
30 #include <vector>
31 #include <string>
32 
33 #include <TROOT.h>
34 #include <TStyle.h>
35 
36 using namespace ana;
37 
38 // --- Number of Time Bins and Quartiles.
39 const int NumTimeBins = 6;
40 const int NumQuartile = 5;
41 //......................................................
42 struct LoadedHistograms {
43  // *** Order the plots by [Quartiles][Time Bins]
44  TH1D* MeanSliceTime[NumQuartile][NumTimeBins];
45  TH1D* SliceDuration[NumQuartile][NumTimeBins];
46  TH1D* SliceRecoE [NumQuartile][NumTimeBins];
47  TH1D* MuonRecoE [NumQuartile][NumTimeBins];
48  TH1D* HadroRecoE [NumQuartile][NumTimeBins];
49  TH1D* SliceNHits [NumQuartile][NumTimeBins];
50  TH1D* HadroNHits [NumQuartile][NumTimeBins];
51 
52  TH1D* XMinPos[NumQuartile][NumTimeBins];
53  TH1D* YMinPos[NumQuartile][NumTimeBins];
54  TH1D* ZMinPos[NumQuartile][NumTimeBins];
55  TH1D* XMaxPos[NumQuartile][NumTimeBins];
56  TH1D* YMaxPos[NumQuartile][NumTimeBins];
57  TH1D* ZMaxPos[NumQuartile][NumTimeBins];
58  TH1D* XPosRng[NumQuartile][NumTimeBins];
59  TH1D* YPosRng[NumQuartile][NumTimeBins];
60  TH1D* ZPosRng[NumQuartile][NumTimeBins];
61 };
62 
63 //......................................................
64 // --- Some important things which need to be configured at run time.
66 bool IsFHC = true;
67 std::string sFHC = "FHC";
68 
69 // --- Some variables that are global, but change.
71 const bool ExtremeBins = true; // Only plot time bins 1 & 6?
72 const bool SingleQuant = false; // Only plot combined quartiles?
73 const bool PlotMean = true; // Plot the Mean, Int, RMS?
74 const bool PlotTest = false; // Only plot one variable?
75 const bool SaveRatio = false; // Produce and save the ratio plots?
76 const bool SaveHists = true; // Produce and save the non-ratio plots?
77 
78 //......................................................
80 //......................................................
81 TH1D* GetSpectToHist( TFile* MyF, double POT, std::string SpecName, std::string Axis );
82 //......................................................
83 void ProducePlots( std::vector<LoadedHistograms> HistVec );
84 //......................................................
85 TH1D* MakeRatio( TH1D* num, TH1D* denom, std::string RatName );
86 //......................................................
87 void SetRange( std::vector<TH1D*> hData, std::vector<TH1D*> hMont, std::vector<TH1D*> hRatio, // Pass the histograms
88  double XLow, double XHigh, double H_YLow, double H_YHigh, double R_YLow, double R_YHigh ); // What Y values do I want?
89 //......................................................
90 void FindAxisRange( double &XLow, double &XHigh, double &H_YLow, double &H_YHigh, double &R_YLow, double &R_YHigh, double MaxVal, bool &SetLogy, std::string Name );
91 //......................................................
92 void MakeSplitCans( std::string PlotNa, std::string QntTxt, TFile* OutF,
93  std::vector<TH1D*> DataHists, std::vector<TH1D*> MontHists, std::vector<std::string> Legends );
94 //......................................................
95 void PlotHistProp( TH1D* Hist, TLegend* L );
96 //......................................................
97 void MakeTextFile( std::string Cut, std::string PTitle, std::string Name );
98 //......................................................
99 void CornerLabel(std::string Str);
100 
101 //......................................................
102 void ProduceCompPlots( bool Horn ) {
103 
104  IsFHC = Horn;
105  if ( IsFHC) { sFHC = "FHC"; POTNom = kAna2018FHCPOT; }
106  if (!IsFHC) { sFHC = "RHC"; POTNom = kAna2018RHCPOT; }
107 
108  // ---- First off, lets set the styles...
109  gStyle->SetOptStat(0);
110  gROOT->SetStyle("novaStyle");
111 
112  // --- Declare a vector of my file name structures
113  std::string BaseInputDir="/nova/ana/users/mbaird42/prod4_neutron_studies/neutron_shine_ND_studies/booster_batch_slicer_differences/hadded_results/";
114  std::vector<std::string> InputFiles;
115  if ( IsFHC ) {
116  InputFiles.push_back( BaseInputDir+"neutron_shine_spectra_FHC_data_hadd.root" );
117  InputFiles.push_back( BaseInputDir+"neutron_shine_spectra_FHC_MC_hadd.root" );
118  } else {
119  InputFiles.push_back( BaseInputDir+"neutron_shine_spectra_RHC_data_hadd.root" );
120  InputFiles.push_back( BaseInputDir+"neutron_shine_spectra_RHC_MC_hadd.root" );
121  }
122 
123  // --- What POT am I normalising to?
124  TFile *TempDataFile = TFile::Open( InputFiles[0].c_str() );
125  std::unique_ptr<Spectrum> TempDataSpec = Spectrum::LoadFrom(TempDataFile, "dir_SliceDuration_Q1_TB1" ) ;
126  POTNom = TempDataSpec->POT();
127  std::cout << "\n sFHC is " << sFHC << ", and my POT is " << POTNom << "\n" << std::endl;
128 
129  // --- Load all of the histograms that I want.
130  std::vector<LoadedHistograms> RawHistograms;
131  for (size_t InFile=0; InFile<InputFiles.size(); ++InFile) {
132  std::cout << "\n Loading the histograms for file " << InputFiles[InFile] << ".\n" << std::endl;
133  RawHistograms.push_back( LoadFile_GetHists( InputFiles[InFile], POTNom ) );
134  }
135 
136  // --- And now I can make the plots!!!
137  ProducePlots( RawHistograms );
138  // --- Finally, return.
139  return;
140 } // DoThePlots
141 
142 //......................................................
144  // --- Declare the vector of LoadedHistograms which I am going to return...
145  LoadedHistograms MyHists;
146 
147  // --- Load the current file.
148  TFile *InFile = TFile::Open( InputFile.c_str() );
149  // --- Grab my spectra...
150  for ( int Qnt=0; Qnt<NumQuartile; ++Qnt ) {
151  for ( int TB=0; TB<NumTimeBins; ++TB ) {
152  std::string QntTB = "_Q"+std::to_string(Qnt+1)+"_TB"+std::to_string(TB+1);
153 
154  MyHists.MeanSliceTime[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_SliceMeanTime"+QntTB, ";Mean Time of Slice (ms);" );
155  MyHists.SliceDuration[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_SliceDuration"+QntTB, ";Slice Time Duration (ms);" );
156  MyHists.SliceRecoE [Qnt][TB] = GetSpectToHist( InFile, POT, "dir_RecoE" +QntTB, ";Reconstructed neutrino energy (GeV);");
157  MyHists.MuonRecoE [Qnt][TB] = GetSpectToHist( InFile, POT, "dir_MuonE" +QntTB, ";Reconstructed muon energy (GeV);" );
158  MyHists.HadroRecoE [Qnt][TB] = GetSpectToHist( InFile, POT, "dir_HadE" +QntTB, ";Hadronic energy in the Slice (GeV);" );
159  MyHists.SliceNHits [Qnt][TB] = GetSpectToHist( InFile, POT, "dir_NHit" +QntTB, ";Total Number of hits in Slice;" );
160  MyHists.HadroNHits [Qnt][TB] = GetSpectToHist( InFile, POT, "dir_NHadHit" +QntTB, ";Number of hadronic hit in Slice;" );
161 
162  MyHists.XMinPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Xmin"+QntTB, ";Minimum X Position (m);" );
163  MyHists.YMinPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Ymin"+QntTB, ";Minimum Y Position (m);" );
164  MyHists.ZMinPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Zmin"+QntTB, ";Minimum Z Position (m);" );
165  MyHists.XMaxPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Xmax"+QntTB, ";Maximum X Position (m);" );
166  MyHists.YMaxPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Ymax"+QntTB, ";Maximum Y Position (m);" );
167  MyHists.ZMaxPos[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_Zmax"+QntTB, ";Maximum Z Position (m);" );
168  MyHists.XPosRng[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_DX" +QntTB, ";Range of X Positions (m);" );
169  MyHists.YPosRng[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_DY" +QntTB, ";Range of Y Positions (m);" );
170  MyHists.ZPosRng[Qnt][TB] = GetSpectToHist( InFile, POT, "dir_DZ" +QntTB, ";Range of Z Positions (m);" );
171  }
172  }
173  return MyHists;
174 }
175 
176 //......................................................
177 TH1D* GetSpectToHist( TFile* MyF, double POT, std::string SpecName, std::string Axis ) {
178 
179  //std::cout << "Loading Spectrum from " << SpecName << std::endl;
180 
181  // --- Load the Spectrum, and convert to a TH1
182  std::unique_ptr<Spectrum> TempSpec = Spectrum::LoadFrom( MyF, SpecName.c_str() ) ;
183  TH1D* MyHist = TempSpec -> ToTH1( POTNom );
184 
185  // --- Make the initial pass of making my histogram pretty...
186  CenterTitles ( MyHist);
187  MyHist->SetMinimum( 0 );
188  MyHist->SetMaximum( MyHist->GetMaximum()*1.05 );
189  MyHist->SetTitle ( Axis.c_str() );
190 
191  // --- Rebin everything...
192  double ReFac = 0;
193  if ( (SpecName.find("dir_HadE" ) != std::string::npos) ||
194  (SpecName.find("dir_MuonE") != std::string::npos) ||
195  (SpecName.find("dir_RecoE") != std::string::npos) ||
196  (SpecName.find("min" ) != std::string::npos) ||
197  (SpecName.find("max" ) != std::string::npos) ||
198  (SpecName.find("dir_D" ) != std::string::npos)
199  ) {
200  ReFac = 10;
201  }
202  if ( (SpecName.find("Z" ) != std::string::npos) ) {
203  ReFac = 20;
204  }
205  if ( (SpecName.find("SliceNHits" ) != std::string::npos) ) {
206  ReFac = 5;
207  }
208  if ( ReFac!=0 )
209  MyHist -> Rebin( ReFac );
210 
211  // --- I want to area normalise everything...
212  MyHist -> Scale( 1/MyHist->Integral() );
213 
214  // -- Return my histogram.
215  return MyHist;
216 }
217 
218 //......................................................
219 TH1D* MakeRatio( TH1D* num, TH1D* denom, std::string RatName ) {
220  // Declare a new histogram.
221  TH1D* ratHist = new TH1D( TString(RatName)+TString("_ratio"),
222  TString(RatName)+TString("_ratio")+TString(";")+TString(num->GetXaxis()->GetTitle())+TString(";Ratio"),
223  num->GetNbinsX(),
224  num->GetXaxis()->GetXmin(),
225  num->GetXaxis()->GetXmax()
226  );
227  // Don't want any exponents?
228  ratHist->GetYaxis()->SetNoExponent();
229  ratHist->GetXaxis()->SetNoExponent();
230  // Divide the two input histograms...
231  ratHist->Divide( num , denom );
232  ratHist->SetMarkerStyle( 20 );
233  ratHist->SetMarkerSize ( 0 );
234  // Figure out what the range should be...
235  ratHist->GetYaxis()->SetRangeUser( 0, 2 );
236  // Return my shiny new ratio plot!
237  return ratHist;
238 }
239 
240 //......................................................
241 void SetRange( std::vector<TH1D*> hData, std::vector<TH1D*> hMont, std::vector<TH1D*> hRatio, // Pass the histograms
242  double XLow, double XHigh, double H_YLow, double H_YHigh, double R_YLow, double R_YHigh ){ // What Y values do I want?
243 
244  for (size_t hh=0; hh<hData.size(); ++hh) {
245  // --- First off, set the X ranges.
246  if ( (XLow != -1) && (XHigh != -1) ) {
247  // Hists
248  hData [hh] -> GetXaxis() -> SetRangeUser( XLow, XHigh );
249  hMont [hh] -> GetXaxis() -> SetRangeUser( XLow, XHigh );
250  hRatio[hh] -> GetXaxis() -> SetRangeUser( XLow, XHigh );
251  }
252 
253  // --- And, the Y axes, but check that they aren't -1!
254  // Hists
255  if ( (H_YLow != -1) && (H_YHigh != -1) ) {
256  hData[hh] -> GetYaxis() -> SetRangeUser( H_YLow, H_YHigh );
257  hMont[hh] -> GetYaxis() -> SetRangeUser( H_YLow, H_YHigh );
258  }
259  // Ratios.
260  if ( (R_YLow != -1) && (R_YHigh != -1) ) {
261  hRatio[hh] -> GetYaxis() -> SetRangeUser( R_YLow, R_YHigh );
262  }
263  }
264  // --- Return
265  return;
266 }
267 
268 //......................................................
269 void FindAxisRange( double &XLow, double &XHigh, double &H_YLow, double &H_YHigh, double &R_YLow, double &R_YHigh, double MaxVal, bool &SetLogy, std::string Name ) {
270  XLow = -1;
271  XHigh = -1;
272  H_YLow = 0;
273  H_YHigh = MaxVal;
274  R_YLow = 0.5;
275  R_YHigh = 1.5;
276  SetLogy = false;
277 
278  if ( (Name.find("HadroNHits" ) != std::string::npos) ) { XLow = 0; XHigh = 150; }
279  if ( (Name.find("SliceDuration") != std::string::npos) ) { XLow = 0; XHigh = 250; }
280  if ( (Name.find("SliceHadroE" ) != std::string::npos) ) { XLow = 0; XHigh = 3.0; }
281  if ( (Name.find("SliceNHits" ) != std::string::npos) ) { XLow =50; XHigh = 300; }
282  if ( (Name.find("XPosRng" ) != std::string::npos) ) { XLow = 0; XHigh = 5 ; }
283  if ( (Name.find("YPosRng" ) != std::string::npos) ) { XLow = 0; XHigh = 5 ; }
284 
285  return;
286 }
287 //......................................................
288 void PlotHistProp( TH1D* Hist, TLegend* L ) {
289  double Mean_Nom = Hist->GetMean();
290  double Mean_Err = Hist->GetMeanError();
291  double RMS_Nom = Hist->GetRMS();
292  double Int_Nom = Hist->Integral();
293  L -> AddEntry( Hist, Form("Mean: %.3f #pm %.3f", Mean_Nom, Mean_Err), "" );
294  //L -> AddEntry( Hist, Form("RMS: %.3f" , RMS_Nom ), "" );
295  //L -> AddEntry( Hist, Form("Int: %.3f" , Int_Nom ), "" );
296  return;
297 }
298 //......................................................
300  // Does this canvas have a ratio on it?
301  std::string WRat = ", with data/mc ratio";
302  if (Name.find("_hist") != std::string::npos) WRat = ".";
303  // Remove the underscores from my cut tier
304  while (Cut.find("_") != std::string::npos)
305  Cut.replace(Cut.find("_"),1," "); //CTier = "Cosmic_Rej";
306  // Determine my caption
307  std::string Cap = "Plot showing the distribution of " + PTitle + " for Cut level and Quartile:" + Cut + WRat;
308  if (MySys == "DataMC" && PTitle.find("neutrino energy") == std::string::npos) {
309  Cap += " The simulated entries are simply taken from MC CAF files, as such they are not individually extrapolated / weighted from RecoE.";
310  }
311  std::cout << "\nFile: " << Name << "\n\t Has caption: " << Cap << ".\n" << std::endl;
312  // Make the output text file
313  std::ofstream TxtOut ( Name.c_str(), std::ofstream::out );
314  TxtOut << Cap;
315  TxtOut.close();
316  // return
317  return;
318 }
319 //......................................................
321  TLatex* CornLab = new TLatex(.1, .93, Str.c_str());
322  CornLab->SetTextColor(kGray+1);
323  CornLab->SetNDC();
324  CornLab->SetTextSize (2/30.);
325  CornLab->SetTextAlign(11);
326  CornLab->Draw();
327 }
328 //......................................................
329 void MakeSplitCans( std::string PlotNa, std::string QntTxt, TFile* OutF,
330  std::vector<TH1D*> DataHists, std::vector<TH1D*> MontHists, std::vector<std::string> Legends
331  ) {
332 
333  std::cout << "Don't want to make Split Cans, returning." << std::endl;
334  return;
335 
336  std::cout << "At the start of MakeSplitCans, " << PlotNa << ", " << QntTxt << ", DataHists.size() is " << DataHists.size()
337  << ", MontHists.size() is " << MontHists.size() << ", and Legends.size() is " << Legends.size()
338  << std::endl;
339 
340  // -- Make the ratio plots.
341  std::vector<TH1D*> Ratios;
342  for (size_t hh=0; hh<DataHists.size(); ++hh) {
343  Ratios.push_back( MakeRatio( DataHists[hh], MontHists[hh], (PlotNa+QntTxt+Legends[hh]) ) );
344  }
345 
346  // --- Set the Colours of my histograms, and center titles.
347  double MaxHVal = 0;
348  for (size_t hh=0; hh<DataHists.size(); ++hh) {
349  // Center titles.
350  CenterTitles( DataHists[hh] );
351  CenterTitles( MontHists[hh] );
352  CenterTitles( Ratios [hh] );
353  // Set the colour.
354  if (DataHists.size()==2 && hh==0) { // If only two plots, and looking at TB1
355  DataHists[hh] -> SetLineColor( 1 ); DataHists[hh] -> SetMarkerColor( 1 );
356  MontHists[hh] -> SetLineColor( 1 ); Ratios [hh] -> SetLineColor ( 1 );
357  } else if (DataHists.size()==2 && hh==1) { // If only two plots, and looking at TB6
358  DataHists[hh] -> SetLineColor( 2 ); DataHists[hh] -> SetMarkerColor( 2 );
359  MontHists[hh] -> SetLineColor( 2 ); Ratios [hh] -> SetLineColor ( 2 );
360  } else { // If plotting all time bins --> All the colours!
361  DataHists[hh] -> SetLineColor( hh ); DataHists[hh] -> SetMarkerColor( hh );
362  MontHists[hh] -> SetLineColor( hh ); Ratios [hh] -> SetLineColor( hh );
363  }
364  MontHists[hh] -> SetLineStyle( 2 );
365  // Figure out the maximum value.
366  if (DataHists[hh]->GetMaximum() > MaxHVal) MaxHVal = DataHists[hh]->GetMaximum();
367  if (MontHists[hh]->GetMaximum() > MaxHVal) MaxHVal = MontHists[hh]->GetMaximum();
368  }
369 
370  // --- What axis ranges do I want to use? Find the ranges, and then set them.
371  double XL, XH, H_YL, H_YH, R_YL, R_YH;
372  bool SetLogy = false;
373  FindAxisRange( XL, XH, H_YL, H_YH, R_YL, R_YH, 1.1*MaxHVal, SetLogy, PlotNa );
374  SetRange ( DataHists, MontHists, Ratios, XL, XH, H_YL, H_YH, R_YL, R_YH );
375 
376  //......................................................//......................................................
377  // ------------------------------ Get ready to make the canvas without ratios. ------------------------------
378  //......................................................//......................................................
379  std::string HCanNa = PlotNa+"_"+QntTxt+"_"+sFHC+"_hist";
380  TCanvas* HCan = new TCanvas( HCanNa.c_str(), HCanNa.c_str() );
381  // Where do I want my legend...
382  double HistLeg_X1 = 0.55, HistLeg_Y1 = 0.2, HistLeg_X2 = 0.85, HistLeg_Y2 = 0.88;
383  // If not plotting mean vals, then want smaller legend.
384  if (!PlotMean) {
385  HistLeg_Y1 = 0.55;
386  }
387  // Do I want the legend on the left instead?
388  if ( (PlotNa.find("MaxPos") != std::string::npos) // 0 to 300
389  ) {
390  HistLeg_X1 = 0.10;
391  HistLeg_X2 = 0.56;
392  }
393  // Make the legend where I've decided...
394  TLegend *HistLeg = new TLegend( HistLeg_X1, HistLeg_Y1, HistLeg_X2, HistLeg_Y2 );
395  HistLeg -> SetFillStyle (0);
396  HistLeg -> SetBorderSize(0);
397  HistLeg -> SetTextSize( 0.8*DataHists[0]->GetXaxis()->GetTitleSize() );
398 
399  // --- Now plot stuff!
400  for (size_t hh=0; hh<DataHists.size(); ++hh) {
401  // First data
402  if (hh==0) DataHists[hh] -> Draw("lep");
403  else DataHists[hh] -> Draw("lep same");
404  HistLeg -> AddEntry( DataHists[hh], TString("Data ")+TString(Legends[hh].c_str()), "lep" );
405  if (PlotMean) PlotHistProp( DataHists[hh], HistLeg );
406  // Then MC
407  MontHists[hh] -> Draw("hist same");
408  HistLeg -> AddEntry( MontHists[hh], TString("MC ") +TString(Legends[hh].c_str()), "l" );
409  if (PlotMean) PlotHistProp( MontHists[hh], HistLeg );
410  }
411  HistLeg -> AddEntry( DataHists[0], QntTxt.c_str(), "" );
412  DataHists[0] -> Draw( "axis same" );
413  // Do I want the canvas to be loagarithmic?
414  if ( SetLogy ) HCan -> SetLogy();
415  // Finally, draw the legend and whether it is FHC or RHC etc!
416  HistLeg -> Draw();
417  Preliminary();
418  if (IsFHC) CornerLabel( "Neutrino beam" );
419  else CornerLabel( "Antineutrino beam" );
420 
421  //......................................................//......................................................
422  // ------------------------------ Get ready to make the canvas with ratios. ------------------------------
423  //......................................................//......................................................
424  /*
425  std::string RatCanNa = FType + CTier + DirNa;
426  TCanvas* RatCan = new TCanvas( RatCanNa.c_str(), CanTi.c_str() );
427  // Sort out the canvas.
428  RatCan -> SetBottomMargin( 0. );
429  double Spl = 0.4;
430  TPad* P1 = new TPad( "Temp_1", "", 0.0, Spl, 1.0, 1.0, 0 );
431  TPad* P2 = new TPad( "Temp_2", "", 0.0, 0.0, 1.0, Spl, 0 );
432  P2 -> SetRightMargin (.03);
433  P2 -> SetTopMargin (.00);
434  P2 -> SetBottomMargin(.22);
435  P2 -> SetLeftMargin (.08);
436  P2 -> Draw();
437  P1 -> SetRightMargin (.03);
438  P1 -> SetLeftMargin (.08);
439  P1 -> SetTopMargin (.10);
440  P1 -> SetBottomMargin(.03);
441  P1 -> Draw();
442  // Set some label sizes.
443  double Lb1 = 0.07;
444  double Lb2 = 0.10;
445  // --- First, draw the ratios so cd onto Pad2
446  P2 -> cd();
447  // Set axis ranges etc.
448  Rat[0] -> GetYaxis() -> SetTitleSize( Lb2 );
449  Rat[0] -> GetYaxis() -> SetTitleOffset(0.4);
450  Rat[0] -> GetYaxis() -> SetLabelSize( Lb2 );
451  Rat[0] -> GetXaxis() -> SetTitleSize( Lb2 );
452  Rat[0] -> GetXaxis() -> SetLabelSize( Lb2 );
453  Rat[0] -> Draw();
454  // Add a reference line
455  //TLine *line = new TLine( Nom->GetXaxis()->GetXmin(), 1, Nom->GetXaxis()->GetXmax(), 1 );
456  double x[2] = { Nom->GetXaxis()->GetXmin(), Nom->GetXaxis()->GetXmax() };
457  double y[2] = { 1, 1 };
458  TGraph *line = new TGraph( 2, x, y );
459  line->SetLineColor(kGray);
460  line->SetLineWidth( 3 );
461  line->SetLineStyle( 2 );
462  line->Draw("l same");
463  // Redraw Rat[0]
464  Rat[0] -> Draw("axis same");
465  if (MySys != "DataMC") {
466  for (unsigned int sh=1; sh<NumSysts; ++sh) {
467  Rat[sh] -> Draw("same");
468  }
469  }
470  // --- And cd into Pad1
471  P1 -> cd();
472  // Where do I want my legend...
473  double Leg_X1 = 0.62, Leg_Y1 = 0.05, Leg_X2 = 0.94, Leg_Y2 = 0.85;
474  // If not plotting mean vals, then want smaller legend.
475  if (!PlotMean) Leg_Y1 = 0.4;
476  // Do I want the legend on the left instead?
477  if ( (DirNa.find("RatKalHitSlc") != std::string::npos) ||
478  (DirNa.find("RemIDScore") != std::string::npos) ||
479  (DirNa.find("_cCVNNuMuID") != std::string::npos) ||
480  (DirNa.find("_cNuMuContPID")!= std::string::npos)
481  ) {
482  Leg_X1 = 0.1;
483  Leg_X2 = 0.32;
484  }
485 
486  // --- Special Legend positions for DataMC.
487  // For Start/EndPos plots want to split the legend.
488 
489  // Make the legend where I've decided...
490  TLegend *Leg = new TLegend( Leg_X1, Leg_Y1, Leg_X2, Leg_Y2 );
491  Leg -> SetFillStyle (0);
492  Leg -> SetBorderSize(0);
493  Leg -> SetTextSize( 1.25*HistLeg -> GetTextSize() );
494  // --- Draw nominal first!
495  Nom -> GetYaxis() -> SetTitleSize( Lb1 );
496  Nom -> GetYaxis() -> SetLabelSize( Lb1 );
497  Nom -> GetYaxis() -> SetTitleOffset( 0.5 );
498  // Remove the x axis labels
499  Nom -> GetXaxis() -> SetLabelSize (0 );
500  Nom -> GetXaxis() -> SetLabelOffset(99);
501  Nom -> DrawCopy("hist");
502  // --- If DataMC want my Data as first thing on the legendto the legend
503  if (MySys == "DataMC" ) Leg -> AddEntry( grData, LegNames[1].c_str(), "lep" );
504  // --- Add nominal to legend
505  Leg -> AddEntry( Nom, LegNames[0].c_str(), "l" );
506  if (PlotMean) PlotHistProp( Nom, Leg );
507  // --- Now draw the shifts!
508  for (unsigned int sh=0; sh<NumSysts; ++sh) {
509  if (MySys == "DataMC" ) {
510  if ( sh != 0 ) {
511  Shi[sh] -> DrawCopy("hist same");
512  Leg -> AddEntry( Shi[sh], LegNames[sh+1].c_str(), "f" );
513  }
514  } else {
515  Shi[sh] -> DrawCopy("hist same");
516  Leg -> AddEntry( Shi[sh], LegNames[sh+1].c_str(), "l" );
517  }
518  if (PlotMean) PlotHistProp( Shi[sh], Leg );
519  }
520  // Want to draw data last
521  if (MySys == "DataMC") {
522  grData -> Draw("ep same");
523  }
524  Nom -> Draw( "axis same" );
525  // Do I want Pad 1 to be loagarithmic?
526  if ( SetLogy ) P1 -> SetLogy();
527  // And, draw the legend!
528  Leg -> Draw();
529  Preliminary();
530  if (IsFHC) CornerLabel( "Neutrino beam" );
531  else CornerLabel( "Antineutrino beam" );
532  */
533 
534  //......................................................//......................................................
535  // ------------------------------ Now lets all both of those canvases. ------------------------------
536  //......................................................//......................................................
537  std::string PDir = "Plots/";
538  std::string HornDir = PDir + sFHC +"/";
539  std::string CansDir = HornDir + PlotNa +"/";
540  gSystem -> MakeDirectory( HornDir.c_str() );
541  gSystem -> MakeDirectory( CansDir.c_str() );
542  // Now I can save my things...
543  std::vector<std::string> Exten = { ".png", ".pdf", ".txt" };
544  if (SaveHists) {
545  for (size_t ex=0; ex<Exten.size(); ++ex) {
546  // Determine the name of my file.
547  std::string HCanSaveLoc = CansDir + HCan->GetName() + Exten[ex];
548  // Do something special if I have a .txt file
549  if ( Exten[ex] == ".txt" ) {
550  //MakeTextFile( Nom->GetXaxis()->GetTitle(), HCanSaveLoc );
551  } else {
552  HCan -> SaveAs( HCanSaveLoc.c_str() );
553  }
554  // And write the canvases to file too.
555  OutF -> cd();
556  HCan -> Write( HCan->GetName() );
557  }
558  }
559  /*
560  if (SaveRatio) {
561  for (size_t ex=0; ex<Exten.size(); ++ex) {
562  // Determine the name of my file.
563  std::string RatCanSaveLoc = CansDir + RatCan->GetName() + Exten[ex];
564  // Do something special if I have a .txt file
565  if ( Exten[ex] == ".txt" ) {
566  MakeTextFile( CTier, Nom->GetXaxis()->GetTitle(), RatCanSaveLoc );
567  } else {
568  // Save the canvases if not.
569  RatCan -> SaveAs( RatCanSaveLoc .c_str() );
570  }
571  // And write the canvases to file too.
572  OutF -> cd();
573  RatCan -> Write( RatCan ->GetName() );
574  }
575  */
576  // --- Return.
577  return;
578 }
579 
580 //.....................................................
581 void ProducePlots( std::vector<LoadedHistograms> HistVec ) {
582 
583  // --- I want to make a directory to hold my plots.
584  std::string PDir = "Plots/";
585  gSystem -> MakeDirectory( PDir.c_str() );
586  // --- I want to make a file to contain all of my plots.
587  std::string OName = PDir+"Quantile_TimeBins_"+sFHC+"_Plots.root";
588  TFile* OutFile = TFile::Open( OName.c_str(), "RECREATE" );
589  std::cout << "I want to make a file called " << OName << std::endl;
590 
591  // --- I need to loop through all of my histograms and construct the vectors that I want to use to plot things...
592  for ( int Qnt=0; Qnt<NumQuartile; ++ Qnt ) {
593  std::string QuartTxt = "Quartile_"+std::to_string(Qnt+1);
594 
595  std::vector<TH1D* > MyDataHists;
596  std::vector<TH1D* > MyMontHists;
597  std::vector<std::string> MyLegends;
598 
599  // --- Mean Slice Time
600  for ( int TB=0; TB<NumTimeBins; ++TB ) {
601  // If plotting extreme bins, only want to fill if TB == 1 or 6
602  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
603  // Fill the vectors...
604  MyDataHists.push_back( HistVec[0].MeanSliceTime[ Qnt ][ TB ] );
605  MyMontHists.push_back( HistVec[1].MeanSliceTime[ Qnt ][ TB ] );
606  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
607  }
608  MakeSplitCans( "MeanSliceTime", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
609 
610  // --- Do I only want to test things out plotting wise?
611  if (PlotTest) return;
612 
613  // --- Slice Duration
614  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
615  for ( int TB=0; TB<NumTimeBins; ++TB ) {
616  // If plotting extreme bins, only want to fill if TB == 1 or 6
617  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
618  // Fill the vectors...
619  MyDataHists.push_back( HistVec[0].SliceDuration[ Qnt ][ TB ] );
620  MyMontHists.push_back( HistVec[1].SliceDuration[ Qnt ][ TB ] );
621  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
622  }
623  MakeSplitCans( "SliceDuration", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
624 
625  // --- Slice Reconstructed Energy
626  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
627  for ( int TB=0; TB<NumTimeBins; ++TB ) {
628  // If plotting extreme bins, only want to fill if TB == 1 or 6
629  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
630  // Fill the vectors...
631  MyDataHists.push_back( HistVec[0].SliceRecoE[ Qnt ][ TB ] );
632  MyMontHists.push_back( HistVec[1].SliceRecoE[ Qnt ][ TB ] );
633  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
634  }
635  MakeSplitCans( "SliceRecoE", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
636 
637  // --- Muon Reconstructed Energy
638  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
639  for ( int TB=0; TB<NumTimeBins; ++TB ) {
640  // If plotting extreme bins, only want to fill if TB == 1 or 6
641  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
642  // Fill the vectors...
643  MyDataHists.push_back( HistVec[0].MuonRecoE[ Qnt ][ TB ] );
644  MyMontHists.push_back( HistVec[1].MuonRecoE[ Qnt ][ TB ] );
645  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
646  }
647  MakeSplitCans( "SliceMuonE", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
648 
649  // ++++ Want to make my profiles histograms...
650  std::string CanTi = "AverageMuonEnergy_"+std::to_string(Qnt);
651  TCanvas* MuonEnMean = new TCanvas( CanTi.c_str(), CanTi.c_str() );
652  TH1D* DataEnergy = new TH1D( "AverageDataEnergy", "Average Energy; TimeBin; Average Energy", 6, 0.5, 6.5 );
653  TH1D* MontEnergy = new TH1D( "AverageMontEnergy", "Average Energy; TimeBin; Average Energy", 6, 0.5, 6.5 );
654  double HistMax = 0, HistMin = 5, HistAv;
655  MontEnergy->SetLineColor(2);
656  for ( int TB=0; TB<NumTimeBins; ++TB ) {
657  DataEnergy -> SetBinContent( TB+1, HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMean() );
658  DataEnergy -> SetBinError ( TB+1, HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMeanError() );
659  MontEnergy -> SetBinContent( TB+1, HistVec[1].MuonRecoE[ Qnt ][ TB ]->GetMean() );
660  MontEnergy -> SetBinError ( TB+1, HistVec[1].MuonRecoE[ Qnt ][ TB ]->GetMeanError() );
661  if (HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMean() > HistMax) HistMax = HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMean();
662  if (HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMean() < HistMin) HistMin = HistVec[0].MuonRecoE[ Qnt ][ TB ]->GetMean();
663  }
664  HistAv = (HistMin+HistMax)/2;
665  DataEnergy->GetYaxis()->SetRangeUser( HistAv-0.02, HistAv+0.02 );
666  DataEnergy->Draw();
667  MontEnergy->Draw("same");
668 
669  // --- Hadronic Reconstructed Energy
670  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
671  for ( int TB=0; TB<NumTimeBins; ++TB ) {
672  // If plotting extreme bins, only want to fill if TB == 1 or 6
673  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
674  // Fill the vectors...
675  MyDataHists.push_back( HistVec[0].HadroRecoE[ Qnt ][ TB ] );
676  MyMontHists.push_back( HistVec[1].HadroRecoE[ Qnt ][ TB ] );
677  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
678  }
679  MakeSplitCans( "SliceHadroE", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
680 
681  // --- Number of hits in the slice
682  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
683  for ( int TB=0; TB<NumTimeBins; ++TB ) {
684  // If plotting extreme bins, only want to fill if TB == 1 or 6
685  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
686  // Fill the vectors...
687  MyDataHists.push_back( HistVec[0].SliceNHits[ Qnt ][ TB ] );
688  MyMontHists.push_back( HistVec[1].SliceNHits[ Qnt ][ TB ] );
689  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
690  }
691  MakeSplitCans( "SliceNHits", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
692 
693  // --- Number of hadronic hits in the slice
694  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
695  for ( int TB=0; TB<NumTimeBins; ++TB ) {
696  // If plotting extreme bins, only want to fill if TB == 1 or 6
697  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
698  // Fill the vectors...
699  MyDataHists.push_back( HistVec[0].HadroNHits[ Qnt ][ TB ] );
700  MyMontHists.push_back( HistVec[1].HadroNHits[ Qnt ][ TB ] );
701  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
702  }
703  MakeSplitCans( "HadroNHits", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
704 
705  // --- Minimum X Position
706  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
707  for ( int TB=0; TB<NumTimeBins; ++TB ) {
708  // If plotting extreme bins, only want to fill if TB == 1 or 6
709  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
710  // Fill the vectors...
711  MyDataHists.push_back( HistVec[0].XMinPos[ Qnt ][ TB ] );
712  MyMontHists.push_back( HistVec[1].XMinPos[ Qnt ][ TB ] );
713  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
714  }
715  MakeSplitCans( "XMinPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
716 
717  // --- Maximum X Position
718  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
719  for ( int TB=0; TB<NumTimeBins; ++TB ) {
720  // If plotting extreme bins, only want to fill if TB == 1 or 6
721  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
722  // Fill the vectors...
723  MyDataHists.push_back( HistVec[0].XMaxPos[ Qnt ][ TB ] );
724  MyMontHists.push_back( HistVec[1].XMaxPos[ Qnt ][ TB ] );
725  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
726  }
727  MakeSplitCans( "XMaxPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
728 
729  // --- Range of X Positions
730  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
731  for ( int TB=0; TB<NumTimeBins; ++TB ) {
732  // If plotting extreme bins, only want to fill if TB == 1 or 6
733  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
734  // Fill the vectors...
735  MyDataHists.push_back( HistVec[0].XPosRng[ Qnt ][ TB ] );
736  MyMontHists.push_back( HistVec[1].XPosRng[ Qnt ][ TB ] );
737  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
738  }
739  MakeSplitCans( "XPosRng", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
740 
741  // --- Minimum Y Position
742  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
743  for ( int TB=0; TB<NumTimeBins; ++TB ) {
744  // If plotting extreme bins, only want to fill if TB == 1 or 6
745  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
746  // Fill the vectors...
747  MyDataHists.push_back( HistVec[0].YMinPos[ Qnt ][ TB ] );
748  MyMontHists.push_back( HistVec[1].YMinPos[ Qnt ][ TB ] );
749  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
750  }
751  MakeSplitCans( "YMinPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
752 
753  // --- Maximum Y Position
754  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
755  for ( int TB=0; TB<NumTimeBins; ++TB ) {
756  // If plotting extreme bins, only want to fill if TB == 1 or 6
757  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
758  // Fill the vectors...
759  MyDataHists.push_back( HistVec[0].YMaxPos[ Qnt ][ TB ] );
760  MyMontHists.push_back( HistVec[1].YMaxPos[ Qnt ][ TB ] );
761  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
762  }
763  MakeSplitCans( "YMaxPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
764 
765  // --- Range of Y Positions
766  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
767  for ( int TB=0; TB<NumTimeBins; ++TB ) {
768  // If plotting extreme bins, only want to fill if TB == 1 or 6
769  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
770  // Fill the vectors...
771  MyDataHists.push_back( HistVec[0].YPosRng[ Qnt ][ TB ] );
772  MyMontHists.push_back( HistVec[1].YPosRng[ Qnt ][ TB ] );
773  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
774  }
775  MakeSplitCans( "YPosRng", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
776 
777  // --- Minimum Z Position
778  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
779  for ( int TB=0; TB<NumTimeBins; ++TB ) {
780  // If plotting extreme bins, only want to fill if TB == 1 or 6
781  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
782  // Fill the vectors...
783  MyDataHists.push_back( HistVec[0].ZMinPos[ Qnt ][ TB ] );
784  MyMontHists.push_back( HistVec[1].ZMinPos[ Qnt ][ TB ] );
785  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
786  }
787  MakeSplitCans( "ZMinPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
788 
789  // --- Maximum Z Position
790  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
791  for ( int TB=0; TB<NumTimeBins; ++TB ) {
792  // If plotting extreme bins, only want to fill if TB == 1 or 6
793  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
794  // Fill the vectors...
795  MyDataHists.push_back( HistVec[0].ZMaxPos[ Qnt ][ TB ] );
796  MyMontHists.push_back( HistVec[1].ZMaxPos[ Qnt ][ TB ] );
797  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
798  }
799  MakeSplitCans( "ZMaxPos", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
800 
801  // --- Range of Z Positions
802  MyDataHists.clear(); MyMontHists.clear(); MyLegends.clear();
803  for ( int TB=0; TB<NumTimeBins; ++TB ) {
804  // If plotting extreme bins, only want to fill if TB == 1 or 6
805  if ( ExtremeBins && !(TB+1==1 || TB+1==6) ) continue;
806  // Fill the vectors...
807  MyDataHists.push_back( HistVec[0].ZPosRng[ Qnt ][ TB ] );
808  MyMontHists.push_back( HistVec[1].ZPosRng[ Qnt ][ TB ] );
809  MyLegends .push_back( "Time Bin "+std::to_string(TB+1) );
810  }
811  MakeSplitCans( "ZPosRng", QuartTxt, OutFile, MyDataHists, MyMontHists, MyLegends );
812 
813  }
814  return;
815 }
816 
817 //......................................................
818 
TH1D * GetSpectToHist(TFile *MyF, double POT, std::string SpecName, std::string Axis)
TH1D * YPosRng[NumQuartile][NumTimeBins]
const bool SaveHists
TH1D * MeanSliceTime[NumQuartile][NumTimeBins]
tree Draw("slc.nhit")
const bool SaveRatio
const bool ExtremeBins
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
TH1D * ZMaxPos[NumQuartile][NumTimeBins]
void ProducePlots(std::vector< LoadedHistograms > HistVec)
correl_xv GetYaxis() -> SetDecimals()
TH1D * SliceDuration[NumQuartile][NumTimeBins]
const int NumQuartile
TH1D * ZMinPos[NumQuartile][NumTimeBins]
hmean SetLineStyle(2)
prelim SetTextSize(2/30.)
Definition: Hist.h:29
TH1D * ZPosRng[NumQuartile][NumTimeBins]
TH1D * XMaxPos[NumQuartile][NumTimeBins]
TH2 * Rebin(TH2 *hist, std::vector< double > edges)
TH1D * MuonRecoE[NumQuartile][NumTimeBins]
void CornerLabel(std::string Str)
void CenterTitles(TH1 *histo)
Definition: Plots.cxx:1481
TH1D * YMaxPos[NumQuartile][NumTimeBins]
ntuple SetFillStyle(1001)
const int NumTimeBins
TH1D * YMinPos[NumQuartile][NumTimeBins]
TH1D * SliceRecoE[NumQuartile][NumTimeBins]
const bool SingleQuant
TH1D * SliceNHits[NumQuartile][NumTimeBins]
const double kAna2018RHCPOT
Definition: Exposures.h:208
std::string sFHC
TH1D * XMinPos[NumQuartile][NumTimeBins]
const bool PlotTest
legend SetBorderSize(0)
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
static constexpr double L
const bool PlotMean
correl_xv GetXaxis() -> SetDecimals()
leg AddEntry(GRdata,"data","p")
hmean SetLineColor(4)
h1 SetMarkerColor(4)
TH1D * HadroRecoE[NumQuartile][NumTimeBins]
TH1D * XPosRng[NumQuartile][NumTimeBins]
void MakeTextFile(std::string Cut, std::string PTitle, std::string Name)
void Preliminary()
OStream cout
Definition: OStream.cxx:6
std::vector< double > POT
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]))
void MakeSplitCans(std::string PlotNa, std::string QntTxt, TFile *OutF, std::vector< TH1D * > DataHists, std::vector< TH1D * > MontHists, std::vector< std::string > Legends)
void ProduceCompPlots(bool Horn)
void FindAxisRange(double &XLow, double &XHigh, double &H_YLow, double &H_YHigh, double &R_YLow, double &R_YHigh, double MaxVal, bool &SetLogy, std::string Name)
int num
Definition: f2_nu.C:119
TH1D * MakeRatio(TH1D *num, TH1D *denom, std::string RatName)
void PlotHistProp(TH1D *Hist, TLegend *L)
TFile * OutFile
const double kAna2018FHCPOT
Definition: Exposures.h:207
void SetRange(std::vector< TH1D * > hData, std::vector< TH1D * > hMont, std::vector< TH1D * > hRatio, double XLow, double XHigh, double H_YLow, double H_YHigh, double R_YLow, double R_YHigh)
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
LoadedHistograms LoadFile_GetHists(std::string InputFile, double POT)
cosmicTree SaveAs("cosmicTree.root")
simulatedPeak Scale(1/simulationNormalisationFactor)
c cd(1)
hh[ixs]
Definition: PlotSingle.C:6
double POTNom
gPad SetLogy()
bool IsFHC
gm Write()
TH1D * HadroNHits[NumQuartile][NumTimeBins]
std::string MySys
enum BeamMode string