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

Reweighting the formation zone model. More...

#include <GReWeightFZone.h>

Inheritance diagram for genie::rew::GReWeightFZone:
genie::rew::GReWeightI

Public Member Functions

 GReWeightFZone ()
 
 ~GReWeightFZone ()
 
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 SetR0 (double R0)
 
void SetNR (double NR)
 
void SetCT0Pion (double ct0)
 
void SetCT0Nucleon (double ct0)
 
void SetK (double k)
 
- Public Member Functions inherited from genie::rew::GReWeightI
virtual ~GReWeightI ()
 

Private Member Functions

void Init (void)
 

Private Attributes

double fFZoneTwkDial
 formation zone tweaking dial More...
 
double fNR
 
double fR0
 
double fct0pion
 
double fct0nucleon
 
double fK
 

Additional Inherited Members

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

Detailed Description

Reweighting the formation zone model.

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 20, 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 33 of file GReWeightFZone.h.

Constructor & Destructor Documentation

GReWeightFZone::GReWeightFZone ( )

Definition at line 42 of file GReWeightFZone.cxx.

42  :
43 GReWeightI()
44 {
45  this->Init();
46 }
GReWeightFZone::~GReWeightFZone ( )

Definition at line 48 of file GReWeightFZone.cxx.

49 {
50 
51 }

Member Function Documentation

double GReWeightFZone::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 87 of file GReWeightFZone.cxx.

88 {
89  // Physics parameter tweaked?
90  bool tweaked = (TMath::Abs(fFZoneTwkDial) > controls::kASmallNum);
91  if(!tweaked) return 1.;
92 
93  // Skip events not involving nuclear targets.
94  GHepParticle * tgt = event.TargetNucleus();
95  if (!tgt) return 1.;
96  double A = tgt->A();
97  double Z = tgt->Z();
98  if (A<=1) return 1.;
99  if (Z<=1) return 1.0;
100 
101 
102  // Skip event if was not DIS scattering.
103  bool is_dis = event.Summary()->ProcInfo().IsDeepInelastic();
104  if(!is_dis) {
105  LOG("ReW", pDEBUG) << "Not a DIS event";
106  return 1.;
107  }
108 
109  //
110  // Calculate event weight.
111  //
112 
113  double event_weight = 1.;
114 
115  // hadronic system 4-/3-momentum
116  TLorentzVector p4hadr = utils::rew::Hadronic4pLAB(event);
117  TVector3 p3hadr = p4hadr.Vect();
118 
119  // vertex
120  assert(event.HitNucleon());
121  const TLorentzVector & vtx = *(event.HitNucleon()->X4());
122 
123  // formation zone: fractional 1sigma err
125  double fracerr = uncertainty->OneSigmaErr(kHadrNuclTwkDial_FormZone);
126 
127  // Loop over particles calculate weights for all primary hadrons inside the nucleus.
128  int ip=-1;
129  GHepParticle * p = 0;
130  TIter event_iter(&event);
131  while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
132  ip++;
133 
134  // Skip particles with code other than 'hadron in the nucleus'
135  GHepStatus_t ist = p->Status();
136  if(ist != kIStHadronInTheNucleus)
137  {
138  continue;
139  }
140  // JIMTODO - Skip if is not a hadron
141  // I am not sure why the above conditional would not catch this out - need to investigate.
142  int pdgc = p->Pdg(); // hadron pdg code
143  if (pdg::IsHadron(pdgc) == false)
144  {
145  continue;
146  }
147 
148  // Determine whether it interacted or not
149  int fsi_code = p->RescatterCode();
150  if(fsi_code == -1 || fsi_code == (int)kIHAFtUndefined) {
151  LOG("ReW", pFATAL) << "INTRANUKE didn't set a valid rescattering code for event in position: " << ip;
152  LOG("ReW", pFATAL) << "Here is the problematic event:";
153  LOG("ReW", pFATAL) << event;
154 // exit(1);
155  fsi_code = kIHAFtNoInteraction;
156  }
157  bool escaped = (fsi_code == (int)kIHAFtNoInteraction);
158  bool interacted = !escaped;
159 
160  LOG("ReW", pDEBUG)
161  << "Attempting to reweight hadron at position = " << ip
162  << " with PDG code = " << pdgc
163  << ". The hadron "
164  << ((interacted) ? "re-interacted" : "did not re-interact");
165 
166  // Default formation zone
167  double m = p->Mass();
168  TLorentzVector * p4 = p->P4();
169 
170  double ct0=0.;
171  pdg::IsNucleon(pdgc) ? ct0=fct0nucleon : ct0=fct0pion;
172  double fz_def = phys::FormationZone(m,*p4,p3hadr,ct0,fK);
173 
174  double fz_scale_factor = (1 + fFZoneTwkDial * fracerr);
175  double fz_twk = fz_def * fz_scale_factor;
176  fz_twk = TMath::Max(0.,fz_twk);
177 
178  LOG("ReW", pDEBUG)
179  << "Formation zone = " << fz_def << " fm (nominal), "
180  << fz_twk << " fm (tweaked) - scale factor = " << fz_scale_factor;
181 
182  // Calculate hadron's position at the end of the formation zone step
183  TVector3 step3v = p4->Vect();
184  step3v.SetMag(fz_def);
185  TLorentzVector step4v(step3v, 0.);
186 
187  TLorentzVector x4 = vtx + step4v;
188  LOG("ReW", pDEBUG) << "Vtx position: "<< print::X4AsString(&vtx);
189  LOG("ReW", pDEBUG) << "Hadron position: "<< print::X4AsString(&x4);
190 
191  // Calculate particle weight
192  double hadron_weight = genie::utils::rew::FZoneWeight(
193  pdgc, vtx, x4, *p4, A, Z, fz_scale_factor, interacted);
194 
195  // Update event weight
196  event_weight *= hadron_weight;
197  }
198 
199  return event_weight;
200 }
double FZoneWeight(int pdgc, const TLorentzVector &vtx, const TLorentzVector &x4, const TLorentzVector &p4, double A, double Z, double fz_scale_factor, bool interacted, double nRpi=0.5, double nRnuc=1.0, double NR=3, double R0=1.4)
static const double m
Definition: Units.h:79
int Z(void) const
int RescatterCode(void) const
Definition: GHepParticle.h:66
double fFZoneTwkDial
formation zone tweaking dial
bool IsNucleon(int pdgc)
Definition: PDGUtils.cxx:316
enum genie::EGHepStatus GHepStatus_t
TLorentzVector Hadronic4pLAB(const EventRecord &event)
#define pFATAL
Definition: Messenger.h:47
double Mass(void) const
Mass that corresponds to the PDG code.
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
double FormationZone(double m, const TLorentzVector &p, const TVector3 &p3hadr, double ct0, double K)
Definition: PhysUtils.cxx:29
double OneSigmaErr(GSyst_t syst, int sign=0) const
int Pdg(void) const
Definition: GHepParticle.h:64
bool IsHadron(int pdgc)
Definition: PDGUtils.cxx:362
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
static const double kASmallNum
Definition: Controls.h:40
p
Definition: test.py:228
static const double A
Definition: Units.h:82
tweak formation zone
Definition: GSyst.h:113
virtual GHepParticle * HitNucleon(void) const
Definition: GHepRecord.cxx:343
static GSystUncertainty * Instance(void)
int A(void) const
string X4AsString(const TLorentzVector *x)
Definition: PrintUtils.cxx:64
TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
#define pDEBUG
Definition: Messenger.h:54
void GReWeightFZone::Init ( void  )
private

