GENIEGenerator
Loading...
Searching...
No Matches
genie::SPPXSec Class Reference

Computes the cross section for an neutrino resonance SPP reaction. More...

#include <SPPXSec.h>

Inheritance diagram for genie::SPPXSec:
[legend]
Collaboration diagram for genie::SPPXSec:
[legend]

Public Member Functions

 SPPXSec ()
 SPPXSec (string param_set)
virtual ~SPPXSec ()
double Integrate (const XSecAlgorithmI *model, const Interaction *i) const
void Configure (const Registry &config)
void Configure (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.
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

bool fUsePauliBlocking
 account for Pauli blocking?

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::SPPXSecWithCache
 SPPXSecWithCache ()
 SPPXSecWithCache (string name)
 SPPXSecWithCache (string name, string config)
virtual ~SPPXSecWithCache ()
void CacheResExcitationXSec (const Interaction *interaction) const
string CacheBranchName (SppChannel_t spp_channel, InteractionType_t it, int nu) const
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::SPPXSecWithCache
bool fUsingDisResJoin
double fWcut
double fEMax
const XSecAlgorithmIfSinglePionProductionXSecModel
BaryonResList fResList
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 cross section for an neutrino resonance SPP reaction.

     Before computing any SPP cross section this algorithm 
     computes and caches splines for neutrino resonance SPP  cross 
     sections. This improves the speed of the GENIE spline construction 
     phase if splines for multiple nuclear targets are to be computed
     (for case without Pauli-blocking).

     Is a concrete implementation of the XSecAlgorithmI interface.\n
Authors
Igor Kakorin kakor.nosp@m.in@j.nosp@m.inr.r.nosp@m.u, Joint Institute for Nuclear Research
Vadim Naumov <vnaum.nosp@m.ov@t.nosp@m.heor..nosp@m.jinr.nosp@m..ru >, Joint Institute for Nuclear Research
based on code of Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n November 12, 2019
License:\n Copyright (c) 2003-2025, The GENIE Collaboration

For the full text of the license visit http://copyright.genie-mc.org
or see $GENIE/LICENSE

Definition at line 37 of file SPPXSec.h.

Constructor & Destructor Documentation

◆ SPPXSec() [1/2]

SPPXSec::SPPXSec ( )

Definition at line 49 of file SPPXSec.cxx.

49 :
50SPPXSecWithCache("genie::SPPXSec")
51{
52
53}

References genie::SPPXSecWithCache::SPPXSecWithCache().

◆ SPPXSec() [2/2]

SPPXSec::SPPXSec ( string param_set)

Definition at line 55 of file SPPXSec.cxx.

55 :
56SPPXSecWithCache("genie::SPPXSec", config)
57{
58
59}

References genie::SPPXSecWithCache::SPPXSecWithCache().

◆ ~SPPXSec()

SPPXSec::~SPPXSec ( )
virtual

Definition at line 61 of file SPPXSec.cxx.

62{
63
64}

Member Function Documentation

◆ Configure() [1/2]

void SPPXSec::Configure ( const Registry & config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 205 of file SPPXSec.cxx.

206{
207 Algorithm::Configure(config);
208 this->LoadConfig();
209}
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
void LoadConfig(void)
Definition SPPXSec.cxx:217

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

◆ Configure() [2/2]

void SPPXSec::Configure ( 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 211 of file SPPXSec.cxx.

212{
213 Algorithm::Configure(config);
214 this->LoadConfig();
215}

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

◆ Integrate()

double SPPXSec::Integrate ( const XSecAlgorithmI * model,
const Interaction * i ) const
virtual

Implements genie::XSecIntegratorI.

Definition at line 66 of file SPPXSec.cxx.

68{
69 if(!model->ValidProcess(interaction) ) return 0.;
70
71 //-- Get init state and process information
72 const InitialState & init_state = interaction->InitState();
73 const ProcessInfo & proc_info = interaction->ProcInfo();
74 const Target & target = init_state.Tgt();
75
76 const KPhaseSpace& kps = interaction->PhaseSpace();
77
78 double Enu = init_state.ProbeE(kRfHitNucRest);
79
80 //-- Get the requested SPP channel
81 SppChannel_t spp_channel = SppChannel::FromInteraction(interaction);
82
83 if (Enu < kps.Threshold_SPP_iso()) return 0.;
84
86
87 InteractionType_t it = proc_info.InteractionTypeId();
88 int nucleon_pdgc = target.HitNucPdg();
89 int nu_pdgc = init_state.ProbePdg();
90 string nc_nuc = ((pdg::IsNeutrino(nu_pdgc)) ? ";v:" : ";vb:");
91
92 // If the input interaction is off a nuclear target, then chek whether
93 // the corresponding free nucleon cross section already exists at the
94 // cross section spline list.
95 // If yes, calculate the nuclear cross section based on that value.
96 //
97 XSecSplineList * xsl = XSecSplineList::Instance();
98 if(init_state.Tgt().IsNucleus() && !xsl->IsEmpty() )
99 {
100 Interaction * in = new Interaction(*interaction);
101 if(pdg::IsProton(nucleon_pdgc))
103 else
105
106 if(xsl->SplineExists(model,in))
107 {
108 const Spline * spl = xsl->GetSpline(model, in);
109 double xsec = spl->Evaluate(Enu);
110 SLOG("SPPXSec", pNOTICE)
111 << "XSec[Channel/" << SppChannel::AsString(spp_channel) << "/free] (Ev = "
112 << Enu << " GeV) = " << xsec/(1E-38 *cm2)<< " x 1E-38 cm^2";
113 if(! interaction->TestBit(kIAssumeFreeNucleon) )
114 {
115 int NNucl = (SppChannel::InitStateNucleon(spp_channel) == kPdgProton) ? target.Z() : target.N();
116 xsec *= NNucl;
117 }
118 delete in;
119 return xsec;
120 }
121 delete in;
122 }
123
124 // There was no corresponding free nucleon spline saved in XSecSplineList that
125 // could be used to speed up this calculation.
126 // Check whether local caching of free nucleon cross sections is allowed.
127 // If yes, store free nucleon cross sections at a cache branch and use those
128 // at any subsequent call.
129 //
130 bool bare_xsec_pre_calc = RunOpt::Instance()->BareXSecPreCalc();
131 if(bare_xsec_pre_calc && !fUsePauliBlocking)
132 {
133 Cache * cache = Cache::Instance();
134 string key = this->CacheBranchName(spp_channel, it, nu_pdgc);
135 LOG("SPPXSec", pINFO)
136 << "Finding cache branch with key: " << key;
137 CacheBranchFx * cache_branch =
138 dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
139 if(!cache_branch) {
140 LOG("SPPXSec", pWARN)
141 << "No cached ResSPP v-production data for input neutrino"
142 << " (pdgc: " << nu_pdgc << ")";
143 LOG("SPPXSec", pWARN)
144 << "Wait while computing/caching ResSPP production xsec first...";
145
146 this->CacheResExcitationXSec(interaction);
147
148 LOG("SPPXSec", pINFO) << "Done caching resonance xsec data";
149 LOG("SPPXSec", pINFO)
150 << "Finding newly created cache branch with key: " << key;
151 cache_branch =
152 dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
153 assert(cache_branch);
154 }
155 const CacheBranchFx & cbranch = (*cache_branch);
156
157 //-- Get cached resonance neutrinoproduction xsec
158 // (If E>Emax, assume xsec = xsec(Emax) - but do not evaluate the
159 // cross section spline at the end of its energy range-)
160 double rxsec = (Enu<fEMax-1) ? cbranch(Enu) : cbranch(fEMax-1);
161
162
163 SLOG("SPPXSec", pNOTICE)
164 << "XSec[Channel: " << SppChannel::AsString(spp_channel) << nc_nuc << nu_pdgc
165 << "/free] (E="<< Enu << " GeV) = " << rxsec/(1E-38 *genie::units::cm2) << " x 1E-38 cm^2";
166
167 if( interaction->TestBit(kIAssumeFreeNucleon) ) return rxsec;
168
169 int NNucl = (pdg::IsProton(nucleon_pdgc)) ? target.Z() : target.N();
170 rxsec*=NNucl; // nuclear xsec
171 return rxsec;
172 } // disable local caching
173
174 // Just go ahead and integrate the input differential cross section for the
175 // specified interaction.
176 else
177 {
178 LOG("SPPXSec", pINFO)
179 << "*** Integrating d^3 XSec/dWdQ^2dCosTheta for Ch: "
180 << SppChannel::AsString(spp_channel) << " at Ev = " << Enu;
181
182 ROOT::Math::IBaseFunctionMultiDim * func= new utils::gsl::d3XSecMK_dWQ2CosTheta_E(model, interaction, fWcut);
183 ROOT::Math::IntegrationMultiDim::Type ig_type = utils::gsl::IntegrationNDimTypeFromString(fGSLIntgType);
184 ROOT::Math::IntegratorMultiDim ig(ig_type,0,fGSLRelTol,fGSLMaxEval);
185 if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE)
186 {
187 ROOT::Math::AdaptiveIntegratorMultiDim * cast = dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*>( ig.GetIntegrator() );
188 assert(cast);
189 cast->SetMinPts(fGSLMinEval);
190 }
191 ig.SetFunction(*func);
192 double kine_min[3] = { 0., 0., 0.};
193 double kine_max[3] = { 1., 1., 1.};
194 double xsec = ig.Integral(kine_min, kine_max)*(1E-38 * units::cm2);
195 delete func;
196
197 SLOG("SPPXSec", pNOTICE)
198 << "XSec[Channel: " << SppChannel::AsString(spp_channel) << nc_nuc << nu_pdgc
199 << "] (E="<< Enu << " GeV) = " << xsec << " x 1E-38 cm^2";
200 return xsec;
201 }
202 return 0;
203}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
#define pWARN
Definition Messenger.h:60
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition Messenger.h:84
static Cache * Instance(void)
Definition Cache.cxx:67
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition Cache.cxx:80
const Target & Tgt(void) const
int ProbePdg(void) const
double ProbeE(RefFrame_t rf) const
Target * TgtPtr(void) const
InitialState * InitStatePtr(void) const
Definition Interaction.h:74
double Threshold_SPP_iso(void) const
Energy limit for resonance single pion production on isoscalar nucleon.
InteractionType_t InteractionTypeId(void) const
bool BareXSecPreCalc(void) const
Definition RunOpt.h:53
static RunOpt * Instance(void)
Definition RunOpt.cxx:54
string CacheBranchName(SppChannel_t spp_channel, InteractionType_t it, int nu) const
const XSecAlgorithmI * fSinglePionProductionXSecModel
void CacheResExcitationXSec(const Interaction *interaction) const
bool fUsePauliBlocking
account for Pauli blocking?
Definition SPPXSec.h:55
double Evaluate(double x) const
Definition Spline.cxx:363
static string AsString(SppChannel_t channel)
Definition SppChannel.h:76
static SppChannel_t FromInteraction(const Interaction *interaction)
Definition SppChannel.h:402
static int InitStateNucleon(SppChannel_t channel)
Definition SppChannel.h:103
void SetId(int pdgc)
Definition Target.cxx:149
int HitNucPdg(void) const
Definition Target.cxx:304
int N(void) const
Definition Target.h:69
int Z(void) const
Definition Target.h:68
bool IsNucleus(void) const
Definition Target.cxx:272
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
string fGSLIntgType
name of GSL numerical integrator
int fGSLMaxEval
GSL max evaluations.
double fGSLRelTol
required relative tolerance (error)
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
bool IsEmpty(void) const
static XSecSplineList * Instance()
double func(double x, double y)
bool IsNeutrino(int pdgc)
Definition PDGUtils.cxx:110
bool IsProton(int pdgc)
Definition PDGUtils.cxx:336
static constexpr double cm2
Definition Units.h:69
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition GSLUtils.cxx:59
const int kPdgProton
Definition PDGCodes.h:81
enum genie::EInteractionType InteractionType_t
const int kPdgTgtFreeN
Definition PDGCodes.h:200
enum genie::ESppChannel SppChannel_t
@ kRfHitNucRest
Definition RefFrame.h:30
const int kPdgTgtFreeP
Definition PDGCodes.h:199
const UInt_t kIAssumeFreeNucleon
Definition Interaction.h:49

References genie::SppChannel::AsString(), genie::RunOpt::BareXSecPreCalc(), genie::SPPXSecWithCache::CacheBranchName(), genie::SPPXSecWithCache::CacheResExcitationXSec(), genie::units::cm2, genie::Spline::Evaluate(), genie::SPPXSecWithCache::fEMax, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLMinEval, genie::XSecIntegratorI::fGSLRelTol, genie::Cache::FindCacheBranch(), genie::SppChannel::FromInteraction(), genie::SPPXSecWithCache::fSinglePionProductionXSecModel, func(), fUsePauliBlocking, genie::SPPXSecWithCache::fWcut, genie::XSecSplineList::GetSpline(), genie::Target::HitNucPdg(), genie::Interaction::InitState(), genie::SppChannel::InitStateNucleon(), genie::Interaction::InitStatePtr(), genie::Cache::Instance(), genie::RunOpt::Instance(), genie::XSecSplineList::Instance(), genie::utils::gsl::IntegrationNDimTypeFromString(), genie::ProcessInfo::InteractionTypeId(), genie::XSecSplineList::IsEmpty(), genie::pdg::IsNeutrino(), genie::Target::IsNucleus(), genie::pdg::IsProton(), genie::kIAssumeFreeNucleon, genie::kPdgProton, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, genie::kRfHitNucRest, LOG, genie::Target::N(), genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbeE(), genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), pWARN, genie::Target::SetId(), SLOG, genie::XSecSplineList::SplineExists(), genie::InitialState::Tgt(), genie::InitialState::TgtPtr(), genie::KPhaseSpace::Threshold_SPP_iso(), genie::XSecAlgorithmI::ValidProcess(), and genie::Target::Z().

◆ LoadConfig()

void SPPXSec::LoadConfig ( void )
private

Definition at line 217 of file SPPXSec.cxx.

218{
219
220 bool good_conf = true ;
221
222 // Get GSL integration type & relative tolerance
223 GetParamDef( "gsl-integration-type", fGSLIntgType, string("adaptive") ) ;
224 GetParamDef( "gsl-relative-tolerance", fGSLRelTol, 1e-5 ) ;
225 GetParamDef( "gsl-max-eval", fGSLMaxEval, 1000000 );
226 GetParamDef( "gsl-min-eval", fGSLMinEval, 7500 ) ;
227 GetParam("UsePauliBlockingForRES", fUsePauliBlocking);
228 GetParamDef("Wcut", fWcut, -1.);
229 // Get upper Emax limit on cached free nucleon xsec spline,
230 // after this value it assume that xsec=xsec(Emax)
231 GetParamDef( "ESplineMax", fEMax, 250. ) ;
232
233 if ( fEMax < 20. ) {
234
235 LOG("SPPXSec", pERROR) << "E max is required to be at least 20 GeV, you set " << fEMax << " GeV" ;
236 good_conf = false ;
237 }
238
239 if ( ! good_conf ) {
240 LOG("SPPXSec", pFATAL)
241 << "Invalid configuration: Exiting" ;
242
243 // From the FreeBSD Library Functions Manual
244 //
245 // EX_CONFIG (78) Something was found in an unconfigured or miscon-
246 // figured state.
247
248 exit( 78 ) ;
249
250 }
251
252}
#define pERROR
Definition Messenger.h:59
#define pFATAL
Definition Messenger.h:56
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const double e

References e, genie::SPPXSecWithCache::fEMax, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLMinEval, genie::XSecIntegratorI::fGSLRelTol, fUsePauliBlocking, genie::SPPXSecWithCache::fWcut, genie::Algorithm::GetParam(), genie::Algorithm::GetParamDef(), LOG, pERROR, and pFATAL.

Referenced by Configure(), and Configure().

Member Data Documentation

◆ fUsePauliBlocking

bool genie::SPPXSec::fUsePauliBlocking
private

account for Pauli blocking?

Definition at line 55 of file SPPXSec.h.

Referenced by Integrate(), and LoadConfig().


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