15 #include "CLHEP/Random/RandGaussQ.h" 98 std::vector<std::string> pars = pset.
get<std::vector<std::string>> (
"parameter_list");
99 std::vector<float> parsigmas = pset.get<std::vector<float>> (
"parameter_sigma");
100 std::string mode = pset.get<std::string>(
"mode");
102 if (pars.size() != parsigmas.size())
104 <<
"::Bad fcl configuration. parameter_list and parameter_sigma need to have same number of parameters." << std::endl;
106 int number_of_multisims = pset.get<
int> (
"number_of_multisims");
108 std::vector<EReweight> erwgh;
109 for (
auto &
s : pars) {
111 else if (
s ==
"NCELeta") erwgh.push_back(
kNCELeta);
112 else if (
s ==
"QEMA") erwgh.push_back(
kQEMA);
113 else if (
s ==
"QEVec") erwgh.push_back(
kQEVec);
114 else if (
s ==
"CCResAxial") erwgh.push_back(
kCCResAxial);
116 else if (
s ==
"ResGanged") erwgh.push_back(
kResGanged);
117 else if (
s ==
"NCResAxial") erwgh.push_back(
kNCResAxial);
119 else if (
s ==
"CohMA") erwgh.push_back(
kCohMA);
120 else if (
s ==
"CohR0") erwgh.push_back(
kCohR0);
128 else if (
s ==
"NC") erwgh.push_back(
kNC);
129 else if (
s ==
"DISAth") erwgh.push_back(
kDISAth);
130 else if (
s ==
"DISBth") erwgh.push_back(
kDISBth);
131 else if (
s ==
"DISCv1u") erwgh.push_back(
kDISCv1u);
132 else if (
s ==
"DISCv2u") erwgh.push_back(
kDISCv2u);
133 else if (
s ==
"DISnucl") erwgh.push_back(
kDISnucl);
134 else if (
s ==
"AGKYxF") erwgh.push_back(
kAGKYxF);
135 else if (
s ==
"AGKYpT") erwgh.push_back(
kAGKYpT);
136 else if (
s ==
"FormZone") erwgh.push_back(
kFormZone);
153 <<
"::Physical process " <<
s <<
" you requested is not available to reweight." << std::endl;
161 std::vector<std::vector<float>> reweightingSigmas(erwgh.size());
163 if (mode.find(
"pm1sigma") != std::string::npos ) {
164 number_of_multisims = 2;
166 for (
unsigned int i = 0; i < reweightingSigmas.size(); ++i) {
167 reweightingSigmas[i].resize(number_of_multisims);
168 for (
int j = 0; j < number_of_multisims; j ++) {
169 if (mode.find(
"multisim") != std::string::npos )
171 else if (mode.find(
"pm1sigma") != std::string::npos )
172 reweightingSigmas[i][j] = (j == 0 ? 1.: -1.);
174 reweightingSigmas[i][j] = parsigmas[i];
180 for (
int weight_point = 0;
181 weight_point < number_of_multisims;
186 for (
unsigned int i_reweightingKnob=0;i_reweightingKnob<erwgh.size();i_reweightingKnob++) {
187 std::cout<<
GetName() <<
"::Setting up rwgh " <<weight_point <<
"\t" << i_reweightingKnob <<
"\t" << erwgh[i_reweightingKnob] << std::endl;
189 switch (erwgh[i_reweightingKnob]){
192 reweightVector[weight_point] -> ReweightNCEL(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
195 reweightVector[weight_point] -> ReweightNCEL(0., reweightingSigmas[i_reweightingKnob][weight_point]);
200 -> ReweightQEMA(reweightingSigmas[i_reweightingKnob][weight_point]);
205 -> ReweightQEVec(reweightingSigmas[i_reweightingKnob][weight_point]);
214 reweightVector[weight_point] -> ReweightCCRes(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
217 reweightVector[weight_point] -> ReweightCCRes(0., reweightingSigmas[i_reweightingKnob][weight_point]);
221 reweightVector[weight_point] -> ReweightNCRes(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
224 reweightVector[weight_point] -> ReweightNCRes(0., reweightingSigmas[i_reweightingKnob][weight_point]);
228 reweightVector[weight_point] -> ReweightCoh(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
231 reweightVector[weight_point] -> ReweightCoh(0., reweightingSigmas[i_reweightingKnob][weight_point]);
237 -> ReweightNonResRvp1pi(reweightingSigmas[i_reweightingKnob][weight_point]);
241 -> ReweightNonResRvbarp1pi(reweightingSigmas[i_reweightingKnob][weight_point]);
245 -> ReweightNonResRvp2pi(reweightingSigmas[i_reweightingKnob][weight_point]);
249 -> ReweightNonResRvbarp2pi(reweightingSigmas[i_reweightingKnob][weight_point]);
253 reweightVector[weight_point] -> ReweightResDecay(reweightingSigmas[i_reweightingKnob][weight_point], 0., 0.);
256 reweightVector[weight_point] -> ReweightResDecay(0., reweightingSigmas[i_reweightingKnob][weight_point], 0.);
259 reweightVector[weight_point] -> ReweightResDecay(0., 0., reweightingSigmas[i_reweightingKnob][weight_point]);
264 -> ReweightNC(reweightingSigmas[i_reweightingKnob][weight_point]);
268 reweightVector[weight_point] -> ReweightDIS(reweightingSigmas[i_reweightingKnob][weight_point], 0., 0., 0.);
271 reweightVector[weight_point] -> ReweightDIS(0., reweightingSigmas[i_reweightingKnob][weight_point], 0., 0.);
274 reweightVector[weight_point] -> ReweightDIS(0., 0., reweightingSigmas[i_reweightingKnob][weight_point], 0.);
277 reweightVector[weight_point] -> ReweightDIS(0., 0., 0., reweightingSigmas[i_reweightingKnob][weight_point]);
282 -> ReweightDISnucl(reweightingSigmas[i_reweightingKnob][weight_point]);
286 reweightVector[weight_point] -> ReweightAGKY(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
289 reweightVector[weight_point] -> ReweightAGKY(0., reweightingSigmas[i_reweightingKnob][weight_point]);
293 reweightVector[weight_point] -> ReweightFormZone(reweightingSigmas[i_reweightingKnob][weight_point]);
297 reweightVector[weight_point] -> ReweightFGM(reweightingSigmas[i_reweightingKnob][weight_point], 0.);
300 reweightVector[weight_point] -> ReweightFGM(0., reweightingSigmas[i_reweightingKnob][weight_point]);
369 std::vector<art::Ptr<simb::MCTruth> > mclist;
372 std::vector<art::Ptr<simb::GTruth > > glist;
376 std::vector<std::vector<double> >
weight(mclist.size());
377 for (
unsigned int inu=0; inu<mclist.size();inu++) {
379 for (
unsigned int i_weight = 0;
#define DECLARE_WEIGHTCALC(wghcalc)
tweak inelastic probability for pions, for given total rescattering probability
tweak absorption probability for nucleons, for given total rescattering probability ...
std::vector< std::vector< double > > GetWeight(art::Event &e)
tweak inelastic probability for nucleons, for given total rescattering probability ...
tweak pion production probability for nucleons, for given total rescattering probability ...
object containing MC flux information
base_engine_t & getEngine() const
tweak elastic probability for nucleons, for given total rescattering probability
CLHEP::RandGaussQ * fGaussRandom
T get(std::string const &key) const
tweak absorption probability for pions, for given total rescattering probability
tweak mean free path for pions
#define REGISTER_WEIGHTCALC(wghcalc)
std::string fGenieModuleLabel
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
void Configure(fhicl::ParameterSet const &pset)
tweak charge exchange probability for nucleons, for given total rescattering probability ...
tweak pion production probability for pions, for given total rescattering probability ...
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
tweak charge exchange probability for pions, for given total rescattering probability ...
tweak mean free path for nucleons
tweak elastic probability for pions, for given total rescattering probability
cet::coded_exception< error, detail::translate > exception
std::vector< rwgt::NuReweight * > reweightVector
Wrapper for reweightings neutrino interactions within the ART framework.