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

Reweight GENIE CC resonance neutrino-production. More...

#include <GReWeightNuXSecCCRES.h>

Inheritance diagram for genie::rew::GReWeightNuXSecCCRES:
genie::rew::GReWeightI

Public Member Functions

 GReWeightNuXSecCCRES ()
 
 ~GReWeightNuXSecCCRES ()
 
bool IsHandled (GSyst_t syst)
 does the current weight calculator handle the input nuisance param? More...
 
void SetSystematic (GSyst_t syst, double val)
 update the value for the specified nuisance param More...
 
void Reset (void)
 set all nuisance parameters to default values More...
 
void Reconfigure (void)
 propagate updated nuisance parameter values to actual MC, etc More...
 
double CalcWeight (const EventRecord &event)
 calculate a weight for the input event using the current nuisance param values More...
 
void SetMode (int mode)
 
void SetMaPath (string p)
 
void SetMvPath (string p)
 
void RewNue (bool tf)
 
void RewNuebar (bool tf)
 
void RewNumu (bool tf)
 
void RewNumubar (bool tf)
 
- Public Member Functions inherited from genie::rew::GReWeightI
virtual ~GReWeightI ()
 

Static Public Attributes

static const int kModeMaMv = 0
 
static const int kModeNormAndMaMvShape = 1
 

Private Member Functions

void Init (void)
 
double CalcWeightNorm (const EventRecord &event)
 
double CalcWeightMaMvShape (const EventRecord &event)
 
double CalcWeightMaMv (const EventRecord &event)
 

Private Attributes

XSecAlgorithmIfXSecModelDef
 default model More...
 
XSecAlgorithmIfXSecModel
 tweaked model More...
 
RegistryfXSecModelConfig
 config in tweaked model More...
 
int fMode
 0: Ma/Mv, 1: Norm and MaShape/MvShape More...
 
string fMaPath
 M_{A} path in configuration. More...
 
string fMvPath
 M_{V} path in configuration. More...
 
bool fRewNue
 reweight nu_e CC? More...
 
bool fRewNuebar
 reweight nu_e_bar CC? More...
 
bool fRewNumu
 reweight nu_mu CC? More...
 
bool fRewNumubar
 reweight nu_mu_bar CC? More...
 
double fNormTwkDial
 
double fNormDef
 
double fNormCurr
 
double fMaTwkDial
 
double fMaDef
 
double fMaCurr
 
double fMvTwkDial
 
double fMvDef
 
double fMvCurr
 

Additional Inherited Members

- Protected Member Functions inherited from genie::rew::GReWeightI
 GReWeightI ()
 

Detailed Description

Reweight GENIE CC resonance neutrino-production.

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

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

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 45 of file GReWeightNuXSecCCRES.h.

Constructor & Destructor Documentation

GReWeightNuXSecCCRES::GReWeightNuXSecCCRES ( )

Definition at line 56 of file GReWeightNuXSecCCRES.cxx.

57 {
58  this->Init();
59 }
GReWeightNuXSecCCRES::~GReWeightNuXSecCCRES ( )

Definition at line 61 of file GReWeightNuXSecCCRES.cxx.

62 {
63 #ifdef _G_REWEIGHT_CCRES_DEBUG_
64  fTestFile->cd();
65  fTestNtp ->Write();
66  fTestFile->Close();
67  delete fTestFile;
68 #endif
69 }

Member Function Documentation

double GReWeightNuXSecCCRES::CalcWeight ( const EventRecord event)
virtual

calculate a weight for the input event using the current nuisance param values

Implements genie::rew::GReWeightI.

Definition at line 170 of file GReWeightNuXSecCCRES.cxx.

