12 #include "CAFAna/Extrap/ExtrapSterile.h" 103 if(nhit <= 0.) {
return 0.; }
112 std::map<std::string, HistAxis*>
axes;
119 axes[
"CosBDT"] =
new HistAxis(labelNCP, kFatPIDBins, kNCP);
120 axes[
"PTP"] =
new HistAxis(labelPTP, kFatPIDBins, kPartPTP);
124 std::map<std::string, IDecomp*> ncdecomps;
125 std::map<std::string, IDecomp*> numudecomps;
126 std::map<std::string, ModularExtrapSterile*> extrap123bs;
127 std::map<std::string, ModularExtrapSterile*> extrap3c3ds;
128 std::map<std::string, PredictionSterile*> predst123bs;
129 std::map<std::string, PredictionSterile*> predst3c3ds;
130 std::map<std::string, PredictionCombinePeriods*> preds;
131 std::map<std::string, Spectrum*>
cosmics;
132 std::map<std::string, Spectrum*> dataspecs;
134 for(
const auto&
ax : axes) {
138 loaderNDMC, loaderNDdata,
144 loaderNDMC, loaderNDdata,
151 loaderNDMC, loaderFDMC_swp, loaderFDMC_non, loaderFDMC_tau,
152 *ncdecomps[axlabel], *numudecomps[axlabel],
161 loaderNDMC, loaderFDMC_swp_3c, loaderFDMC_non_3c, loaderFDMC_tau_3c,
162 *ncdecomps[axlabel], *numudecomps[axlabel],
172 cosmics[axlabel] =
new Spectrum(loaderFDdata, *
ax.second,
185 loaderFDMC_non_3c.
Go();
186 loaderFDMC_swp_3c.
Go();
187 loaderFDMC_tau_3c.
Go();
194 for(
const auto&
ax : axes) {
204 TFile* rootF =
new TFile(outfile.c_str(),
"RECREATE");
207 TDirectory*
tmp = gDirectory;
208 TDirectory* saveDir = gDirectory;
212 for(
const auto&
ax : axes) {
215 dir =
"ncdecomp" + sep + axlabel;
216 saveDir = rootF->mkdir(dir.c_str());
217 ncdecomps[axlabel]->SaveTo(saveDir);
219 dir =
"numudecomp" + sep + axlabel;
220 saveDir = rootF->mkdir(dir.c_str());
221 numudecomps[axlabel]->SaveTo(saveDir);
223 dir =
"extrap123b" + sep + axlabel;
224 saveDir = rootF->mkdir(dir.c_str());
225 extrap123bs[axlabel]->SaveTo(saveDir);
227 dir =
"extrap3c3d" + sep + axlabel;
228 saveDir = rootF->mkdir(dir.c_str());
229 extrap3c3ds[axlabel]->SaveTo(saveDir);
231 dir =
"predst123b" + sep + axlabel;
232 saveDir = rootF->mkdir(dir.c_str());
233 predst123bs[axlabel]->SaveTo(saveDir);
235 dir =
"predst3c3d" + sep + axlabel;
236 saveDir = rootF->mkdir(dir.c_str());
237 predst3c3ds[axlabel]->SaveTo(saveDir);
239 dir =
"pred" + sep + axlabel;
240 saveDir = rootF->mkdir(dir.c_str());
241 preds[axlabel]->SaveTo(saveDir);
243 dir =
"cosmic" + sep + axlabel;
244 saveDir = rootF->mkdir(dir.c_str());
245 cosmics[axlabel]->SaveTo(saveDir);
247 dir =
"dataspec" + sep + axlabel;
248 saveDir = rootF->mkdir(dir.c_str());
249 dataspecs[axlabel]->SaveTo(saveDir);
_HistAxis< Var > HistAxis
Represent the binning of a Spectrum's x-axis.
Cuts and Vars for the 2020 FD DiF Study.
caf::Proxy< float > stoptop
const double kSecondAnaPeriod2POT
const Var kDistTop([](const caf::SRProxy *sr){return std::min(sr->sel.nuecosrej.starttop, sr->sel.nuecosrej.stoptop);})
Proxy for caf::StandardRecord.
const double kSecondAnaEpoch3dPOT
std::vector< double > Spectrum
const double kSecondAnaEpoch3bPOT
const std::vector< std::string > fFDMC_non
void SetSpillCut(const SpillCut &cut)
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
const double kSecondAnaPeriod1POT
const Var kEPerHit([](const caf::SRProxy *sr){if(sr->slc.nhit >0) return 1000.0 *(sr->slc.calE/sr->slc.nhit);else return-5.;})
caf::Proxy< float > starttop
const Cut kInTimingSideband([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return(kInTimingSideband_before(sr)|| kInTimingSideband_after(sr));else return(kInTimingSideband_before(sr)|| kInTimingSideband_afterA(sr)|| kInTimingSideband_afterB(sr));}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_after.Livetime(spill));else return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_afterA.Livetime(spill)+ kInTimingSideband_afterB.Livetime(spill));}, [](const caf::SRSpillProxy *spill){return 0;})
caf::Proxy< caf::SRElastic > elastic
caf::Proxy< caf::SRNueCosRej > nuecosrej
const std::string fnamenear_concat
caf::Proxy< unsigned int > nhit
const std::string fnameneardata_concat
const std::vector< std::string > fFDMC_swp
const std::string fFDMC_non_3c
void AnaResultsLoad(std::string outfile)
caf::Proxy< float > partptp
virtual void Go() override
Load all the registered spectra.
const HistAxis kNCAxis("Calorimetric Energy (GeV)", kNCDisappearanceEnergyBinning, kCaloE)
Axes used in Ana01 analysis by nus group.
#define SIMPLEVAR(CAFNAME)
For Vars where literally all you need is a single CAF variable.
const SystShifts kNoShift
const std::string fFDMC_tau_3c
const HistAxis kNCBinsNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNCDisappearanceEnergyBinning, kCCE)
caf::Proxy< bool > IsValid
caf::Proxy< caf::SRSlice > slc
Splits Data proportionally according to MC.
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const std::vector< std::string > fFDMC_tau
caf::Proxy< caf::SRVector3D > vtx
const std::string fFDMC_swp_3c
const Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
A prediction object compatible with sterile oscillations.
const double kSecondAnaEpoch3cPOT
const SpillCut kStandardSpillCuts
Apply this unless you're doing something special.
Sum MC predictions from different periods scaled according to data POT targets.
caf::Proxy< caf::SRIDBranch > sel
T min(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRVertexBranch > vtx
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
const std::vector< std::string > fnamefardata_unblind(MakeUnblindList())