Class for data driven decomposition of signal and background using two different samples with slightly different spectra. More...
Public Member Functions | |
TwoSampleDecomp (SpectrumLoaderBase &loaderMC, SpectrumLoaderBase &loaderData, std::string label, const Binning &bins, const Var &var, const Cut &firstSample, const Cut &isSignal=kNoCut, const Cut &anaCut=kNoCut, const SystShifts &shift=kNoShift, const Var &weight=kUnweighted) | |
Constructor for creating spectra from a SpectrumLoader. Must supply cuts to define samples, first or second. For instance first: left side, second: right side. Also must define cut to specefiy signal/background. Analysis cuts are optional, but likely necessary. More... | |
TwoSampleDecomp (SpectrumLoaderBase &loaderMC, SpectrumLoaderBase &loaderData, const HistAxis &axis, const Cut &firstSample, const Cut &isSignal=kNoCut, const Cut &anaCut=kNoCut, const SystShifts &shift=kNoShift, const Var &weight=kUnweighted) | |
virtual | ~TwoSampleDecomp () |
virtual Spectrum | NCTotalComponent () const override |
Returns the decomposed NC component. More... | |
virtual Spectrum | NCComponent () const override |
virtual Spectrum | NCAntiComponent () const override |
virtual Spectrum | NumuComponent () const override |
Returns the decomposed numu CC component. More... | |
virtual Spectrum | NueComponent () const override |
Could return the nue CC component, but not implemented for two sample decomposition. More... | |
virtual Spectrum | AntiNumuComponent () const override |
virtual Spectrum | AntiNueComponent () const override |
void | Decomp () const |
Preform the decomposition using the ratios in the MC sample. More... | |
void | RatioCalc () const |
Calculate the ratios for the signal and background, second/first. More... | |
void | SaveTo (TDirectory *dir, const std::string &name) const override |
void | DrawSigBkgOverlay () |
void | DrawTwoSamplesWithRatios () |
void | DrawRatios () |
virtual Spectrum | Data_Component () const |
virtual Spectrum | MC_NCTotalComponent () const |
virtual Spectrum | MC_NCComponent () const |
virtual Spectrum | MC_NCAntiComponent () const |
virtual Spectrum | MC_NumuComponent () const |
virtual Spectrum | MC_AntiNumuComponent () const |
virtual Spectrum | MC_NueComponent () const |
virtual Spectrum | MC_AntiNueComponent () const |
Static Public Member Functions | |
static std::unique_ptr< TwoSampleDecomp > | LoadFrom (TDirectory *dir, const std::string &name) |
Public Attributes | |
const SpectrumLoaderBase & | fLoaderMC |
const SpectrumLoaderBase & | fLoaderData |
const HistAxis * | fAxis |
Axis used for spectra. More... | |
Spectrum | fFirstSig |
Spectrum for first sample, signal. More... | |
Spectrum | fSecondSig |
Spectrum for second sample, signal. More... | |
Spectrum | fFirstBkg |
Spectrum for first sample, background. More... | |
Spectrum | fSecondBkg |
Spectrum for second sample, background. More... | |
Spectrum | fTrueSig |
True signal spectrum. More... | |
Spectrum | fTrueBkg |
True backgroundh spectrum. More... | |
Spectrum | fFirst |
Spectrum of events that pass the firstSample cut. More... | |
Spectrum | fSecond |
Spectrum of events that fail the firstSample cut. More... | |
Spectrum | fSig |
Decomposed spectrum of signal events. More... | |
Spectrum | fBkg |
Decomposed spectrum of signal events. More... | |
TH1D * | fSigRatio |
Ratio of second/first spectra for signal. More... | |
TH1D * | fBkgRatio |
Ratio of second/first spectra for bkg. More... | |
bool | fDecomposed |
Indicates whether decomposition was done. More... | |
Protected Member Functions | |
TwoSampleDecomp () | |
Class for data driven decomposition of signal and background using two different samples with slightly different spectra.
Definition at line 21 of file TwoSampleDecomp.h.
ana::TwoSampleDecomp::TwoSampleDecomp | ( | SpectrumLoaderBase & | loaderMC, |
SpectrumLoaderBase & | loaderData, | ||
std::string | label, | ||
const Binning & | bins, | ||
const Var & | var, | ||
const Cut & | firstSample, | ||
const Cut & | isSignal = kNoCut , |
||
const Cut & | anaCut = kNoCut , |
||
const SystShifts & | shift = kNoShift , |
||
const Var & | weight = kUnweighted |
||
) |
Constructor for creating spectra from a SpectrumLoader. Must supply cuts to define samples, first or second. For instance first: left side, second: right side. Also must define cut to specefiy signal/background. Analysis cuts are optional, but likely necessary.
Detailed description starts here.
loaderMC | Spectrum loader for MC |
loaderData | Spectrum loader for data |
label | Name of the thing |
bins | Desired binning for spectra |
var | Variable to be plotted in spectra |
firstSample | Cut to define samples, true: first, false: second |
isSignal | Signal or not? true: sig, false: bkg |
anaCut | Cut to define selection(e.g. numu CC) |
weight | Weight for events in spectrum |
Definition at line 24 of file TwoSampleDecomp.cxx.
ana::TwoSampleDecomp::TwoSampleDecomp | ( | SpectrumLoaderBase & | loaderMC, |
SpectrumLoaderBase & | loaderData, | ||
const HistAxis & | axis, | ||
const Cut & | firstSample, | ||
const Cut & | isSignal = kNoCut , |
||
const Cut & | anaCut = kNoCut , |
||
const SystShifts & | shift = kNoShift , |
||
const Var & | weight = kUnweighted |
||
) |
loaderMC | Spectrum loader for MC |
loaderData | Spectrum loader for data |
axis | Variable to be plotted in spectra |
firstSample | Cut to define samples, true: first, false: second |
isSignal | Signal or not? true: sig, false: bkg |
anaCut | Cut to define selection(e.g. numu CC) |
weight | Weight for events in spectrum |
Definition at line 42 of file TwoSampleDecomp.cxx.
References om::cout, allTimeWatchdog::endl, and ana::LabelsAndBins::NDimensions().
|
inlinevirtual |
Definition at line 57 of file TwoSampleDecomp.h.
|
protected |
Definition at line 86 of file TwoSampleDecomp.cxx.
|
inlineoverridevirtual |
Implements ana::IDecomp.
Definition at line 75 of file TwoSampleDecomp.h.
References Decomp(), dir, DrawRatios(), DrawSigBkgOverlay(), DrawTwoSamplesWithRatios(), fBkg, LoadFrom(), RatioCalc(), SaveTo(), and string.
|
inlineoverridevirtual |
Implements ana::IDecomp.
Definition at line 74 of file TwoSampleDecomp.h.
References Decomp(), and fBkg.
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, ana::FakeDecomp, ana::NumuDecomp, ana::NueDecomp, and ana::NCDecomp.
Definition at line 16 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDComponents(), ana::GetNDCompsFromDecomp(), ana::GetNDDecompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
void ana::TwoSampleDecomp::Decomp | ( | ) | const |
Preform the decomposition using the ratios in the MC sample.
Definition at line 160 of file TwoSampleDecomp.cxx.
References ana::assert(), fBkg, fBkgRatio, fDecomposed, fFirst, fLoaderData, fLoaderMC, fSecond, fSig, fSigRatio, ana::Spectrum::GetBinnings(), ana::Spectrum::GetLabels(), ana::SpectrumLoaderBase::Gone(), MECModelEnuComparisons::i, ana::Spectrum::Livetime(), plotROC::nBins, ana::Spectrum::POT(), RatioCalc(), util::sqr(), std::sqrt(), string, plotROC::title, and ana::Spectrum::ToTH1().
Referenced by AntiNueComponent(), AntiNumuComponent(), DrawSigBkgOverlay(), DrawTwoSamplesWithRatios(), NCTotalComponent(), NueComponent(), and NumuComponent().
void ana::TwoSampleDecomp::DrawRatios | ( | ) |
Definition at line 408 of file TwoSampleDecomp.cxx.
References fBkgRatio, and fSigRatio.
Referenced by AntiNueComponent(), and runTwoSampleDecomp().
void ana::TwoSampleDecomp::DrawSigBkgOverlay | ( | ) |
Definition at line 333 of file TwoSampleDecomp.cxx.
References Decomp(), fBkg, fFirst, fSecond, fSig, fTrueBkg, fTrueSig, kBlue, kGreen, kRed, ana::Spectrum::POT(), and ana::Spectrum::ToTH1().
Referenced by AntiNueComponent(), and runTwoSampleDecomp().
void ana::TwoSampleDecomp::DrawTwoSamplesWithRatios | ( | ) |
Definition at line 372 of file TwoSampleDecomp.cxx.
References Decomp(), fFirst, fFirstBkg, fFirstSig, fSecondBkg, fSecondSig, make_syst_table_plots::h, hists, kBlue, kRed, m, cet::sqlite::max(), ana::Spectrum::POT(), and ana::Spectrum::ToTH1().
Referenced by AntiNueComponent(), and runTwoSampleDecomp().
|
static |
Definition at line 133 of file TwoSampleDecomp.cxx.
References ana::assert(), dir, ana::Spectrum::LoadFrom(), and runNovaSAM::ret.
Referenced by AntiNueComponent().
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, and ana::NumuDecomp.
Definition at line 46 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDCompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, and ana::NumuDecomp.
Definition at line 38 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDCompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::MichelDecomp, ana::FluxDecomp, and ana::ProportionalDecomp.
Definition at line 30 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::MichelDecomp, ana::FluxDecomp, and ana::ProportionalDecomp.
Definition at line 26 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, and ana::NumuDecomp.
Definition at line 22 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDCompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, and ana::NumuDecomp.
Definition at line 42 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDCompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
|
virtualinherited |
Reimplemented in ana::BENDecomp, ana::MichelDecomp, ana::FluxDecomp, ana::ProportionalDecomp, and ana::NumuDecomp.
Definition at line 34 of file IDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by ana::GetNDCompsFromDecomp(), and ana::IDecomp::NCTotalComponent().
|
overridevirtual |
Implements ana::IDecomp.
Definition at line 158 of file TwoSampleDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by NCTotalComponent().
|
overridevirtual |
Implements ana::IDecomp.
Definition at line 156 of file TwoSampleDecomp.cxx.
References om::cout, and allTimeWatchdog::endl.
Referenced by NCTotalComponent().
|
inlineoverridevirtual |
Returns the decomposed NC component.
Reimplemented from ana::IDecomp.
Definition at line 62 of file TwoSampleDecomp.h.
References Decomp(), fBkg, NCAntiComponent(), and NCComponent().
|
inlineoverridevirtual |
Could return the nue CC component, but not implemented for two sample decomposition.
Implements ana::IDecomp.
Definition at line 72 of file TwoSampleDecomp.h.
References Decomp(), and fBkg.
|
inlineoverridevirtual |
Returns the decomposed numu CC component.
Implements ana::IDecomp.
Definition at line 68 of file TwoSampleDecomp.h.
References Decomp(), and fSig.
void ana::TwoSampleDecomp::RatioCalc | ( | ) | const |
Calculate the ratios for the signal and background, second/first.
Definition at line 266 of file TwoSampleDecomp.cxx.
References ana::assert(), ana::bins, fAxis, fBkgRatio, fFirstBkg, fFirstSig, fSecondBkg, fSecondSig, fSigRatio, ana::LabelsAndBins::GetBinnings(), MECModelEnuComparisons::i, plotROC::nBins, ana::Spectrum::POT(), string, plotROC::title, and ana::Spectrum::ToTH1().
Referenced by AntiNueComponent(), and Decomp().
|
overridevirtual |
Implements ana::IDecomp.
Definition at line 106 of file TwoSampleDecomp.cxx.
References dir, fBkg, fFirst, fFirstBkg, fFirstSig, fSecond, fSecondBkg, fSecondSig, fSig, fTrueBkg, fTrueSig, ana::Spectrum::SaveTo(), and tmp.
Referenced by AntiNueComponent(), and runTwoSampleDecomp().
const HistAxis* ana::TwoSampleDecomp::fAxis |
|
mutable |
Decomposed spectrum of signal events.
Definition at line 108 of file TwoSampleDecomp.h.
Referenced by AntiNueComponent(), AntiNumuComponent(), Decomp(), DrawSigBkgOverlay(), NCTotalComponent(), NueComponent(), and SaveTo().
|
mutable |
Ratio of second/first spectra for bkg.
Definition at line 112 of file TwoSampleDecomp.h.
Referenced by Decomp(), DrawRatios(), and RatioCalc().
|
mutable |
Indicates whether decomposition was done.
Definition at line 113 of file TwoSampleDecomp.h.
Referenced by Decomp().
Spectrum ana::TwoSampleDecomp::fFirst |
Spectrum of events that pass the firstSample cut.
Definition at line 104 of file TwoSampleDecomp.h.
Referenced by Decomp(), DrawSigBkgOverlay(), DrawTwoSamplesWithRatios(), and SaveTo().
Spectrum ana::TwoSampleDecomp::fFirstBkg |
Spectrum for first sample, background.
Definition at line 98 of file TwoSampleDecomp.h.
Referenced by DrawTwoSamplesWithRatios(), RatioCalc(), and SaveTo().
Spectrum ana::TwoSampleDecomp::fFirstSig |
Spectrum for first sample, signal.
Definition at line 96 of file TwoSampleDecomp.h.
Referenced by DrawTwoSamplesWithRatios(), RatioCalc(), and SaveTo().
const SpectrumLoaderBase& ana::TwoSampleDecomp::fLoaderData |
Definition at line 93 of file TwoSampleDecomp.h.
Referenced by Decomp().
const SpectrumLoaderBase& ana::TwoSampleDecomp::fLoaderMC |
Definition at line 92 of file TwoSampleDecomp.h.
Referenced by Decomp().
Spectrum ana::TwoSampleDecomp::fSecond |
Spectrum of events that fail the firstSample cut.
Definition at line 105 of file TwoSampleDecomp.h.
Referenced by Decomp(), DrawSigBkgOverlay(), and SaveTo().
Spectrum ana::TwoSampleDecomp::fSecondBkg |
Spectrum for second sample, background.
Definition at line 99 of file TwoSampleDecomp.h.
Referenced by DrawTwoSamplesWithRatios(), RatioCalc(), and SaveTo().
Spectrum ana::TwoSampleDecomp::fSecondSig |
Spectrum for second sample, signal.
Definition at line 97 of file TwoSampleDecomp.h.
Referenced by DrawTwoSamplesWithRatios(), RatioCalc(), and SaveTo().
|
mutable |
Decomposed spectrum of signal events.
Definition at line 107 of file TwoSampleDecomp.h.
Referenced by Decomp(), DrawSigBkgOverlay(), NumuComponent(), and SaveTo().
|
mutable |
Ratio of second/first spectra for signal.
Definition at line 111 of file TwoSampleDecomp.h.
Referenced by Decomp(), DrawRatios(), and RatioCalc().
Spectrum ana::TwoSampleDecomp::fTrueBkg |
True backgroundh spectrum.
Definition at line 102 of file TwoSampleDecomp.h.
Referenced by DrawSigBkgOverlay(), and SaveTo().
Spectrum ana::TwoSampleDecomp::fTrueSig |
True signal spectrum.
Definition at line 101 of file TwoSampleDecomp.h.
Referenced by DrawSigBkgOverlay(), and SaveTo().