171 {
172  bool is_res = event.Summary()->ProcInfo().IsResonant();
173  bool is_cc = event.Summary()->ProcInfo().IsWeakCC();
174  if(!is_res || !is_cc) return 1.;
175 
176  int nupdg = event.Probe()->Pdg();
177  if(nupdg==kPdgNuMu && !fRewNumu ) return 1.;
178  if(nupdg==kPdgAntiNuMu && !fRewNumubar) return 1.;
179  if(nupdg==kPdgNuE && !fRewNue ) return 1.;
180  if(nupdg==kPdgAntiNuE && !fRewNuebar ) return 1.;
181 
182  if(fMode==kModeMaMv) {
183  double wght = this->CalcWeightMaMv(event);
184  return wght;
185  }
186  else
188  double wght =
189  this->CalcWeightNorm (event) *
190  this->CalcWeightMaMvShape (event);
191  return wght;
192  }
193 
194  return 1.;
195 }
const int kPdgNuE
Definition: PDGCodes.h:25
double CalcWeightMaMv(const EventRecord &event)
const int kPdgAntiNuE
Definition: PDGCodes.h:26
const int kPdgNuMu
Definition: PDGCodes.h:27
const int kPdgAntiNuMu
Definition: PDGCodes.h:28
bool fRewNuebar
reweight nu_e_bar CC?
double CalcWeightMaMvShape(const EventRecord &event)
int fMode
0: Ma/Mv, 1: Norm and MaShape/MvShape
bool fRewNumubar
reweight nu_mu_bar CC?
double CalcWeightNorm(const EventRecord &event)
double GReWeightNuXSecCCRES::CalcWeightMaMv ( const EventRecord event)
private

Definition at line 249 of file GReWeightNuXSecCCRES.cxx.

250 {
251  bool tweaked =
252  (TMath::Abs(fMaTwkDial) > controls::kASmallNum) ||
253  (TMath::Abs(fMvTwkDial) > controls::kASmallNum);
254  if(!tweaked) return 1.0;
255 
256  Interaction * interaction = event.Summary();
257 
258  interaction->KinePtr()->UseSelectedKinematics();
259 
260  double old_xsec = event.DiffXSec();
261  double old_weight = event.Weight();
262  double new_xsec = fXSecModel->XSec(interaction, kPSWQ2fE);
263  double new_weight = old_weight * (new_xsec/old_xsec);
264 
265  interaction->KinePtr()->ClearRunningValues();
266 
267  return new_weight;
268 }
Kinematics * KinePtr(void) const
Definition: Interaction.h:73
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
Summary information for an interaction.
Definition: Interaction.h:53
void UseSelectedKinematics(void)
Definition: Kinematics.cxx:369
static const double kASmallNum
Definition: Controls.h:40
void ClearRunningValues(void)
Definition: Kinematics.cxx:357
XSecAlgorithmI * fXSecModel
tweaked model
double GReWeightNuXSecCCRES::CalcWeightMaMvShape ( const EventRecord event)
private

Definition at line 270 of file GReWeightNuXSecCCRES.cxx.

271 {
272  bool tweaked =
273  (TMath::Abs(fMaTwkDial) > controls::kASmallNum) ||
274  (TMath::Abs(fMvTwkDial) > controls::kASmallNum);
275  if(!tweaked) return 1.0;
276 
277  Interaction * interaction = event.Summary();
278 
279  interaction->KinePtr()->UseSelectedKinematics();
280 
281  double old_xsec = event.DiffXSec();
282  double old_weight = event.Weight();
283  double new_xsec = fXSecModel->XSec(interaction, kPSWQ2fE);
284  double new_weight = old_weight * (new_xsec/old_xsec);
285 
286 //LOG("ReW", pDEBUG) << "differential cross section (old) = " << old_xsec;
287 //LOG("ReW", pDEBUG) << "differential cross section (new) = " << new_xsec;
288 //LOG("ReW", pDEBUG) << "event generation weight = " << old_weight;
289 //LOG("ReW", pDEBUG) << "new weight = " << new_weight;
290 
291 //double old_integrated_xsec = event.XSec();
292  double old_integrated_xsec = fXSecModelDef -> Integral(interaction);
293  double twk_integrated_xsec = fXSecModel -> Integral(interaction);
294  assert(twk_integrated_xsec > 0);
295  new_weight *= (old_integrated_xsec/twk_integrated_xsec);
296 
297 //LOG("ReW", pDEBUG) << "integrated cross section (old) = " << old_integrated_xsec;
298 //LOG("ReW", pDEBUG) << "integrated cross section (twk) = " << twk_integrated_xsec;
299 //LOG("ReW", pDEBUG) << "new weight (normalized to const integral) = " << new_weight;
300 
301  interaction->KinePtr()->ClearRunningValues();
302 
303 #ifdef _G_REWEIGHT_CCRES_DEBUG_
304  double E = interaction->InitState().ProbeE(kRfHitNucRest);
305  double Q2 = interaction->Kine().Q2(true);
306  double W = interaction->Kine().W(true);
307  fTestNtp->Fill(E,Q2,W,new_weight);
308 #endif
309 
310  return new_weight;
311 }
double W(bool selected=false) const
Definition: Kinematics.cxx:167
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:642
Kinematics * KinePtr(void) const
Definition: Interaction.h:73
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
XSecAlgorithmI * fXSecModelDef
default model
Summary information for an interaction.
Definition: Interaction.h:53
void UseSelectedKinematics(void)
Definition: Kinematics.cxx:369
const Kinematics & Kine(void) const
Definition: Interaction.h:68
static const double kASmallNum
Definition: Controls.h:40
const InitialState & InitState(void) const
Definition: Interaction.h:66
double Q2(bool selected=false) const
Definition: Kinematics.cxx:135
void ClearRunningValues(void)
Definition: Kinematics.cxx:357
double ProbeE(RefFrame_t rf) const
XSecAlgorithmI * fXSecModel
tweaked model
double GReWeightNuXSecCCRES::CalcWeightNorm ( const EventRecord event)
private

