32 using namespace genie;
33 using namespace genie::utils;
34 using namespace genie::constants;
47 LOG(
"CascadeReweight",
pERROR) <<
"** Null input!";
61 TIter event_iter(&event);
62 double total_weight = 1.;
63 while ((p = dynamic_cast<GHepParticle *>(event_iter.Next()))) {
77 int pdg_target = p->
Pdg();
78 const auto weight_it = (map_it->second).find(pdg_target);
79 if (weight_it != (map_it->second).end()) {
80 total_weight *= weight_it->second;
87 total_weight *= def_it->second;
105 bool good_config =
true;
115 for (map<INukeFateHN_t, string>::iterator it_keys =
116 EINukeFate_map_keys.begin();
117 it_keys != EINukeFate_map_keys.end(); it_keys++) {
119 std::string to_find_def =
120 "CascadeReweight-Default-Weight-" + (it_keys->second);
123 for (
auto kiter = kdef_list.begin(); kiter != kdef_list.end(); ++kiter) {
124 const RgKey &key = *kiter;
130 <<
"The weight assigned to " << to_find_def <<
" is not positive";
138 std::string to_find_pdg =
139 "CascadeReweight-Weight-" + (it_keys->second) +
"@Pdg=";
141 std::map<int, double> WeightMap;
142 for (
auto kiter = kpdg_list.begin(); kiter != kpdg_list.end(); ++kiter) {
143 const RgKey &key = *kiter;
145 assert(kv.size() == 2);
146 int pdg_target = stoi(kv[1]);
149 <<
"The target Pdg code associated to " << to_find_pdg
150 <<
" is not valid : " << pdg_target;
159 <<
"The weight assigned to " << to_find_pdg <<
" is not positive";
164 WeightMap.insert(std::pair<int, double>(pdg_target, weight));
171 LOG(
"CascadeReweight",
pFATAL) <<
"Configuration has failed.";
int RescatterCode(void) const
virtual void SetWeight(double wght)
void ProcessEventRecord(GHepRecord *event_rec) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
GHepStatus_t Status(void) const
virtual const Registry & GetConfig(void) const
RgKeyList FindKeys(RgKey key_part) const
create list with all keys containing 'key_part'
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
enum genie::EINukeFateHN_t INukeFateHN_t
std::map< INukeFateHN_t, map< int, double > > fFateWeightsMap
virtual void Configure(const Registry &config)
void Configure(const Registry &config)
static const std::map< INukeFateHN_t, string > & GetEINukeFateKeysMap(void)
static PDGLibrary * Instance(void)
vector< string > Split(string input, string delim)
double GetEventWeight(const GHepRecord &ev) const
get weight from fate and configuration
A registry. Provides the container for algorithm configuration parameters.
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
void LoadConfig(void)
read configuration from xml file
std::map< INukeFateHN_t, double > fDefaultMap
GENIE's GHEP MC event record.
STDHEP-like event record entry that can fit a particle or a nucleus.