Representation of a spectrum in any variable, with associated POT. More...
#include <Spectrum.h>
Public Types | |
enum | ESparse { kDense, kSparse } |
Public Member Functions | |
Spectrum (const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const Var &var, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const Var &var, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const SpillVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted) | |
Spectrum (const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const MultiVar &var, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
The only MultiVar variant available. More... | |
Spectrum (const std::string &label, const Binning &bins, SpectrumLoaderBase &loader, const SpillMultiVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted) | |
Spectrum (SpectrumLoaderBase &loader, const HistAxis &axis, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (SpectrumLoaderBase &loader, const HistAxis &axis, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (const std::string &label, const Binning &bins, ESparse sparse=kDense) | |
Spectrum (const std::string &label, double pot, double livetime, const Binning &bins) | |
Spectrum (TH1 *h, const std::vector< std::string > &labels, const std::vector< Binning > &bins, double pot, double livetime) | |
Copies h. More... | |
Spectrum (std::unique_ptr< TH1D > h, const std::vector< std::string > &labels, const std::vector< Binning > &bins, double pot, double livetime) | |
Takes possession of h. More... | |
Spectrum (const std::string &label, SpectrumLoaderBase &loader, const Binning &binsx, const Var &varx, const Binning &binsy, const Var &vary, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
2D Spectrum of two Vars More... | |
Spectrum (const std::string &label, SpectrumLoaderBase &loader, const Binning &binsx, const SpillVar &varx, const Binning &binsy, const SpillVar &vary, const SpillCut &spillcut, const SpillVar &wei=kSpillUnweighted) | |
2D Spectrum of two SpillVars More... | |
Spectrum (const std::string &label, SpectrumLoaderBase &loader, const Binning &binsx, const MultiVar &varx, const Binning &binsy, const MultiVar &vary, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
2D Spectrum of two MultiVars More... | |
Spectrum (const std::string &label, SpectrumLoaderBase &loader, const Binning &binsx, const SpillMultiVar &varx, const Binning &binsy, const SpillMultiVar &vary, const SpillCut &spillcut, const SpillVar &wei=kSpillUnweighted) | |
2D Spectrum of two SpillMultiVars More... | |
Spectrum (SpectrumLoaderBase &loader, const HistAxis &xAxis, const HistAxis &yAxis, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
2D Spectrum taking 2 HistAxis More... | |
Spectrum (const std::string &xLabel, const std::string &yLabel, SpectrumLoaderBase &loader, const Binning &binsx, const Var &varx, const Binning &binsy, const Var &vary, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (const std::string &xLabel, const std::string &yLabel, SpectrumLoaderBase &loader, const Binning &binsx, const SpillVar &varx, const Binning &binsy, const SpillVar &vary, const SpillCut &spillcut, const SpillVar &wei=kSpillUnweighted) | |
Spectrum (const std::string &xLabel, const std::string &yLabel, SpectrumLoaderBase &loader, const Binning &binsx, const MultiVar &varx, const Binning &binsy, const MultiVar &vary, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted) | |
Spectrum (const std::string &xLabel, const std::string &yLabel, SpectrumLoaderBase &loader, const Binning &binsx, const SpillMultiVar &varx, const Binning &binsy, const SpillMultiVar &vary, const SpillCut &spillcut, const SpillVar &wei=kSpillUnweighted) | |
Spectrum (const std::string &label, SpectrumLoaderBase &loader, const Binning &binsx, const Var &varx, const Binning &binsy, const Var &vary, const Binning &binsz, const Var &varz, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted, ESparse sparse=kDense) | |
3D Spectrum of three Vars More... | |
Spectrum (const std::string &xLabel, const std::string &yLabel, const std::string &zLabel, SpectrumLoaderBase &loader, const Binning &binsx, const Var &varx, const Binning &binsy, const Var &vary, const Binning &binsz, const Var &varz, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted, ESparse sparse=kDense) | |
Spectrum (SpectrumLoaderBase &loader, const HistAxis &xAxis, const HistAxis &yAxis, const HistAxis &zAxis, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift=kNoShift, const Var &wei=kUnweighted, ESparse sparse=kDense) | |
3D Spectrum taking 3 HistAxis More... | |
virtual | ~Spectrum () |
Spectrum (const Spectrum &rhs) | |
Spectrum (Spectrum &&rhs) | |
Spectrum & | operator= (const Spectrum &rhs) |
Spectrum & | operator= (Spectrum &&rhs) |
void | Fill (double x, double w=1) |
TH1D * | ToTH1 (double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const |
Histogram made from this Spectrum, scaled to some exposure. More... | |
TH1D * | ToTH1 (double exposure, EExposureType expotype, EBinType bintype=kBinContent) const |
Histogram made from this Spectrum, scaled to some exposure. More... | |
TH2 * | ToTH2 (double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const |
Spectrum must be 2D to obtain TH2. More... | |
TH2 * | ToTH2NormX (double exposure, EExposureType expotype=kPOT) const |
Spectrum must be 2D to obtain TH2. Normalized to X axis. More... | |
TH3 * | ToTH3 (double exposure, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const |
Spectrum must be 3D to obtain TH3. More... | |
TH1 * | ToTHX (double exposure, bool force1D=false, EExposureType expotype=kPOT) const |
Function decides what is the appropriate projection based on fBins, and does that. More... | |
double | Integral (double exposure, double *err=0, EExposureType expotype=kPOT) const |
Return total number of events scaled to pot. More... | |
double | Mean () const |
Return mean of 1D histogram. More... | |
Spectrum | MockData (double pot, bool makethrow=true, int seed=0) const |
Mock data is FakeData with Poisson fluctuations applied. More... | |
Spectrum | FakeData (double pot) const |
Fake data is a MC spectrum scaled to the POT expected in the data. More... | |
double | POT () const |
double | Livetime () const |
Seconds. For informational purposes only. No calculations use this. More... | |
void | OverridePOT (double newpot) |
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY! More... | |
void | OverrideLivetime (double newlive) |
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY! More... | |
void | Clear () |
void | Scale (double c) |
Multiply this spectrum by a constant c. More... | |
Spectrum & | operator+= (const Spectrum &rhs) |
Spectrum | operator+ (const Spectrum &rhs) const |
Spectrum & | operator-= (const Spectrum &rhs) |
Spectrum | operator- (const Spectrum &rhs) const |
Spectrum & | operator*= (const Ratio &rhs) |
Spectrum | operator* (const Ratio &rhs) const |
Spectrum & | operator/= (const Ratio &rhs) |
Spectrum | operator/ (const Ratio &rhs) const |
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< Spectrum > | LoadFrom (TDirectory *dir) |
Protected Member Functions | |
Spectrum (const std::vector< std::string > &labels, const std::vector< Binning > &bins, ESparse sparse=kDense) | |
void | ConstructHistogram (ESparse sparse=kDense) |
void | RemoveLoader (SpectrumLoaderBase *) |
void | AddLoader (SpectrumLoaderBase *) |
Spectrum & | PlusEqualsHelper (const Spectrum &rhs, int sign) |
Helper for operator+= and operator-=. More... | |
Protected Attributes | |
TH1D * | fHist |
THnSparseD * | fHistSparse |
double | fPOT |
double | fLivetime |
std::set< SpectrumLoaderBase * > | fLoaderCount |
This count is maintained by SpectrumLoader, as a sanity check. More... | |
std::vector< std::string > | fLabels |
std::vector< Binning > | fBins |
Friends | |
class | SpectrumLoaderBase |
class | SpectrumLoader |
class | NullLoader |
Representation of a spectrum in any variable, with associated POT.
Definition at line 30 of file Spectrum.h.
Enumerator | |
---|---|
kDense | |
kSparse |
Definition at line 37 of file Spectrum.h.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
const Binning & | bins, | ||
SpectrumLoaderBase & | loader, | ||
const Var & | var, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
Definition at line 43 of file Spectrum.cxx.
|
inline |
Definition at line 47 of file Spectrum.h.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
const Binning & | bins, | ||
SpectrumLoaderBase & | loader, | ||
const SpillVar & | var, | ||
const SpillCut & | cut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
Definition at line 56 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
const Binning & | bins, | ||
SpectrumLoaderBase & | loader, | ||
const MultiVar & | var, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
The only MultiVar variant available.
Definition at line 67 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
const Binning & | bins, | ||
SpectrumLoaderBase & | loader, | ||
const SpillMultiVar & | var, | ||
const SpillCut & | cut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
Definition at line 80 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | SpectrumLoaderBase & | loader, |
const HistAxis & | axis, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
Definition at line 91 of file Spectrum.cxx.
|
inline |
Definition at line 86 of file Spectrum.h.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
const Binning & | bins, | ||
ESparse | sparse = kDense |
||
) |
Definition at line 33 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
double | pot, | ||
double | livetime, | ||
const Binning & | bins | ||
) |
Definition at line 103 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | TH1 * | h, |
const std::vector< std::string > & | labels, | ||
const std::vector< Binning > & | bins, | ||
double | pot, | ||
double | livetime | ||
) |
Copies h.
Definition at line 112 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | std::unique_ptr< TH1D > | h, |
const std::vector< std::string > & | labels, | ||
const std::vector< Binning > & | bins, | ||
double | pot, | ||
double | livetime | ||
) |
Takes possession of h.
Definition at line 138 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const Var & | varx, | ||
const Binning & | binsy, | ||
const Var & | vary, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
2D Spectrum of two Vars
Definition at line 147 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const SpillVar & | varx, | ||
const Binning & | binsy, | ||
const SpillVar & | vary, | ||
const SpillCut & | spillcut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
2D Spectrum of two SpillVars
Definition at line 160 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const MultiVar & | varx, | ||
const Binning & | binsy, | ||
const MultiVar & | vary, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
2D Spectrum of two MultiVars
Definition at line 171 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | label, |
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const SpillMultiVar & | varx, | ||
const Binning & | binsy, | ||
const SpillMultiVar & | vary, | ||
const SpillCut & | spillcut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
2D Spectrum of two SpillMultiVars
Definition at line 184 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | SpectrumLoaderBase & | loader, |
const HistAxis & | xAxis, | ||
const HistAxis & | yAxis, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
2D Spectrum taking 2 HistAxis
Definition at line 195 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | xLabel, |
const std::string & | yLabel, | ||
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const Var & | varx, | ||
const Binning & | binsy, | ||
const Var & | vary, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
Definition at line 213 of file Spectrum.cxx.
ana::Spectrum::Spectrum | ( | const std::string & | xLabel, |
const std::string & | yLabel, | ||
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const SpillVar & | varx, | ||
const Binning & | binsy, | ||
const SpillVar & | vary, | ||
const SpillCut & | spillcut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
ana::Spectrum::Spectrum | ( | const std::string & | xLabel, |
const std::string & | yLabel, | ||
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const MultiVar & | varx, | ||
const Binning & | binsy, | ||
const MultiVar & | vary, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted |
||
) |
ana::Spectrum::Spectrum | ( | const std::string & | xLabel, |
const std::string & | yLabel, | ||
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const SpillMultiVar & | varx, | ||
const Binning & | binsy, | ||
const SpillMultiVar & | vary, | ||
const SpillCut & | spillcut, | ||
const SpillVar & | wei = kSpillUnweighted |
||
) |
ana::Spectrum::Spectrum | ( | const std::string & | label, |
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const Var & | varx, | ||
const Binning & | binsy, | ||
const Var & | vary, | ||
const Binning & | binsz, | ||
const Var & | varz, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted , |
||
ESparse | sparse = kDense |
||
) |
3D Spectrum of three Vars
ana::Spectrum::Spectrum | ( | const std::string & | xLabel, |
const std::string & | yLabel, | ||
const std::string & | zLabel, | ||
SpectrumLoaderBase & | loader, | ||
const Binning & | binsx, | ||
const Var & | varx, | ||
const Binning & | binsy, | ||
const Var & | vary, | ||
const Binning & | binsz, | ||
const Var & | varz, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted , |
||
ESparse | sparse = kDense |
||
) |
ana::Spectrum::Spectrum | ( | SpectrumLoaderBase & | loader, |
const HistAxis & | xAxis, | ||
const HistAxis & | yAxis, | ||
const HistAxis & | zAxis, | ||
const SpillCut & | spillcut, | ||
const Cut & | cut, | ||
const SystShifts & | shift = kNoShift , |
||
const Var & | wei = kUnweighted , |
||
ESparse | sparse = kDense |
||
) |
3D Spectrum taking 3 HistAxis
|
virtual |
ana::Spectrum::Spectrum | ( | const Spectrum & | rhs | ) |
ana::Spectrum::Spectrum | ( | Spectrum && | rhs | ) |
|
protected |
Definition at line 22 of file Spectrum.cxx.
|
protected |
void ana::Spectrum::Clear | ( | ) |
Spectrum ana::Spectrum::FakeData | ( | double | pot | ) | const |
Fake data is a MC spectrum scaled to the POT expected in the data.
Use for sensitivity plots and testing fit convergence
void ana::Spectrum::Fill | ( | double | x, |
double | w = 1 |
||
) |
|
inline |
Definition at line 325 of file Spectrum.h.
|
inline |
Definition at line 324 of file Spectrum.h.
double ana::Spectrum::Integral | ( | double | exposure, |
double * | err = 0 , |
||
EExposureType | expotype = kPOT |
||
) | const |
Return total number of events scaled to pot.
exposure | POT/livetime to scale to |
err | The statistical error on this total (optional) |
expotype | What the first parameter represents |
|
inline |
Seconds. For informational purposes only. No calculations use this.
Definition at line 292 of file Spectrum.h.
|
static |
double ana::Spectrum::Mean | ( | ) | const |
Return mean of 1D histogram.
Mock data is FakeData with Poisson fluctuations applied.
Use for low-budget MDCs, or just getting a sense of the expected scale of statistical variation
|
inline |
Definition at line 323 of file Spectrum.h.
|
inline |
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY!
Definition at line 298 of file Spectrum.h.
|
inline |
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY!
Definition at line 295 of file Spectrum.h.
Helper for operator+= and operator-=.
|
inline |
Definition at line 289 of file Spectrum.h.
|
protected |
void ana::Spectrum::SaveTo | ( | TDirectory * | dir | ) | const |
void ana::Spectrum::Scale | ( | double | c | ) |
Multiply this spectrum by a constant c.
TH1D* ana::Spectrum::ToTH1 | ( | double | exposure, |
Color_t | col = kBlack , |
||
Style_t | style = kSolid , |
||
EExposureType | expotype = kPOT , |
||
EBinType | bintype = kBinContent |
||
) | const |
Histogram made from this Spectrum, scaled to some exposure.
exposure | POT or livetime (seconds) |
col | Histogram color (default black) |
style | Histogram line style (default solid) |
expotype | How to interpret exposure (kPOT (default) or kLivetime) |
|
inline |
Histogram made from this Spectrum, scaled to some exposure.
exposure | POT or livetime (seconds) |
expotype | How to interpret exposure (kPOT (default) or kLivetime) |
Definition at line 248 of file Spectrum.h.
TH2* ana::Spectrum::ToTH2 | ( | double | exposure, |
EExposureType | expotype = kPOT , |
||
EBinType | bintype = kBinContent |
||
) | const |
Spectrum must be 2D to obtain TH2.
TH2* ana::Spectrum::ToTH2NormX | ( | double | exposure, |
EExposureType | expotype = kPOT |
||
) | const |
Spectrum must be 2D to obtain TH2. Normalized to X axis.
TH3* ana::Spectrum::ToTH3 | ( | double | exposure, |
EExposureType | expotype = kPOT , |
||
EBinType | bintype = kBinContent |
||
) | const |
Spectrum must be 3D to obtain TH3.
TH1* ana::Spectrum::ToTHX | ( | double | exposure, |
bool | force1D = false , |
||
EExposureType | expotype = kPOT |
||
) | const |
Function decides what is the appropriate projection based on fBins, and does that.
|
friend |
Definition at line 35 of file Spectrum.h.
|
friend |
Definition at line 34 of file Spectrum.h.
|
friend |
Definition at line 33 of file Spectrum.h.
|
protected |
Definition at line 349 of file Spectrum.h.
|
protected |
Definition at line 340 of file Spectrum.h.
|
protected |
Definition at line 341 of file Spectrum.h.
|
protected |
Definition at line 348 of file Spectrum.h.
|
protected |
Definition at line 343 of file Spectrum.h.
|
protected |
This count is maintained by SpectrumLoader, as a sanity check.
Definition at line 346 of file Spectrum.h.
|
protected |
Definition at line 342 of file Spectrum.h.