12 #include "CAFAna/Core/Binning.h" 18 #include "CAFAna/Cuts/NumuCuts.h" 23 #include "CAFAna/Vars/NumuVars.h" 35 #include "TProfile2D.h" 48 TLatex*
prelim =
new TLatex(.9, .95,
"NO#nuA Preliminary");
49 prelim->SetTextColor(
kBlue);
51 prelim->SetTextSize(2/30.);
52 prelim->SetTextAlign(32);
109 std::cout <<
"\nrun : ---- Running CAF NuMU ND Validation.\n";
118 TH1D* spillHist =
new TH1D(
"reco-spills",
";Detector;Spills", 3, 0, 3);
127 std::vector<Selection> selections_base;
129 if(isFD) selections_base.emplace_back(
kNumuFD,
"numuFD",
130 "Selected events pass the numu FD selection");
131 else selections_base.emplace_back(
kNumuND,
"numuND",
132 "Selected events pass the numu ND selection");
144 const Var kRecoMuE({
"energy.mutrkE.E",
"sel.remid.bestidx",
"energy.mutrkE"},
149 if(
sr->
energy.mutrkE.size() == 0)
return 0.
f;
155 std::vector<TangibleAxis> variables;
157 "CC energy estimator (GeV) ");
164 std::vector<UsefulHist>
hists;
165 hists.reserve(selections_base.size() * variables.size());
167 for(
const auto& sel_base:selections_base){
168 for(
const auto& variable:variables){
169 hists.emplace_back(sel_base, tanTrkStartX, tanTrkStartY, variable, loader);
174 std::cout <<
"\nrun : --- run loader.\n";
177 double pot = hists[0].fHist.POT();
179 std::cout <<
"\nrun : --- save output.\n";
180 TFile outputfile(kOutputFileName.c_str(),
"RECREATE");
182 for(
const auto&
hist:hists){
185 TProfile2D* tempProj = (TProfile2D*)temp -> Project3DProfile(
"yx");
187 tempProj->Write(tempName.c_str());
192 TH1F *pothist =
new TH1F(
"meta-TotalPOT",
"TotalPOT", 1, 0, 1);
193 TH1F *evthist =
new TH1F(
"meta-TotalEvents",
"TotalEvents", 1, 0, 1);
194 pothist->SetBinContent(1, pot);
195 evthist->SetBinContent(1, spillHist->GetEntries());
196 pothist->Write(
"meta-TotalPOT");
197 evthist->Write(
"meta-TotalEvents");
199 std::cout <<
"\nrun : --- close output files.\n";
_HistAxis< Var > HistAxis
Represent the binning of a Spectrum's x-axis.
Cuts and Vars for the 2020 FD DiF Study.
const Var kTrkStartY([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.Y()/100;})
Tangible< Cut > Selection
void caf_numu_nuenergy_vs_xy(std::string kInputFileName, std::string kOutputFileName, bool isFD)
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
void Preliminary()
Put NOvA Preliminary on plots.
const HistAxis kNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNumuEnergyBinning, kCCE)
virtual void AddSpillHistogram(TH1 *h, const SpillVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted)
Uses include counting the total POT or spills in a run.
Tangible(const T &obj, const std::string &shortName, const std::string &blurb)
UsefulHist(Selection selA, TangibleAxis tanXAxis, TangibleAxis tanYAxis, TangibleAxis tanZAxis, SpectrumLoader &loader, const Cut &cutMEC=!kIsDytmanMEC, const Cut &bkg=kNoCut)
SRRemid remid
Output from RecoMuonID (ReMId) package.
Tangible< HistAxis > TangibleAxis
const Binning kEnergyBinning
virtual void Go() override
Load all the registered spectra.
const Var kTrkStartX([](const caf::SRProxy *sr){if(sr->trk.kalman.ntracks< 1) return-10.0f;return sr->trk.kalman.tracks[0].start.X()/100;})
The StandardRecord is the primary top-level object in the Common Analysis File trees.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
SRIDBranch sel
Selector (PID) branch.
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
Template for Var and SpillVar.
SREnergyBranch energy
Energy estimator branch.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.