Classes | |
struct | Component |
Public Member Functions | |
SpectrumComponents (const ana::Cut &baseCut, const ana::HistAxis &axis, ana::SpectrumLoaderBase &loader, const Var &wei=kUnweighted, const std::map< std::string, Component > &categories={}) | |
SpectrumComponents makes a collection of Spectra differing by a single (often truth) Cut. More... | |
SpectrumComponents (const ana::Cut &baseCut, const ana::MultiVarHistAxis &axis, ana::SpectrumLoaderBase &loader, const Var &wei=kUnweighted, const std::map< std::string, Component > &categories={}) | |
SpectrumComponents (Spectrum &&tot, std::map< std::string, Component > &&compDescrs, std::map< std::string, Spectrum > &&compSpecs) | |
Constructor for use in LoadFrom() More... | |
SpectrumComponents (const Spectrum &tot, const std::map< std::string, Component > &compDescrs, const std::map< std::string, Spectrum > &compSpecs) | |
Constructor from copies... More... | |
TLegend * | DrawLegend (double drawThreshold=0, TLegend *leg=nullptr) const |
Draw legend on plots. More... | |
void | DrawComponents (bool stacked=true, EBinType bintype=kBinContent, double POT=0, bool sameAll=true) const |
Draw MC components distribution. More... | |
float | Purity (const std::set< std::string > &signalCatNames={}) const |
Purity of the MC selection based on the MC subcategories. More... | |
void | SaveTo (TDirectory *dir, const std::string &name) const |
const ana::Cut & | Sel () const |
Spectrum & | Tot () |
const Spectrum & | Tot () const |
unsigned int | NDimensions () const |
std::vector< std::string > | GetLabels () const |
std::vector< Binning > | GetBinnings () const |
const std::map< std::string, Component > & | ComponentDescrs () const |
std::map< std::string, Component > & | ComponentDescrs () |
const std::map< std::string, Spectrum > & | ComponentSpecs () const |
Static Public Member Functions | |
static std::unique_ptr< SpectrumComponents > | LoadFrom (TDirectory *dir, const std::string &name) |
Private Attributes | |
ana::Cut | fSel |
Spectrum | fTot |
std::map< std::string, Component > | fComponentDescr |
std::map< std::string, Spectrum > | fComponentSpecs |
Definition at line 16 of file SpectrumComponents.h.
ana::SpectrumComponents::SpectrumComponents | ( | const ana::Cut & | baseCut, |
const ana::HistAxis & | axis, | ||
ana::SpectrumLoaderBase & | loader, | ||
const Var & | wei = kUnweighted , |
||
const std::map< std::string, Component > & | categories = {} |
||
) |
SpectrumComponents makes a collection of Spectra differing by a single (often truth) Cut.
baseCut | the selection cut shared between all components |
axis | HistAxis shared between all components |
loaderData | SpectrumLoader for data |
loaderMC | SpectrumLoader for MC |
wei | Weight to apply to events |
systs | std::vector of ISyst* for drawing plots with syst bands |
bkg | Cut object to define background |
mcCategories | the various Cut s defining each category |
Definition at line 19 of file SpectrumComponents.cxx.
References fComponentDescr, fComponentSpecs, fSel, and ana::kNoShift.
ana::SpectrumComponents::SpectrumComponents | ( | const ana::Cut & | baseCut, |
const ana::MultiVarHistAxis & | axis, | ||
ana::SpectrumLoaderBase & | loader, | ||
const Var & | wei = kUnweighted , |
||
const std::map< std::string, Component > & | categories = {} |
||
) |
Definition at line 41 of file SpectrumComponents.cxx.
References fComponentDescr, fComponentSpecs, fSel, and ana::kNoShift.
|
inline |
Constructor for use in LoadFrom()
Definition at line 53 of file SpectrumComponents.h.
|
inline |
Constructor from copies...
Definition at line 63 of file SpectrumComponents.h.
References dir, DrawComponents(), DrawLegend(), ana::kBinContent, MECModelEnuComparisons::leg, LoadFrom(), POT, Purity(), SaveTo(), and string.
|
inline |
Definition at line 101 of file SpectrumComponents.h.
References fComponentDescr.
Referenced by ana::DataMCPair::DrawLegend(), ana::DataMCPair::SetComponentBlurb(), and ana::DataMCPair::SetComponentColor().
|
inline |
Definition at line 102 of file SpectrumComponents.h.
References fComponentDescr.
|
inline |
Definition at line 103 of file SpectrumComponents.h.
void ana::SpectrumComponents::DrawComponents | ( | bool | stacked = true , |
EBinType | bintype = kBinContent , |
||
double | POT = 0 , |
||
bool | sameAll = true |
||
) | const |
Draw MC components distribution.
stack | By default components will be shown stacked. Pass false to show them unstacked instead. |
bintype | Raw bin contents or bin-width normalized? |
POT | Normalize to specific POT? Otherwise use internal Spectrum POT |
sameAll | Draw all hists with "same" option? |
Definition at line 103 of file SpectrumComponents.cxx.
References fComponentDescr, fComponentSpecs, make_syst_table_plots::h, hists, ana::kPOT, MECModelEnuComparisons::opt, and string.
Referenced by ana::DataMCPair::DrawMCComponents(), and SpectrumComponents().
TLegend * ana::SpectrumComponents::DrawLegend | ( | double | drawThreshold = 0 , |
TLegend * | leg = nullptr |
||
) | const |
Draw legend on plots.
drawThreshold | Only create entries for histograms whose integral is greater than this fraction of the total |
Definition at line 63 of file SpectrumComponents.cxx.
References ana::assert(), ana::AutoPlaceLegend(), fComponentDescr, fComponentSpecs, fTot, ana::Spectrum::Integral(), MECModelEnuComparisons::leg, and ana::Spectrum::POT().
Referenced by ana::DataMCPair::DrawLegend(), and SpectrumComponents().
|
inline |
Definition at line 99 of file SpectrumComponents.h.
References fTot, and ana::Spectrum::GetBinnings().
|
inline |
Definition at line 98 of file SpectrumComponents.h.
References fTot, and ana::Spectrum::GetLabels().
|
static |
Definition at line 185 of file SpectrumComponents.cxx.
References ana::assert(), dir, findDuplicateFiles::key, ana::kNoCut, ana::Spectrum::LoadFrom(), runNovaSAM::release, runNovaSAM::ret, cvnie::subdir, and PandAna.Demos.pi0_spectra::tot.
Referenced by ana::DataMCPair::LoadFrom(), and SpectrumComponents().
|
inline |
Definition at line 97 of file SpectrumComponents.h.
References fTot, and ana::Spectrum::NDimensions().
float ana::SpectrumComponents::Purity | ( | const std::set< std::string > & | signalCatNames = {} | ) | const |
Purity of the MC selection based on the MC subcategories.
signalCatNames | If any of your subcategories are "signal", pass them here to avoid counting them as background |
Definition at line 139 of file SpectrumComponents.cxx.
References fComponentSpecs, fTot, POT, and ana::Spectrum::ToTH1().
Referenced by ana::DataMCPair::Purity(), and SpectrumComponents().
void ana::SpectrumComponents::SaveTo | ( | TDirectory * | dir, |
const std::string & | name | ||
) | const |
Definition at line 153 of file SpectrumComponents.cxx.
References plot_validation_datamc_2018::color, dir, fComponentDescr, fComponentSpecs, fTot, ana::Spectrum::SaveTo(), and tmp.
Referenced by ana::DataMCPair::SaveTo(), and SpectrumComponents().
|
inline |
|
inline |
Definition at line 94 of file SpectrumComponents.h.
References fTot.
Referenced by ana::DataMCPair::CreateSystTable(), ana::DataMCPair::DrawMCNormSyst(), and ana::DataMCPair::DrawMCSyst().
|
inline |
|
private |
Definition at line 108 of file SpectrumComponents.h.
Referenced by ComponentDescrs(), DrawComponents(), DrawLegend(), SaveTo(), and SpectrumComponents().
|
private |
Definition at line 109 of file SpectrumComponents.h.
Referenced by DrawComponents(), DrawLegend(), Purity(), SaveTo(), and SpectrumComponents().
|
private |
Definition at line 103 of file SpectrumComponents.h.
Referenced by Sel(), and SpectrumComponents().
|
private |
Definition at line 107 of file SpectrumComponents.h.
Referenced by DrawLegend(), GetBinnings(), GetLabels(), NDimensions(), Purity(), SaveTo(), and Tot().