7 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
16 : fPSetName(psetName), fPSetIdx(-1), fUnivIdx(univIdx)
23 if(sr->truth.index < 0)
return 1;
30 const caf::Proxy<std::vector<caf::SRMultiverse>>& wgts = sr->truth.wgt;
31 if(wgts.empty())
return 1;
33 const int Nwgts = wgts[
fPSetIdx].univ.size();
35 static bool once =
true;
38 std::cout <<
"UniverseWeight: WARNING requesting universe " <<
fUnivIdx <<
" in parameter set " <<
fPSetName <<
" which only has size " << Nwgts <<
". Will wrap-around and suppress future warnings." << std::endl;
41 const unsigned int unividx =
fUnivIdx % Nwgts;
48 :
ISyst(systName, systName),
56 if(sr->truth.index < 0)
return;
60 const caf::Proxy<std::vector<caf::SRMultiverse>>& wgts = sr->truth.wgt;
61 if(wgts.empty())
return;
66 if(u.
w0 != 0) y += u.
w0 * wgts[
fIdx].univ[u.
i0];
67 if(u.
w1 != 0) y += u.
w1 * wgts[
fIdx].univ[u.
i1];
76 if(it !=
fUnivs.end())
return it->second;
97 u.w0 = (x1-
x)/(x1-x0);
98 u.w1 = (x-x0)/(x1-x0);
105 if(u.i0 == -1){u.i0 = u.i1; u.w0 = u.w1 = 0.5;}
106 if(u.i1 == -1){u.i1 = u.i0; u.w0 = u.w1 = 0.5;}
139 "NonRESBGvbarnCC1pi",
140 "NonRESBGvbarnCC2pi",
141 "NonRESBGvbarnNC1pi",
142 "NonRESBGvbarnNC2pi",
143 "NonRESBGvbarpCC1pi",
144 "NonRESBGvbarpCC2pi",
145 "NonRESBGvbarpNC1pi",
146 "NonRESBGvbarpNC2pi",
161 static std::vector<const ISyst*> ret;
162 if(!ret.empty())
return ret;
190 static std::vector<const ISyst*> ret;
191 if(!ret.empty())
return ret;
202 static std::vector<const ISyst*> ret;
206 ret.reserve(g.size()+f.size());
207 ret.insert(ret.end(), g.begin(), g.end());
208 ret.insert(ret.end(), f.begin(), f.end());
unsigned int SystIndex(const std::string &name) const
Which index in the weights array corresponds to the shifting of just this syst (in any parameter set)...
process_name opflash particleana ie x
double operator()(const caf::SRSliceProxy *sr) const
const std::vector< const ISyst * > & GetSBNBoosterFluxWeightSysts()
void Shift(double x, caf::SRSliceProxy *sr, double &weight) const override
Perform the systematic shift.
UniverseWeight(const std::string &psetName, int univIdx)
process_name opflashCryoW ana
std::unordered_map< double, Univs > fUnivs
static UniverseOracle & Instance()
Encapsulate code to systematically shift a caf::StandardRecord.
caf::Proxy< caf::SRSlice > SRSliceProxy
virtual std::string ShortName() const final
The name printed out to the screen.
process_name opflash particleana ie ie y
SBNWeightSyst(const std::string &systName)
const std::vector< const ISyst * > & GetSBNGenieWeightSysts()
std::vector< std::string > GetSBNBoosterFluxWeightNames()
Univs GetUnivs(double x) const
unsigned int ParameterSetIndex(const std::string &name) const
Which index in the weights array corresponds to this parameter set?
const std::vector< const ISyst * > & GetSBNWeightSysts()
unsigned int ClosestShiftIndex(const std::string &name, double shift, ESide side=ESide::kEither, double *trueShift=0) const
Within that entry, which index corresponds most closely to 'shift'?
std::vector< std::string > GetSBNGenieWeightNames()
BEGIN_PROLOG could also be cout