Definition at line 240 of file GReWeightNuXSecCCRES.cxx.

241 {
242  bool tweaked = (TMath::Abs(fNormTwkDial) > controls::kASmallNum);
243  if(!tweaked) return 1.0;
244 
245  double wght = fNormCurr;
246  return wght;
247 }
static const double kASmallNum
Definition: Controls.h:40
void GReWeightNuXSecCCRES::Init ( void  )
private

Definition at line 197 of file GReWeightNuXSecCCRES.cxx.

198 {
199  AlgId id("genie::ReinSehgalRESPXSec","Default");
200 
201  AlgFactory * algf = AlgFactory::Instance();
202 
203  Algorithm * algdef = algf->AdoptAlgorithm(id);
204  fXSecModelDef = dynamic_cast<XSecAlgorithmI*>(algdef);
206 
207  Algorithm * alg = algf->AdoptAlgorithm(id);
208  fXSecModel = dynamic_cast<XSecAlgorithmI*>(alg);
210 
212 //LOG("ReW", pNOTICE) << *fXSecModelConfig;
213 
215 
216  this->RewNue (true);
217  this->RewNuebar (true);
218  this->RewNumu (true);
219  this->RewNumubar(true);
220 
221  this->SetMaPath("Ma");
222  this->SetMvPath("Mv");
223 
224  fNormTwkDial = 0.;
225  fNormDef = 1.;
227  fMaTwkDial = 0.;
229  fMaCurr = fMaDef;
230  fMvTwkDial = 0.;
232  fMvCurr = fMvDef;
233 
234 #ifdef _G_REWEIGHT_CCRES_DEBUG_
235  fTestFile = new TFile("./ccres_reweight_test.root","recreate");
236  fTestNtp = new TNtupleD("testntp","","E:Q2:W:wght");
237 #endif
238 }
virtual const Registry & GetConfig(void) const
Get configuration registry.
Definition: Algorithm.h:63
Cross Section Calculation Interface.
Registry * fXSecModelConfig
config in tweaked model
Algorithm abstract base class.
Definition: Algorithm.h:48
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:488
XSecAlgorithmI * fXSecModelDef
default model
void AdoptSubstructure(void)
Definition: Algorithm.cxx:287
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Definition: AlgFactory.cxx:127
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:35
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
string fMvPath
M_{V} path in configuration.
string fMaPath
M_{A} path in configuration.
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
XSecAlgorithmI * fXSecModel
tweaked model
bool GReWeightNuXSecCCRES::IsHandled ( GSyst_t  syst)
virtual

does the current weight calculator handle the input nuisance param?

Implements genie::rew::GReWeightI.

Definition at line 71 of file GReWeightNuXSecCCRES.cxx.

72 {
73  bool handle;
74 
75  switch(syst) {
76 
77  case ( kXSecTwkDial_NormCCRES ) :
78  case ( kXSecTwkDial_MaCCRESshape ) :
79  case ( kXSecTwkDial_MvCCRESshape ) :
81  handle = true;
82  } else {
83  handle = false;
84  }
85  break;
86 
87  case ( kXSecTwkDial_MaCCRES ) :
88  case ( kXSecTwkDial_MvCCRES ) :
89  if(fMode==kModeMaMv) {
90  handle = true;
91  } else {
92  handle = false;
93  }
94  break;
95 
96  default:
97  handle = false;
98  break;
99  }
100 
101  return handle;
102 }
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:59
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:57
tweak CCRES normalization
Definition: GSyst.h:55
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:58
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:56
int fMode
0: Ma/Mv, 1: Norm and MaShape/MvShape
void GReWeightNuXSecCCRES::Reconfigure ( void  )
virtual

