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

Class that caches resonance neutrinoproduction cross sections on free nucleons according to the Rein-Sehgal model. This significantly speeds the cross section calculation for multiple nuclear targets (eg at the spline construction phase). This class integrates cross sections faster, than ReinSehgalRESXSecWithCache because of integration area transformation. More...

#include <ReinSehgalRESXSecWithCacheFast.h>

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

Protected Member Functions

 ReinSehgalRESXSecWithCacheFast ()
 ReinSehgalRESXSecWithCacheFast (string name)
 ReinSehgalRESXSecWithCacheFast (string name, string config)
virtual ~ReinSehgalRESXSecWithCacheFast ()
void CacheResExcitationXSec (const Interaction *interaction) const
string CacheBranchName (Resonance_t r, InteractionType_t it, int nu, int nuc) 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

bool fUsingDisResJoin
double fWcut
double fEMax
const XSecAlgorithmIfSingleResXSecModel
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)

Additional Inherited Members

Public Member Functions inherited from genie::XSecIntegratorI
virtual ~XSecIntegratorI ()
virtual double Integrate (const XSecAlgorithmI *model, const Interaction *interaction) const =0
Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
virtual void Configure (const Registry &config)
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.
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)

Detailed Description

Class that caches resonance neutrinoproduction cross sections on free nucleons according to the Rein-Sehgal model. This significantly speeds the cross section calculation for multiple nuclear targets (eg at the spline construction phase). This class integrates cross sections faster, than ReinSehgalRESXSecWithCache because of integration area transformation.

References:\n D.Rein and L.M.Sehgal, Neutrino Excitation of Baryon Resonances
and Single Pion Production, Ann.Phys.133, 79 (1981)
Author
Igor Kakorin kakor.nosp@m.in@j.nosp@m.inr.r.nosp@m.u Joint Institute for Nuclear Research

based on code of Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool

Created:\n March 01, 2017
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 43 of file ReinSehgalRESXSecWithCacheFast.h.

Constructor & Destructor Documentation

◆ ReinSehgalRESXSecWithCacheFast() [1/3]

ReinSehgalRESXSecWithCacheFast::ReinSehgalRESXSecWithCacheFast ( )
protected

◆ ReinSehgalRESXSecWithCacheFast() [2/3]

ReinSehgalRESXSecWithCacheFast::ReinSehgalRESXSecWithCacheFast ( string name)
protected

Definition at line 63 of file ReinSehgalRESXSecWithCacheFast.cxx.

63 :
65{
66
67}

References genie::XSecIntegratorI::XSecIntegratorI().

◆ ReinSehgalRESXSecWithCacheFast() [3/3]

ReinSehgalRESXSecWithCacheFast::ReinSehgalRESXSecWithCacheFast ( string name,
string config )
protected

Definition at line 69 of file ReinSehgalRESXSecWithCacheFast.cxx.

69 :
70XSecIntegratorI(nm,conf)
71{
72
73}

References genie::XSecIntegratorI::XSecIntegratorI().

◆ ~ReinSehgalRESXSecWithCacheFast()

ReinSehgalRESXSecWithCacheFast::~ReinSehgalRESXSecWithCacheFast ( )
protectedvirtual

Definition at line 75 of file ReinSehgalRESXSecWithCacheFast.cxx.

76{
77
78}

Member Function Documentation

◆ CacheBranchName()

string ReinSehgalRESXSecWithCacheFast::CacheBranchName ( Resonance_t r,
InteractionType_t it,
int nu,
int nuc ) const
protected

Definition at line 204 of file ReinSehgalRESXSecWithCacheFast.cxx.

206{
207// Build a unique name for the cache branch
208
209 Cache * cache = Cache::Instance();
210 string res_name = utils::res::AsString(res);
211 string it_name = InteractionType::AsString(it);
212 string nc_nuc = ((nucleonpdgc==kPdgProton) ? "p" : "n");
213
214 ostringstream intk;
215 intk << "ResExcitationXSec/R:" << res_name << ";nu:" << nupdgc
216 << ";int:" << it_name << nc_nuc;
217
218 string algkey = fSingleResXSecModel->Id().Key();
219 string ikey = intk.str();
220 string key = cache->CacheBranchKey(algkey, ikey);
221
222 return key;
223}
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition Cache.cxx:93
static Cache * Instance(void)
Definition Cache.cxx:67
static string AsString(InteractionType_t type)
const char * AsString(Resonance_t res)
resonance id -> string
const int kPdgProton
Definition PDGCodes.h:81

References genie::InteractionType::AsString(), genie::utils::res::AsString(), genie::Cache::CacheBranchKey(), fSingleResXSecModel, genie::Cache::Instance(), and genie::kPdgProton.

