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

Reweighting GENIE INTRANUKE/hA hadron transport model. More...

#include <GReWeightINuke.h>

Inheritance diagram for genie::rew::GReWeightINuke:
genie::rew::GReWeightI

Public Member Functions

 GReWeightINuke ()
 
 ~GReWeightINuke ()
 
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...
 
- Public Member Functions inherited from genie::rew::GReWeightI
virtual ~GReWeightI ()
 

Private Attributes

GReWeightINukeParams fINukeRwParams
 

Additional Inherited Members

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

Detailed Description

Reweighting GENIE INTRANUKE/hA hadron transport model.

The reweighting code considers two sets of physics changes: Change in the hadron mean free path , i.e. change in the total rescattering probability P_{rescat}. Changes in probabilty for rescattering mode X, given a fixed total rescattering probability P(X | ). X = {elastic, inelastic, charge exchange, pion production, absorption + multi-nucleon knockout}.

Physics changes are considered separately for pions and nucleons. Unitarity is explicitly conserved.

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

Sep 10, 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 51 of file GReWeightINuke.h.

Constructor & Destructor Documentation

GReWeightINuke::GReWeightINuke ( )

Definition at line 56 of file GReWeightINuke.cxx.

56  :
57 GReWeightI()
58 {
59 #ifdef _G_REWEIGHT_INUKE_DEBUG_NTP_
60  fTestFile = new TFile("./intranuke_reweight_test.root","recreate");
61  fTestNtp = new TNtuple("testntp","","pdg:E:mfp_twk_dial:d:d_mfp:fate:interact:w_mfp:w_fate");
62 #endif
63 }
GReWeightINuke::~GReWeightINuke ( )

Definition at line 65 of file GReWeightINuke.cxx.

66 {
67 #ifdef _G_REWEIGHT_INUKE_DEBUG_NTP_
68  assert(fTestFile);
69  assert(fTestNtp);
70  fTestFile->cd();
71  fTestNtp->Write();
72  fTestFile->Close();
73  delete fTestFile;
74  //delete fTestNtp;
75 #endif
76 }

Member Function Documentation

double GReWeightINuke::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 123 of file GReWeightINuke.cxx.

