7 #include "TObjString.h" 23 for (
int i = 0;
i <= hbkgd->GetNbinsX();
i++) hbkgd->SetBinContent(
i,0);
25 &&
"Number of kinematic bins given to NumuCC2p2hBkgdEstimator" 26 " does not match number of reconstructed bins in analysis");
29 for (
int kinIdx = 0; kinIdx <
int(
fCompPreds.size()); kinIdx++){
40 double bkgdscale = seed.GetShift(systs[
i]);
41 double bkgdnom =
fCompPreds[kinIdx]->GetSpectra()[
i]->Integral(pot);
42 bkgdsum+=(1+bkgdscale)*bkgdnom;
44 hbkgd->SetBinContent(kinIdx+1, bkgdsum);
56 TDirectory *
tmp = gDirectory;
59 TObjString(
"NumuCC2p2hBkgdEstimator").Write(
"type");
65 nanabins.Write(
"nanabins");
68 fCompPreds[
i]->SaveTo(dir->mkdir((
"fCompPreds_"+idxstr).c_str()));
69 fDatas[
i] ->SaveTo(dir->mkdir((
"fDatas_" +idxstr).c_str()));
76 std::unique_ptr<NumuCC2p2hBkgdEstimator>
80 (dir->GetDirectory(
"fData")).
release();
83 assert(nanabins->GetNoElements()==1 &&
"N MCBkgds is not 1.");
84 std::vector<Spectrum*> datas;
85 std::vector<PredictionScaleComp*>
ps;
87 for (
int i = 0;
i < (*nanabins)[0];
i++){
89 dir->cd((
"fCompPreds_"+idxstr).c_str());
90 ps.push_back(ana::LoadFrom<PredictionScaleComp>(gDirectory).
release());
91 dir->cd((
"fDatas_"+idxstr).c_str());
92 datas.push_back(ana::LoadFrom<Spectrum>(gDirectory).
release());
94 return std::unique_ptr<NumuCC2p2hBkgdEstimator>(
Spectrum Background() const override
const std::vector< Binning > & GetBinnings() const
~NumuCC2p2hBkgdEstimator()
Cuts and Vars for the 2020 FD DiF Study.
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.
Simple record of shifts applied to systematic parameters.
std::vector< PredictionScaleComp * > fCompPreds
Representation of a spectrum in any variable, with associated POT.
const XML_Char const XML_Char * data
void SaveTo(TDirectory *dir) const override
NumuCC2p2hBkgdEstimator(SpectrumLoaderBase &lMC, SpectrumLoaderBase &lDA, const HistAxis axisana, const HistAxis axisfit, const Cut sel, std::vector< Cut > kinsel, std::vector< std::pair< Cut, bool > > bkgdtypes, Cut isSig, const SystShifts &shiftmc=kNoShift, const SystShifts &shiftda=kNoShift, const Var &weimc=kUnweighted, const Var &weida=kUnweighted)
void SaveTo(TDirectory *dir, const std::string &name) const
void GetSpectra(IPrediction *pred, osc::IOscCalc *calc, TH1 *&hSig, TH1 *&hNC, TH1 *&hCC, TH1 *&hBeam, TH1 *&hTotBkg)
std::vector< Spectrum * > fDatas
assert(nhit_max >=nhit_nbins)
static std::unique_ptr< NumuCC2p2hBkgdEstimator > LoadFrom(TDirectory *dir)
std::string to_string(ModuleType mt)
const std::vector< std::string > & GetLabels() const
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
Compare a single data spectrum to the MC + cosmics expectation.
Perform MINUIT fits in one or two dimensions.