5 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
20 for(
int i = 0; i < 2; ++i)
21 for(
int j = 0; j < 2; ++j)
22 for(
int k = 0;
k < 2; ++
k)
29 if(slc->truth.index < 0)
return;
32 if(slc->truth.baseline < 500){
33 std::cout <<
"Using NuMIFluxSyst on what appears not to be an icarus file (baseline = " << slc->truth.baseline <<
")!" << std::endl;
38 const char* sbndata = getenv(
"SBNDATA_DIR");
40 std::cout <<
"NuMIFluxSysts: $SBNDATA_DIR environment variable not set. Please setup the sbndata product." << std::endl;
44 const std::string
fname = std::string(sbndata)+
"/beamData/NuMIdata/icarus_numi_flux_syst_ana.root";
45 TFile f(fname.c_str());
47 std::cout <<
"NuMIFluxSysts: Failed to open " << fname << std::endl;
51 for(
int hcIdx: {0, 1}){
52 for(
int flavIdx: {0, 1}){
53 for(
int signIdx: {0, 1}){
55 if(hcIdx == 0) hName +=
"_fhc";
else hName +=
"_rhc";
56 if(flavIdx == 0) hName +=
"_nue";
else hName +=
"_numu";
57 if(signIdx == 1) hName +=
"bar";
59 TH1*
h = (TH1*)f.Get(hName.c_str());
61 std::cout <<
"NuMIFluxSysts: failed to find " << hName <<
" in " << f.GetName() << std::endl;
67 fScale[hcIdx][flavIdx][signIdx] =
h;
73 const int flav =
abs(slc->truth.initpdg);
74 if(flav != 12 && flav != 14)
return;
77 const int flavIdx = (flav == 12) ? 0 : 1;
78 const int signIdx = (slc->truth.initpdg > 0) ? 0 : 1;
80 TH1*
h =
fScale[hcIdx][flavIdx][signIdx];
83 const int bin = h->FindBin(slc->truth.E);
85 if(bin == 0 || bin == h->GetNbinsX()+1)
return;
87 weight *= 1 + sigma*h->GetBinContent(bin);
92 const std::string& prefix,
93 const std::string&
name)
96 static std::map<std::string, const NuMIFluxSyst*> cache;
98 const std::string key = dir+
"/"+prefix+
name;
99 if(cache.count(key) == 0) cache[key] =
new NuMIFluxSyst(dir, prefix, name);
107 const std::vector<std::string> syst_names =
120 std::vector<const ISyst*> ret;
121 for(std::string
name: syst_names)
122 ret.push_back(
GetNuMIFluxSyst(
"fractional_uncertainties/hadron_production",
"hfrac_",
name));
129 const std::vector<std::string> syst_names =
142 std::vector<const ISyst*> ret;
143 for(std::string
name: syst_names)
151 std::vector<const ISyst*> ret;
152 for(
unsigned int i = 0; i < Npcs; ++i){
164 ret.insert(ret.end(), add.begin(), add.end());
std::vector< const ISyst * > GetNuMIHadronProductionFluxSysts()
These are envelopes not real systs. TODO make clearer in naming.
process_name opflashCryoW ana
caf::Proxy< caf::SRSlice > SRSliceProxy
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
const NuMIFluxSyst * GetNuMIFluxSyst(const std::string &dir, const std::string &prefix, const std::string &name)
std::vector< const ISyst * > GetAllNuMIFluxSysts(unsigned int Npcs)
Combination of all beamline systs plus Npcs hadron production components.
std::vector< const ISyst * > GetNuMIPCAFluxSysts(unsigned int Npcs)
void Shift(double sigma, caf::SRSliceProxy *slc, double &weight) const override
Perform the systematic shift.
std::vector< const ISyst * > GetNuMIBeamlineFluxSysts()
std::string to_string(WindowPattern const &pattern)
std::string UniqueName()
Return a different string each time, for creating histograms.
BEGIN_PROLOG could also be cout