124 {
125  // get the atomic mass number for the hit nucleus
126  GHepParticle * tgt = event.TargetNucleus();
127  if (!tgt) return 1.0;
128  double A = tgt->A();
129  double Z = tgt->Z();
130  if (A<=1) return 1.0;
131  if (Z<=1) return 1.0;
132 
133  double event_weight = 1.0;
134 
135  // Loop over stdhep entries and only calculate weights for particles.
136  // All particles that are not hadrons generated inside the nucleus are given weights of 1.0
137  int ip=-1;
138  GHepParticle * p = 0;
139  TIter event_iter(&event);
140  while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
141  ip++;
142 
143  // Skip particles not rescattered by the actual hadron transport code
144  int pdgc = p->Pdg();
145  bool is_pion = pdg::IsPion (pdgc);
146  bool is_nucleon = pdg::IsNucleon(pdgc);
147  if(!is_pion && !is_nucleon)
148  {
149  continue;
150  }
151 
152  // Skip particles with code other than 'hadron in the nucleus'
153  GHepStatus_t ist = p->Status();
154  if(ist != kIStHadronInTheNucleus)
155  {
156  continue;
157  }
158 
159  // Determine the interaction type for current hadron in nucleus, if any
160  int fsi_code = p->RescatterCode();
161  LOG("ReW", pDEBUG)
162  << "Attempting to reweight hadron at position = " << ip
163  << " with PDG code = " << pdgc
164  << " and FSI code = " << fsi_code
165  << " (" << INukeHadroFates::AsString((INukeFateHA_t)fsi_code) << ")";
166  if(fsi_code == -1 || fsi_code == (int)kIHAFtUndefined) {
167  LOG("ReW", pFATAL) << "INTRANUKE didn't set a valid rescattering code for event in position: " << ip;
168  LOG("ReW", pFATAL) << "Here is the problematic event:";
169  LOG("ReW", pFATAL) << event;
170  exit(1);
171  }
172  bool escaped = (fsi_code == (int)kIHAFtNoInteraction);
173  bool interacted = !escaped;
174 
175  // Get 4-momentum and 4-position
176  TLorentzVector x4 (p->Vx(), p->Vy(), p->Vz(), 0. );
177  TLorentzVector p4 (p->Px(), p->Py(), p->Pz(), p->E());
178 
179  // Init current hadron weights
180  double w_mfp = 1.0;
181  double w_fate = 1.0;
182 
183  // Check which weights need to be calculated (only if relevant params were tweaked)
184  bool calc_w_mfp = fINukeRwParams.MeanFreePathParams(pdgc)->IsTweaked();
185  bool calc_w_fate = fINukeRwParams.FateParams(pdgc)->IsTweaked();
186 
187  // Compute weight to account for changes in the total rescattering probability
188  double mfp_scale_factor = 1.;
189  if(calc_w_mfp)
190  {
191  mfp_scale_factor = fINukeRwParams.MeanFreePathParams(pdgc)->ScaleFactor();
192  w_mfp = utils::rew::MeanFreePathWeight(pdgc,x4,p4,A,Z,mfp_scale_factor,interacted);
193  } // calculate mfp weight?
194 
195  // Compute weight to account for changes in relative fractions of reaction channels
196  if(calc_w_fate && interacted)
197  {
198  double fate_fraction_scale_factor =
200  GSyst::INukeFate2GSyst((INukeFateHA_t)fsi_code,pdgc), p4);
201  w_fate = fate_fraction_scale_factor;
202  }
203 
204  // Calculate the current hadron weight
205  double hadron_weight = w_mfp * w_fate;
206 
207  LOG("ReW", pNOTICE)
208  << "Reweighted hadron at position = " << ip
209  << " with PDG code = " << pdgc
210  << ", FSI code = " << fsi_code
211  << " (" << INukeHadroFates::AsString((INukeFateHA_t)fsi_code) << ") :"
212  << " w_mfp = " << w_mfp
213  <<", w_fate = " << w_fate;
214 
215  // Debug info
216 #ifdef _G_REWEIGHT_INUKE_DEBUG_NTP_
217  double d = utils::intranuke::Dist2Exit(x4,p4,A);
218  double d_mfp = utils::intranuke::Dist2ExitMFP(pdgc,x4,p4,A,Z);
219  double Eh = p->E();
220  double iflag = (interacted) ? 1 : 0;
221  fTestNtp->Fill(pdgc, Eh, mfp_scale_factor, d, d_mfp, fsi_code, iflag, w_mfp, w_fate);
222 #endif
223 
224  // Update the current event weight
225  event_weight *= hadron_weight;
226 
227  }//particle loop
228 
229  return event_weight;
230 }
enum genie::EINukeFateHA_t INukeFateHA_t
int Z(void) const
bool IsPion(int pdgc)
Definition: PDGUtils.cxx:296
int RescatterCode(void) const
Definition: GHepParticle.h:66
double E(void) const
Get energy.
Definition: GHepParticle.h:90
MFP * MeanFreePathParams(int pdgc) const
bool IsNucleon(int pdgc)
Definition: PDGUtils.cxx:316
bool IsTweaked(GSyst_t s) const
is included & tweaked to non-def value?
enum genie::EGHepStatus GHepStatus_t
#define pFATAL
Definition: Messenger.h:47
double Dist2ExitMFP(int pdgc, const TLorentzVector &x4, const TLorentzVector &p4, double A, double Z, double NR=3, double R0=1.4)
Distance to exit.
Definition: INukeUtils.cxx:306
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:89
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
double Px(void) const
Get Px.
Definition: GHepParticle.h:87
int Pdg(void) const
Definition: GHepParticle.h:64
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
double MeanFreePathWeight(int pdgc, const TLorentzVector &x4, const TLorentzVector &p4, double A, double Z, double mfp_scale_factor, bool interacted, double nRpi=0.5, double nRnuc=1.0, double NR=3, double R0=1.4)
GReWeightINukeParams fINukeRwParams
p
Definition: test.py:228
static const double A
Definition: Units.h:82
double Dist2Exit(const TLorentzVector &x4, const TLorentzVector &p4, double A, double NR=3, double R0=1.4)
Distance to exit.
Definition: INukeUtils.cxx:279
double Vz(void) const
Get production z.
Definition: GHepParticle.h:95
static string AsString(INukeFateHN_t fate)
double ScaleFactor(void) const
mean free path scale factor = 1 + twk_dial * fractional_err
double ScaleFactor(GSyst_t s, const TLorentzVector &p4) const
see next
double Vy(void) const
Get production y.
Definition: GHepParticle.h:94
int A(void) const
#define pNOTICE
Definition: Messenger.h:52
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
static GSyst_t INukeFate2GSyst(INukeFateHA_t fate, int pdgc)
Definition: GSyst.h:469
double Vx(void) const
Get production x.
Definition: GHepParticle.h:93
#define pDEBUG
Definition: Messenger.h:54
double Py(void) const
Get Py.
Definition: GHepParticle.h:88
bool GReWeightINuke::IsHandled ( GSyst_t  syst)
virtual