Referenced by CacheResExcitationXSec(), and genie::ReinSehgalRESXSecFast::Integrate().

◆ CacheResExcitationXSec()

void ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec ( const Interaction * interaction) const
protected

Definition at line 80 of file ReinSehgalRESXSecWithCacheFast.cxx.

82{
83// Cache resonance neutrino production data from free nucleons
84
85 Cache * cache = Cache::Instance();
86
87 assert(fSingleResXSecModel);
88// assert(fIntegrator);
89
90 // Compute the number of spline knots - use at least 10 knots per decade
91 // && at least 40 knots in the full energy range
92 const double Emin = 0.01;
93 const int nknots_min = (int) (10*(TMath::Log(fEMax)-TMath::Log(Emin)));
94 const int nknots = TMath::Max(100, nknots_min);
95 double * E = new double[nknots]; // knot 'x'
96
97 TLorentzVector p4(0,0,0,0);
98
99 int nu_code = in->InitState().ProbePdg();
100 int nuc_code = in->InitState().Tgt().HitNucPdg();
101 int tgt_code = (nuc_code==kPdgProton) ? kPdgTgtFreeP : kPdgTgtFreeN;
102
103 Interaction * interaction = new Interaction(*in);
104 interaction->InitStatePtr()->SetPdgs(tgt_code, nu_code);
105 interaction->InitStatePtr()->TgtPtr()->SetHitNucPdg(nuc_code);
106
107 InteractionType_t wkcur = interaction->ProcInfo().InteractionTypeId();
108 unsigned int nres = fResList.NResonances();
109 for(unsigned int ires = 0; ires < nres; ires++) {
110
111 // Get next resonance from the resonance list
112 Resonance_t res = fResList.ResonanceId(ires);
113
114 interaction->ExclTagPtr()->SetResonance(res);
115
116 // Get a unique cache branch name
117 string key = this->CacheBranchName(res, wkcur, nu_code, nuc_code);
118
119 // Make sure the cache branch does not already exists
120 CacheBranchFx * cache_branch =
121 dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
122 assert(!cache_branch);
123
124 // Create the new cache branch
125 LOG("ReinSehgalResCF", pNOTICE)
126 << "\n ** Creating cache branch - key = " << key;
127 cache_branch = new CacheBranchFx("RES Excitation XSec");
128 cache->AddCacheBranch(key, cache_branch);
129 assert(cache_branch);
130
131 const KPhaseSpace & kps = interaction->PhaseSpace();
132 double Ethr = kps.Threshold();
133 LOG("ReinSehgalResCF", pNOTICE) << "E threshold = " << Ethr;
134
135 // Distribute the knots in the energy range as is being done in the
136 // XSecSplineList so that the energy threshold is treated correctly
137 // in the spline - see comments there in.
138 int nkb = (Ethr>Emin) ? 5 : 0; // number of knots < threshold
139 int nka = nknots-nkb; // number of knots >= threshold
140 // knots < energy threshold
141 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
142 for(int i=0; i<nkb; i++) {
143 E[i] = Emin + i*dEb;
144 }
145 // knots >= energy threshold
146 double E0 = TMath::Max(Ethr,Emin);
147 double dEa = (TMath::Log10(fEMax) - TMath::Log10(E0)) /(nka-1);
148 for(int i=0; i<nka; i++) {
149 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
150 }
151
152 // Compute cross sections at the given set of energies
153 for(int ie=0; ie<nknots; ie++) {
154 double xsec = 0.;
155 double Ev = E[ie];
156 p4.SetPxPyPzE(0,0,Ev,Ev);
157 interaction->InitStatePtr()->SetProbeP4(p4);
158
159 if(Ev>Ethr+kASmallNum) {
160 // Get integration ranges
161 Range1D_t rW = Range1D_t(0.0,1.0);
162 Range1D_t rQ2 = Range1D_t(0.0,1.0);
163
164 LOG("ReinSehgalResCF", pINFO)
165 << "*** Integrating d^2 XSec/dWdQ^2 for R: "
166 << utils::res::AsString(res) << " at Ev = " << Ev;
167 LOG("ReinSehgalResCF", pINFO)
168 << "{W} = " << rW.min << ", " << rW.max;
169 LOG("ReinSehgalResCF", pINFO)
170 << "{Q^2} = " << rQ2.min << ", " << rQ2.max;
171
172 if(rW.max<rW.min || rQ2.max<rQ2.min || rW.min<0 || rQ2.min<0) {
173 LOG("ReinSehgalResCF", pINFO)
174 << "** Not allowed kinematically, xsec=0";
175 } else {
176 ROOT::Math::IBaseFunctionMultiDim * func= new utils::gsl::d2XSecRESFast_dWQ2_E(fSingleResXSecModel, interaction);
177 ROOT::Math::IntegrationMultiDim::Type ig_type = utils::gsl::IntegrationNDimTypeFromString(fGSLIntgType);
178 ROOT::Math::IntegratorMultiDim ig(ig_type,0,fGSLRelTol,fGSLMaxEval);
179 ig.SetFunction(*func);
180 double kine_min[2] = { rW.min, rQ2.min };
181 double kine_max[2] = { rW.max, rQ2.max };
182 xsec = ig.Integral(kine_min, kine_max) * (1E-38 * units::cm2);
183 delete func;
184 }
185 } else {
186 LOG("ReinSehgalResCF", pINFO)
187 << "** Below threshold E = " << Ev << " <= " << Ethr;
188 }
189 cache_branch->AddValues(Ev,xsec);
190 SLOG("ReinSehgalResCF", pNOTICE)
191 << "RES XSec (R:" << utils::res::AsString(res)
192 << ", E="<< Ev << ") = "<< xsec/(1E-38 *genie::units::cm2)
193 << " x 1E-38 cm^2";
194 }//spline knots
195
196 // Build the spline
197 cache_branch->CreateSpline();
198 }//ires
199
200 delete [] E;
201 delete interaction;
202}
#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 SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition Messenger.h:84
void CreateSpline(string type="TSpline3")
void AddValues(double x, double y)
void AddCacheBranch(string key, CacheBranchI *branch)
Definition Cache.cxx:88
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition Cache.cxx:80
void SetPdgs(int tgt_pdgc, int probe_pdgc)
void SetProbeP4(const TLorentzVector &P4)
Target * TgtPtr(void) const
InitialState * InitStatePtr(void) const
Definition Interaction.h:74
XclsTag * ExclTagPtr(void) const
Definition Interaction.h:77
const ProcessInfo & ProcInfo(void) const
Definition Interaction.h:70
const KPhaseSpace & PhaseSpace(void) const
Definition Interaction.h:73
double Threshold(void) const
Energy threshold.
InteractionType_t InteractionTypeId(void) const
string CacheBranchName(Resonance_t r, InteractionType_t it, int nu, int nuc) const
void SetHitNucPdg(int pdgc)
Definition Target.cxx:171
string fGSLIntgType
name of GSL numerical integrator
int fGSLMaxEval
GSL max evaluations.
double fGSLRelTol
required relative tolerance (error)
void SetResonance(Resonance_t res)
Definition XclsTag.cxx:128
double func(double x, double y)
static const double kASmallNum
Definition Controls.h:40
static constexpr double cm2
Definition Units.h:69
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition GSLUtils.cxx:59
enum genie::EInteractionType InteractionType_t
enum genie::EResonance Resonance_t
const int kPdgTgtFreeN
Definition PDGCodes.h:200
const int kPdgTgtFreeP
Definition PDGCodes.h:199