Definition at line 202 of file GReWeightFZone.cxx.

203 {
204  fFZoneTwkDial = 0.;
205 
206  this->SetR0 (1.3);//fm
207  this->SetNR (3.);
208  this->SetCT0Pion (0.342);//fm
209  this->SetCT0Nucleon (2.300);//fm
210  this->SetK (0.);
211 }
double fFZoneTwkDial
formation zone tweaking dial
void SetCT0Nucleon(double ct0)
void SetCT0Pion(double ct0)
bool GReWeightFZone::IsHandled ( GSyst_t  syst)
virtual

does the current weight calculator handle the input nuisance param?

Implements genie::rew::GReWeightI.

Definition at line 53 of file GReWeightFZone.cxx.

54 {
55  switch(syst) {
57  return true;
58  break;
59  default:
60  return false;
61  break;
62  }
63  return false;
64 }
tweak formation zone
Definition: GSyst.h:113
void GReWeightFZone::Reconfigure ( void  )
virtual

propagate updated nuisance parameter values to actual MC, etc

Implements genie::rew::GReWeightI.

Definition at line 82 of file GReWeightFZone.cxx.

83 {
84 
85 }
void GReWeightFZone::Reset ( void  )
virtual

set all nuisance parameters to default values

Implements genie::rew::GReWeightI.

Definition at line 77 of file GReWeightFZone.cxx.

78 {
79  fFZoneTwkDial = 0.;
80 }
double fFZoneTwkDial
formation zone tweaking dial
void genie::rew::GReWeightFZone::SetCT0Nucleon ( double  ct0)
inline

Definition at line 51 of file GReWeightFZone.h.

51 { fct0nucleon = ct0; }
void genie::rew::GReWeightFZone::SetCT0Pion ( double  ct0)
inline

Definition at line 50 of file GReWeightFZone.h.

50 { fct0pion = ct0; }
void genie::rew::GReWeightFZone::SetK ( double  k)
inline

Definition at line 52 of file GReWeightFZone.h.

void genie::rew::GReWeightFZone::SetNR ( double  NR)
inline

Definition at line 49 of file GReWeightFZone.h.

49 { fNR = NR; }
void genie::rew::GReWeightFZone::SetR0 ( double  R0)
inline

Definition at line 48 of file GReWeightFZone.h.

48 { fR0 = R0; }
void GReWeightFZone::SetSystematic ( GSyst_t  syst,
double  val 
)
virtual

update the value for the specified nuisance param

Implements genie::rew::GReWeightI.

Definition at line 66 of file GReWeightFZone.cxx.

67 {
68  switch(syst) {
70  fFZoneTwkDial = twk_dial;
71  break;
72  default:
73  return;
74  }
75 }
double fFZoneTwkDial
formation zone tweaking dial
tweak formation zone
Definition: GSyst.h:113

Member Data Documentation

double genie::rew::GReWeightFZone::fct0nucleon
private

Definition at line 63 of file GReWeightFZone.h.

double genie::rew::GReWeightFZone::fct0pion
private

Definition at line 62 of file GReWeightFZone.h.

double genie::rew::GReWeightFZone::fFZoneTwkDial
private

formation zone tweaking dial

Definition at line 58 of file GReWeightFZone.h.

double genie::rew::GReWeightFZone::fK
private

Definition at line 64 of file GReWeightFZone.h.

double genie::rew::GReWeightFZone::fNR
private

Definition at line 60 of file GReWeightFZone.h.

double genie::rew::GReWeightFZone::fR0
private

Definition at line 61 of file GReWeightFZone.h.


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