GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Member Functions | Protected Attributes | List of all members
genie::SPPXSecWithCache Class Reference

Class that caches neutrino resonance SPP cross sections on free nucleons. This significantly speeds the cross section calculation for multiple nuclear targets (eg at the spline construction phase, but only for case without Pauli-blocking). This class integrates cross sections faster,. More...

#include <SPPXSecWithCache.h>

Inheritance diagram for genie::SPPXSecWithCache:
Inheritance graph
[legend]
Collaboration diagram for genie::SPPXSecWithCache:
Collaboration graph
[legend]

Protected Member Functions

 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. 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 XSecAlgorithmIfSinglePionProductionXSecModel
 
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 neutrino resonance SPP cross sections on free nucleons. This significantly speeds the cross section calculation for multiple nuclear targets (eg at the spline construction phase, but only for case without Pauli-blocking). This class integrates cross sections faster,.

Computes the cross section for an neutrino resonance SPP reaction.

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 cern.ch> University of Liverpool
Created:
November 12, 2019
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 43 of file SPPXSecWithCache.h.

Constructor & Destructor Documentation

SPPXSecWithCache::SPPXSecWithCache ( )
protected

Definition at line 56 of file SPPXSecWithCache.cxx.

56  :
58 {
59 
60 }
SPPXSecWithCache::SPPXSecWithCache ( string  name)
protected

Definition at line 62 of file SPPXSecWithCache.cxx.

62  :
63  XSecIntegratorI(nm)
64 {
65 
66 }
SPPXSecWithCache::SPPXSecWithCache ( string  name,
string  config 
)
protected

Definition at line 68 of file SPPXSecWithCache.cxx.

68  :
69  XSecIntegratorI(nm,conf)
70 {
71 
72 }
SPPXSecWithCache::~SPPXSecWithCache ( )
protectedvirtual

Definition at line 74 of file SPPXSecWithCache.cxx.

75 {
76 
77 }

Member Function Documentation

string SPPXSecWithCache::CacheBranchName ( SppChannel_t  spp_channel,
InteractionType_t  it,
int  nu 
) const
protected

Definition at line 195 of file SPPXSecWithCache.cxx.

References genie::InteractionType::AsString(), genie::SppChannel::AsString(), genie::Cache::CacheBranchKey(), fSinglePionProductionXSecModel, genie::Algorithm::Id(), genie::Cache::Instance(), genie::pdg::IsNeutrino(), and genie::AlgId::Key().

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

197 {
198  // Build a unique name for the cache branch
199 
200  Cache * cache = Cache::Instance();
201  string spp_channel_name = SppChannel::AsString(spp_channel);
202  string it_name = InteractionType::AsString(it);
203  string nc_nuc = ((pdg::IsNeutrino(nupdgc)) ? ";v:" : ";vb:");
204 
205  ostringstream intk;
206  intk << "ResSPPXSec/Ch:" << spp_channel_name << nc_nuc << nupdgc
207  << ";int:" << it_name;
208 
209  string algkey = fSinglePionProductionXSecModel->Id().Key();
210  string ikey = intk.str();
211  string key = cache->CacheBranchKey(algkey, ikey);
212 
213  return key;
214 }
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:110
static string AsString(SppChannel_t channel)
Definition: SppChannel.h:76
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:93
const XSecAlgorithmI * fSinglePionProductionXSecModel
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
static Cache * Instance(void)
Definition: Cache.cxx:67
string Key(void) const
Definition: AlgId.h:46
void SPPXSecWithCache::CacheResExcitationXSec ( const Interaction interaction) const
protected

Definition at line 79 of file SPPXSecWithCache.cxx.

References genie::Cache::AddCacheBranch(), genie::CacheBranchFx::AddValues(), genie::SppChannel::AsString(), CacheBranchName(), genie::units::cm2, genie::CacheBranchFx::CreateSpline(), fEMax, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLMinEval, genie::XSecIntegratorI::fGSLRelTol, genie::Cache::FindCacheBranch(), genie::SppChannel::FromInteraction(), fSinglePionProductionXSecModel, func(), fWcut, genie::Target::HitNucPdg(), genie::Interaction::InitState(), genie::Interaction::InitStatePtr(), genie::Cache::Instance(), genie::XSecSplineList::Instance(), genie::utils::gsl::IntegrationNDimTypeFromString(), genie::ProcessInfo::InteractionTypeId(), genie::pdg::IsNeutrino(), genie::controls::kASmallNum, genie::kPdgProton, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, LOG, genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), genie::Target::SetHitNucPdg(), genie::InitialState::SetPdgs(), genie::InitialState::SetProbeP4(), SLOG, genie::InitialState::Tgt(), genie::InitialState::TgtPtr(), and genie::KPhaseSpace::Threshold_SPP_iso().

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

