GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for genie::ReinSehgalRESXSecWithCacheFast:
Collaboration graph
[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. 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
 
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. More...
 
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 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

bool fUsingDisResJoin
 
double fWcut
 
double fEMax
 
const XSecAlgorithmIfSingleResXSecModel
 
BaryonResList fResList
 
- 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< bool > fOwnerships
 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...
 

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. 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...
 
- 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:
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 cern.ch> University of Liverpool

Created:
March 01, 2017
License:
Copyright (c) 2003-2024, 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::ReinSehgalRESXSecWithCacheFast ( )
protected

Definition at line 57 of file ReinSehgalRESXSecWithCacheFast.cxx.

57  :
59 {
60 
61 }
ReinSehgalRESXSecWithCacheFast::ReinSehgalRESXSecWithCacheFast ( string  name)
protected

Definition at line 63 of file ReinSehgalRESXSecWithCacheFast.cxx.

63  :
65 {
66 
67 }
ReinSehgalRESXSecWithCacheFast::ReinSehgalRESXSecWithCacheFast ( string  name,
string  config 
)
protected

Definition at line 69 of file ReinSehgalRESXSecWithCacheFast.cxx.

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

Definition at line 75 of file ReinSehgalRESXSecWithCacheFast.cxx.

76 {
77 
78 }

Member Function Documentation

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

Definition at line 204 of file ReinSehgalRESXSecWithCacheFast.cxx.

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

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

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 string AsString(InteractionType_t type)
GENIE Cache Memory.
Definition: Cache.h:38
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
const char * AsString(Resonance_t res)
resonance id -&gt; string
const int kPdgProton
Definition: PDGCodes.h:81
static Cache * Instance(void)
Definition: Cache.cxx:67
string Key(void) const
Definition: AlgId.h:46
void ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec ( const Interaction interaction) const
protected

Definition at line 80 of file ReinSehgalRESXSecWithCacheFast.cxx.

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::BaryonResList::NResonances(), genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), genie::BaryonResList::ResonanceId(), 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().

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 }
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
InteractionType_t InteractionTypeId(void) const
string fGSLIntgType
name of GSL numerical integrator
void SetProbeP4(const TLorentzVector &P4)
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition: GSLUtils.cxx:59
A simple [min,max] interval for doubles.
Definition: Range1.h:42
double Threshold(void) const
Energy threshold.
Definition: KPhaseSpace.cxx:82
void CreateSpline(string type="TSpline3")
enum genie::EResonance Resonance_t
string CacheBranchName(Resonance_t r, InteractionType_t it, int nu, int nuc) const
unsigned int NResonances(void) const
void SetResonance(Resonance_t res)
Definition: XclsTag.cxx:128
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:88
Summary information for an interaction.
Definition: Interaction.h:56
void AddValues(double x, double y)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double cm2
Definition: Units.h:69
Kinematical phase space.
Definition: KPhaseSpace.h:33
const int kPdgTgtFreeN
Definition: PDGCodes.h:200
const int kPdgTgtFreeP
Definition: PDGCodes.h:199
double func(double x, double y)
void SetPdgs(int tgt_pdgc, int probe_pdgc)
static const double kASmallNum
Definition: Controls.h:40
#define pINFO
Definition: Messenger.h:62
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:80
GENIE Cache Memory.
Definition: Cache.h:38
XclsTag * ExclTagPtr(void) const
Definition: Interaction.h:77
double max
Definition: Range1.h:53
int fGSLMaxEval
GSL max evaluations.
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:171
Target * TgtPtr(void) const
Definition: InitialState.h:67
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
const char * AsString(Resonance_t res)
resonance id -&gt; string
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
double min
Definition: Range1.h:52
const int kPdgProton
Definition: PDGCodes.h:81
#define pNOTICE
Definition: Messenger.h:61
static Cache * Instance(void)
Definition: Cache.cxx:67
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
enum genie::EInteractionType InteractionType_t
double fGSLRelTol
required relative tolerance (error)
Resonance_t ResonanceId(unsigned int ires) const

Member Data Documentation

double genie::ReinSehgalRESXSecWithCacheFast::fEMax
protected
BaryonResList genie::ReinSehgalRESXSecWithCacheFast::fResList
protected
const XSecAlgorithmI* genie::ReinSehgalRESXSecWithCacheFast::fSingleResXSecModel
mutableprotected
bool genie::ReinSehgalRESXSecWithCacheFast::fUsingDisResJoin
protected

Definition at line 56 of file ReinSehgalRESXSecWithCacheFast.h.

double genie::ReinSehgalRESXSecWithCacheFast::fWcut
protected

Definition at line 57 of file ReinSehgalRESXSecWithCacheFast.h.


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