13 #include "TObjString.h" 21 REGISTER_LOADFROM(
"PredictionSystJointDemo", IPrediction, PredictionSystJointDemo);
27 const std::vector<const ISyst*>&
systs,
35 gROOT->SetMustClean(
false);
42 << (mergePeripheral ?
"true" :
"false") <<
std::endl;
44 std::cout <<
"use FakeNDData predictions is " 45 << (isFakeData ?
"true" :
"false") <<
std::endl;
48 if (extrap ==
kCombo) extrapStr +=
"ComboExtrap";
49 if (extrap ==
kNoExtrap) extrapStr +=
"NoExtrap";
51 if (extrap ==
kFake) extrapStr +=
"PropExtrap";
59 TFile fSyst(fnameSyst.c_str());
74 for(
const ISyst* syst: systs){
95 std::cout <<
"\tLooking at systName " << systName <<
", so pushing back nomLightLevel " <<
std::endl;
102 &fSyst, extrapStr +
"/LightNom/NoShift").
release();
104 &fSyst,
"Nue_NoExtrap/LightNom/NoShift").
release();
107 nomLLCore, nomLLNoExtrap,
true);
109 sp.
preds.push_back(nomLightLevel);
112 sp.
preds.push_back(nom);
118 IPrediction* shCore = ana::LoadFrom<PredictionExtrap> (&fSyst, extrapStr +
"/"+systName + sigmaStr).
release();
119 PredictionNoExtrap* shNoExtrap = ana::LoadFrom<PredictionNoExtrap>(&fSyst,
"Nue_NoExtrap/" + systName + sigmaStr).
release();
145 const std::vector<const ISyst*>&
systs,
150 gROOT->SetMustClean(
false);
157 if (extrap ==
kNuMu) extrapStr +=
"Extrap";
162 if (WhichQuant == -1) VarName =
"Quant0";
164 std::cout <<
"\nLooking at VarName " << VarName <<
" --> Loading nominals now..." <<
std::endl;
166 TFile
fin(fname.c_str());
169 std::string NomVar = extrapStr+VarName+
"/Nominal/NoShift";
173 for(
const ISyst* syst: systs){
177 syst->
ShortName() ==
"RPAShapeRES2018Test" 197 if (systName ==
"Lightlevel" || systName ==
"Cherenkov") {
198 std::cout <<
"\tLooking at systName " << systName <<
", so pushing back nomLightLevel " <<
std::endl;
200 std::string LNomVar = extrapStr+VarName+
"/LightNom/NoShift/"+VarName;
203 sp.
preds.push_back(nomLightLevel);
205 sp.
preds.push_back(nom);
214 auto shCore = ana::LoadFrom<PredictionExtrap> (&
fin, extrapStr + VarName+
"/"+systName + sigmaStr).
release();
215 sp.
preds.push_back(shCore);
244 const double kNormFHC = 0.0144;
245 const double kNormRHC = 0.0064;
262 const std::vector<const ISyst*>&
systs,
266 if(std::find(systs.begin(), systs.end(), syst) == systs.end())
return;
269 const int nBins = h->GetNbinsX();
282 for(
int binIdx = 0; binIdx < nBins+2; ++binIdx){
283 normsp.
fits[
coeff][binIdx].emplace_back(0, 0, frac, 1);
292 fPreds.emplace(syst, normsp);
298 dir = dir->GetDirectory(name.c_str());
301 TObjString*
tag = (TObjString*)dir->Get(
"type");
304 assert(tag->GetString() ==
"PredictionSystJointDemo");
310 const TObjString*
beam = (TObjString*)dir->Get(
"beam");
312 ret->fBeam = beam->GetString();
314 ret->fSplitBySign = ret->IsFHC();
330 TDirectory*
tmp = gDirectory;
332 dir = (TDirectory*)dir->GetDirectory(name.c_str());
335 TObjString(
"PredictionSystJointDemo").Write(
"type");
348 if(sigma == -2)
return "MinusTwo";
349 if(sigma == -1)
return "MinusOne";
350 if(sigma == 0)
return "";
351 if(sigma == +1)
return "PlusOne";
352 if(sigma == +2)
return "PlusTwo";
361 if(
fBeam ==
"fhc" )
return true;
362 if(
fBeam ==
"rhc")
return false;
364 std::cout <<
"PredictionSystJointDemo: Bad beam string: " bool IsFHC() const
Interprets fBeam.
Cuts and Vars for the 2020 FD DiF Study.
std::string systName
What systematic we're interpolating.
Loads shifted spectra from files.
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.
virtual const std::string & ShortName() const final
The name printed out to the screen.
virtual ~PredictionSystJointDemo()
General interface to oscillation calculators.
std::vector< std::vector< std::vector< Coeffs > > > fitsNubar
Will be filled if signs are separated, otherwise not.
void SaveTo(TDirectory *dir, const std::string &name) const override
std::vector< int > GetDummyShifts(const ISyst *s)
Encapsulate code to systematically shift a caf::SRProxy.
std::unique_ptr< IPrediction > fPredNom
The nominal prediction.
const DummyAnaSyst kAnaLightlevelSyst("Lightlevel","Lightlevel")
virtual void SaveTo(TDirectory *dir, const std::string &name) const override
std::string SigmaToString(int sigma) const
const DummyAnaSyst kAnaCherenkovSyst("Cherenkov","Cherenkov")
std::vector< double > shifts
Shift values sampled.
PredictionSystJointDemo()
std::vector< IPrediction * > preds
void AddNormSyst(const ISyst *syst, const std::vector< const ISyst * > &systs, double frac)
double frac(double x)
Fractional part.
const Binning kNue2018Binning
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir, const std::string &label)
double coeff(double W, int m, int l, bool real)
Oscillation probability calculators.
virtual _IOscCalc * Copy() const =0
Spectrum Predict(osc::IOscCalc *calc) const override
const DummyAnaSyst kAna2018NormRHC("NormRHC2018","RHC. Norm.")
static std::unique_ptr< PredictionSystJointDemo > LoadFrom(TDirectory *dir, const std::string &name)
REGISTER_LOADFROM("BENDecomp", IDecomp, BENDecomp)
assert(nhit_max >=nhit_nbins)
Standard interface to all prediction techniques.
std::string to_string(ModuleType mt)
std::unordered_map< const ISyst *, ShiftedPreds > fPreds
osc::IOscCalc * fOscOrigin
The oscillation values we assume when evaluating the coefficients.
static void LoadFromBody(TDirectory *dir, PredictionInterp *ret, std::vector< const ISyst * > veto={})
const DummyAnaSyst kAna2018NormFHC("NormFHC2018","FHC. Norm.")
void AddNormSysts(const std::vector< const ISyst * > &systs)
Must set fBeam first.
std::vector< std::vector< std::vector< Coeffs > > > fits
Indices: [type][histogram bin][shift bin].