References genie::Cache::AddCacheBranch(), genie::CacheBranchFx::AddValues(), genie::utils::res::AsString(), CacheBranchName(), genie::units::cm2, genie::CacheBranchFx::CreateSpline(), genie::Interaction::ExclTagPtr(), fEMax, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLRelTol, genie::Cache::FindCacheBranch(), fResList, fSingleResXSecModel, func(), genie::Target::HitNucPdg(), genie::Interaction::InitState(), genie::Interaction::InitStatePtr(), genie::Cache::Instance(), genie::utils::gsl::IntegrationNDimTypeFromString(), genie::ProcessInfo::InteractionTypeId(), genie::controls::kASmallNum, genie::kPdgProton, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, LOG, genie::Range1D_t::max, genie::Range1D_t::min, genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), genie::Target::SetHitNucPdg(), genie::InitialState::SetPdgs(), genie::InitialState::SetProbeP4(), genie::XclsTag::SetResonance(), SLOG, genie::InitialState::Tgt(), genie::InitialState::TgtPtr(), and genie::KPhaseSpace::Threshold().

Referenced by genie::ReinSehgalRESXSecFast::Integrate().

Member Data Documentation

◆ fEMax

double genie::ReinSehgalRESXSecWithCacheFast::fEMax
protected

◆ fResList

BaryonResList genie::ReinSehgalRESXSecWithCacheFast::fResList
protected

◆ fSingleResXSecModel

const XSecAlgorithmI* genie::ReinSehgalRESXSecWithCacheFast::fSingleResXSecModel
mutableprotected

◆ fUsingDisResJoin

bool genie::ReinSehgalRESXSecWithCacheFast::fUsingDisResJoin
protected

Definition at line 56 of file ReinSehgalRESXSecWithCacheFast.h.

◆ fWcut

double genie::ReinSehgalRESXSecWithCacheFast::fWcut
protected

Definition at line 57 of file ReinSehgalRESXSecWithCacheFast.h.


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