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

Computes the Quasi Elastic (QEL) total cross section.
Is a concrete implementation of the XSecIntegratorI interface.
. More...

#include <NewQELXSec.h>

Inheritance diagram for genie::NewQELXSec:
genie::XSecIntegratorI genie::Algorithm

Public Member Functions

 NewQELXSec (void)
 
 NewQELXSec (std::string config)
 
double Integrate (const XSecAlgorithmI *model, const Interaction *i) const
 XSecIntegratorI interface implementation. More...
 
void Configure (const Registry &config)
 
void Configure (std::string config)
 
- Public Member Functions inherited from genie::XSecIntegratorI
virtual ~XSecIntegratorI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Private Member Functions

void LoadConfig (void)
 

Private Attributes

std::string fGSLIntgType
 
double fGSLRelTol
 
unsigned int fGSLMaxEval
 
AlgId fVertexGenID
 
int fNumNucleonThrows
 
double fMinAngleEM
 
bool fAverageOverNucleons
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
- Protected Member Functions inherited from genie::XSecIntegratorI
 XSecIntegratorI ()
 
 XSecIntegratorI (string name)
 
 XSecIntegratorI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 
- Protected Attributes inherited from genie::XSecIntegratorI
const IntegratorI * fIntegrator
 GENIE numerical integrator. More...
 
string fGSLIntgType
 name of GSL numerical integrator More...
 
double fGSLRelTol
 required relative tolerance (error) More...
 
int fGSLMaxEval
 GSL max evaluations. More...
 
int fGSLMinEval
 GSL min evaluations. Ignored by some integrators. More...
 
unsigned int fGSLMaxSizeOfSubintervals
 GSL maximum number of sub-intervals for 1D integrator. More...
 
unsigned int fGSLRule
 GSL Gauss-Kronrod integration rule (only for GSL 1D adaptive type) More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< boolfOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

Computes the Quasi Elastic (QEL) total cross section.
Is a concrete implementation of the XSecIntegratorI interface.
.

Author
Steven Gardiner <gardiner fnal.gov> Fermi National Accelerator Laboratory

February 26, 2019

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 63 of file NewQELXSec.h.

Constructor & Destructor Documentation

NewQELXSec::NewQELXSec ( void  )

Definition at line 39 of file NewQELXSec.cxx.

39  : XSecIntegratorI("genie::NewQELXSec")
40 {
41 
42 }
NewQELXSec::NewQELXSec ( std::string  config)

Definition at line 44 of file NewQELXSec.cxx.

44  : XSecIntegratorI("genie::NewQELXSec", config)
45 {
46 
47 }
static Config * config
Definition: config.cpp:1054

Member Function Documentation

void NewQELXSec::Configure ( const Registry config)
virtual

Overload the Algorithm::Configure() methods to load private data members from configuration options

Reimplemented from genie::Algorithm.

Definition at line 172 of file NewQELXSec.cxx.

