All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PredictionLinFit.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace ana
6 {
7  class Loaders;
8  class IPredictionGenerator;
9 
10  /// Parameterize a collection of universes as a function of the syst knobs
12  {
13  public:
14  /// Direct creation from an ensemble of universes
15  PredictionLinFit(const std::vector<const ISyst*>& systs,
16  const IPrediction* pnom,
17  const std::vector<std::pair<SystShifts, const IPrediction*>>& univs);
18 
19  /// Constructor in the PredictionInterp style
20  PredictionLinFit(const std::vector<const ISyst*>& systs,
21  const IPredictionGenerator& predGen,
22  Loaders& loaders,
23  int nUniv);
24 
26 
27  Spectrum Predict(osc::IOscCalc* calc) const override;
29  const SystShifts& syst) const override;
30 
32  Flavors::Flavors_t flav,
33  Current::Current_t curr,
34  Sign::Sign_t sign) const override;
36  const SystShifts& syst,
37  Flavors::Flavors_t flav,
38  Current::Current_t curr,
39  Sign::Sign_t sign) const override;
40 
41  void DebugPlot(const ISyst* syst,
42  osc::IOscCalc* calc,
45  Sign::Sign_t sign = Sign::kBoth) const;
46 
47  // If \a savePattern is not empty, print each pad. If it contains "%s" then
48  // multiple files will be written, one per systematic.
49  void DebugPlots(osc::IOscCalc* calc,
50  const std::string& savePattern = "",
53  Sign::Sign_t sign = Sign::kBoth) const;
54 
55  void DebugPlotColz(const ISyst* syst,
56  osc::IOscCalc* calc,
59  Sign::Sign_t sign = Sign::kBoth) const;
60 
61  void DebugPlotsColz(osc::IOscCalc* calc,
62  const std::string& savePattern = "",
65  Sign::Sign_t sign = Sign::kBoth) const;
66 
67  void SaveTo(TDirectory* dir) const override;
68  static std::unique_ptr<PredictionLinFit> LoadFrom(TDirectory* dir);
69 
70  protected:
71  void InitFits() const;
72 
73  /// Helper for InitFits()
74  std::vector<double> InitFitsBin(const std::vector<std::vector<double>>& M,
75  const std::vector<double>& ds,
76  const std::vector<std::vector<double>>& coords) const;
77 
78  std::vector<double> GetCoords(const SystShifts& shift) const;
79 
80  Ratio GetRatio(const SystShifts& shift) const;
81 
82  const std::vector<const ISyst*> fSysts;
83  const IPrediction* fNom;
84  std::vector<std::pair<SystShifts, const IPrediction*>> fUnivs;
85 
86  mutable std::vector<std::vector<double>> fCoeffs;
87  };
88 }
Spectrum PredictComponentSyst(osc::IOscCalc *calc, const SystShifts &syst, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
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
const IPrediction * fNom
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 std::vector< const ISyst * > fSysts
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:12
std::vector< double > GetCoords(const SystShifts &shift) const
std::vector< std::vector< double > > fCoeffs
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
process_name opflashCryoW ana
Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const override
shift
Definition: fcl_checks.sh:26
Encapsulate code to systematically shift a caf::StandardRecord.
Definition: ISyst.h:14
Spectrum Predict(osc::IOscCalc *calc) const override
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
std::vector< std::pair< SystShifts, const IPrediction * > > fUnivs
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Interactions of both types.
Definition: IPrediction.h:41
PredictionLinFit(const std::vector< const ISyst * > &systs, const IPrediction *pnom, const std::vector< std::pair< SystShifts, const IPrediction * >> &univs)
Direct creation from an ensemble of universes.
Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Parameterize a collection of universes as a function of the syst knobs.
Represent the ratio between two spectra.
Definition: Ratio.h:8
std::vector< double > InitFitsBin(const std::vector< std::vector< double >> &M, const std::vector< double > &ds, const std::vector< std::vector< double >> &coords) const
Helper for InitFits()
tuple dir
Definition: dropbox.py:28
static std::unique_ptr< PredictionLinFit > LoadFrom(TDirectory *dir)
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
int sign(double val)
Definition: UtilFunc.cxx:104
Both neutrinos and antineutrinos.
Definition: IPrediction.h:51
Standard interface to all prediction techniques.
Definition: IPrediction.h:58
Given loaders and an MC shift, Generate() generates an IPrediction.
All neutrinos, any flavor.
Definition: IPrediction.h:25
void SaveTo(TDirectory *dir) const override
Ratio GetRatio(const SystShifts &shift) const