GENIEGenerator
Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for genie::NewQELXSec:
[legend]

Public Member Functions

 NewQELXSec (void)
 NewQELXSec (std::string config)
double Integrate (const XSecAlgorithmI *model, const Interaction *i) const
 XSecIntegratorI interface implementation.
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 Configure (string config)
virtual void FindConfig (void)
virtual const RegistryGetConfig (void) const
RegistryGetOwnedConfig (void)
virtual const AlgIdId (void) const
 Get algorithm ID.
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status.
virtual bool AllowReconfig (void) const
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm.
virtual void SetId (const AlgId &id)
 Set algorithm ID.
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.

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)
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
static string BuildParamMatRowSizeKey (const std::string &comm_name)
static string BuildParamMatColSizeKey (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.
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.
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
template<class T>
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters.
template<class T>
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
int GetParamMatKeys (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
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership
int MergeTopRegistry (const Registry &r)
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships.
Protected Attributes inherited from genie::XSecIntegratorI
const IntegratorI * fIntegrator
 GENIE numerical integrator.
string fGSLIntgType
 name of GSL numerical integrator
double fGSLRelTol
 required relative tolerance (error)
int fGSLMaxEval
 GSL max evaluations.
int fGSLMinEval
 GSL min evaluations. Ignored by some integrators.
unsigned int fGSLMaxSizeOfSubintervals
 GSL maximum number of sub-intervals for 1D integrator.
unsigned int fGSLRule
 GSL Gauss-Kronrod integration rule (only for GSL 1D adaptive type)
Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...)
AlgId fID
 algorithm name and configuration set
vector< Registry * > fConfVect
vector< bool > fOwnerships
 ownership for every registry in fConfVect
AlgStatus_t fStatus
 algorithm execution status
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool)

Detailed Description

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

Author
Steven Gardiner <gardiner \at fnal.gov> Fermi National Accelerator Laboratory
Created:\n February 26, 2019
License:\n Copyright (c) 2003-2025, 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() [1/2]

NewQELXSec::NewQELXSec ( void )

Definition at line 39 of file NewQELXSec.cxx.

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

References genie::XSecIntegratorI::XSecIntegratorI().

◆ NewQELXSec() [2/2]

NewQELXSec::NewQELXSec ( std::string config)

Definition at line 44 of file NewQELXSec.cxx.

44 : XSecIntegratorI("genie::NewQELXSec", config)
45{
46
47}

References genie::XSecIntegratorI::XSecIntegratorI().

Member Function Documentation

◆ Configure() [1/2]

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)

References genie::Algorithm::Configure(), and LoadConfig().

◆ Configure() [2/2]

void genie::NewQELXSec::Configure ( std::string config)

◆ Integrate()

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
62 AlgFactory* algf = AlgFactory::Instance();
63 const VertexGenerator* vtx_gen = dynamic_cast<const VertexGenerator*>(
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.
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
77 utils::gsl::FullQELdXSec* func = new utils::gsl::FullQELdXSec(model,
78 interaction, bind_mode, fMinAngleEM);
79 ROOT::Math::IntegrationMultiDim::Type ig_type =
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}
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
const Algorithm * GetAlgorithm(const AlgId &algid)
static AlgFactory * Instance()
virtual const Registry & GetConfig(void) const
const Algorithm * SubAlg(const RgKey &registry_key) const
double ProbeE(RefFrame_t rf) const
Target * TgtPtr(void) const
const InitialState & InitState(void) const
Definition Interaction.h:69
unsigned int fGSLMaxEval
Definition NewQELXSec.h:88
std::string fGSLIntgType
Definition NewQELXSec.h:86
void SetMomentum3(const TVector3 &mom) const
void SetRemovalEnergy(double E) const
virtual bool GenerateNucleon(const Target &) const =0
RgDbl GetDouble(RgKey key) const
Definition Registry.cxx:474
RgStr GetString(RgKey key) const
Definition Registry.cxx:481
void SetHitNucPosition(double r)
Definition Target.cxx:210
int A(void) const
Definition Target.h:70
bool IsNucleus(void) const
Definition Target.cxx:272
TVector3 GenerateVertex(const Interaction *in, double A) const
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
const double e
double func(double x, double y)
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition GSLUtils.cxx:59
QELEvGen_BindingMode_t StringToQELBindingMode(const std::string &mode_str)
Definition QELUtils.cxx:194
@ kOnShell
Definition DMELUtils.h:27
enum genie::EQELEvGenBindingMode QELEvGen_BindingMode_t
@ kRfLab
Definition RefFrame.h:26
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition Interaction.h:47
const UInt_t kIAssumeFreeNucleon
Definition Interaction.h:49

References genie::Target::A(), e, fAverageOverNucleons, fGSLIntgType, fGSLMaxEval, fGSLRelTol, fMinAngleEM, fNumNucleonThrows, func(), fVertexGenID, genie::NuclearModelI::GenerateNucleon(), genie::VertexGenerator::GenerateVertex(), genie::AlgFactory::GetAlgorithm(), genie::Algorithm::GetConfig(), genie::Registry::GetDouble(), genie::Registry::GetString(), genie::Interaction::InitState(), genie::AlgFactory::Instance(), genie::utils::gsl::IntegrationNDimTypeFromString(), genie::Target::IsNucleus(), genie::kIAssumeFreeNucleon, genie::kISkipProcessChk, genie::kOnShell, genie::constants::kPi, genie::kRfLab, LOG, genie::Range1D_t::max, genie::Range1D_t::min, pDEBUG, genie::InitialState::ProbeE(), genie::Target::SetHitNucPosition(), genie::NuclearModelI::SetMomentum3(), genie::NuclearModelI::SetRemovalEnergy(), genie::utils::StringToQELBindingMode(), genie::Algorithm::SubAlg(), genie::InitialState::TgtPtr(), and genie::XSecAlgorithmI::ValidProcess().

◆ LoadConfig()

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 GetParamDef(const RgKey &name, T &p, const T &def) const

References e, fAverageOverNucleons, fGSLIntgType, fGSLMaxEval, fGSLRelTol, fMinAngleEM, fNumNucleonThrows, fVertexGenID, and genie::Algorithm::GetParamDef().

Referenced by Configure().

Member Data Documentation

◆ fAverageOverNucleons

bool genie::NewQELXSec::fAverageOverNucleons
private

Definition at line 100 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fGSLIntgType

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

Definition at line 86 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fGSLMaxEval

unsigned int genie::NewQELXSec::fGSLMaxEval
private

Definition at line 88 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fGSLRelTol

double genie::NewQELXSec::fGSLRelTol
private

Definition at line 87 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fMinAngleEM

double genie::NewQELXSec::fMinAngleEM
private

Definition at line 91 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fNumNucleonThrows

int genie::NewQELXSec::fNumNucleonThrows
private

Definition at line 90 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().

◆ fVertexGenID

AlgId genie::NewQELXSec::fVertexGenID
private

Definition at line 89 of file NewQELXSec.h.

Referenced by Integrate(), and LoadConfig().


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