173 {
174  Algorithm::Configure(config);
175  this->LoadConfig();
176 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void LoadConfig(void)
Definition: NewQELXSec.cxx:184
void NewQELXSec::Configure ( std::string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 178 of file NewQELXSec.cxx.

179 {
181  this->LoadConfig();
182 }
static Config * config
Definition: config.cpp:1054
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void LoadConfig(void)
Definition: NewQELXSec.cxx:184
double NewQELXSec::Integrate ( const XSecAlgorithmI model,
const Interaction i 
) const
virtual

XSecIntegratorI interface implementation.

Implements genie::XSecIntegratorI.

Definition at line 49 of file NewQELXSec.cxx.

50 {
51  LOG("NewQELXSec",pDEBUG) << "Beginning integrate";
52  if ( !model->ValidProcess(in) ) return 0.;
53 
54  Interaction* interaction = new Interaction( *in );
55  interaction->SetBit( kISkipProcessChk );
56  //interaction->SetBit( kISkipKinematicChk );
57 
58  const NuclearModelI* nucl_model = dynamic_cast<const NuclearModelI*>(
59  model->SubAlg("IntegralNuclearModel") );
60  assert( nucl_model );
61 
63  const VertexGenerator* vtx_gen = dynamic_cast<const VertexGenerator*>(
64  algf->GetAlgorithm(fVertexGenID) );
65  assert( vtx_gen );
66 
67  // Determine the appropriate binding energy mode to use.
68  // The default given here is for the case of a free nucleon.
69  QELEvGen_BindingMode_t bind_mode = kOnShell;
70  Target* tgt = interaction->InitState().TgtPtr();
71  if ( tgt->IsNucleus() ) {
72  std::string bind_mode_str = model->GetConfig()
73  .GetString( "IntegralNucleonBindingMode" );
74  bind_mode = genie::utils::StringToQELBindingMode( bind_mode_str );
75  }
76 
78  interaction, bind_mode, fMinAngleEM);
81 
82  // Switch to using the copy of the interaction in the integrator rather than
83  // the copy that we made in this function
84  delete interaction;
85  interaction = func->GetInteractionPtr();
86 
87  // Also update the pointer to the Target
88  tgt = interaction->InitState().TgtPtr();
89 
90  double abstol = 1e-16; // We mostly care about relative tolerance
91  ROOT::Math::IntegratorMultiDim ig(*func, ig_type, abstol, fGSLRelTol, fGSLMaxEval);
92 
93  // Integration ranges for the lepton COM frame scattering angles (in the
94  // kPSQELEvGen phase space, these are measured with respect to the COM
95  // velocity as observed in the lab frame)
96  Range1D_t cos_theta_0_lim( -1., 1. );
97  Range1D_t phi_0_lim( 0., 2.*kPi );
98 
99  double kine_min[2] = { cos_theta_0_lim.min, phi_0_lim.min };
100  double kine_max[2] = { cos_theta_0_lim.max, phi_0_lim.max };
101 
102  // If averaging over the initial nucleon distribution has been
103  // disabled, just integrate over angles and return the result.
104  if ( !fAverageOverNucleons ) {
105  double xsec_total = ig.Integral(kine_min, kine_max);
106  delete func;
107  return xsec_total;
108  }
109 
110  // For a free nucleon target (hit nucleon is at rest in the lab frame), we
111  // don't need to do an MC integration over the initial state variables. In
112  // this case, just set up the nucleon at the origin, on-shell, and at rest,
113  // then integrate over the angles and return the result.
114 
115  // Also use this approach if we're over the "nuclear influence" cutoff
116  // energy for the probe. Beyond the cutoff, the effects of Fermi motion
117  // and the removal energy are assumed to be small enough to be neglected
118  double E_lab_cutoff = model->GetConfig()
119  .GetDouble("IntegralNuclearInfluenceCutoffEnergy");
120 
121  double probeE = interaction->InitState().ProbeE( kRfLab );
122  if ( !tgt->IsNucleus() || probeE > E_lab_cutoff ) {
123  tgt->SetHitNucPosition(0.);
124 
125  if ( tgt->IsNucleus() ) nucl_model->GenerateNucleon(*tgt, 0.);
126  else {
127  nucl_model->SetRemovalEnergy(0.);
128  interaction->SetBit( kIAssumeFreeNucleon );
129  }
130 
131  nucl_model->SetMomentum3( TVector3(0., 0., 0.) );
132  double xsec_total = ig.Integral(kine_min, kine_max);
133  delete func;
134  return xsec_total;
135  }
136 
137  // For a nuclear target, we need to loop over a bunch of nucleons sampled
138  // from the nuclear model (with positions sampled from the vertex generator
139  // to allow for using the local Fermi gas model). The MC estimator for the
140  // total cross section is simply the mean of ig.Integral() for all of the
141  // sampled nucleons.
142  double xsec_sum = 0.;
143  for (int n = 0; n < fNumNucleonThrows; ++n) {
144 
145  // Select a new position for the initial hit nucleon (needed for the local
146  // Fermi gas model, but other than slowing things down a bit, it doesn't
147  // hurt to do this for other models)
148  TVector3 vertex_pos = vtx_gen->GenerateVertex( interaction, tgt->A() );
149  double radius = vertex_pos.Mag();
150  tgt->SetHitNucPosition( radius );
151 
152  // Sample a new nucleon 3-momentum and removal energy (this will be applied
153  // to the nucleon via a call to genie::utils::ComputeFullQELPXSec(), so
154  // there's no need to mess with its 4-momentum here)
155  nucl_model->GenerateNucleon(*tgt, radius);
156 
157  // The initial state variables have all been defined, so integrate over
158  // the final lepton angles.
159  double xsec = ig.Integral(kine_min, kine_max);
160 
161  xsec_sum += xsec;
162  }
163 
164  delete func;
165 
166  // MC estimator of the total cross section is the mean of the xsec values
167  double xsec_mean = xsec_sum / fNumNucleonThrows;
168 
169  return xsec_mean;
170 }
TVector3 GenerateVertex(const Interaction *in, double A) const
bool fAverageOverNucleons
Definition: NewQELXSec.h:100
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition: GSLUtils.cxx:59
int Type
Definition: 018_def.c:12
std::string string
Definition: nybbler.cc:12
int A(void) const
Definition: Target.h:70
A simple [min,max] interval for doubles.
Definition: Range1.h:42
bool IsNucleus(void) const
Definition: Target.cxx:272
std::string fGSLIntgType
Definition: NewQELXSec.h:86
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
Definition: NuclearModelI.h:46
void SetHitNucPosition(double r)
Definition: Target.cxx:210
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:474
enum genie::EQELEvGenBindingMode QELEvGen_BindingMode_t
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:246
unsigned int fGSLMaxEval
Definition: NewQELXSec.h:88
Summary information for an interaction.
Definition: Interaction.h:56
const double e
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
std::void_t< T > n
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:40
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
void SetRemovalEnergy(double E) const
Definition: NuclearModelI.h:90
RgStr GetString(RgKey key) const
Definition: Registry.cxx:481
static AlgFactory * Instance()
Definition: AlgFactory.cxx:64
void SetMomentum3(const TVector3 &mom) const
Definition: NuclearModelI.h:86
const UInt_t kIAssumeFreeNucleon
Definition: Interaction.h:49
QELEvGen_BindingMode_t StringToQELBindingMode(const std::string &mode_str)
Definition: QELUtils.cxx:194
Target * TgtPtr(void) const
Definition: InitialState.h:67
def func()
Definition: docstring.py:7
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
virtual bool GenerateNucleon(const Target &) const =0
const InitialState & InitState(void) const
Definition: Interaction.h:69
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39
double fMinAngleEM
Definition: NewQELXSec.h:91
double ProbeE(RefFrame_t rf) const
static const double kPi
Definition: Constants.h:37
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
#define pDEBUG
Definition: Messenger.h:63
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:345
void NewQELXSec::LoadConfig ( void  )
private

Definition at line 184 of file NewQELXSec.cxx.

185 {
186  // Get GSL integration type & relative tolerance
187  GetParamDef( "gsl-integration-type", fGSLIntgType, std::string("adaptive") ) ;
188  GetParamDef( "gsl-relative-tolerance", fGSLRelTol, 1e-2 ) ;
189  int max;
190  GetParamDef( "gsl-max-eval", max, 500000 ) ;
191  fGSLMaxEval = static_cast<unsigned int>( max );
192 
193  RgAlg vertexGenID;
194  GetParamDef( "VertexGenAlg", vertexGenID, RgAlg("genie::VertexGenerator", "Default") );
195  fVertexGenID = AlgId( vertexGenID );
196 
197  GetParamDef( "NumNucleonThrows", fNumNucleonThrows, 5000 );
198 
199  // TODO: This is a parameter that may also be specified in the XML
200  // configuration for QELEventGenerator. Avoid duplication here to ensure
201  // consistency.
202  GetParamDef( "SF-MinAngleEMscattering", fMinAngleEM, 0. ) ;
203 
204  // If true, then the integration of the total cross section will include an
205  // MC integration over the initial state nuclear model
206  GetParamDef( "AverageOverNucleons", fAverageOverNucleons, true );
207 }
bool fAverageOverNucleons
Definition: NewQELXSec.h:100
std::string string
Definition: nybbler.cc:12
std::string fGSLIntgType
Definition: NewQELXSec.h:86
unsigned int fGSLMaxEval
Definition: NewQELXSec.h:88
const double e
static int max(int a, int b)
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:34
bool GetParamDef(const RgKey &name, T &p, const T &def) const
double fMinAngleEM
Definition: NewQELXSec.h:91

Member Data Documentation

bool genie::NewQELXSec::fAverageOverNucleons
private

Definition at line 100 of file NewQELXSec.h.

std::string genie::NewQELXSec::fGSLIntgType
private

Definition at line 86 of file NewQELXSec.h.

unsigned int genie::NewQELXSec::fGSLMaxEval
private

Definition at line 88 of file NewQELXSec.h.

double genie::NewQELXSec::fGSLRelTol
private

Definition at line 87 of file NewQELXSec.h.

double genie::NewQELXSec::fMinAngleEM
private

Definition at line 91 of file NewQELXSec.h.

int genie::NewQELXSec::fNumNucleonThrows
private

Definition at line 90 of file NewQELXSec.h.

AlgId genie::NewQELXSec::fVertexGenID
private

Definition at line 89 of file NewQELXSec.h.


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