#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-25/CAFAna/Analysis/DataMCPair.h"
Public Member Functions | |
DataMCPair (Selection sel, TangibleAxis tanAxis, SpectrumLoaderBase &loaderData, SpectrumLoaderBase &loaderMC, const Var &wei=kUnweighted, const std::vector< const ISyst * > &systs={}, const std::map< std::string, SpectrumComponents::Component > &mcCategories={}) | |
DataMCPair wraps up spectrum creation for data/MC comparison More... | |
DataMCPair (Cut cut, HistAxis axis, SpectrumLoaderBase &loaderData, SpectrumLoaderBase &loaderMC, const ana::Var &wei=kUnweighted, const std::vector< const ISyst * > &systs={}, const std::map< std::string, SpectrumComponents::Component > &mcCategories={}) | |
DataMCPair wraps up spectrum creation for data/MC comparison This version simply takes a Cut and Var, leaving the ShortName and Blurb blank for both. More... | |
DataMCPair (const Spectrum &data, const SpectrumComponents &MC, const std::vector< Spectrum > &ups, const std::vector< Spectrum > &downs, const std::string &shortName) | |
Constructor from copies. More... | |
DataMCPair (Spectrum &&data, SpectrumComponents &&MC, std::vector< Spectrum > &&ups, std::vector< Spectrum > &&downs, std::string shortName) | |
Constructor for use in LoadFrom() More... | |
std::string | ShortName () const |
const char * | CName () const |
void | DrawMCSyst (const int iSyst=-1, EBinType bintype=kBinContent) const |
Draw MC with error band. More... | |
void | OverlayDataMCSyst (const int iSyst=-1, bool drawMCBreakdown=true, EBinType bintype=kBinContent, bool drawLegend=true) const |
Draw data and MC with error band. More... | |
void | DrawMCNormSyst (const int iSyst=-1, EBinType bintype=kBinContent) const |
Draw MC with error band, but with each syst normalized to total area of MC to highlight shape differences. More... | |
void | OverlayDataMCSystNorm (const int iSyst=-1, bool drawMCBreakdown=true, EBinType bintype=kBinContent, bool drawLegend=true) const |
Draw data and MC with error band, but with each syst normalized to total area of MC to highlight shape differences. More... | |
TLegend * | DrawLegend (const int dataColor=kBlack, bool includeComponents=true, double drawThreshold=-1) const |
Draw legend on plots, mostly for internal use. More... | |
void | AddExposure () const |
Write exposure on plots, used internally. More... | |
void | DrawData (const int color=kBlack, EBinType bintype=kBinContent) const |
Draw data on plots, mostly for internal use. More... | |
void | DrawMCComponents (bool stacked=true, EBinType bintype=kBinContent) 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 | CreateSystTable (const std::string &fname) const |
Write LaTeX table of syst means: |par|mean up(%)|mean down(%)|. More... | |
void | SaveTo (TDirectory *dir, const std::string &name) const |
unsigned int | NDimensions () const |
std::vector< std::string > | GetLabels () const |
std::vector< Binning > | GetBinnings () const |
void | SetComponentColor (const std::string &name, int color) |
void | SetComponentBlurb (const std::string &name, const std::string &blurb) |
Static Public Member Functions | |
static std::unique_ptr< DataMCPair > | LoadFrom (TDirectory *dir, const std::string &name) |
Public Attributes | |
Selection | fSel |
Spectrum | fData |
SpectrumComponents | fMC |
std::vector< Spectrum > | fUps |
std::vector< Spectrum > | fDowns |
std::string | fShortName |
const std::vector< const ISyst * > | fSysts |
Definition at line 55 of file DataMCPair.h.
DataMCPair::DataMCPair | ( | Selection | sel, |
TangibleAxis | tanAxis, | ||
SpectrumLoaderBase & | loaderData, | ||
SpectrumLoaderBase & | loaderMC, | ||
const Var & | wei = kUnweighted , |
||
const std::vector< const ISyst * > & | systs = {} , |
||
const std::map< std::string, SpectrumComponents::Component > & | mcCategories = {} |
||
) |
DataMCPair wraps up spectrum creation for data/MC comparison
sel | Selection object (cut, blurb, name) for cuts |
tanAxis | TangibleAxis object (HistAxis, blurb, name) |
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 |
Definition at line 48 of file DataMCPair.cxx.
References fDowns, ana::Tangible< T >::fObj, fSel, and fUps.
DataMCPair::DataMCPair | ( | Cut | cut, |
HistAxis | axis, | ||
SpectrumLoaderBase & | loaderData, | ||
SpectrumLoaderBase & | loaderMC, | ||
const ana::Var & | wei = kUnweighted , |
||
const std::vector< const ISyst * > & | systs = {} , |
||
const std::map< std::string, SpectrumComponents::Component > & | mcCategories = {} |
||
) |
DataMCPair wraps up spectrum creation for data/MC comparison This version simply takes a Cut and Var, leaving the ShortName and Blurb blank for both.
cut | Cut object to define selection |
axis | HistAxis object to set up histograms |
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 |
Definition at line 71 of file DataMCPair.cxx.
|
inline |
Constructor from copies.
Definition at line 92 of file DataMCPair.h.
|
inline |
Constructor for use in LoadFrom()
Definition at line 104 of file DataMCPair.h.
void DataMCPair::AddExposure | ( | ) | const |
Write exposure on plots, used internally.
Definition at line 200 of file DataMCPair.cxx.
References fData, genie::utils::style::Format(), pot, ana::Spectrum::POT(), and MakeMiniprodValidationCuts::text.
|
inline |
Definition at line 117 of file DataMCPair.h.
References plot_validation_datamc_2018::color, dir, DrawLegend(), plot_validation_datamc::fname, ana::Tangible< T >::fShortName, ana::kBinContent, ana::LoadFrom(), ana::SaveTo(), and string.
void DataMCPair::CreateSystTable | ( | const std::string & | fname | ) | const |
Write LaTeX table of syst means: |par|mean up(%)|mean down(%)|.
/param fname Path where output file will be written
Definition at line 234 of file DataMCPair.cxx.
References allTimeWatchdog::endl, fDowns, fMC, fShortName, fSysts, fUps, ana::Spectrum::Mean(), ana::replaceAll(), getGoodRuns4SAM::table, ana::TableNum(), and ana::SpectrumComponents::Tot().
void DataMCPair::DrawData | ( | const int | color = kBlack , |
EBinType | bintype = kBinContent |
||
) | const |
Draw data on plots, mostly for internal use.
color | color of data for legend points |
Definition at line 214 of file DataMCPair.cxx.
References plot_validation_datamc_2018::color, fData, ana::kPOT, ana::Spectrum::POT(), and ana::Spectrum::ToTH1().
Referenced by OverlayDataMCSyst(), DataMCPair::OverlayDataMCSystExtraData(), OverlayDataMCSystNorm(), and DataMCPair::OverlayDataMCSystNormExtraData().
TLegend * DataMCPair::DrawLegend | ( | const int | dataColor = kBlack , |
bool | includeComponents = true , |
||
double | drawThreshold = -1 |
||
) | const |
Draw legend on plots, mostly for internal use.
includeComponents | Add legend entries for MC subcomponents? |
drawThreshold | Only draw MC components that are larger than this fraction of the total MC |
Definition at line 160 of file DataMCPair.cxx.
References ana::AutoPlaceLegend(), ana::SpectrumComponents::ComponentDescrs(), ana::SpectrumComponents::DrawLegend(), fMC, ana::kFullPredColor, ana::kTotalBkgColor, and MECModelEnuComparisons::leg.
Referenced by OverlayDataMCSyst(), and OverlayDataMCSystNorm().
void DataMCPair::DrawMCComponents | ( | bool | stacked = true , |
EBinType | bintype = kBinContent |
||
) | const |
Draw MC components distribution.
stack | By default components will be shown stacked. Pass false to show them unstacked instead. |
Definition at line 222 of file DataMCPair.cxx.
References ana::SpectrumComponents::DrawComponents(), fData, fMC, and ana::Spectrum::POT().
Referenced by OverlayDataMCSyst(), and OverlayDataMCSystNorm().
void DataMCPair::DrawMCNormSyst | ( | const int | iSyst = -1 , |
EBinType | bintype = kBinContent |
||
) | const |
Draw MC with error band, but with each syst normalized to total area of MC to highlight shape differences.
iSyst | index of syst in the syst vector |
Definition at line 110 of file DataMCPair.cxx.
References fData, fDowns, fMC, fUps, MECModelEnuComparisons::i, ana::Spectrum::Integral(), ana::kFullPredColor, ana::kPredErrColor, norm, ana::Spectrum::OverridePOT(), ana::PlotWithSystErrorBand(), ana::Spectrum::POT(), and ana::SpectrumComponents::Tot().
Referenced by OverlayDataMCSystNorm().
void DataMCPair::DrawMCSyst | ( | const int | iSyst = -1 , |
EBinType | bintype = kBinContent |
||
) | const |
Draw MC with error band.
iSyst | index of syst in the syst vector |
Definition at line 84 of file DataMCPair.cxx.
References ana::assert(), fData, fDowns, fMC, fUps, ana::kFullPredColor, ana::kPredErrColor, ana::PlotWithSystErrorBand(), ana::Spectrum::POT(), and ana::SpectrumComponents::Tot().
Referenced by OverlayDataMCSyst().
|
inline |
Definition at line 177 of file DataMCPair.h.
References plot_validation_datamc_2018::color, and string.
|
inline |
Definition at line 176 of file DataMCPair.h.
|
static |
Definition at line 315 of file DataMCPair.cxx.
References ana::assert(), dir, findDuplicateFiles::key, ana::SpectrumComponents::LoadFrom(), ana::Spectrum::LoadFrom(), mc, runNovaSAM::release, runNovaSAM::ret, and PandAna.Demos.tute_pid_validation::specs.
Referenced by plot_ND_DataMC().
|
inline |
Definition at line 175 of file DataMCPair.h.
void DataMCPair::OverlayDataMCSyst | ( | const int | iSyst = -1 , |
bool | drawMCBreakdown = true , |
||
EBinType | bintype = kBinContent , |
||
bool | drawLegend = true |
||
) | const |
Draw data and MC with error band.
iSyst | index of syst in the syst vector |
Definition at line 99 of file DataMCPair.cxx.
References DrawData(), DrawLegend(), DrawMCComponents(), and DrawMCSyst().
void DataMCPair::OverlayDataMCSystNorm | ( | const int | iSyst = -1 , |
bool | drawMCBreakdown = true , |
||
EBinType | bintype = kBinContent , |
||
bool | drawLegend = true |
||
) | const |
Draw data and MC with error band, but with each syst normalized to total area of MC to highlight shape differences.
iSyst | index of syst in the syst vector |
Definition at line 149 of file DataMCPair.cxx.
References DrawData(), DrawLegend(), DrawMCComponents(), and DrawMCNormSyst().
float DataMCPair::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 228 of file DataMCPair.cxx.
References fMC, and ana::SpectrumComponents::Purity().
void DataMCPair::SaveTo | ( | TDirectory * | dir, |
const std::string & | name | ||
) | const |
Definition at line 282 of file DataMCPair.cxx.
References dir, fData, fDowns, fMC, fShortName, fUps, compare_h5_caf::idx, ana::SpectrumComponents::SaveTo(), ana::Spectrum::SaveTo(), galleryMaker::shortName, tmp, and art::to_string().
Referenced by ND_DataMC().
void DataMCPair::SetComponentBlurb | ( | const std::string & | name, |
const std::string & | blurb | ||
) |
Definition at line 363 of file DataMCPair.cxx.
References ana::assert(), ana::SpectrumComponents::ComponentDescrs(), and fMC.
void DataMCPair::SetComponentColor | ( | const std::string & | name, |
int | color | ||
) |
Definition at line 354 of file DataMCPair.cxx.
References ana::assert(), plot_validation_datamc_2018::color, ana::SpectrumComponents::ComponentDescrs(), and fMC.
|
inline |
Spectrum DataMCPair::fData |
Definition at line 183 of file DataMCPair.h.
Referenced by AddExposure(), DrawData(), DrawMCComponents(), DrawMCNormSyst(), DrawMCSyst(), and SaveTo().
std::vector< Spectrum > DataMCPair::fDowns |
Definition at line 186 of file DataMCPair.h.
Referenced by CreateSystTable(), DataMCPair(), DrawMCNormSyst(), DrawMCSyst(), and SaveTo().
Spectrum DataMCPair::fMC |
Definition at line 184 of file DataMCPair.h.
Referenced by CreateSystTable(), DrawLegend(), DrawMCComponents(), DrawMCNormSyst(), DrawMCSyst(), Purity(), SaveTo(), SetComponentBlurb(), and SetComponentColor().
Selection DataMCPair::fSel |
Definition at line 182 of file DataMCPair.h.
Referenced by DataMCPair(), and WriteBlurb().
std::string DataMCPair::fShortName |
Definition at line 187 of file DataMCPair.h.
Referenced by CreateSystTable(), and SaveTo().
const std::vector<const ISyst*> ana::DataMCPair::fSysts |
Definition at line 188 of file DataMCPair.h.
Referenced by CreateSystTable().
std::vector< Spectrum > DataMCPair::fUps |
Definition at line 185 of file DataMCPair.h.
Referenced by CreateSystTable(), DataMCPair(), DrawMCNormSyst(), DrawMCSyst(), and SaveTo().