Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::rew::GReWeight Class Reference

Interface to the GENIE event reweighting engines. More...

#include <GReWeight.h>

Public Member Functions

 GReWeight ()
 
 ~GReWeight ()
 
void AdoptWghtCalc (string name, GReWeightI *wcalc)
 add concrete weight calculator, transfers ownership More...
 
GReWeightIWghtCalc (string name)
 access a weight calculator by name More...
 
GSystSetSystematics (void)
 set of enabled systematic params & values More...
 
void Reconfigure (void)
 reconfigure weight calculators with new params More...
 
double CalcWeight (const genie::EventRecord &event)
 calculate weight for input event More...
 
void Print (void)
 print More...
 

Private Member Functions

void CleanUp (void)
 

Private Attributes

GSystSet fSystSet
 set of enabled nuisance parameters More...
 
map< string, GReWeightI * > fWghtCalc
 concrete weight calculators More...
 

Detailed Description

Interface to the GENIE event reweighting engines.

Author
Jim Dobson <J.Dobson07 imperial.ac.uk> Imperial College London

Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

Aug 1, 2009

Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 40 of file GReWeight.h.

Constructor & Destructor Documentation

GReWeight::GReWeight ( )

Definition at line 43 of file GReWeight.cxx.

44 {
45  // Disable cacheing that interferes with event reweighting
47 }
static RunOpt * Instance(void)
Definition: RunOpt.cxx:55
void EnableBareXSecPreCalc(bool flag)
Definition: RunOpt.h:55
GReWeight::~GReWeight ( )

Definition at line 49 of file GReWeight.cxx.

50 {
51  this->CleanUp();
52 }

Member Function Documentation

void GReWeight::AdoptWghtCalc ( string  name,
GReWeightI wcalc 
)

add concrete weight calculator, transfers ownership

Definition at line 54 of file GReWeight.cxx.

55 {
56  if(!wcalc) return;
57 
58  fWghtCalc.insert(map<string, GReWeightI*>::value_type(name,wcalc));
59 }
map< string, GReWeightI * > fWghtCalc
concrete weight calculators
Definition: GReWeight.h:58
double GReWeight::CalcWeight ( const genie::EventRecord event)

calculate weight for input event

Definition at line 99 of file GReWeight.cxx.

100 {
101 // calculate weight for all tweaked physics parameters
102 //
103  double weight = 1.0;
105  for( ; it != fWghtCalc.end(); ++it) {
106  GReWeightI * wcalc = it->second;
107  double w = wcalc->CalcWeight(event);
108  LOG("ReW", pNOTICE)
109  << "Calculator: " << it->first << " => wght = " << w;
110  weight *= w;
111  }
112  return weight;
113 }
intermediate_table::iterator iterator
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
map< string, GReWeightI * > fWghtCalc
concrete weight calculators
Definition: GReWeight.h:58
virtual double CalcWeight(const genie::EventRecord &event)=0
calculate a weight for the input event using the current nuisance param values
weight
Definition: test.py:293
#define pNOTICE
Definition: Messenger.h:52
GENIE event reweighting engine ABC.
Definition: GReWeightI.h:31
void GReWeight::CleanUp ( void  )
private

Definition at line 115 of file GReWeight.cxx.

116 {
118  for( ; it != fWghtCalc.end(); ++it) {
119  GReWeightI * rw = it->second;
120  if(rw) {
121  delete rw;
122  rw=0;
123  }
124  }
125  fWghtCalc.clear();
126 }
intermediate_table::iterator iterator
map< string, GReWeightI * > fWghtCalc
concrete weight calculators
Definition: GReWeight.h:58
GENIE event reweighting engine ABC.
Definition: GReWeightI.h:31
void GReWeight::Print ( void  )

print

Definition at line 128 of file GReWeight.cxx.

129 {
130  vector<genie::rew::GSyst_t> syst_vec = this->Systematics().AllIncluded();
131  int vec_size = syst_vec.size();
132 
133  LOG("ReW", pNOTICE) << "Current set of systematic params:";
134  for(int i = 0 ; i < vec_size ; i ++){
135  LOG("ReW", pNOTICE)
136  << " --o " << GSyst::AsString(syst_vec[i])
137  << " is set at " << this->Systematics().Info(syst_vec[i])->CurValue;
138  }
139 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
const GSystInfo * Info(GSyst_t syst) const
Definition: GSystSet.cxx:81
static string AsString(GSyst_t syst)
Definition: GSyst.h:175
#define pNOTICE
Definition: Messenger.h:52
GSystSet & Systematics(void)
set of enabled systematic params & values
Definition: GReWeight.cxx:69
vector< genie::rew::GSyst_t > AllIncluded(void)
Definition: GSystSet.cxx:69
void GReWeight::Reconfigure ( void  )

reconfigure weight calculators with new params

Definition at line 74 of file GReWeight.cxx.

75 {
76  LOG("ReW", pNOTICE) << "Reconfiguring ...";
77 
78  vector<genie::rew::GSyst_t> svec = fSystSet.AllIncluded();
79 
81  for( ; it != fWghtCalc.end(); ++it) {
82 
83  GReWeightI * wcalc = it->second;
84 
85  vector<genie::rew::GSyst_t>::const_iterator parm_iter = svec.begin();
86  for( ; parm_iter != svec.end(); ++parm_iter) {
87  GSyst_t syst = *parm_iter;
88  double val = fSystSet.Info(syst)->CurValue;
89  wcalc->SetSystematic(syst, val);
90  }//params
91 
92  wcalc->Reconfigure();
93 
94  }//weight calculators
95 
96  LOG("ReW", pDEBUG) << "Done reconfiguring";
97 }
intermediate_table::iterator iterator
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
intermediate_table::const_iterator const_iterator
An enumeration of systematic parameters.
map< string, GReWeightI * > fWghtCalc
concrete weight calculators
Definition: GReWeight.h:58
virtual void Reconfigure(void)=0
propagate updated nuisance parameter values to actual MC, etc
GSystSet fSystSet
set of enabled nuisance parameters
Definition: GReWeight.h:57
const GSystInfo * Info(GSyst_t syst) const
Definition: GSystSet.cxx:81
virtual void SetSystematic(GSyst_t syst, double val)=0
update the value for the specified nuisance param
#define pNOTICE
Definition: Messenger.h:52
vector< genie::rew::GSyst_t > AllIncluded(void)
Definition: GSystSet.cxx:69
GENIE event reweighting engine ABC.
Definition: GReWeightI.h:31
#define pDEBUG
Definition: Messenger.h:54
GSystSet & GReWeight::Systematics ( void  )

set of enabled systematic params & values

Definition at line 69 of file GReWeight.cxx.

70 {
71  return fSystSet;
72 }
GSystSet fSystSet
set of enabled nuisance parameters
Definition: GReWeight.h:57
GReWeightI * GReWeight::WghtCalc ( string  name)

access a weight calculator by name

Definition at line 61 of file GReWeight.cxx.

62 {
64  if(iter != fWghtCalc.end()) return iter->second;
65 
66  return 0;
67 }
intermediate_table::iterator iterator
map< string, GReWeightI * > fWghtCalc
concrete weight calculators
Definition: GReWeight.h:58

Member Data Documentation

GSystSet genie::rew::GReWeight::fSystSet
private

set of enabled nuisance parameters

Definition at line 57 of file GReWeight.h.

map<string, GReWeightI *> genie::rew::GReWeight::fWghtCalc
private

concrete weight calculators

Definition at line 58 of file GReWeight.h.


The documentation for this class was generated from the following files: