MakeCutFlow.C
Go to the documentation of this file.
1 //......................................................
4 
5 #include "CAFAna/Core/Loaders.h"
6 #include "CAFAna/Core/Spectrum.h"
9 
10 #include "Utilities/rootlogon.C"
11 
12 #include "TCanvas.h"
13 #include "TColor.h"
14 #include "TFile.h"
15 #include "TGraph.h"
16 #include "TGraphAsymmErrors.h"
17 #include "TH1.h"
18 #include "TH2.h"
19 #include "TLatex.h"
20 #include "TLegend.h"
21 #include "TStyle.h"
22 #include "TSystem.h"
23 
24 #include <fstream>
25 #include <iostream>
26 #include <string>
27 
28 //......................................................
29 using namespace ana;
30 
31 //......................................................
32 TH1D* GetHistVectors ( TFile* InF, std::string InDir, double Norm, bool Cosm=false );
33 //......................................................
34 void WriteOutEntries( std::vector<TH1D*> Hists, std::vector<double> &Entries );
35 //......................................................
36 void SetBin( TH1D* hist, size_t ind, double Val );
37 //......................................................
38 void SetHistProp( TH1D* hist, int Colour, double Width, double Offset );
39 //......................................................
40 void MakeCanvasForData( std::vector<double> Beam, std::vector<double> NuMuCC, std::vector<double> NotNuMuCC, std::vector<double> Cosm );
41 //......................................................
42 void MakeCanvasForSim ( std::vector<double> NuMuCC, std::vector<double> NotNuMuCC, std::vector<double> Cosm );
43 //......................................................
44 void MakeNuEnergyPlots ( std::vector<TH1D*> Data, std::vector<TH1D*> AllMont, std::vector<TH1D*> NotNuMuCC, std::vector<TH1D*> Cosm, bool WithData );
45 //......................................................
46 void MakeTextFile( std::string OutName, bool BarChart );
47 //......................................................
48 // --- Define the names of my cuts.
49 std::vector<std::string> CutNames;
50 size_t NCuts = 0;
51 
52 // --- Define some new colours
53 TColor *Colour1 = new TColor(229, 0.37 , 0.05 , 0.67 ,"");
54 TColor *Colour2 = new TColor(230, 0 , 0.725, 0.659,"");
55 TColor *Colour3 = new TColor(231, 0.925, 0 , 0.549,"");
56 TColor *Colour4 = new TColor(232, 0.627, 0 , 0.373,"");
57 TColor *Colour5 = new TColor(233, 0 , 0.631, 0.569,"");
58 
59 double POTNorm = 0;
60 double LivNorm = 0;
61 
62 //......................................................
63 void MakeCutFlow() {
64  // Where are my input files?
65  std::string InBase = "/nova/ana/users/karlwarb/NuMu_BoxOpening2017/CutFlowFiles/";
66  std::string MontNa = "CutFlow_MC.root";
67  std::string DataNa = "CutFlow_Data.root";
68 
69  std::string MontLoc = InBase + MontNa;
70  std::string DataLoc = InBase + DataNa;
71 
72  std::cerr << "Loading;"
73  << "\n\t Monte Carlo - " << MontLoc
74  << "\n\t Data Files - " << DataLoc
75  << std::endl;
76 
77  TFile *MontFile = TFile::Open( MontLoc.c_str() );
78  TFile *DataFile = TFile::Open( DataLoc.c_str() );
79 
80  // --- Do my cuts.
81  CutNames.emplace_back("NoCut");
82  CutNames.emplace_back("Quality");
83  CutNames.emplace_back("Containment");
84  CutNames.emplace_back("Particle_ID");
85  CutNames.emplace_back("Cosmic_Rej");
86 
87  NCuts = CutNames.size();
88 
89  // --- Define my histograms.
90  // Data
91  std::vector<TH1D*> hBeam;
92  std::vector<TH1D*> hCosm;
93  // Mont
94  std::vector<TH1D*> hAllMont;
95  std::vector<TH1D*> hNuMuCC;
96  std::vector<TH1D*> hAllNue;
97  std::vector<TH1D*> hNuEToMu;
98  std::vector<TH1D*> hAllNC;
99  std::vector<TH1D*> hAllTau;
100 
101  // --- Need to specify my POT and LiveTime
102  // Beam POT
103  std::unique_ptr<Spectrum> TempSpec_Beam = Spectrum::LoadFrom( DataFile, TString(CutNames[2])+TString("_BeamNus") ) ;
104  POTNorm = TempSpec_Beam -> POT();
105  // Cosm Livetime
106  std::unique_ptr<Spectrum> TempSpec_Cosm = Spectrum::LoadFrom( DataFile, TString(CutNames[2])+TString("_Cosmics") ) ;
107  LivNorm = TempSpec_Cosm->Livetime();
108  // What numbers did I get?
109  std::cerr << "\n My POT is " << POTNorm << ". My cosmic livetime is " << LivNorm << "\n" << std::endl;
110 
111  // --- Loop through my vector of cut names, and load the histograms.
112  for (size_t cc=0; cc<NCuts; ++cc) {
113  // --- Data strings.
115 
116  // --- Load the Monte Carlo
117  hAllMont.push_back( GetHistVectors( MontFile, CutNames[cc]+"_FullMC" , POTNorm, false ) );
118  hNuMuCC .push_back( GetHistVectors( MontFile, CutNames[cc]+"_NuMuCC" , POTNorm, false ) );
119  hAllNue .push_back( GetHistVectors( MontFile, CutNames[cc]+"_AllNue" , POTNorm, false ) );
120  hNuEToMu.push_back( GetHistVectors( MontFile, CutNames[cc]+"_NuEToMu", POTNorm, false ) );
121  hAllNC .push_back( GetHistVectors( MontFile, CutNames[cc]+"_AllNC" , POTNorm, false ) );
122  hAllTau .push_back( GetHistVectors( MontFile, CutNames[cc]+"_AllTau" , POTNorm, false ) );
123  // --- Load the Data
124  hBeam.push_back( GetHistVectors( DataFile, LoadData+"_BeamNus", POTNorm, false ) );
125  hCosm.push_back( GetHistVectors( DataFile, LoadData+"_Cosmics", LivNorm, true ) );
126  }
127 
128  // --- How many events in each sample?
129  // Data
130  std::vector<double> nBeam;
131  std::vector<double> nCosm;
132  // Mont
133  std::vector<double> nAllMont;
134  std::vector<double> nNuMuCC;
135  std::vector<double> nAllNue;
136  std::vector<double> nNuEToMu;
137  std::vector<double> nAllNC;
138  std::vector<double> nAllTau;
139 
140  // Data
141  std::cout << "\nNow for Beam Data" << std::endl; WriteOutEntries( hBeam, nBeam );
142  std::cout << "\nNow for Cosmics" << std::endl; WriteOutEntries( hCosm, nCosm );
143  // Mont
144  std::cout << "\nNow for All MC" << std::endl; WriteOutEntries( hAllMont, nAllMont );
145  std::cout << "\nNow for NuMU CC" << std::endl; WriteOutEntries( hNuMuCC , nNuMuCC );
146  std::cout << "\nNow for All NuE" << std::endl; WriteOutEntries( hAllNue , nAllNue );
147  std::cout << "\nNow for NuE to NuMu"<< std::endl; WriteOutEntries( hNuEToMu, nNuEToMu );
148  std::cout << "\nNow for All NC" << std::endl; WriteOutEntries( hAllNC , nAllNC );
149  std::cout << "\nNow for All NuTau" << std::endl; WriteOutEntries( hAllTau , nAllTau );
150 
151  // --- Make a histogram which is the sum of everything but NuMuCC.
152  std::cout << "\nNow for everything that is not NuMuCC" << std::endl;
153  std::vector<TH1D*> hNotNuMuCC;
154  std::vector<double> nNotNuMuCC;
155  for (size_t cc=0; cc<NCuts; ++cc) {
156  TH1D* TempHist = (TH1D*)hAllNue[cc]->Clone();
157  TempHist -> Add( hNuEToMu[cc] );
158  TempHist -> Add( hAllNC [cc] );
159  TempHist -> Add( hAllTau [cc] );
160 
161  double TempSum = nAllNue[cc] + nNuEToMu[cc] + nAllNC[cc] + nAllTau[cc];
162 
163  hNotNuMuCC.push_back( TempHist );
164  nNotNuMuCC.push_back( TempSum );
165 
166  std::cout << "\tCut: " << CutNames[cc] << " - " << nNotNuMuCC[cc] << std::endl;
167  }
168  // --- Now lets start drawing things!!!
169  std::cerr << "\n\nNow lets start plotting things..." << std::endl;
170 
171  std::string OutName = "Plots/CutFlowPlots_NuMu_Ana2017.root";
172  TFile *OutFile = new TFile(OutName.c_str(), "RECREATE");
173  OutFile -> cd();
174 
175  // --- Make a canvas for FD Data, TotalPred, BeamBkg, Cosmics
176  MakeCanvasForData( nBeam, nNuMuCC, nNotNuMuCC, nCosm );
177 
178  // --- Make a canvas for event rate without data
179  MakeCanvasForSim ( nNuMuCC, nNotNuMuCC, nCosm );
180 
181  // --- Make canvases for Neutrino Energy Plots with Data
182  MakeNuEnergyPlots( hBeam, hAllMont, hNotNuMuCC, hCosm, true );
183 
184  // --- Make canvases for Neutrino Energy Plots without Data
185  MakeNuEnergyPlots( hBeam, hAllMont, hNotNuMuCC, hCosm, false );
186 
187  return;
188 }
189 
190 //......................................................
191 TH1D* GetHistVectors( TFile* InF, std::string InDir, double Norm, bool Cosm ) {
192  std::unique_ptr<Spectrum> Temp = Spectrum::LoadFrom( InF, InDir);
193  if ( Cosm ) return Temp -> ToTH1( Norm, kLivetime );
194  else return Temp -> ToTH1( Norm );
195 }
196 //......................................................
197 void WriteOutEntries( std::vector<TH1D*> Hists, std::vector<double> &Entries ) {
198  for (size_t cc=0; cc<NCuts; ++cc) {
199  std::cout << "\tCut: " << CutNames[cc] << " - " << Hists[cc]->Integral() << std::endl;
200  Entries.push_back( Hists[cc]->Integral() );
201  }
202  return;
203 }
204 //......................................................
205 void SetBin( TH1D* hist, size_t ind, double Val ) {
206  hist -> SetBinContent( ind, Val );
207  std::string BinText = CutNames[ NCuts-ind ];
208  while (BinText.find("_") != std::string::npos) BinText.replace(BinText.find("_"),1," ");
209  hist -> GetXaxis() -> SetBinLabel( ind, BinText.c_str() );
210  return;
211 }
212 //......................................................
213 void SetHistProp( TH1D* hist, int Colour, double Width, double Offset ) {
214  hist -> SetFillColor( Colour );
215  hist -> SetBarWidth ( Width );
216  hist -> SetBarOffset( Offset );
217  hist -> SetStats(0);
218  for (int bi=0; bi<hist->GetNbinsY(); ++bi) hist->SetBinContent( bi, 0 );
219  return;
220 }
221 //..................................
222 void MakeTextFile( std::string OutName, bool BarChart ) {
223  // Determine output name, and caption.
224  std::string FNa = "Plots/"+OutName+".txt";
225  while (OutName.find("_") != std::string::npos) OutName.replace(OutName.find("_"),1," ");
226  std::string Cap = "Plot showing the number of events passing cuts for " + OutName;
227  if (BarChart) {
228  std::string DaCap = "for expected data rates, taken from MC and Cosmic sidebands.";
229  if (OutName.find("Data") != std::string::npos) DaCap = "with NuMi data shown, along with estimates from MC and Cosmic sidebands.";
230  Cap = "A bar chart showing the number of events changes as subsequent cuts are applied, " + DaCap;
231  }
232  std::cout << "\nFile name: " << FNa << "\n\tCaption: " << Cap << std::endl;
233  // Write to file.
234  std::ofstream TxtOut ( FNa.c_str(), std::ofstream::out );
235  TxtOut << Cap;
236  TxtOut.close();
237  // Done.
238  return;
239 }
240 //......................................................
241 void MakeCanvasForData( std::vector<double> Beam, std::vector<double> NuMuCC, std::vector<double> NotNuMuCC, std::vector<double> Cosm ) {
242  // --- Declare a canvas.
243  TCanvas *DataCan = new TCanvas( "DataCan", "Cut Efficiency Canvas for Data vs MC" );
244  DataCan -> SetLogx();
245  DataCan -> SetGridx();
246  DataCan -> SetLeftMargin(0.15);
247  DataCan -> SetRightMargin(0.05);
248 
249  double HistWidth = 0.2;
250 
251  // First Total Predicted flux.
252  TH1D *hTot = new TH1D( "TotalFlux", "", NCuts, 0, NCuts );
253  SetHistProp( hTot, 229, HistWidth, 0.7 );
254  for(size_t i=1; i<=NCuts; i++) {
255  double TotBin = NuMuCC[ NCuts-i ] + NotNuMuCC[ NCuts-i ] + Cosm[ NCuts-i ];
256  SetBin( hTot, i, TotBin );
257  }
258  // Draw.
259  hTot -> Draw("hbar0");
260 
261  // Now Beam background
262  TH1D *hBea = new TH1D("BeamBack","",NCuts, 0, NCuts);
263  SetHistProp( hBea, 230, HistWidth, 0.5 );
264  for(size_t i=1; i<=NCuts; i++) {
265  SetBin( hBea, i, NotNuMuCC[ NCuts-i ]);
266  }
267  hBea -> Draw("hbar0 same");
268 
269  // Now Cosmic background
270  TH1D *hCos = new TH1D("CosmBack","",NCuts, 0, NCuts);
271  SetHistProp( hCos, 231, HistWidth, 0.3 );
272  for(size_t i=1; i<=NCuts; i++) {
273  SetBin( hCos, i, Cosm[ NCuts-i ]);
274  }
275  hCos -> Draw("hbar0 same");
276 
277  // Last Data
278  TH1D *hDat = new TH1D("BeamData","",NCuts, 0, NCuts);
279  SetHistProp( hDat, 232, HistWidth, 0.1 );
280  for(size_t i=1; i<=NCuts; i++) {
281  SetBin( hDat, i, Beam[ NCuts-i ]);
282  }
283  hDat -> Draw("hbar0 same");
284 
285  // Add a legend to the plot.
286  TLegend *l = new TLegend(0.5,0.15,0.9,0.35);
287  l->AddEntry(hTot,"Predicted Num. Events","f");
288  l->AddEntry(hBea,"Beam Background" ,"f");
289  l->AddEntry(hCos,"Cosmic Background" ,"f");
290  l->AddEntry(hDat,"Recorded data" ,"f");
291  l->Draw();
292 
293  // Draw Preliminary()
294  Preliminary();
295 
296  // Set axis range etc.
297  hTot -> GetXaxis() -> SetLabelSize( 0.055 );
298  hTot -> GetYaxis() -> SetTitle("Events");
299  hTot -> GetYaxis() -> CenterTitle();
300  hTot -> GetYaxis() -> SetRangeUser( 1, 1e7 );
301  // And redraw axis
302  hTot -> Draw("axis same");
303 
304  // Finally, save the canvas.
305  DataCan -> SaveAs( "Plots/DataCutFlow_NuMu.pdf" );
306  DataCan -> SaveAs( "Plots/DataCutFlow_NuMu.png" );
307  DataCan -> Write ( "DataCutFlow_NuMu" );
308  MakeTextFile ( "DataCutFlow_NuMu", true );
309 
310  return;
311 }
312 //......................................................
313 void MakeCanvasForSim ( std::vector<double> NuMuCC, std::vector<double> NotNuMuCC, std::vector<double> Cosm ) {
314  // --- Declare a canvas.
315  TCanvas *SimCan = new TCanvas( "SimCan", "Cut Efficiency Canvas for MC" );
316  SimCan -> SetLogx();
317  SimCan -> SetGridx();
318  SimCan -> SetLeftMargin(0.15);
319  SimCan -> SetRightMargin(0.05);
320 
321  double HistWidth = 0.25;
322 
323  // NuMC CC.
324  TH1D *hNuMu = new TH1D( "NuMu", "", NCuts, 0, NCuts );
325  SetHistProp( hNuMu, 229, HistWidth, 0.625 );
326  for(size_t i=1; i<=NCuts; i++) {
327  SetBin( hNuMu, i, NuMuCC[ NCuts-i ]);
328  }
329  // Draw.
330  hNuMu -> Draw("hbar0");
331 
332  // Now Beam background
333  TH1D *hBeam = new TH1D("BeamBkg","",NCuts, 0, NCuts);
334  SetHistProp( hBeam, 230, HistWidth, 0.375 );
335  for(size_t i=1; i<=NCuts; i++) {
336  SetBin( hBeam, i, NotNuMuCC[ NCuts-i ]);
337  }
338  hBeam -> Draw("hbar0 same");
339 
340  // Now Cosmic background
341  TH1D *hCosm = new TH1D("Cosmics","",NCuts, 0, NCuts);
342  SetHistProp( hCosm, 231, HistWidth, 0.125 );
343  for(size_t i=1; i<=NCuts; i++) {
344  SetBin( hCosm, i, Cosm[ NCuts-i ]);
345  }
346  hCosm -> Draw("hbar0 same");
347 
348  // Add a legend to the plot.
349  TLegend *l = new TLegend(0.6,0.15,0.9,0.35);
350  l->AddEntry(hNuMu,"#nu_{#mu} Signal" ,"f");
351  l->AddEntry(hBeam,"Beam Background" ,"f");
352  l->AddEntry(hCosm,"Cosmic Background","f");
353  l->Draw();
354 
355  // Draw Preliminary()
356  Preliminary();
357 
358  // Set axis range etc.
359  hNuMu -> GetXaxis() -> SetLabelSize( 0.055 );
360  hNuMu -> GetYaxis() -> SetTitle("Events");
361  hNuMu -> GetYaxis() -> CenterTitle();
362  hNuMu -> GetYaxis() -> SetRangeUser( 1, 1e7 );
363  // And redraw axis
364  hNuMu -> Draw("axis same");
365 
366  // Finally, save the canvas.
367  SimCan -> SaveAs( "Plots/SimCutFlow_NuMu.pdf" );
368  SimCan -> SaveAs( "Plots/SimCutFlow_NuMu.png" );
369  SimCan -> Write ( "SimCutFlow_NuMu" );
370  MakeTextFile ( "SimCutFlow_NuMu", true );
371  return;
372 }
373 //......................................................
374 void MakeNuEnergyPlots( std::vector<TH1D*> Data, std::vector<TH1D*> AllMont, std::vector<TH1D*> NotNuMuCC, std::vector<TH1D*> Cosm, bool WithData ) {
375  std::string sWData = "_WithData";
376  if (!WithData) sWData = "_WithoutData";
377  // --- Want a plot for each cut level.
378  for(size_t cc=0; cc<NCuts; cc++) {
379  // Determine the name and write it out.
380  std::string CanName = CutNames[cc] + "_NuEnergy" + sWData;
381  std::cout << "\nNow looking at Cut Tier: " << CutNames[cc] << " ==> Can Name is " << CanName << std::endl;
382  // Make my Total background plot
383  TH1D* TotBkg = (TH1D*)NotNuMuCC[cc] -> Clone();
384  TotBkg -> Add( Cosm[cc] );
385  // Make my Total predicted plot.
386  TH1D* TotPred = (TH1D*)AllMont [cc] -> Clone();
387  TotPred -> Add( Cosm[cc] );
388 
389  // --- Scale my hists in X.
390  TH1D* ScPred = (TH1D*)TotPred ->Clone(); ScPred->Scale(0.1,"width");
391  TH1D* ScBeam = (TH1D*)NotNuMuCC[cc]->Clone(); ScBeam->Scale(0.1,"width");
392  TH1D* ScBkg = (TH1D*)TotBkg ->Clone(); ScBkg ->Scale(0.1,"width");
393  TH1D* ScCosm = (TH1D*)Cosm[cc] ->Clone(); ScCosm->Scale(0.1,"width");
394  TH1D* ScData = (TH1D*)Data[cc] ->Clone(); ScData->Scale(0.1,"width");
395 
396  // --- Set my line colours and styles.
397  // Total Predicted
398  ScPred -> SetLineColor (kViolet-1);
399  // Total background
400  ScBkg -> SetLineColor (kGray+1);
401  ScBkg -> SetFillColor (kGray+1);
402  // Cosmic background
403  ScCosm -> SetLineColor (kAzure+1);
404  ScCosm -> SetFillColor (kAzure+1);
405  // Beam background
406  ScBeam -> SetLineColor (kAzure+1);
407  ScBeam -> SetFillColor (kAzure+1);
408 
409  // Set axis labels
410  ScPred -> GetXaxis() -> SetTitle("Reconstructed Neutrino Energy (GeV)");
411  ScPred -> GetXaxis() -> SetLabelSize( ScPred->GetXaxis()->GetTitleSize() );
412  ScPred -> GetXaxis() -> CenterTitle();
413  ScPred -> GetYaxis() -> SetTitle("Events / 0.1 GeV");
414  ScPred -> GetYaxis() -> SetLabelSize( ScPred->GetYaxis()->GetTitleSize() );
415  ScPred -> GetYaxis() -> CenterTitle();
416 
417  // --- Find Maximum value.
418  double MaxVal = std::max( ScPred->GetMaximum(), std::max( ScBkg->GetMaximum(), ScCosm->GetMaximum() ) );
419  if (WithData) MaxVal = std::max( MaxVal , ScData->GetMaximum() );
420 
421  // --- Scale my hists in Y.
422  if ( CanName.find("NoCut" ) != std::string::npos ||
423  CanName.find("Quality") != std::string::npos
424  ) {
425  ScPred->Scale(0.001);
426  ScBkg ->Scale(0.001);
427  ScCosm->Scale(0.001);
428  ScBeam->Scale(0.001);
429  ScData->Scale(0.001);
430  ScPred -> GetYaxis() -> SetTitle("10^{3} Events / 0.1 GeV");
431  MaxVal = MaxVal / 1000;
432  }
433  ScPred -> SetMaximum( MaxVal * 1.2 );
434  if ( WithData && (cc==3 || cc==4) )
435  ScPred -> SetMaximum( MaxVal * 1.4 );
436 
437  // --- Make Data plot a GraphWithPoissonErrors
438  TGraphAsymmErrors* grData = GraphWithPoissonErrors(ScData, false, false);
439  TGraphAsymmErrors* grCosm = GraphWithPoissonErrors(ScCosm, false, false);
440  // Cosmics
441  grCosm -> SetMarkerStyle(kFullCircle);
442  grCosm -> SetLineColor (1);
443  grCosm -> SetFillColor (1);
444  grCosm -> SetLineWidth (2);
445  if (WithData) grCosm -> SetMarkerColor(kAzure+1);
446 
447  for (int bin=0; bin < grCosm->GetN(); ++bin) {
448  double myscale = (kLivetime/LivNorm);
449  grCosm->SetPointEYlow (bin, myscale * grCosm->GetErrorYlow (bin));
450  grCosm->SetPointEYhigh(bin, myscale * grCosm->GetErrorYhigh(bin));
451  }
452 
453  // Data
454  grData -> SetMarkerStyle(kFullCircle);
455  grData -> SetLineWidth (2);
456 
457 
458  TCanvas* NuEnCan = new TCanvas( CanName.c_str(), CanName.c_str() );
459  ScPred -> Draw("hist");
460  if (!WithData) {
461  ScBeam -> Draw("hist same");
462  grCosm -> Draw("ep same" );
463  } else {
464  ScBkg -> Draw("hist same");
465  ScCosm -> Draw("hist same");
466  grData -> Draw("ep same" );
467  }
468 
469  // Add a legend to the plot.
470  TLegend *l = new TLegend(0.58,0.68,0.88,0.88);
471  if (WithData)
472  l->AddEntry(grData,"FD Data","lep");
473  l->AddEntry(ScPred,"Total Predicted" ,"l");
474  if (WithData) {
475  l->AddEntry(ScBkg ,"Total Background","f");
476  l->AddEntry(ScCosm,"Cosmic Background","f");
477  } else {
478  l->AddEntry(grCosm,"Cosmic Background","lep");
479  l->AddEntry(ScBeam,"Beam Background" ,"f");
480  }
481 
482  l->SetFillStyle(0);
483  l->Draw();
484 
485  // Draw Preliminary()
486  Preliminary();
487  // And redraw axis
488  ScPred -> Draw("axis same");
489 
490  // Finally, save the canvas.
491  NuEnCan -> SaveAs( TString("Plots/")+TString(CanName)+TString(".pdf") );
492  NuEnCan -> SaveAs( TString("Plots/")+TString(CanName)+TString(".png") );
493  NuEnCan -> Write ( CanName.c_str() );
494  MakeTextFile ( CanName, false );
495  }
496  return;
497 }
498 //......................................................
T max(const caf::Proxy< T > &a, T b)
tree Draw("slc.nhit")
void SetBin(TH1D *hist, size_t ind, double Val)
Definition: MakeCutFlow.C:205
size_t NCuts
Definition: MakeCutFlow.C:50
bin1_2sigma SetFillColor(3)
c1 SetGridx()
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
h7 SetMaximum(maxY)
correl_xv GetYaxis() -> SetDecimals()
double Integral(const Spectrum &s, const double pot, int cvnregion)
TColor * Colour4
Definition: MakeCutFlow.C:56
def BarChart(node, total, depth=0, startpos=0)
OStream cerr
Definition: OStream.cxx:7
double TotBkg(std::vector< double > integrals)
double Width(Resonance_t res)
resonance width (GeV)
TGraphAsymmErrors * GraphWithPoissonErrors(const TH1 *h, bool noErrorsXaxis, bool drawEmptyBins)
Calculate statistical errors appropriate for small Poisson numbers.
Definition: Plots.cxx:910
fVtxDx SetMarkerStyle(20)
gargamelle SetTitle("Gargamelle #nu_{e} CC data")
double POTNorm
Definition: MakeCutFlow.C:59
void MakeTextFile(std::string OutName, bool BarChart)
Definition: MakeCutFlow.C:222
double LivNorm
Definition: MakeCutFlow.C:60
void MakeNuEnergyPlots(std::vector< TH1D * > Data, std::vector< TH1D * > AllMont, std::vector< TH1D * > NotNuMuCC, std::vector< TH1D * > Cosm, bool WithData)
Definition: MakeCutFlow.C:374
TColor * Colour2
Definition: MakeCutFlow.C:54
TColor * Colour1
Definition: MakeCutFlow.C:53
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:535
correl_xv GetXaxis() -> SetDecimals()
Spectrum LoadData(bool nd, bool rhc=false)
Function to load NuS data file.
hmean SetLineWidth(2)
hmean SetLineColor(4)
h1 SetMarkerColor(4)
void SetHistProp(TH1D *hist, int Colour, double Width, double Offset)
Definition: MakeCutFlow.C:213
TColor * Colour3
Definition: MakeCutFlow.C:55
c1 SetLogx()
float bin[41]
Definition: plottest35.C:14
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 cc()
Definition: test_ana.C:28
enum BeamMode kViolet
void WriteOutEntries(std::vector< TH1D * > Hists, std::vector< double > &Entries)
Definition: MakeCutFlow.C:197
void MakeCanvasForSim(std::vector< double > NuMuCC, std::vector< double > NotNuMuCC, std::vector< double > Cosm)
Definition: MakeCutFlow.C:313
void MakeCutFlow()
Definition: MakeCutFlow.C:63
TFile * OutFile
correl_xv SetStats(0)
void Beam(bool isRHC)
cosmicTree SaveAs("cosmicTree.root")
void MakeCanvasForData(std::vector< double > Beam, std::vector< double > NuMuCC, std::vector< double > NotNuMuCC, std::vector< double > Cosm)
Definition: MakeCutFlow.C:241
c cd(1)
TH1D * GetHistVectors(TFile *InF, std::string InDir, double Norm, bool Cosm=false)
Definition: MakeCutFlow.C:191
gm Write()
std::vector< std::string > CutNames
Definition: MakeCutFlow.C:49
enum BeamMode string
TColor * Colour5
Definition: MakeCutFlow.C:57