Spectrum with the value of a second variable, allowing for reweighting More...
#include <ReweightableSpectrum.h>
Public Member Functions | |
ReweightableSpectrum (SpectrumLoaderBase &loader, const HistAxis &recoAxis, const HistAxis &trueAxis, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
ReweightableSpectrum (SpectrumLoaderBase &loader, const HistAxis &recoAxis, const HistAxis &trueAxis, const SpillCut &spillcut, const SliceCut &slicecut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
ReweightableSpectrum (const Var &rwVar, const std::string &xlabel, const std::string &ylabel, double pot, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax) | |
ReweightableSpectrum (const Var &rwVar, TH2 *h, const std::vector< std::string > &labels, const std::vector< Binning > &bins, double pot, double livetime) | |
ReweightableSpectrum (const Var &rwVar, std::unique_ptr< TH2D > h, const std::vector< std::string > &labels, const std::vector< Binning > &bins, double pot, double livetime) | |
virtual | ~ReweightableSpectrum () |
ReweightableSpectrum (const ReweightableSpectrum &rhs) | |
ReweightableSpectrum & | operator= (const ReweightableSpectrum &rhs) |
const Var & | ReweightVar () const |
The variable that will be used to fill the y-axis. More... | |
void | Fill (double x, double y, double w=1) |
TH2D * | ToTH2 (double pot) const |
Spectrum | UnWeighted () const |
Spectrum | WeightingVariable () const |
Spectrum | WeightedBy (const TH1 *weights) const |
void | ReweightToTrueSpectrum (const Spectrum &target) |
Rescale bins so that WeightingVariable will return target. More... | |
void | ReweightToRecoSpectrum (const Spectrum &target) |
Recale bins so that Unweighted will return target. More... | |
void | Clear () |
void | SaveTo (TDirectory *dir) const |
unsigned int | NDimensions () const |
std::vector< std::string > | GetLabels () const |
std::vector< Binning > | GetBinnings () const |
Static Public Member Functions | |
static std::unique_ptr < ReweightableSpectrum > | LoadFrom (TDirectory *dir) |
Protected Member Functions | |
ReweightableSpectrum (const std::vector< std::string > &labels, const std::vector< Binning > &bins, const Var &rwVar) | |
ReweightableSpectrum (const std::string &label, const Binning &bins, const Var &rwVar) | |
ReweightableSpectrum (TH2 *h, const std::vector< std::string > &labels, const std::vector< Binning > &bins, double pot, double livetime) | |
void | RemoveLoader (SpectrumLoaderBase *) |
void | AddLoader (SpectrumLoaderBase *) |
Protected Attributes | |
Var | fRWVar |
What goes on the y axis? More... | |
TH2D * | fHist |
double | fPOT |
double | fLivetime |
std::vector< std::string > | fLabels |
std::vector< Binning > | fBins |
std::string | fTrueLabel |
std::set< SpectrumLoaderBase * > | fLoaderCount |
This count is maintained by SpectrumLoader, as a sanity check. More... | |
Friends | |
class | SpectrumLoaderBase |
class | SpectrumLoader |
class | NullLoader |
class | MRCCLoader |
Spectrum with the value of a second variable, allowing for reweighting
Definition at line 14 of file ReweightableSpectrum.h.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | SpectrumLoaderBase & | loader, |
const HistAxis & | recoAxis, | ||
const HistAxis & | trueAxis, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
Definition at line 21 of file ReweightableSpectrum.cxx.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | SpectrumLoaderBase & | loader, |
const HistAxis & | recoAxis, | ||
const HistAxis & | trueAxis, | ||
const SpillCut & | spillcut, | ||
const SliceCut & | slicecut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
Definition at line 32 of file ReweightableSpectrum.cxx.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | const Var & | rwVar, |
const std::string & | xlabel, | ||
const std::string & | ylabel, | ||
double | pot, | ||
int | nbinsx, | ||
double | xmin, | ||
double | xmax, | ||
int | nbinsy, | ||
double | ymin, | ||
double | ymax | ||
) |
Definition at line 88 of file ReweightableSpectrum.cxx.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | const Var & | rwVar, |
TH2 * | h, | ||
const std::vector< std::string > & | labels, | ||
const std::vector< Binning > & | bins, | ||
double | pot, | ||
double | livetime | ||
) |
Definition at line 109 of file ReweightableSpectrum.cxx.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | const Var & | rwVar, |
std::unique_ptr< TH2D > | h, | ||
const std::vector< std::string > & | labels, | ||
const std::vector< Binning > & | bins, | ||
double | pot, | ||
double | livetime | ||
) |
Definition at line 155 of file ReweightableSpectrum.cxx.
|
virtual |
Definition at line 170 of file ReweightableSpectrum.cxx.
ana::ReweightableSpectrum::ReweightableSpectrum | ( | const ReweightableSpectrum & | rhs | ) |
Definition at line 188 of file ReweightableSpectrum.cxx.
|
inlineprotected |
Definition at line 97 of file ReweightableSpectrum.h.
|
inlineprotected |
Definition at line 106 of file ReweightableSpectrum.h.
|
inlineprotected |
Constructor needed by LoadFrom. Since there's no good way to store a Var, ReweightVar will return nonsense for ReweightableSpectrum that are loaded from a file
Definition at line 118 of file ReweightableSpectrum.h.
|
protected |
Definition at line 456 of file ReweightableSpectrum.cxx.
void ana::ReweightableSpectrum::Clear | ( | ) |
Definition at line 446 of file ReweightableSpectrum.cxx.
void ana::ReweightableSpectrum::Fill | ( | double | x, |
double | y, | ||
double | w = 1 |
||
) |
Definition at line 249 of file ReweightableSpectrum.cxx.
|
inline |
Definition at line 93 of file ReweightableSpectrum.h.
|
inline |
Definition at line 92 of file ReweightableSpectrum.h.
|
static |
Definition at line 485 of file ReweightableSpectrum.cxx.
|
inline |
Definition at line 91 of file ReweightableSpectrum.h.
ReweightableSpectrum & ana::ReweightableSpectrum::operator= | ( | const ReweightableSpectrum & | rhs | ) |
Definition at line 202 of file ReweightableSpectrum.cxx.
|
protected |
Definition at line 452 of file ReweightableSpectrum.cxx.
void ana::ReweightableSpectrum::ReweightToRecoSpectrum | ( | const Spectrum & | target | ) |
Recale bins so that Unweighted will return target.
Definition at line 410 of file ReweightableSpectrum.cxx.
void ana::ReweightableSpectrum::ReweightToTrueSpectrum | ( | const Spectrum & | target | ) |
Rescale bins so that WeightingVariable will return target.
Definition at line 373 of file ReweightableSpectrum.cxx.
|
inline |
The variable that will be used to fill the y-axis.
By convention, return zero if the information can't be obtained, and this event will be skipped.
Definition at line 64 of file ReweightableSpectrum.h.
void ana::ReweightableSpectrum::SaveTo | ( | TDirectory * | dir | ) | const |
Function to save a ReweightableSpectrum to file the fRWVar member is not written to file, so when the spectrum is loaded back from file, ReweightVar should not be accessed, but reweighting still works
Definition at line 460 of file ReweightableSpectrum.cxx.
TH2D * ana::ReweightableSpectrum::ToTH2 | ( | double | pot | ) | const |
Definition at line 223 of file ReweightableSpectrum.cxx.
Spectrum ana::ReweightableSpectrum::UnWeighted | ( | ) | const |
Definition at line 281 of file ReweightableSpectrum.cxx.
Spectrum ana::ReweightableSpectrum::WeightedBy | ( | const TH1 * | weights | ) | const |
Definition at line 333 of file ReweightableSpectrum.cxx.
Spectrum ana::ReweightableSpectrum::WeightingVariable | ( | ) | const |
Definition at line 320 of file ReweightableSpectrum.cxx.
|
friend |
Definition at line 20 of file ReweightableSpectrum.h.
|
friend |
Definition at line 19 of file ReweightableSpectrum.h.
|
friend |
Definition at line 18 of file ReweightableSpectrum.h.
|
friend |
Definition at line 17 of file ReweightableSpectrum.h.
|
protected |
Definition at line 136 of file ReweightableSpectrum.h.
|
protected |
Definition at line 131 of file ReweightableSpectrum.h.
|
protected |
Definition at line 135 of file ReweightableSpectrum.h.
|
protected |
Definition at line 133 of file ReweightableSpectrum.h.
|
protected |
This count is maintained by SpectrumLoader, as a sanity check.
Definition at line 141 of file ReweightableSpectrum.h.
|
protected |
Definition at line 132 of file ReweightableSpectrum.h.
|
protected |
What goes on the y axis?
Definition at line 129 of file ReweightableSpectrum.h.
|
protected |
Definition at line 138 of file ReweightableSpectrum.h.