PlotVisibleEnergy.C
Go to the documentation of this file.
1 #pragma once
2 
4 #include "CAFAna/Core/Loaders.h"
5 #include "CAFAna/Core/Spectrum.h"
9 #include "CAFAna/Core/Cut.h"
10 #include "CAFAna/Core/Binning.h"
11 
13 
14 #include "TFile.h"
15 #include "TH1.h"
16 
17 using namespace ana;
18 
20 
21  TFile* f1 = new TFile(("hist_"+samdef+".root").c_str(), "recreate");
22 
23  // Set the spectrum loaders
24  SpectrumLoader thisLoader(samdef.c_str());
25 
26  const Binning xbins = Binning::Simple(50, 0, 5);
27 
28  Spectrum spect ("kHADE_2020",
29  xbins,
30  thisLoader,
32  ana::kNoCut);
33 
34  thisLoader.Go();
35 
36  f1->cd();
37  double pot = spect.POT();
38  TH1* h = (TH1*)spect.ToTH1(pot);
39  h->Write();
40 
41 }
Represent the binning of a Spectrum's x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:176
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
const int xbins
Definition: MakePlots.C:82
void PlotVisibleEnergy(std::string samdef="")
#define pot
Float_t f1
double POT() const
Definition: Spectrum.h:226
const Var kHADE_2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;const double CVNha_CalE=sr->slc.calE;return std::max(CVNha_CalE-kEME_2020(sr), 0.);})
Definition: NueEnergy2020.h:15
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNoCut
Definition: Cut.h:13
enum BeamMode string