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::IOscCalc* 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  abort();
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, const std::string& name);
67  virtual void SaveTo(TDirectory* dir, const std::string& name) 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 }
const XML_Char * name
Definition: expat.h:151
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
virtual Spectrum Predict(osc::IOscCalc *calc) const =0
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
std::vector< Spectrum * > fSpectra
std::vector< const ISyst * > fSysts
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
osc::OscCalcDumb calc
Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:33
Spectrum Predict(osc::IOscCalc *osc) const override
virtual Spectrum PredictSyst(osc::IOscCalc *calc, const SystShifts &syst) const
Definition: IPrediction.cxx:72
loader
Definition: demo0.py:10
Oscillation probability calculators.
Definition: Calcs.h:5
const SystShifts kNoShift
Definition: SystShifts.h:115
Base class for the various types of spectrum loader.
std::vector< const ISyst * > GetSysts() const
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Cut cut
Definition: exporter_fd.C:30
TDirectory * dir
Definition: macro.C:5
static std::unique_ptr< PredictionScaleComp > LoadFrom(TDirectory *dir, const std::string &name)
std::vector< Spectrum * > GetSpectra() const
assert(nhit_max >=nhit_nbins)
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
std::vector< bool > fIsComponentFloated
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:100
Spectrum PredictSyst(osc::IOscCalc *osc, const SystShifts &syst) const override
PredictionScaleComp(SpectrumLoaderBase &loader, const HistAxis &axis, Cut cut, std::vector< Cut > truthcuts, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
def sign(x)
Definition: canMan.py:197
Prediction broken down into arbitrary components whose scales can be varied independently.