propagate updated nuisance parameter values to actual MC, etc

Implements genie::rew::GReWeightI.

Definition at line 137 of file GReWeightNuXSecCCRES.cxx.

138 {
140 
141  if(fMode==kModeMaMv) {
142  double fracerr_ma = fracerr->OneSigmaErr(kXSecTwkDial_MaCCRES);
143  double fracerr_mv = fracerr->OneSigmaErr(kXSecTwkDial_MvCCRES);
144  fMaCurr = fMaDef * (1. + fMaTwkDial * fracerr_ma);
145  fMvCurr = fMvDef * (1. + fMvTwkDial * fracerr_mv);
146  }
147  else
149  double fracerr_norm = fracerr->OneSigmaErr(kXSecTwkDial_NormCCRES);
150  double fracerr_mash = fracerr->OneSigmaErr(kXSecTwkDial_MaCCRESshape);
151  double fracerr_mvsh = fracerr->OneSigmaErr(kXSecTwkDial_MvCCRESshape);
152  fNormCurr = fNormDef * (1. + fNormTwkDial * fracerr_norm);
153  fMaCurr = fMaDef * (1. + fMaTwkDial * fracerr_mash);
154  fMvCurr = fMvDef * (1. + fMvTwkDial * fracerr_mvsh);
155  }
156 
157  fNormCurr = TMath::Max(0., fNormCurr);
158  fMaCurr = TMath::Max(0., fMaCurr );
159  fMvCurr = TMath::Max(0., fMvCurr );
160 
162 
163  r.Set(fMaPath, fMaCurr);
164  r.Set(fMvPath, fMvCurr);
165  fXSecModel->Configure(r);
166 
167 //LOG("ReW, pDEBUG) << *fXSecModel;
168 }
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:59
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:57
Registry * fXSecModelConfig
config in tweaked model
double OneSigmaErr(GSyst_t syst, int sign=0) const
virtual void Configure(const Registry &config)
Configure the algorithm.
Definition: Algorithm.cxx:70
tweak CCRES normalization
Definition: GSyst.h:55
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:58
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
string fMvPath
M_{V} path in configuration.
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:56
string fMaPath
M_{A} path in configuration.
int fMode
0: Ma/Mv, 1: Norm and MaShape/MvShape
static GSystUncertainty * Instance(void)
void Set(RgIMapPair entry)
Definition: Registry.cxx:281
XSecAlgorithmI * fXSecModel
tweaked model
void GReWeightNuXSecCCRES::Reset ( void  )
virtual

set all nuisance parameters to default values

Implements genie::rew::GReWeightI.

Definition at line 125 of file GReWeightNuXSecCCRES.cxx.

void genie::rew::GReWeightNuXSecCCRES::RewNue ( bool  tf)
inline

Definition at line 65 of file GReWeightNuXSecCCRES.h.

65 { fRewNue = tf; }
Definition: tf_graph.h:23
void genie::rew::GReWeightNuXSecCCRES::RewNuebar ( bool  tf)
inline

Definition at line 66 of file GReWeightNuXSecCCRES.h.

66 { fRewNuebar = tf; }
Definition: tf_graph.h:23
bool fRewNuebar
reweight nu_e_bar CC?
void genie::rew::GReWeightNuXSecCCRES::RewNumu ( bool  tf)
inline

Definition at line 67 of file GReWeightNuXSecCCRES.h.

67 { fRewNumu = tf; }
Definition: tf_graph.h:23
void genie::rew::GReWeightNuXSecCCRES::RewNumubar ( bool  tf)
inline

Definition at line 68 of file GReWeightNuXSecCCRES.h.

68 { fRewNumubar = tf; }
Definition: tf_graph.h:23
bool fRewNumubar
reweight nu_mu_bar CC?
void genie::rew::GReWeightNuXSecCCRES::SetMaPath ( string  p)
inline

Definition at line 63 of file GReWeightNuXSecCCRES.h.

63 { fMaPath = p; }
p
Definition: test.py:228
string fMaPath
M_{A} path in configuration.
void genie::rew::GReWeightNuXSecCCRES::SetMode ( int  mode)
inline

Definition at line 62 of file GReWeightNuXSecCCRES.h.

