All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OscillatableSpectrum.h
Go to the documentation of this file.
1 #pragma once
2 
4 
8 
9 #include <string>
10 
11 class TH2;
12 class TH2D;
13 class TMD5;
14 
15 namespace osc
16 {
17  template<class T> class _IOscCalc;
18  typedef _IOscCalc<double> IOscCalc;
19 }
20 
21 namespace ana
22 {
23  /// %Spectrum with true energy information, allowing it to be oscillated
25  {
26  public:
27  friend class SpectrumLoaderBase;
28  friend class SpectrumLoader;
29  friend class NullLoader;
30 
31  OscillatableSpectrum(const std::string& label,
32  const Binning& bins,
34  const Var& var,
35  const Cut& cut,
36  const SystShifts& shift = kNoShift,
37  const Var& wei = kUnweighted);
38 
40  const HistAxis& axis,
41  const Cut& cut,
42  const SystShifts& shift = kNoShift,
43  const Var& wei = kUnweighted);
44 
46  const HistAxis& axis,
47  const SpillCut& spillcut,
48  const SliceCut& slicecut,
49  const SystShifts& shift = kNoShift,
50  const Var& wei = kUnweighted);
51 
52  OscillatableSpectrum(const std::string& label, const Binning& bins);
53  OscillatableSpectrum(const std::string& label, double pot, double livetime,
54  const Binning& bins);
56  const std::vector<std::string>& labels,
57  const std::vector<Binning>& bins,
58  double pot, double livetime);
59 
60  OscillatableSpectrum(std::unique_ptr<TH2D> h,
61  const std::vector<std::string>& labels,
62  const std::vector<Binning>& bins,
63  double pot, double livetime);
64 
66 
67  /// Copy constructor
70  /// Assignment operator
73 
74  // Expose these ones directly
78 
79  /// Rescale bins so that \ref TrueEnergy will return \a target
81  /// Rescale bins so that \ref Unoscillated will return \a target
83 
84  // These under a different name
85  Spectrum Unoscillated() const {return UnWeighted();}
87 
88  Spectrum Oscillated(osc::IOscCalc* calc, int from, int to) const;
89 
92 
95 
96  void SaveTo(TDirectory* dir) const;
97  static std::unique_ptr<OscillatableSpectrum> LoadFrom(TDirectory* dir);
98 
99  protected:
100  // Derived classes can be trusted take care of their own construction
101  OscillatableSpectrum(const std::vector<std::string>& labels,
102  const std::vector<Binning>& bins,
103  const Var& rwVar)
104  : ReweightableSpectrum(labels, bins, rwVar),
105  fCachedOsc(0, {}, {}, 0, 0),
107  {
108  }
109 
110  OscillatableSpectrum(const std::string& label,
111  const Binning& bins,
112  const Var& rwVar)
113  : ReweightableSpectrum(label, bins, rwVar),
114  fCachedOsc(0, {}, {}, 0, 0),
116  {
117  }
118 
120  mutable TMD5* fCachedHash;
121  };
122 }
* labels
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:18
void Fill(double x, double y, double w=1)
tuple loader
Definition: demo.py:7
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:16
static std::unique_ptr< OscillatableSpectrum > LoadFrom(TDirectory *dir)
Spectrum with the value of a second variable, allowing for reweighting
void ReweightToRecoSpectrum(const Spectrum &target)
Recale bins so that Unweighted will return target.
process_name opflashCryoW ana
OscillatableSpectrum & operator-=(const OscillatableSpectrum &rhs)
shift
Definition: fcl_checks.sh:26
_IOscCalc< double > IOscCalc
Definition: Plots.h:17
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
OscillatableSpectrum(const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const Var &var, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted)
while getopts h
OscillatableSpectrum & operator+=(const OscillatableSpectrum &rhs)
OscillatableSpectrum operator+(const OscillatableSpectrum &rhs) const
const SystShifts kNoShift
Definition: SystShifts.h:61
tuple dir
Definition: dropbox.py:28
Base class for the various types of spectrum loader.
Spectrum Oscillated(osc::IOscCalc *calc, int from, int to) const
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kUnweighted([](const caf::SRSliceProxy *){return 1;})
The simplest possible Var, always 1. Used as a default weight.
OscillatableSpectrum(const std::vector< std::string > &labels, const std::vector< Binning > &bins, const Var &rwVar)
Dummy loader that doesn&#39;t load any files.
OscillatableSpectrum & operator=(const OscillatableSpectrum &rhs)
Assignment operator.
void ReweightToTrueSpectrum(const Spectrum &target)
Rescale bins so that WeightingVariable will return target.
Spectrum with true energy information, allowing it to be oscillated
OscillatableSpectrum operator-(const OscillatableSpectrum &rhs) const
OscillatableSpectrum(const std::string &label, const Binning &bins, const Var &rwVar)
void SaveTo(TDirectory *dir) const
TH2D * ToTH2(double pot) const