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

An ABC 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) More...

#include <ReinSehgalRESXSecWithCache.h>

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

Protected Member Functions

 ReinSehgalRESXSecWithCache ()
 ReinSehgalRESXSecWithCache (string name)
 ReinSehgalRESXSecWithCache (string name, string config)
virtual ~ReinSehgalRESXSecWithCache ()
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

An ABC 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)

References:\n D.Rein and L.M.Sehgal, Neutrino Excitation of Baryon Resonances
and Single Pion Production, Ann.Phys.133, 79 (1981)
Author
Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n March 09, 2006
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 34 of file ReinSehgalRESXSecWithCache.h.

Constructor & Destructor Documentation

◆ ReinSehgalRESXSecWithCache() [1/3]

◆ ReinSehgalRESXSecWithCache() [2/3]

ReinSehgalRESXSecWithCache::ReinSehgalRESXSecWithCache ( string name)
protected

Definition at line 48 of file ReinSehgalRESXSecWithCache.cxx.

48 :
50{
51
52}

References genie::XSecIntegratorI::XSecIntegratorI().

◆ ReinSehgalRESXSecWithCache() [3/3]

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

Definition at line 54 of file ReinSehgalRESXSecWithCache.cxx.

54 :
55XSecIntegratorI(nm,conf)
56{
57
58}

References genie::XSecIntegratorI::XSecIntegratorI().

◆ ~ReinSehgalRESXSecWithCache()

ReinSehgalRESXSecWithCache::~ReinSehgalRESXSecWithCache ( )
protectedvirtual

Definition at line 60 of file ReinSehgalRESXSecWithCache.cxx.

61{
62
63}

Member Function Documentation

◆ CacheBranchName()

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

Definition at line 192 of file ReinSehgalRESXSecWithCache.cxx.

194{
195// Build a unique name for the cache branch
196
197 Cache * cache = Cache::Instance();
198 string res_name = utils::res::AsString(res);
199 string it_name = InteractionType::AsString(it);
200 string nc_nuc = ((nucleonpdgc==kPdgProton) ? "p" : "n");
201
202 ostringstream intk;
203 intk << "ResExcitationXSec/R:" << res_name << ";nu:" << nupdgc
204 << ";int:" << it_name << nc_nuc;
205
206 string algkey = fSingleResXSecModel->Id().Key();
207 string ikey = intk.str();
208 string key = cache->CacheBranchKey(algkey, ikey);
209
210 return key;
211}
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(), genie::ReinSehgalRESXSec::Integrate(), and genie::ReinSehgalSPPXSec::Integrate().

◆ CacheResExcitationXSec()

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

Definition at line 65 of file ReinSehgalRESXSecWithCache.cxx.

