PredictionScaleComp.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "CAFAna/Core/ISyst.h"
7 
8 namespace ana
9 {
10  /// \brief Prediction broken down into arbitrary components whose scales can
11  /// be varied independently.
13  {
14  public:
15  /// \param cut Cut applied to all histograms
16  /// \param truthcuts Prediction will be broken down into N components
17  /// following these cuts.
19  const HistAxis& axis,
20  Cut cut,
21  std::vector<Cut> truthcuts,
22  const SystShifts& shift = kNoShift,
23  const Var& wei = kUnweighted);
24  /// Constructor to take two HistAxis's to weight 2D spectra
26  const HistAxis& axis1,
27  const HistAxis& axis2,
28  Cut cut,
29  std::vector<Cut> truthcuts,
30  const SystShifts& shift = kNoShift,
31  const Var& wei = kUnweighted);
32  // A constructor, allowing for some of the true interaction types to
33  // be fixed to sim (for example, in the case when there is a tiny bkg)
35  const HistAxis& axis,
36  Cut cut,
37  std::vector< std::pair<Cut, bool> > truthcuts,
38  const SystShifts& shift = kNoShift,
39  const Var& wei = kUnweighted);
40 
41  virtual ~PredictionScaleComp() {}
42 
43  // un-hide inherited method stubs so we don't get warnings from the compiler
47 
48  Spectrum Predict(osc::IOscCalculator* osc) const override;
50  const SystShifts& syst) const override;
52  Flavors::Flavors_t flav,
54  Sign::Sign_t sign) const override
55  {
56  assert(0 && "Please don't use PredictionScaleComp::PredictComponent");
57  return Spectrum(0,0,0);
58  }
59 
60  /// Use these systematics in PredictSyst to vary the corresponding
61  /// components
62  std::vector<const ISyst*> GetSysts() const { return fSysts; }
63 
64  std::vector<Spectrum*> GetSpectra() const { return fSpectra; }
65 
66  static std::unique_ptr<PredictionScaleComp> LoadFrom(TDirectory* dir);
67  virtual void SaveTo(TDirectory* dir) const override;
68 
69  private:
70  PredictionScaleComp(Spectrum* complement,
71  std::vector<Spectrum*> spectra,
72  std::vector<bool> isfloated);
73 
74  std::vector<const ISyst*> fSysts;
75  std::vector<Spectrum*> fSpectra;
76 
79  std::vector<bool> fIsComponentFloated;
80  };
81 }
osc::OscCalculatorDumb calc
Oscillation analysis framework, runs over CAF files outside of ART.
static std::unique_ptr< PredictionScaleComp > LoadFrom(TDirectory *dir)
Spectrum PredictComponent(osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
General interface to oscillation calculators.
Definition: FwdDeclare.h:15
virtual Spectrum PredictComponent(osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
std::vector< Spectrum * > fSpectra
std::vector< const ISyst * > fSysts
virtual Spectrum Predict(osc::IOscCalculator *calc) const =0
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:37
Spectrum PredictSyst(osc::IOscCalculator *osc, const SystShifts &syst) const override
virtual Spectrum PredictSyst(osc::IOscCalculator *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:98
loader
Definition: demo0.py:10
Oscillation probability calculators.
Definition: Calcs.h:5
def sign(x)
Definition: canMan.py:204
const SystShifts kNoShift
Definition: SystShifts.h:112
Base class for the various types of spectrum loader.
std::vector< const ISyst * > GetSysts() const
const Cut cut
Definition: exporter_fd.C:30
TDirectory * dir
Definition: macro.C:5
string syst
Definition: plotSysts.py:176
std::vector< Spectrum * > GetSpectra() const
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
Spectrum Predict(osc::IOscCalculator *osc) const override
std::vector< bool > fIsComponentFloated
virtual void SaveTo(TDirectory *dir) const override
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:100
PredictionScaleComp(SpectrumLoaderBase &loader, const HistAxis &axis, Cut cut, std::vector< Cut > truthcuts, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
Prediction broken down into arbitrary components whose scales can be varied independently.