12 #include <unordered_map> 126 std::vector<const ISyst*> veto = {});
129 Coeffs(
double _a,
double _b,
double _c,
double _d)
130 :
a(_a),
b(_b),
c(_c),
d(_d) {}
135 std::vector<std::vector<Coeffs>>
136 FitRatios(
const std::vector<double>& shifts,
137 const std::vector<Eigen::ArrayXd>& ratios)
const;
140 std::vector<std::vector<Coeffs>>
142 const std::vector<IPrediction*>& preds,
178 double Stride()
const {
return shifts.size() > 1 ? shifts[1]-shifts[0] : 1;}
187 std::vector<std::vector<std::vector<Coeffs>>>
fits;
189 std::vector<std::vector<std::vector<Coeffs>>>
fitsNubar;
195 std::vector<std::vector<std::vector<Coeffs>>>
fitsRemap;
199 mutable std::unordered_map<const ISyst*, ShiftedPreds>
fPreds;
200 mutable std::unordered_map<const ISyst*, ShiftedPreds>
fSumPreds;
214 return (std::make_tuple(flav, curr, sign) <
230 std::vector<std::vector<std::vector<Coeffs>>>&
fits,
234 template <
typename T>
244 template <
typename T>
252 template <
typename T>
void ShiftBins(unsigned int N, T *arr, CoeffsType type, bool nubar, const SystShifts &shift) const
Helper for ShiftSpectrum.
Implements systematic errors by interpolation between shifted templates.
Cuts and Vars for the 2020 FD DiF Study.
std::string systName
What systematic we're interpolating.
ThreadLocal< std::map< Key_t, Val_t > > fNomCache
std::vector< std::vector< std::vector< Coeffs > > > fitsNubarRemap
Simple record of shifts applied to systematic parameters.
Collection of SpectrumLoaders for many configurations.
General interface to oscillation calculators.
Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &shift) const override
std::vector< std::vector< std::vector< Coeffs > > > fitsNubar
Will be filled if signs are separated, otherwise not.
void SetOscSeed(osc::IOscCalc *oscSeed)
void DebugPlotsColz(osc::IOscCalc *calc, const std::string &savePattern="", Flavors::Flavors_t flav=Flavors::kAll, Current::Current_t curr=Current::kBoth, Sign::Sign_t sign=Sign::kBoth) const
Encapsulate code to systematically shift a caf::SRProxy.
Representation of a spectrum in any variable, with associated POT.
std::unique_ptr< IPrediction > fPredNom
The nominal prediction.
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
Interactions of both types.
virtual ~PredictionInterp()
std::vector< double > shifts
Shift values sampled.
Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
std::vector< std::vector< Coeffs > > FitComponent(const std::vector< double > &shifts, const std::vector< IPrediction * > &preds, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign, const std::string &systName) const
Find coefficients describing the ratios from this component.
std::vector< IPrediction * > preds
Spectrum fBinning
Dummy spectrum to provide binning.
Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
std::unordered_map< const ISyst *, ShiftedPreds > fSumPreds
Oscillation probability calculators.
void DebugPlots(osc::IOscCalc *calc, const std::string &savePattern="", Flavors::Flavors_t flav=Flavors::kAll, Current::Current_t curr=Current::kBoth, Sign::Sign_t sign=Sign::kBoth) const
const SystShifts kNoShift
Spectrum Predict(osc::IOscCalc *calc) const override
Spectrum _ShiftedComponent(osc::_IOscCalc< T > *calc, const TMD5 *hash, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign, CoeffsType type) const
Templated helper for ShiftedComponent.
bool operator<(const Key_t &rhs) const
void DebugPlotColz(const ISyst *syst, osc::IOscCalc *calc, Flavors::Flavors_t flav=Flavors::kAll, Current::Current_t curr=Current::kBoth, Sign::Sign_t sign=Sign::kBoth) const
static std::unique_ptr< PredictionInterp > LoadFrom(TDirectory *dir, const std::string &name)
std::vector< std::vector< std::vector< Coeffs > > > fitsRemap
Coeffs(double _a, double _b, double _c, double _d)
std::vector< std::string > fits
std::vector< const ISyst * > GetAllSysts() const
Both neutrinos and antineutrinos.
Standard interface to all prediction techniques.
void DebugPlot(const ISyst *syst, osc::IOscCalc *calc, Flavors::Flavors_t flav=Flavors::kAll, Current::Current_t curr=Current::kBoth, Sign::Sign_t sign=Sign::kBoth) const
void InitFitsHelper(ShiftedPreds &sp, std::vector< std::vector< std::vector< Coeffs >>> &fits, Sign::Sign_t sign) const
Given loaders and an MC shift, Generate() generates an IPrediction.
std::unordered_map< const ISyst *, ShiftedPreds > fPreds
osc::IOscCalc * fOscOrigin
The oscillation values we assume when evaluating the coefficients.
static void LoadFromBody(TDirectory *dir, PredictionInterp *ret, std::vector< const ISyst * > veto={})
All neutrinos, any flavor.
std::vector< std::vector< Coeffs > > FitRatios(const std::vector< double > &shifts, const std::vector< Eigen::ArrayXd > &ratios) const
Find coefficients describing this set of shifts.
Spectrum ShiftedComponent(osc::IOscCalc *calc, const TMD5 *hash, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign, CoeffsType type) const
Helper for PredictComponentSyst.
Spectrum _PredictComponentSyst(osc::_IOscCalc< T > *calc, const SystShifts &shift, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const
Templated helper for PredictComponentSyst.
Spectrum ShiftSpectrum(const Spectrum &s, CoeffsType type, bool nubar, const SystShifts &shift) const
std::vector< std::vector< std::vector< Coeffs > > > fits
Indices: [type][histogram bin][shift bin].