67{
68// Cache resonance neutrino production data from free nucleons
69
70 Cache * cache = Cache::Instance();
71
72 assert(fSingleResXSecModel);
73// assert(fIntegrator);
74
75 // Compute the number of spline knots - use at least 10 knots per decade
76 // && at least 40 knots in the full energy range
77 const double Emin = 0.01;
78 const int nknots_min = (int) (10*(TMath::Log(fEMax)-TMath::Log(Emin)));
79 const int nknots = TMath::Max(40, nknots_min);
80 double * E = new double[nknots]; // knot 'x'
81
82 TLorentzVector p4(0,0,0,0);
83
84 int nu_code = in->InitState().ProbePdg();
85 int nuc_code = in->InitState().Tgt().HitNucPdg();
86 int tgt_code = (nuc_code==kPdgProton) ? kPdgTgtFreeP : kPdgTgtFreeN;
87
88 Interaction * interaction = new Interaction(*in);
89 interaction->InitStatePtr()->SetPdgs(tgt_code, nu_code);
90 interaction->InitStatePtr()->TgtPtr()->SetHitNucPdg(nuc_code);
91
92 InteractionType_t wkcur = interaction->ProcInfo().InteractionTypeId();
93 unsigned int nres = fResList.NResonances();
94 for(unsigned int ires = 0; ires < nres; ires++) {
95
96 // Get next resonance from the resonance list
97 Resonance_t res = fResList.ResonanceId(ires);
98
99 interaction->ExclTagPtr()->SetResonance(res);
100
101 // Get a unique cache branch name
102 string key = this->CacheBranchName(res, wkcur, nu_code, nuc_code);
103
104 // Make sure the cache branch does not already exists
105 CacheBranchFx * cache_branch =
106 dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
107 assert(!cache_branch);
108
109 // Create the new cache branch
110 LOG("ReinSehgalResC", pNOTICE)
111 << "\n ** Creating cache branch - key = " << key;
112 cache_branch = new CacheBranchFx("RES Excitation XSec");
113 cache->AddCacheBranch(key, cache_branch);
114 assert(cache_branch);
115
116 const KPhaseSpace & kps = interaction->PhaseSpace();
117 double Ethr = kps.Threshold();
118 LOG("ReinSehgalResC", pNOTICE) << "E threshold = " << Ethr;
119
120 // Distribute the knots in the energy range as is being done in the
121 // XSecSplineList so that the energy threshold is treated correctly
122 // in the spline - see comments there in.
123 int nkb = (Ethr>Emin) ? 5 : 0; // number of knots < threshold
124 int nka = nknots-nkb; // number of knots >= threshold
125 // knots < energy threshold
126 double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
127 for(int i=0; i<nkb; i++) {
128 E[i] = Emin + i*dEb;
129 }
130 // knots >= energy threshold
131 double E0 = TMath::Max(Ethr,Emin);
132 double dEa = (TMath::Log10(fEMax) - TMath::Log10(E0)) /(nka-1);
133 for(int i=0; i<nka; i++) {
134 E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
135 }
136
137 // Compute cross sections at the given set of energies
138 for(int ie=0; ie<nknots; ie++) {
139 double xsec = 0.;
140 double Ev = E[ie];
141 p4.SetPxPyPzE(0,0,Ev,Ev);
142 interaction->InitStatePtr()->SetProbeP4(p4);
143
144 if(Ev>Ethr+kASmallNum) {
145 // Get W integration range and the wider possible Q2 range
146 // (for all W)
147 Range1D_t rW = kps.Limits(kKVW);
148 Range1D_t rQ2 = kps.Limits(kKVQ2);
149
150 LOG("ReinSehgalResC", pINFO)
151 << "*** Integrating d^2 XSec/dWdQ^2 for R: "
152 << utils::res::AsString(res) << " at Ev = " << Ev;
153 LOG("ReinSehgalResC", pINFO)
154 << "{W} = " << rW.min << ", " << rW.max;
155 LOG("ReinSehgalResC", pINFO)
156 << "{Q^2} = " << rQ2.min << ", " << rQ2.max;
157
158 if(rW.max<rW.min || rQ2.max<rQ2.min || rW.min<0 || rQ2.min<0) {
159 LOG("ReinSehgalResC", pINFO)
160 << "** Not allowed kinematically, xsec=0";
161 } else {
162
163 ROOT::Math::IBaseFunctionMultiDim * func =
164 new utils::gsl::d2XSec_dWdQ2_E(fSingleResXSecModel, interaction);
165 ROOT::Math::IntegrationMultiDim::Type ig_type =
167 ROOT::Math::IntegratorMultiDim ig(ig_type,0,fGSLRelTol,fGSLMaxEval);
168 ig.SetFunction(*func);
169 double kine_min[2] = { rW.min, rQ2.min };
170 double kine_max[2] = { rW.max, rQ2.max };
171 xsec = ig.Integral(kine_min, kine_max) * (1E-38 * units::cm2);
172 delete func;
173 }
174 } else {
175 LOG("ReinSehgalResC", pINFO)
176 << "** Below threshold E = " << Ev << " <= " << Ethr;
177 }
178 cache_branch->AddValues(Ev,xsec);
179 SLOG("ReinSehgalResC", pNOTICE)
180 << "RES XSec (R:" << utils::res::AsString(res)
181 << ", E="<< Ev << ") = "<< xsec/(1E-38 *genie::units::cm2) << " x 1E-38 cm^2";
182 }//spline knots
183
184 // Build the spline
185 cache_branch->CreateSpline();
186 }//ires
187
188 delete [] E;
189 delete interaction;
190}
#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.
Range1D_t Limits(KineVar_t kvar) const
Return the kinematical variable limits.
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
@ kKVQ2
Definition KineVar.h:33
@ kKVW
Definition KineVar.h:35
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::kKVQ2, genie::kKVW, genie::kPdgProton, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, genie::KPhaseSpace::Limits(), 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::ReinSehgalRESXSec::Integrate(), and genie::ReinSehgalSPPXSec::Integrate().

Member Data Documentation

◆ fEMax

◆ fResList

◆ fSingleResXSecModel

const XSecAlgorithmI* genie::ReinSehgalRESXSecWithCache::fSingleResXSecModel
mutableprotected

◆ fUsingDisResJoin

bool genie::ReinSehgalRESXSecWithCache::fUsingDisResJoin
protected

Definition at line 47 of file ReinSehgalRESXSecWithCache.h.

◆ fWcut

double genie::ReinSehgalRESXSecWithCache::fWcut
protected

Definition at line 48 of file ReinSehgalRESXSecWithCache.h.


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