80 {
81  // Cache resonance neutrino production data from free nucleons
82 
83  Cache * cache = Cache::Instance();
84 
86 
87  SppChannel_t spp_channel = SppChannel::FromInteraction(in);
88 
89  // Splines parameters are taken from Splines configuration
91 
92  // Compute the number of spline knots - use at least 10 knots per decade
93  // && at least 40 knots in the full energy range
94  const double Emin = xsl -> Emin() ;
95  const double Emax = std::min( fEMax, xsl -> Emax() ) ; // here we ignore the run configuration
96  // since we know that the splines have a plateau
97  const int nknots = xsl -> NKnots() ;
98 
99  vector<double> E( nknots, 0. ) ;
100 
101  int nu_code = in->InitState().ProbePdg();
102  int nuc_code = in->InitState().Tgt().HitNucPdg();
103  int tgt_code = (nuc_code==kPdgProton) ? kPdgTgtFreeP : kPdgTgtFreeN;
104 
105  Interaction local_interaction(*in);
106  local_interaction.InitStatePtr()->SetPdgs(tgt_code, nu_code);
107  local_interaction.InitStatePtr()->TgtPtr()->SetHitNucPdg(nuc_code);
108 
109  InteractionType_t wkcur = local_interaction.ProcInfo().InteractionTypeId();
110 
111  // Get a unique cache branch name
112  string key = this->CacheBranchName(spp_channel, wkcur, nu_code);
113 
114  // Make sure the cache branch does not already exists
115  CacheBranchFx * cache_branch =
116  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
117  assert(!cache_branch);
118 
119  // Create the new cache branch
120  LOG("SPPCache", pNOTICE)
121  << "\n ** Creating cache branch - key = " << key;
122  cache_branch = new CacheBranchFx("ResSPP XSec");
123  cache->AddCacheBranch(key, cache_branch);
124  assert(cache_branch);
125 
126  const KPhaseSpace& kps = in->PhaseSpace();
127 
128  double Ethr = kps.Threshold_SPP_iso();
129  LOG("SPPCache", pNOTICE) << "E threshold = " << Ethr;
130 
131  // Distribute the knots in the energy range as is being done in the
132  // XSecSplineList so that the energy threshold is treated correctly
133  // in the spline - see comments there in.
134  int nkb = (Ethr>Emin) ? 5 : 0; // number of knots < threshold
135  int nka = nknots-nkb; // number of knots >= threshold
136  // knots < energy threshold
137  double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
138  for(int i=0; i<nkb; i++) {
139  E[i] = Emin + i*dEb;
140  }
141  // knots >= energy threshold
142  double E0 = TMath::Max(Ethr,Emin);
143  double dEa = (TMath::Log10(Emax) - TMath::Log10(E0)) /(nka-1);
144  for(int i=0; i<nka; i++) {
145  E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i*dEa);
146  }
147 
148  // Compute cross sections at the given set of energies
149  for(int ie=0; ie<nknots; ie++) {
150  double xsec = 0.;
151  double Ev = E[ie];
152 
153  TLorentzVector p4(0., 0., Ev, Ev);
154  local_interaction.InitStatePtr()->SetProbeP4(p4);
155 
156  if(Ev>Ethr+kASmallNum) {
157 
158  LOG("SPPCache", pINFO)
159  << "*** Integrating d^3 XSec/dWdQ^2dCosTheta for Ch: "
160  << SppChannel::AsString(spp_channel) << " at Ev = " << Ev;
161 
163  ROOT::Math::IntegrationMultiDim::Type ig_type = utils::gsl::IntegrationNDimTypeFromString(fGSLIntgType);
164  ROOT::Math::IntegratorMultiDim ig(ig_type,0,fGSLRelTol,fGSLMaxEval);
165  if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE)
166  {
167  ROOT::Math::AdaptiveIntegratorMultiDim * cast = dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*>( ig.GetIntegrator() );
168  assert(cast);
169  cast->SetMinPts(fGSLMinEval);
170  }
171  ig.SetFunction(func);
172  double kine_min[3] = { 0., 0., 0.};
173  double kine_max[3] = { 1., 1., 1.};
174  xsec = ig.Integral(kine_min, kine_max)*(1E-38 * units::cm2);;
175  }
176  else
177  LOG("SPPCache", pINFO) << "** Below threshold E = " << Ev << " <= " << Ethr;
178 
179  cache_branch->AddValues(Ev,xsec);
180 
181 
182  string nc_nuc = ((pdg::IsNeutrino(nu_code)) ? ";v:" : ";vb:");
183 
184 
185  SLOG("SPPCache", pNOTICE)
186  << "SPP XSec (Ch:" << SppChannel::AsString(spp_channel) << nc_nuc << nu_code
187  << ", E="<< Ev << ") = "<< xsec << " x 1E-38 cm^2";
188  }//spline knots
189 
190  // Build the spline
191  cache_branch->CreateSpline();
192 
193 }
static SppChannel_t FromInteraction(const Interaction *interaction)
Definition: SppChannel.h:402
string fGSLIntgType
name of GSL numerical integrator
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:110
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition: GSLUtils.cxx:59
void CreateSpline(string type="TSpline3")
double Threshold_SPP_iso(void) const
Energy limit for resonance single pion production on isoscalar nucleon.
static XSecSplineList * Instance()
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:88
enum genie::ESppChannel SppChannel_t
static string AsString(SppChannel_t channel)
Definition: SppChannel.h:76
Summary information for an interaction.
Definition: Interaction.h:56
void AddValues(double x, double y)
string CacheBranchName(SppChannel_t spp_channel, InteractionType_t it, int nu) const
#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
const XSecAlgorithmI * fSinglePionProductionXSecModel
double func(double x, double y)
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
int fGSLMaxEval
GSL max evaluations.
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
List of cross section vs energy splines.
enum genie::EInteractionType InteractionType_t
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
double fGSLRelTol
required relative tolerance (error)

Member Data Documentation

double genie::SPPXSecWithCache::fEMax
protected
BaryonResList genie::SPPXSecWithCache::fResList
protected

Definition at line 61 of file SPPXSecWithCache.h.

const XSecAlgorithmI* genie::SPPXSecWithCache::fSinglePionProductionXSecModel
mutableprotected
bool genie::SPPXSecWithCache::fUsingDisResJoin
protected

Definition at line 56 of file SPPXSecWithCache.h.

double genie::SPPXSecWithCache::fWcut
protected

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