getFlatWeightSpectra.C
Go to the documentation of this file.
1 // I found that the energy estimator used by the nuebar oscillation analysis
2 // was not sufficient for this analysis due to training on a sample of
3 // neutrinos with energy less than 4.5 GeV.
4 //
5 // This script marks the first piece of training a new estimator.
6 // Following docdb-26696, we need to normalize the true energy distribution
7 // to avoid biasing the energy estimation toward our peak beam energy.
8 //
9 // Grab true energy distributions
10 // dddoyle@colostate.edu
11 
13 #include "CAFAna/Core/Spectrum.h"
14 #include "CAFAna/Core/Var.h"
15 #include "CAFAna/Cuts/SpillCuts.h"
16 #include "CAFAna/Cuts/TruthCuts.h"
17 #include "3FlavorAna/Cuts/NueCutsSecondAna.h"
20 #include "CAFAna/Vars/XsecTunes.h"
22 
26 
27 using namespace ana;
28 
29 // selection used in the nuebar CC inclusive analysis
31 std::string training_data = NominalMC_energy_training_RHC_prod4;
32 
33 const Binning trueE_bins = Binning::Simple(50, 0, 10);
34 
35 
37 {
38  Cut cuts = kcPresel && kIsTrueSig; // ktIsNuebarCCST && kTrueFiducialST
40 
41  Spectrum* trueE = new Spectrum("True #nu Energy [GeV]",
42  trueE_bins,
43  *loader,
44  kTrueE,
45  cuts,
46  kNoShift,
47  weights);
48 
49  loader->Go();
50 
51 
52  TFile* out_file = new TFile("flat_weight_energy_spectra.root", "recreate");
53  trueE->SaveTo(out_file, "trueE");
54 
55 }
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
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const Cut kcPresel
Definition: NueCCIncCuts.h:139
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
virtual void Go()=0
Load all the registered spectra.
out_file
Append EOF lines.
Definition: modifyFHiCL.py:113
const Var kTrueE([](const caf::SRProxy *sr){return(sr->mc.nnu==0)?0.:float(sr->mc.nu[0].E);})
Definition: Vars.cxx:85
Var weights
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:517
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:573
const SystShifts kNoShift
Definition: SystShifts.cxx:21
Base class for the various types of spectrum loader.
const Cut kIsTrueSig
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kXSecCVWgt2018
Definition: XsecTunes.h:49
void getFlatWeightSpectra()
std::string training_data
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:114
const Binning trueE_bins