62 { fMode = mode; }
int fMode
0: Ma/Mv, 1: Norm and MaShape/MvShape
void genie::rew::GReWeightNuXSecCCRES::SetMvPath ( string  p)
inline

Definition at line 64 of file GReWeightNuXSecCCRES.h.

64 { fMvPath = p; }
p
Definition: test.py:228
string fMvPath
M_{V} path in configuration.
void GReWeightNuXSecCCRES::SetSystematic ( GSyst_t  syst,
double  val 
)
virtual

update the value for the specified nuisance param

Implements genie::rew::GReWeightI.

Definition at line 104 of file GReWeightNuXSecCCRES.cxx.

105 {
106  if(!this->IsHandled(syst)) return;
107 
108  switch(syst) {
109  case ( kXSecTwkDial_NormCCRES ) :
110  fNormTwkDial = twk_dial;
111  break;
112  case ( kXSecTwkDial_MaCCRESshape ) :
113  case ( kXSecTwkDial_MaCCRES ) :
114  fMaTwkDial = twk_dial;
115  break;
116  case ( kXSecTwkDial_MvCCRESshape ) :
117  case ( kXSecTwkDial_MvCCRES ) :
118  fMvTwkDial = twk_dial;
119  break;
120  default:
121  break;
122  }
123 }
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:59
tweak Mv CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:57
bool IsHandled(GSyst_t syst)
does the current weight calculator handle the input nuisance param?
tweak CCRES normalization
Definition: GSyst.h:55
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 both in shape and normalization
Definition: GSyst.h:58
tweak Ma CCRES, affects d2sigma(CCRES)/dWdQ2 in shape only (normalized to constant integral) ...
Definition: GSyst.h:56

Member Data Documentation

double genie::rew::GReWeightNuXSecCCRES::fMaCurr
private

Definition at line 93 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fMaDef
private

Definition at line 92 of file GReWeightNuXSecCCRES.h.

string genie::rew::GReWeightNuXSecCCRES::fMaPath
private

M_{A} path in configuration.

Definition at line 82 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fMaTwkDial
private

Definition at line 91 of file GReWeightNuXSecCCRES.h.

int genie::rew::GReWeightNuXSecCCRES::fMode
private

0: Ma/Mv, 1: Norm and MaShape/MvShape

Definition at line 81 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fMvCurr
private

Definition at line 96 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fMvDef
private

Definition at line 95 of file GReWeightNuXSecCCRES.h.

string genie::rew::GReWeightNuXSecCCRES::fMvPath
private

M_{V} path in configuration.

Definition at line 83 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fMvTwkDial
private

Definition at line 94 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fNormCurr
private

Definition at line 90 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fNormDef
private

Definition at line 89 of file GReWeightNuXSecCCRES.h.

double genie::rew::GReWeightNuXSecCCRES::fNormTwkDial
private

Definition at line 88 of file GReWeightNuXSecCCRES.h.

bool genie::rew::GReWeightNuXSecCCRES::fRewNue
private

reweight nu_e CC?

Definition at line 84 of file GReWeightNuXSecCCRES.h.

bool genie::rew::GReWeightNuXSecCCRES::fRewNuebar
private

reweight nu_e_bar CC?

Definition at line 85 of file GReWeightNuXSecCCRES.h.

bool genie::rew::GReWeightNuXSecCCRES::fRewNumu
private

reweight nu_mu CC?

Definition at line 86 of file GReWeightNuXSecCCRES.h.

bool genie::rew::GReWeightNuXSecCCRES::fRewNumubar
private

reweight nu_mu_bar CC?

Definition at line 87 of file GReWeightNuXSecCCRES.h.

XSecAlgorithmI* genie::rew::GReWeightNuXSecCCRES::fXSecModel
private

tweaked model

Definition at line 78 of file GReWeightNuXSecCCRES.h.

Registry* genie::rew::GReWeightNuXSecCCRES::fXSecModelConfig
private

config in tweaked model

Definition at line 79 of file GReWeightNuXSecCCRES.h.

XSecAlgorithmI* genie::rew::GReWeightNuXSecCCRES::fXSecModelDef
private

default model

Definition at line 77 of file GReWeightNuXSecCCRES.h.

const int GReWeightNuXSecCCRES::kModeMaMv = 0
static

Definition at line 48 of file GReWeightNuXSecCCRES.h.

const int GReWeightNuXSecCCRES::kModeNormAndMaMvShape = 1
static

Definition at line 49 of file GReWeightNuXSecCCRES.h.


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