does the current weight calculator handle the input nuisance param?

Implements genie::rew::GReWeightI.

Definition at line 78 of file GReWeightINuke.cxx.

79 {
80  bool handle;
81 
82  switch(syst) {
83  case ( kINukeTwkDial_MFP_pi ) :
84  case ( kINukeTwkDial_MFP_N ) :
85  case ( kINukeTwkDial_FrCEx_pi ) :
86  case ( kINukeTwkDial_FrElas_pi ) :
87  case ( kINukeTwkDial_FrInel_pi ) :
88  case ( kINukeTwkDial_FrAbs_pi ) :
89  case ( kINukeTwkDial_FrPiProd_pi ) :
90  case ( kINukeTwkDial_FrCEx_N ) :
91  case ( kINukeTwkDial_FrElas_N ) :
92  case ( kINukeTwkDial_FrInel_N ) :
93  case ( kINukeTwkDial_FrAbs_N ) :
94  case ( kINukeTwkDial_FrPiProd_N ) :
95  handle = true;
96  break;
97 
98  default:
99  handle = false;
100  }
101 
102  return handle;
103 }
tweak inelastic probability for pions, for given total rescattering probability
Definition: GSyst.h:128
tweak elastic probability for pions, for given total rescattering probability
Definition: GSyst.h:127
tweak charge exchange probability for nucleons, for given total rescattering probability ...
Definition: GSyst.h:131
tweak pion production probability for pions, for given total rescattering probability ...
Definition: GSyst.h:130
tweak inelastic probability for nucleons, for given total rescattering probability ...
Definition: GSyst.h:133
tweak absorption probability for nucleons, for given total rescattering probability ...
Definition: GSyst.h:134
tweak absorption probability for pions, for given total rescattering probability
Definition: GSyst.h:129
tweak elastic probability for nucleons, for given total rescattering probability
Definition: GSyst.h:132
tweak mean free path for nucleons
Definition: GSyst.h:125
tweak mean free path for pions
Definition: GSyst.h:124
tweak pion production probability for nucleons, for given total rescattering probability ...
Definition: GSyst.h:135
tweak charge exchange probability for pions, for given total rescattering probability ...
Definition: GSyst.h:126
void GReWeightINuke::Reconfigure ( void  )
virtual

propagate updated nuisance parameter values to actual MC, etc

Implements genie::rew::GReWeightI.

Definition at line 118 of file GReWeightINuke.cxx.

119 {
121 }
GReWeightINukeParams fINukeRwParams
void GReWeightINuke::Reset ( void  )
virtual

set all nuisance parameters to default values

Implements genie::rew::GReWeightI.

Definition at line 112 of file GReWeightINuke.cxx.

113 {
115  this->Reconfigure();
116 }
void Reconfigure(void)
propagate updated nuisance parameter values to actual MC, etc
GReWeightINukeParams fINukeRwParams
void GReWeightINuke::SetSystematic ( GSyst_t  syst,
double  val 
)
virtual

update the value for the specified nuisance param

Implements genie::rew::GReWeightI.

Definition at line 105 of file GReWeightINuke.cxx.

106 {
107  if(this->IsHandled(syst)) {
109  }
110 }
bool IsHandled(GSyst_t syst)
does the current weight calculator handle the input nuisance param?
void SetTwkDial(GSyst_t s, double val)
GReWeightINukeParams fINukeRwParams

Member Data Documentation

GReWeightINukeParams genie::rew::GReWeightINuke::fINukeRwParams
private

Definition at line 66 of file GReWeightINuke.h.


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