Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
genie::DISXSec Class Reference

Computes the DIS Cross Section.
Is a concrete implementation of the XSecIntegratorI interface.
. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Physics/DeepInelastic/XSection/DISXSec.h"

Inheritance diagram for genie::DISXSec:
genie::XSecIntegratorI genie::Algorithm

Public Member Functions

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

Protected Member Functions

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 >
bool GetParamVect (const std::string &comm_name, std::vector< T > &v, unsigned int max, 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

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...
 
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...
 

Private Member Functions

void LoadConfig (void)
 
void CacheFreeNucleonXSec (const XSecAlgorithmI *model, const Interaction *in) const
 
string CacheBranchName (const XSecAlgorithmI *model, const Interaction *in) const
 

Private Attributes

double fVldEmin
 
double fVldEmax
 

Detailed Description

Computes the DIS Cross Section.
Is a concrete implementation of the XSecIntegratorI interface.
.

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

May 04, 2004

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 27 of file DISXSec.h.

Constructor & Destructor Documentation

DISXSec::DISXSec ( )

Definition at line 60 of file DISXSec.cxx.

60  :
61 XSecIntegratorI("genie::DISXSec")
62 {
63 
64 }
DISXSec::DISXSec ( string  config)

Definition at line 66 of file DISXSec.cxx.

66  :
67 XSecIntegratorI("genie::DISXSec", config)
68 {
69 
70 }
Definition: config.py:1
DISXSec::~DISXSec ( )
virtual

Definition at line 72 of file DISXSec.cxx.

73 {
74 
75 }

Member Function Documentation

int Algorithm::AddLowRegistry ( Registry rp,
bool  owns = true 
)
protectedinherited

add registry with lowest priority, also update ownership

Definition at line 601 of file Algorithm.cxx.

Referenced by genie::EventGenerator::Configure().

601  {
602 
603  fConfVect.push_back( rp ) ;
604  fOwnerships.push_back( own ) ;
605 
606  if ( fConfig ) {
607  delete fConfig ;
608  fConfig = 0 ;
609  }
610 
611  return fConfVect.size() ;
612 
613 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
int Algorithm::AddTopRegisties ( const vector< Registry * > &  rs,
bool  owns = false 
)
protectedinherited

Add registries with top priority, also udated Ownerships.

Definition at line 653 of file Algorithm.cxx.

653  {
654 
655  fConfVect.insert( fConfVect.begin(), rs.begin(), rs.end() ) ;
656 
657  fOwnerships.insert( fOwnerships.begin(), rs.size(), own ) ;
658 
659  if ( fConfig ) {
660  delete fConfig ;
661  fConfig = 0 ;
662  }
663 
664  return fConfVect.size() ;
665 
666 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
int Algorithm::AddTopRegistry ( Registry rp,
bool  owns = true 
)
protectedinherited

add registry with top priority, also update ownership

Definition at line 585 of file Algorithm.cxx.

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList().

585  {
586 
587  fConfVect.insert( fConfVect.begin(), rp ) ;
588  fOwnerships.insert( fOwnerships.begin(), own ) ;
589 
590  if ( fConfig ) {
591  delete fConfig ;
592  fConfig = 0 ;
593  }
594 
595  return fConfVect.size() ;
596 
597 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
void Algorithm::AdoptConfig ( void  )
inherited

Clone the configuration registry looked up from the configuration pool and take its ownership

Definition at line 394 of file Algorithm.cxx.

References Configure(), GetConfig(), LOG, and pNOTICE.

Referenced by genie::Algorithm::AllowReconfig().

394  {
395 
396  LOG("Algorithm", pNOTICE)
397  << this->Id().Key() << " is taking ownership of its configuration";
398 
399  // if(fOwnsConfig) {
400  // LOG("Algorithm", pWARN)
401  // << this->Id().Key() << " already owns its configuration!";
402  // return;
403  // }
404 
405  this->Configure( GetConfig() );
406 }
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
#define pNOTICE
Definition: Messenger.h:62
string Key(void) const
Definition: AlgId.h:47
void Algorithm::AdoptSubstructure ( void  )
inherited

Take ownership of the algorithms subtructure (sub-algorithms,...) by copying them from the AlgFactory pool to the local pool Also bring all the configuration variables to the top level config Registry. This can be used to group together a series of algorithms & their configurations and extract (a clone of) this group from the shared pools. Having a series of algorithms/configurations behaving as a monolithic block, with a single point of configuration (the top level) is to be used when bits & pieces of GENIE are used in isolation for data fitting or reweighting

Definition at line 408 of file Algorithm.cxx.

References genie::AlgFactory::AdoptAlgorithm(), genie::Algorithm::AdoptSubstructure(), GetConfig(), genie::AlgFactory::Instance(), genie::kRgAlg, LOG, pDEBUG, pNOTICE, and genie::RegistryItemI::TypeInfo().

Referenced by genie::Algorithm::AdoptSubstructure(), genie::Algorithm::AllowReconfig(), main(), and testReconfigInOwnedModules().

409 {
410 // Take ownership of the algorithms subtructure (sub-algorithms,..) by copying
411 // them from the AlgFactory pool to the local pool. Also bring all the
412 // configuration variables to the top level. See the header for more details.
413 // A secial naming convention is required for configuration parameter keys
414 // for parameters belonging to sub-algorithms (or sub-algorithms of these
415 // sub-algorithms and so on...).
416 // The convention is: "sub-alg-key/sub-sub-alg-key/.../original name"
417 // This is a recursive method: The AdoptSubtructure()of all sub-algorithms is
418 // invoked.
419 //
420  LOG("Algorithm", pNOTICE)
421  << "Algorithm: " << this->Id().Key() << " is adopting its substructure";
422 
423 // Registry deep_config;
424 // deep_config.UnLock();
425 // deep_config.SetName(this->Id().Key());
426 
427  // deep_config.SetName(this->Id().Config() + ";D");
428  // fID.SetConfig(this->Id().Config() + ";D");
429 
430  if(fOwnsSubstruc) this->DeleteSubstructure();
431 
432  fOwnedSubAlgMp = new AlgMap;
433  fOwnsSubstruc = true;
434 
435  AlgFactory * algf = AlgFactory::Instance();
436 
437  const RgIMap & rgmap = GetConfig().GetItemMap();
438 
439  RgIMapConstIter iter = rgmap.begin();
440  for( ; iter != rgmap.end(); ++iter) {
441 
442  RgKey reg_key = iter->first;
443  RegistryItemI * ri = iter->second;
444 
445  if(ri->TypeInfo() == kRgAlg) {
446  LOG("Algorithm", pDEBUG)
447  << "Found sub-algorithm pointed to by " << reg_key;
448  RgAlg reg_alg = fConfig->GetAlg(reg_key);
449  AlgId id(reg_alg);
450 
451  LOG("Algorithm", pDEBUG) << "Adopting sub-algorithm = " << id.Key();
452  Algorithm * subalg = algf->AdoptAlgorithm(id.Name(),id.Config());
453  subalg->AdoptSubstructure();
454 
455  LOG("Algorithm", pDEBUG) << "Adding sub-algorithm to local pool";
456  AlgMapPair key_alg_pair(reg_key, subalg);
457  fOwnedSubAlgMp->insert(key_alg_pair);
458 
459  }
460 
461  }
462 
463 
464  if ( fConfig ) {
465  delete fConfig ;
466  fConfig = 0 ;
467  }
468 
469 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
void DeleteSubstructure(void)
Definition: Algorithm.cxx:496
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
map< string, Algorithm * > AlgMap
Definition: Algorithm.h:49
Registry item pABC.
Definition: RegistryItemI.h:30
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
virtual RgType_t TypeInfo(void) const =0
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
void AdoptSubstructure(void)
Definition: Algorithm.cxx:408
pair< string, Algorithm * > AlgMapPair
Definition: Algorithm.h:52
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Definition: AlgFactory.cxx:127
Algorithm ID (algorithm name + configuration set name)
Definition: AlgId.h:35
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
string RgKey
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
#define pNOTICE
Definition: Messenger.h:62
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
string Key(void) const
Definition: AlgId.h:47
RgAlg GetAlg(RgKey key) const
Definition: Registry.cxx:503
#define pDEBUG
Definition: Messenger.h:64
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
virtual bool genie::Algorithm::AllowReconfig ( void  ) const
inlinevirtualinherited
string DISXSec::CacheBranchName ( const XSecAlgorithmI model,
const Interaction in 
) const
private

Definition at line 337 of file DISXSec.cxx.

References genie::Interaction::AsString(), genie::Cache::CacheBranchKey(), genie::Algorithm::Id(), genie::Cache::Instance(), findDuplicateFiles::key, and genie::AlgId::Key().

Referenced by CacheFreeNucleonXSec(), and Integrate().

339 {
340 // Build a unique name for the cache branch
341 
342  Cache * cache = Cache::Instance();
343 
344  string algkey = model->Id().Key();
345  string ikey = interaction->AsString();
346  string key = cache->CacheBranchKey(algkey, ikey);
347  return key;
348 }
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:102
GENIE Cache Memory.
Definition: Cache.h:39
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static Cache * Instance(void)
Definition: Cache.cxx:76
string Key(void) const
Definition: AlgId.h:47
void DISXSec::CacheFreeNucleonXSec ( const XSecAlgorithmI model,
const Interaction in 
) const
private

Definition at line 233 of file DISXSec.cxx.

References genie::Cache::AddCacheBranch(), genie::CacheBranchFx::AddValues(), ana::assert(), CacheBranchName(), genie::units::cm2, genie::CacheBranchFx::CreateSpline(), E, Emax, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLMinEval, genie::XSecIntegratorI::fGSLRelTol, genie::Cache::FindCacheBranch(), func(), fVldEmax, fVldEmin, genie::Target::HitNucPdg(), MECModelEnuComparisons::i, genie::Interaction::InitStatePtr(), genie::Cache::Instance(), makeTrainCVSamples::int, genie::utils::gsl::IntegrationNDimTypeFromString(), genie::pdg::IsProton(), genie::controls::kASmallNum, findDuplicateFiles::key, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, LOG, genie::Range1D_t::max, genie::Range1D_t::min, nknots, make_associated_cosmic_defs::p4, genie::Interaction::PhaseSpace(), pINFO, pNOTICE, pWARN, genie::KPhaseSpace::Q2Lim(), genie::Target::SetId(), genie::InitialState::SetProbeP4(), genie::InitialState::TgtPtr(), genie::KPhaseSpace::Threshold(), genie::KPhaseSpace::WLim(), and xsec.

Referenced by Integrate().

235 {
236  LOG("DISXSec", pWARN)
237  << "Wait while computing/caching free nucleon DIS xsections first...";
238 
239  // Create the cache branch
240  Cache * cache = Cache::Instance();
241  string key = this->CacheBranchName(model,interaction);
242  CacheBranchFx * cache_branch =
243  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
244  assert(!cache_branch);
245  cache_branch = new CacheBranchFx("DIS XSec");
246  cache->AddCacheBranch(key, cache_branch);
247 
248  // Tweak interaction to be on a free nucleon target
249  Target * target = interaction->InitStatePtr()->TgtPtr();
250  int nucpdgc = target->HitNucPdg();
251  if(pdg::IsProton(nucpdgc)) { target->SetId(kPdgTgtFreeP); }
252  else { target->SetId(kPdgTgtFreeN); }
253 
254  // Compute threshold
255  const KPhaseSpace & kps = interaction->PhaseSpace();
256  double Ethr = kps.Threshold();
257 
258  // Compute the number of spline knots - use at least 10 knots per decade
259  // && at least 40 knots in the full energy range
260  const double Emin = fVldEmin/3.;
261  const double Emax = fVldEmax*3.;
262  const int nknots_min = (int) (10*(TMath::Log(Emax) - TMath::Log(Emin)));
263  const int nknots = TMath::Max(40, nknots_min);
264 
265  // Distribute the knots in the energy range as is being done in the
266  // XSecSplineList so that the energy threshold is treated correctly
267  // in the spline - see comments there in.
268  double * E = new double[nknots];
269  int nkb = (Ethr>Emin) ? 5 : 0; // number of knots < threshold
270  int nka = nknots-nkb; // number of knots >= threshold
271  // knots < energy threshold
272  double dEb = (Ethr>Emin) ? (Ethr - Emin) / nkb : 0;
273  for(int i=0; i<nkb; i++) {
274  E[i] = Emin + i*dEb;
275  }
276  // knots >= energy threshold
277  double E0 = TMath::Max(Ethr,Emin);
278  double dEa = (TMath::Log10(Emax) - TMath::Log10(E0)) /(nka-1);
279  for(int i=0; i<nka; i++) {
280  E[i+nkb] = TMath::Power(10., TMath::Log10(E0) + i * dEa);
281  }
282 
283  // Create the integrand
284  ROOT::Math::IBaseFunctionMultiDim * func =
285  new utils::gsl::d2XSec_dWdQ2_E(model, interaction);
286 
287  // Compute the cross section at the given set of knots
288  for(int ie=0; ie<nknots; ie++) {
289  double Ev = E[ie];
290  TLorentzVector p4(0,0,Ev,Ev);
291  interaction->InitStatePtr()->SetProbeP4(p4);
292  double xsec = 0.;
293  if(Ev>Ethr+kASmallNum) {
294  Range1D_t Wl = kps.WLim();
295  Range1D_t Q2l = kps.Q2Lim();
296  LOG("DISXSec", pINFO)
297  << "W integration range = [" << Wl.min << ", " << Wl.max << "]";
298  LOG("DISXSec", pINFO)
299  << "Q2 integration range = [" << Q2l.min << ", " << Q2l.max << "]";
300 
301  bool phsp_ok =
302  (Q2l.min >= 0. && Q2l.max >= 0. && Q2l.max >= Q2l.min &&
303  Wl.min >= 0. && Wl.max >= 0. && Wl.max >= Wl.min);
304 
305  if(phsp_ok) {
308  double abstol = 1; //We mostly care about relative tolerance.
309  ROOT::Math::IntegratorMultiDim ig(*func, ig_type, abstol, fGSLRelTol, fGSLMaxEval);
310 
311  if (ig_type == ROOT::Math::IntegrationMultiDim::kADAPTIVE) {
312  ROOT::Math::AdaptiveIntegratorMultiDim * cast =
313  dynamic_cast<ROOT::Math::AdaptiveIntegratorMultiDim*>( ig.GetIntegrator() );
314  assert(cast);
315  cast->SetMinPts(fGSLMinEval);
316  }
317 
318  double kine_min[2] = { Wl.min, Q2l.min };
319  double kine_max[2] = { Wl.max, Q2l.max };
320  xsec = ig.Integral(kine_min, kine_max) * (1E-38 * units::cm2);
321  }// phase space limits ok?
322  }//Ev>threshold
323 
324  LOG("DISXSec", pNOTICE)
325  << "Caching: XSec[DIS] (E = " << Ev << " GeV) = "
326  << xsec / (1E-38 * units::cm2) << " x 1E-38 cm^2";
327  cache_branch->AddValues(Ev,xsec);
328  }//ie
329 
330  // Create the spline
331  cache_branch->CreateSpline();
332 
333  delete [] E;
334  delete func;
335 }
string fGSLIntgType
name of GSL numerical integrator
const XML_Char * target
Definition: expat.h:268
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition: GSLUtils.cxx:67
int HitNucPdg(void) const
Definition: Target.cxx:321
A simple [min,max] interval for doubles.
Definition: Range1.h:43
double Threshold(void) const
Energy threshold.
Definition: KPhaseSpace.cxx:81
Range1D_t Q2Lim(void) const
Q2 limits.
static const double cm2
Definition: Units.h:77
void SetId(int pdgc)
Definition: Target.cxx:166
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:97
void AddValues(double x, double y)
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:299
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const Int_t nknots
Definition: testXsec.C:24
Float_t E
Definition: plot.C:20
double fVldEmax
Definition: DISXSec.h:49
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
Kinematical phase space.
Definition: KPhaseSpace.h:34
const int kPdgTgtFreeN
Definition: PDGCodes.h:177
const int kPdgTgtFreeP
Definition: PDGCodes.h:176
double func(double x, double y)
static const double kASmallNum
Definition: Controls.h:40
#define pINFO
Definition: Messenger.h:63
Double_t xsec[nknots]
Definition: testXsec.C:47
#define pWARN
Definition: Messenger.h:61
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:89
GENIE Cache Memory.
Definition: Cache.h:39
double max
Definition: Range1.h:54
int fGSLMaxEval
GSL max evaluations.
assert(nhit_max >=nhit_nbins)
double fVldEmin
Definition: DISXSec.h:48
double Emax
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
Definition: DISXSec.cxx:337
double min
Definition: Range1.h:53
#define pNOTICE
Definition: Messenger.h:62
static Cache * Instance(void)
Definition: Cache.cxx:76
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
Range1D_t WLim(void) const
W limits.
double fGSLRelTol
required relative tolerance (error)
AlgCmp_t Algorithm::Compare ( const Algorithm alg) const
virtualinherited

Compare with input algorithm.

Definition at line 294 of file Algorithm.cxx.

References genie::AlgId::Config(), genie::Algorithm::Id(), genie::kAlgCmpDiffAlg, genie::kAlgCmpDiffConfig, genie::kAlgCmpIdentical, genie::kAlgCmpUnknown, and genie::AlgId::Name().

Referenced by genie::Algorithm::AllowReconfig().

295 {
296 // Compares itself with the input algorithm
297 
298  string alg1 = this->Id().Name();
299  string config1 = this->Id().Config();
300  string alg2 = algo->Id().Name();
301  string config2 = algo->Id().Config();
302 
303  if(alg1 == alg2)
304  {
305  if(config1 == config2) return kAlgCmpIdentical;
306  else return kAlgCmpDiffConfig;
307  }
308  else return kAlgCmpDiffAlg;
309 
310  return kAlgCmpUnknown;
311 }
string Name(void) const
Definition: AlgId.h:45
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
string Config(void) const
Definition: AlgId.h:46
void DISXSec::Configure ( const Registry config)
virtual

Overload the Algorithm::Configure() methods to load private data members from configuration options

Reimplemented from genie::Algorithm.

Definition at line 202 of file DISXSec.cxx.

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

203 {
204  Algorithm::Configure(config);
205  this->LoadConfig();
206 }
void LoadConfig(void)
Definition: DISXSec.cxx:214
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void DISXSec::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 208 of file DISXSec.cxx.

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

209 {
211  this->LoadConfig();
212 }
Definition: config.py:1
void LoadConfig(void)
Definition: DISXSec.cxx:214
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void Algorithm::DeleteConfig ( void  )
protectedinherited

Definition at line 471 of file Algorithm.cxx.

References MECModelEnuComparisons::i.

Referenced by genie::Algorithm::AllowReconfig().

472 {
473  // there is nothing to delete if the configuration is not owned but is
474  // rather looked up from the configuration pool
475  //
476 
477  for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
478  if ( fOwnerships[i] ) {
479  delete fConfVect[i] ;
480  }
481  }
482 
483  fConfVect.clear() ;
484  fOwnerships.clear() ;
485 
486  // delete owned configuration registry
487 
488  if(fConfig) {
489  delete fConfig;
490  fConfig=0;
491  }
492 
493 }
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
void Algorithm::DeleteSubstructure ( void  )
protectedinherited

Definition at line 496 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

497 {
498  // there is nothing to delete if the sub-algorithms are not owned but rather
499  // taken from the AlgFactory's pool
500  //
501  if(!fOwnsSubstruc) return;
502 
503  // delete local algorithm pool
504  //
505  AlgMapIter iter = fOwnedSubAlgMp->begin();
506  for( ; iter != fOwnedSubAlgMp->end(); ++iter) {
507  Algorithm * alg = iter->second;
508  if(alg) {
509  delete alg;
510  alg=0;
511  }
512  }
513  delete fOwnedSubAlgMp;
514  fOwnedSubAlgMp = 0;
515 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
map< string, Algorithm * >::iterator AlgMapIter
Definition: Algorithm.h:50
Registry * Algorithm::ExtractLocalConfig ( const Registry in) const
protectedinherited

Split an incoming configuration Registry into a block valid for this algorithm Ownership of the returned registry belongs to the algo

Definition at line 518 of file Algorithm.cxx.

References genie::RegistryItemI::Clone(), genie::Registry::GetItemMap(), genie::Registry::Name(), and confusionMatrixTree::out.

Referenced by genie::Algorithm::AllowReconfig().

518  {
519 
520  const RgIMap & rgmap = in.GetItemMap();
521  Registry * out = new Registry( in.Name(), false );
522 
523  for( RgIMapConstIter reg_iter = rgmap.begin();
524  reg_iter != rgmap.end(); ++reg_iter ) {
525 
526  RgKey reg_key = reg_iter->first;
527  if( reg_key.find( '/' ) != string::npos) continue;
528 
529  // at this point
530  // this key is referred to the local algorithm
531  // it has to be copied in out;
532 
533  RegistryItemI * ri = reg_iter->second;
534  RgIMapPair key_item_pair( reg_key, ri->Clone() );
535  out -> Set(key_item_pair);
536 
537  }
538 
539  if ( out -> NEntries() <= 0 ) {
540  delete out ;
541  out = 0 ;
542  }
543 
544  return out ;
545 }
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:47
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
virtual RegistryItemI * Clone(void) const =0
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
Registry * Algorithm::ExtractLowerConfig ( const Registry in,
const string alg_key 
) const
protectedinherited

Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key.

Definition at line 549 of file Algorithm.cxx.

References genie::RegistryItemI::Clone(), genie::Registry::GetItemMap(), genie::Registry::Name(), and confusionMatrixTree::out.

Referenced by genie::Algorithm::AllowReconfig().

549  {
550 
551  const RgIMap & rgmap = in.GetItemMap();
552  Registry * out = new Registry( in.Name(), false );
553 
554  for( RgIMapConstIter reg_iter = rgmap.begin();
555  reg_iter != rgmap.end(); ++reg_iter ) {
556 
557  RgKey reg_key = reg_iter->first;
558  if( reg_key.find(alg_key+"/") == string::npos) continue;
559 
560  // at this point
561  // this key is referred to the sub-algorithm
562  // indicated by alg_key: it has to be copied in out;
563 
564  int new_key_start = reg_key.find_first_of('/')+1;
565  RgKey new_reg_key = reg_key.substr( new_key_start, reg_key.length() );
566 
567  RegistryItemI * ri = reg_iter->second;
568  RgIMapPair key_item_pair(new_reg_key, ri->Clone());
569  out -> Set(key_item_pair);
570 
571  }
572 
573  if ( out -> NEntries() <= 0 ) {
574  delete out ;
575  out = 0 ;
576  }
577 
578  return out ;
579 
580 }
Registry item pABC.
Definition: RegistryItemI.h:30
string Name(void) const
get the registry name
Definition: Registry.cxx:612
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
pair< RgKey, RegistryItemI * > RgIMapPair
Definition: Registry.h:47
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
virtual RegistryItemI * Clone(void) const =0
map< RgKey, RegistryItemI * > RgIMap
Definition: Registry.h:46
void Algorithm::FindConfig ( void  )
virtualinherited

Lookup configuration from the config pool Similar logic from void Configure(string)

Definition at line 135 of file Algorithm.cxx.

References gen_flatrecord::config, exit(), genie::AlgConfigPool::FindRegistry(), genie::Registry::GetItemMap(), genie::Registry::GetString(), MECModelEnuComparisons::i, genie::AlgConfigPool::Instance(), it, genie::Registry::ItemIsLocal(), parse_dependency_file_t::list, LOG, pDEBUG, pFATAL, time_estimates::pool, pWARN, moon_position_table_new3::second, genie::utils::str::Split(), string, and APDHVSetting::temp.

136 {
137 // Finds its configration Registry from the ConfigPool and gets a pointer to
138 // it. If the Registry comes from the ConfigPool then the Algorithm does not
139 // own its configuration (the ConfigPool singleton keeps the ownership and the
140 // responsibility to -eventually- delete all the Registries it instantiates
141 // by parsing the XML config files).
142 
143  DeleteConfig() ;
144 
146 
147  Registry * config = 0 ;
148 
149  // load the Default config if config is not the default
150  if ( fID.Config() != "Default" ) {
151  config = pool -> FindRegistry( fID.Name(), "Default" );
152  if ( config ) {
153  if ( config -> NEntries() > 0 ) {
154  AddTopRegistry( config, false ) ;
155  LOG("Algorithm", pDEBUG) << "\n" << *config;
156  }
157  }
158  }
159 
160  // Load the right config
161  config = pool->FindRegistry(this);
162 
163  if(!config)
164  // notify & keep whatever config Registry was used before.
165  LOG("Algorithm", pWARN)
166  << "No Configuration available for "
167  << this->Id().Key() << " at the ConfigPool";
168  else {
169  if ( config -> NEntries() > 0 ) {
170  AddTopRegistry( config, false ) ;
171  LOG("Algorithm", pDEBUG) << "\n" << config;
172  }
173  }
174 
175  const string common_key_root = "Common" ;
176  std::map<string, string> common_lists;
177 
178  // Load Common Parameters if key that start with "Common" is found
179  for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
180  const Registry & temp = * fConfVect[i] ;
181  for ( RgIMapConstIter it = temp.GetItemMap().begin() ; it != temp.GetItemMap().end() ; ++it ) {
182 
183  // check if it is a "Common" entry
184  if ( it -> first.find( common_key_root ) == 0 ) {
185  // retrieve the type of the common entry
186  std::string type = it -> first.substr(common_key_root.size() ) ;
187 
188  if ( temp.ItemIsLocal( it -> first ) ) {
189 
190  string temp_list = temp.GetString( it -> first ) ;
191  if ( temp_list.length() > 0 ) {
192  common_lists[type] = temp_list ;
193  }
194  }
195  }
196 
197  }
198 
199  } // loop over the local registries
200 
201 
202  for ( std::map<string, string>::const_iterator it = common_lists.begin() ;
203  it != common_lists.end() ; ++it ) {
204 
205  vector<string> list = str::Split( it -> second , "," ) ;
206 
207  for ( unsigned int i = 0; i < list.size(); ++i ) {
208 
209  config = pool -> CommonList( it -> first, list[i] ) ;
210 
211  if ( ! config ) {
212  LOG("Algorithm", pFATAL)
213  << "No Commom parameters available for " << it -> first << " list "
214  << list[i] << " at the ConfigPool";
215 
216  exit( 78 ) ;
217  }
218  else {
219  AddLowRegistry( config, false ) ;
220  LOG("Algorithm", pDEBUG) << "Loading "
221  << it -> first << " registry "
222  << list[i] << " \n" << config;
223  }
224 
225  }
226 
227  }
228 
229 
230  // Load Tunable from CommonParameters
231  // only if the option is specified in RunOpt
232  config = pool -> CommonList( "Param", "Tunable" ) ;
233  if ( config ) {
234  if ( config -> NEntries() > 0 ) {
235  AddTopRegistry( config, false ) ;
236  LOG("Algorithm", pDEBUG) << "Loading Tunable registry \n" << config;
237  }
238  }
239  else {
240  // notify & keep whatever config Registry was used before.
241  LOG("Algorithm", pWARN)
242  << "No Tunable parameter set available at the ConfigPool";
243  }
244 
245  if ( fConfig ) {
246  delete fConfig ;
247  fConfig = 0 ;
248  }
249 
250 }
set< int >::iterator it
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Definition: AlgConfigPool.h:41
#define pFATAL
Definition: Messenger.h:57
Definition: config.py:1
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition: Registry.h:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const RgIMap & GetItemMap(void) const
Definition: Registry.h:162
string Name(void) const
Definition: AlgId.h:45
bool ItemIsLocal(RgKey key) const
local or global?
Definition: Registry.cxx:193
int AddTopRegistry(Registry *rp, bool owns=true)
add registry with top priority, also update ownership
Definition: Algorithm.cxx:585
#define pWARN
Definition: Messenger.h:61
void DeleteConfig(void)
Definition: Algorithm.cxx:471
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
RgStr GetString(RgKey key) const
Definition: Registry.cxx:496
vector< Registry * > fConfVect
Definition: Algorithm.h:161
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:42
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
exit(0)
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
Registry * FindRegistry(string key) const
int AddLowRegistry(Registry *rp, bool owns=true)
add registry with lowest priority, also update ownership
Definition: Algorithm.cxx:601
string Key(void) const
Definition: AlgId.h:47
static AlgConfigPool * Instance()
#define pDEBUG
Definition: Messenger.h:64
string Config(void) const
Definition: AlgId.h:46
enum BeamMode string
const Registry & Algorithm::GetConfig ( void  ) const
virtualinherited

Get configuration registry Evaluate the summary of the configuration and returns it The summary of a configuration is a merge of all the registries known to the algorithm (see Configure() methods) but every parameter is appearing only once and in case of repetitions, only the parameter from the registry with the highest prioriry is considered.

Definition at line 254 of file Algorithm.cxx.

References febshutoff_auto::end, genie::Algorithm::GetConfig(), MECModelEnuComparisons::i, LOG, pDEBUG, r(), and moon_position_table_new3::second.

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList(), GetAlgorithms(), genie::Algorithm::GetConfig(), genie::GRV98LO::GRV98LO(), genie::NewQELXSec::Integrate(), genie::LHAPDF5::LHAPDF5(), genie::IBDXSecMap::LoadConfig(), genie::Decayer::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::SmithMonizUtils::LoadConfig(), main(), genie::AlgFactory::Print(), TestPythiaTauDecays(), testReconfigInOwnedModules(), and genie::P33PaschosLalakulichPXSec::XSec().

254  {
255 
256  if ( fConfig ) return * fConfig ;
257 
258  const_cast<Algorithm*>( this ) -> fConfig = new Registry( fID.Key() + "_summary", false ) ;
259 
260  // loop and append
261  // understand the append mechanism
262  for ( unsigned int i = 0 ; i < fConfVect.size(); ++i ) {
263  fConfig -> Append( * fConfVect[i] ) ;
264  }
265 
266  if ( fOwnsSubstruc ) {
267 
268  for ( AlgMapConstIter iter = fOwnedSubAlgMp -> begin() ;
269  iter != fOwnedSubAlgMp -> end() ; ++iter ) {
270 
271  Algorithm * subalg = iter -> second ;
272 
273  LOG("Algorithm", pDEBUG) << "Appending config from " << iter -> first << " -> " << subalg -> Id() ;
274  const Registry & r = subalg->GetConfig();
275  RgKey prefix = iter -> first + "/";
276  fConfig -> Append(r,prefix);
277 
278  }
279 
280  } //if owned substructure
281 
282  return * fConfig ;
283 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const XML_Char * prefix
Definition: expat.h:380
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
vector< Registry * > fConfVect
Definition: Algorithm.h:161
string RgKey
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
string Key(void) const
Definition: AlgId.h:47
#define pDEBUG
Definition: Messenger.h:64
Registry * Algorithm::GetOwnedConfig ( void  )
inherited

Returns the pointer of the summary registry, see previous method Gives access to the summary so it could be changed. The usage of this method is deprecated as it is mantained only for back compatibility. If you need to add or chage a parter (or more), use the AddTopRegistry() instead

Definition at line 287 of file Algorithm.cxx.

References GetConfig().

Referenced by genie::TransverseEnhancementFFModel::LoadConfig(), and genie::EffectiveSF::LoadConfig().

288 {
289 
290  GetConfig() ;
291  return fConfig;
292 }
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
template<class T >
bool genie::Algorithm::GetParam ( const RgKey name,
T p,
bool  is_top_call = true 
) const
protectedinherited

Ideal access to a parameter value from the vector of registries Returns true if the value is found and the parameters is set

Referenced by genie::CollinsSpillerFragm::BuildFunction(), genie::PetersonFragm::BuildFunction(), genie::COHXSec::LoadConfig(), LoadConfig(), genie::INukeDeltaPropg::LoadConfig(), genie::HadronTransporter::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::RSHelicityAmplModelNCn::LoadConfig(), genie::RSHelicityAmplModelNCp::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::DipoleAxialFormFactorModel::LoadConfig(), genie::DipoleELFormFactorsModel::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::VertexGenerator::LoadConfig(), genie::H3AMNuGammaPXSec::LoadConfig(), genie::RSPPResonanceSelector::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::Decayer::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::EmpiricalMECPXSec2015::LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::KuzminNaumov2016AxialFormFactorModel::LoadConfig(), genie::SlowRsclCharmDISPXSecLO::LoadConfig(), genie::UnstableParticleDecayer::LoadConfig(), genie::AhrensNCELPXSec::LoadConfig(), genie::AlamSimoAtharVacasSKPXSec2014::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::ReinDFRPXSec::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::BYPDF::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::ZExpAxialFormFactorModel::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BBA05ELFormFactorsModel::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::BBA03ELFormFactorsModel::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::PrimaryLeptonGenerator::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::SpectralFunc1d::LoadConfig(), genie::OutgoingDarkGenerator::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::LHAPDF6::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::LwlynSmithFF::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::BBA07ELFormFactorsModel::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke2018::LoadConfig(), genie::LocalFGM::LoadConfig(), genie::HNIntranuke2018::LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::EffectiveSF::LoadConfig(), genie::ReinSehgalSPPPXSec::LoadConfig(), genie::KNOHadronization::LoadConfig(), genie::SmithMonizUtils::LoadConfig(), genie::MECInteractionListGenerator::LoadConfigData(), genie::PhysInteractionSelector::LoadConfigData(), genie::RESInteractionListGenerator::LoadConfigData(), genie::PauliBlocker::LoadModelType(), genie::BYStrucFunc::ReadBYParams(), and genie::LHAPDF5::SetPDFSetFromConfig().

template<class T >
bool genie::Algorithm::GetParamDef ( const RgKey name,
T p,
const T def 
) const
protectedinherited

Ideal access to a parameter value from the vector of registries, With default value. Returns true if the value is set from the registries, false if the value is the default

Referenced by genie::IMDXSec::LoadConfig(), genie::COHXSec::LoadConfig(), LoadConfig(), genie::RESXSec::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::COHXSecAR::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::COHElKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::QELXSec::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::NuEInteractionListGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DMELXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::NucBindEnergyAggregator::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::NuElectronXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AlamSimoAtharVacasSKXSec::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::KovalenkoQELCharmPXSec::LoadConfig(), genie::SmithMonizQELCCXSec::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::LocalFGM::LoadConfig(), genie::HNIntranuke2018::LoadConfig(), genie::HAIntranuke2018::LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::EffectiveSF::LoadConfig(), genie::KNOHadronization::LoadConfig(), genie::NewQELXSec::LoadConfig(), genie::DFRInteractionListGenerator::LoadConfigData(), genie::MECInteractionListGenerator::LoadConfigData(), genie::QELInteractionListGenerator::LoadConfigData(), genie::COHInteractionListGenerator::LoadConfigData(), genie::RESInteractionListGenerator::LoadConfigData(), genie::SKInteractionListGenerator::LoadConfigData(), genie::DMELInteractionListGenerator::LoadConfigData(), genie::RSPPInteractionListGenerator::LoadConfigData(), genie::DISInteractionListGenerator::LoadConfigData(), and genie::DMDISInteractionListGenerator::LoadConfigData().

template<class T >
bool genie::Algorithm::GetParamVect ( const std::string comm_name,
std::vector< T > &  v,
unsigned int  max,
bool  is_top_call = true 
) const
protectedinherited

Handle to load vectors of parameters It looks for different registry item with name comm_name0, comm_name1, etc...

virtual AlgStatus_t genie::Algorithm::GetStatus ( void  ) const
inlinevirtualinherited

Get algorithm status.

Definition at line 101 of file Algorithm.h.

References genie::Algorithm::fStatus.

101 { return fStatus; }
AlgStatus_t fStatus
algorithm execution status
Definition: Algorithm.h:166
virtual const AlgId& genie::Algorithm::Id ( void  ) const
inlinevirtualinherited

Get algorithm ID.

Definition at line 98 of file Algorithm.h.

References genie::Algorithm::fID.

Referenced by genie::KineGeneratorWithCache::AccessCacheBranch(), genie::QELEventGeneratorSM::AccessCacheBranch2(), genie::QELEventGeneratorSM::AccessCacheBranchDiffv(), genie::InteractionListAssembler::AssembleInteractionList(), genie::XSecAlgorithmMap::BuildMap(), genie::InteractionGeneratorMap::BuildMap(), genie::XSecSplineList::BuildSplineKey(), CacheBranchName(), genie::ReinSehgalRESXSecWithCache::CacheBranchName(), genie::DMDISXSec::CacheBranchName(), genie::ReinSehgalRESXSecWithCacheFast::CacheBranchName(), genie::Algorithm::Compare(), genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::COHElKinematicsGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::ComputeMaxXSec(), genie::Algorithm::Configure(), genie::GEVGDriver::CreateSplines(), genie::QPMDISPXSec::DISRESJoinSuppressionFactor(), genie::QPMDMDISPXSec::DMDISRESJoinSuppressionFactor(), genie::AlgConfigPool::FindRegistry(), genie::AlgFactory::ForceReconfiguration(), genie::GEVGDriver::GenerateEvent(), GetAlgorithms(), genie::LwlynSmithQELCCPXSec::Integral(), genie::NievesQELCCPXSec::Integral(), genie::COHXSec::Integrate(), genie::QPMDISPXSec::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::EventGeneratorListAssembler::LoadGenerator(), main(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), genie::XSecAlgorithmMap::Print(), genie::InteractionGeneratorMap::Print(), genie::AlgFactory::Print(), genie::COHHadronicSystemGenerator::ProcessEventRecord(), genie::COHPrimaryLeptonGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::MECGenerator::ProcessEventRecord(), genie::EventGenerator::ProcessEventRecord(), genie::KNOPythiaHadronization::SelectHadronizer(), TestPythiaTauDecays(), and genie::GEVGDriver::UseSplines().

98 { return fID; }
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void Algorithm::Initialize ( void  )
protectedinherited

Definition at line 343 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

344 {
345 // Algorithm initialization
346 //
347  fAllowReconfig = true;
348  fOwnsSubstruc = false;
349  fConfig = 0;
350  fOwnedSubAlgMp = 0;
351 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
double DISXSec::Integrate ( const XSecAlgorithmI model,
const Interaction i 
) const
virtual

XSecIntegratorI interface implementation.

Implements genie::XSecIntegratorI.

Definition at line 77 of file DISXSec.cxx.

References ana::assert(), genie::RunOpt::BareXSecPreCalc(), CacheBranchName(), CacheFreeNucleonXSec(), genie::units::cm2, E, genie::Spline::Evaluate(), genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLRelTol, genie::Cache::FindCacheBranch(), func(), genie::XSecSplineList::GetSpline(), genie::Target::HitNucPdg(), genie::Interaction::InitState(), genie::Interaction::InitStatePtr(), genie::RunOpt::Instance(), genie::Cache::Instance(), genie::XSecSplineList::Instance(), genie::utils::gsl::IntegrationNDimTypeFromString(), genie::KPhaseSpace::IsAboveThreshold(), genie::XSecSplineList::IsEmpty(), genie::Target::IsNucleus(), genie::pdg::IsProton(), findDuplicateFiles::key, genie::kIAssumeFreeNucleon, genie::kINoNuclearCorrection, genie::kISkipProcessChk, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, genie::kRfHitNucRest, LOG, genie::Range1D_t::max, genie::Range1D_t::min, genie::Target::N(), pDEBUG, genie::Interaction::PhaseSpace(), pINFO, genie::InitialState::ProbeE(), genie::KPhaseSpace::Q2Lim(), genie::Target::SetId(), genie::XSecSplineList::SplineExists(), genie::InitialState::Tgt(), genie::InitialState::TgtPtr(), genie::XSecAlgorithmI::ValidProcess(), genie::KPhaseSpace::WLim(), xsec, and genie::Target::Z().

79 {
80  if(! model->ValidProcess(in) ) return 0.;
81 
82  const KPhaseSpace & kps = in->PhaseSpace();
83  if(!kps.IsAboveThreshold()) {
84  LOG("DISXSec", pDEBUG) << "*** Below energy threshold";
85  return 0;
86  }
87 
88  const InitialState & init_state = in->InitState();
89  double Ev = init_state.ProbeE(kRfHitNucRest);
90 
91  int nucpdgc = init_state.Tgt().HitNucPdg();
92  int NNucl = (pdg::IsProton(nucpdgc)) ?
93  init_state.Tgt().Z() : init_state.Tgt().N();
94 
95  // If the input interaction is off a nuclear target, then chek whether
96  // the corresponding free nucleon cross section already exists at the
97  // cross section spline list.
98  // If yes, calculate the nuclear cross section based on that value.
99  //
101  if(init_state.Tgt().IsNucleus() && !xsl->IsEmpty() ) {
102  Interaction * interaction = new Interaction(*in);
103  Target * target = interaction->InitStatePtr()->TgtPtr();
104  if(pdg::IsProton(nucpdgc)) { target->SetId(kPdgTgtFreeP); }
105  else { target->SetId(kPdgTgtFreeN); }
106  if(xsl->SplineExists(model,interaction)) {
107  const Spline * spl = xsl->GetSpline(model, interaction);
108  double xsec = spl->Evaluate(Ev);
109  LOG("DISXSec", pINFO)
110  << "From XSecSplineList: XSec[DIS,free nucleon] (E = " << Ev << " GeV) = " << xsec;
111  if(! interaction->TestBit(kIAssumeFreeNucleon) ) {
112  xsec *= NNucl;
113  LOG("DISXSec", pINFO) << "XSec[DIS] (E = " << Ev << " GeV) = " << xsec;
114  }
115  delete interaction;
116  return xsec;
117  }
118  delete interaction;
119  }
120 
121  // There was no corresponding free nucleon spline saved in XSecSplineList that
122  // could be used to speed up this calculation.
123  // Check whether local caching of free nucleon cross sections is allowed.
124  // If yes, store free nucleon cross sections at a cache branch and use those
125  // at any subsequent call.
126  //
127  bool precalc_bare_xsec = RunOpt::Instance()->BareXSecPreCalc();
128  if(precalc_bare_xsec) {
129  Cache * cache = Cache::Instance();
130  Interaction * interaction = new Interaction(*in);
131  string key = this->CacheBranchName(model,interaction);
132  LOG("DISXSec", pINFO) << "Finding cache branch with key: " << key;
133  CacheBranchFx * cache_branch =
134  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
135  if(!cache_branch) {
136  this->CacheFreeNucleonXSec(model,interaction);
137  cache_branch =
138  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
139  assert(cache_branch);
140  }
141  const CacheBranchFx & cb = (*cache_branch);
142  double xsec = cb(Ev);
143  if(! interaction->TestBit(kIAssumeFreeNucleon) ) { xsec *= NNucl; }
144  LOG("DISXSec", pINFO) << "XSec[DIS] (E = " << Ev << " GeV) = " << xsec;
145  delete interaction;
146  return xsec;
147  }
148  else {
149  // Just go ahead and integrate the input differential cross section for the
150  // specified interaction.
151  //
152  Interaction * interaction = new Interaction(*in);
153  interaction->SetBit(kISkipProcessChk);
154 // interaction->SetBit(kISkipKinematicChk);
155 
156  // **Important note**
157  // Based on discussions with Hugh at the GENIE mini-workshop / RAL - July '07
158  // The DIS nuclear corrections re-distribute the strength in x,y but do not
159  // affect the total cross-section They should be disabled at this step.
160  // But they should be enabled at the DIS thread's kinematical selection.
161  // Since nuclear corrections don't need to be included at this stage, all the
162  // nuclear cross sections can be trivially built from the free nucleon ones.
163  //
164  interaction->SetBit(kINoNuclearCorrection);
165 
166  Range1D_t Wl = kps.WLim();
167  Range1D_t Q2l = kps.Q2Lim();
168  LOG("DISXSec", pINFO)
169  << "W integration range = [" << Wl.min << ", " << Wl.max << "]";
170  LOG("DISXSec", pINFO)
171  << "Q2 integration range = [" << Q2l.min << ", " << Q2l.max << "]";
172 
173  bool phsp_ok =
174  (Q2l.min >= 0. && Q2l.max >= 0. && Q2l.max >= Q2l.min &&
175  Wl.min >= 0. && Wl.max >= 0. && Wl.max >= Wl.min);
176 
177  double xsec = 0.;
178 
179  if(phsp_ok) {
180  ROOT::Math::IBaseFunctionMultiDim * func =
181  new utils::gsl::d2XSec_dWdQ2_E(model, interaction);
184 
185  double abstol = 1; //We mostly care about relative tolerance.
186  ROOT::Math::IntegratorMultiDim ig(*func, ig_type, abstol, fGSLRelTol, fGSLMaxEval);
187  double kine_min[2] = { Wl.min, Q2l.min };
188  double kine_max[2] = { Wl.max, Q2l.max };
189  xsec = ig.Integral(kine_min, kine_max) * (1E-38 * units::cm2);
190  delete func;
191  }//phase space ok?
192 
193  LOG("DISXSec", pINFO) << "XSec[DIS] (E = " << Ev << " GeV) = " << xsec;
194 
195  delete interaction;
196 
197  return xsec;
198  }
199  return 0;
200 }
string fGSLIntgType
name of GSL numerical integrator
const XML_Char * target
Definition: expat.h:268
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition: GSLUtils.cxx:67
int HitNucPdg(void) const
Definition: Target.cxx:321
A simple [min,max] interval for doubles.
Definition: Range1.h:43
bool SplineExists(const XSecAlgorithmI *alg, const Interaction *i) const
A numeric analysis tool class for interpolating 1-D functions.
Definition: Spline.h:47
bool IsNucleus(void) const
Definition: Target.cxx:289
static XSecSplineList * Instance()
Range1D_t Q2Lim(void) const
Q2 limits.
double Evaluate(double x) const
Definition: Spline.cxx:362
static const double cm2
Definition: Units.h:77
void SetId(int pdgc)
Definition: Target.cxx:166
Summary information for an interaction.
Definition: Interaction.h:56
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:299
bool BareXSecPreCalc(void) const
Definition: RunOpt.h:52
const UInt_t kINoNuclearCorrection
if set, inhibit nuclear corrections
Definition: Interaction.h:51
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool IsEmpty(void) const
Float_t E
Definition: plot.C:20
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
Kinematical phase space.
Definition: KPhaseSpace.h:34
const int kPdgTgtFreeN
Definition: PDGCodes.h:177
const int kPdgTgtFreeP
Definition: PDGCodes.h:176
void CacheFreeNucleonXSec(const XSecAlgorithmI *model, const Interaction *in) const
Definition: DISXSec.cxx:233
double func(double x, double y)
int Z(void) const
Definition: Target.h:69
#define pINFO
Definition: Messenger.h:63
Double_t xsec[nknots]
Definition: testXsec.C:47
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:89
GENIE Cache Memory.
Definition: Cache.h:39
double max
Definition: Range1.h:54
int fGSLMaxEval
GSL max evaluations.
ifstream in
Definition: comparison.C:7
int N(void) const
Definition: Target.h:70
static RunOpt * Instance(void)
Definition: RunOpt.cxx:62
const UInt_t kIAssumeFreeNucleon
Definition: Interaction.h:49
Target * TgtPtr(void) const
Definition: InitialState.h:68
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
virtual bool ValidProcess(const Interaction *i) const =0
Can this cross section algorithm handle the input process?
assert(nhit_max >=nhit_nbins)
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
string CacheBranchName(const XSecAlgorithmI *model, const Interaction *in) const
Definition: DISXSec.cxx:337
double min
Definition: Range1.h:53
const Target & Tgt(void) const
Definition: InitialState.h:67
static Cache * Instance(void)
Definition: Cache.cxx:76
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
const Spline * GetSpline(const XSecAlgorithmI *alg, const Interaction *i) const
List of cross section vs energy splines.
double ProbeE(RefFrame_t rf) const
Range1D_t WLim(void) const
W limits.
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
Initial State information.
Definition: InitialState.h:49
#define pDEBUG
Definition: Messenger.h:64
double fGSLRelTol
required relative tolerance (error)
void DISXSec::LoadConfig ( void  )
private

Definition at line 214 of file DISXSec.cxx.

References E, genie::XSecIntegratorI::fGSLIntgType, genie::XSecIntegratorI::fGSLMaxEval, genie::XSecIntegratorI::fGSLMinEval, genie::XSecIntegratorI::fGSLRelTol, fVldEmax, fVldEmin, genie::Algorithm::GetParam(), genie::Algorithm::GetParamDef(), and makeTrainCVSamples::int.

Referenced by Configure().

215 {
216  // Get GSL integration type & relative tolerance
217  GetParamDef("gsl-integration-type", fGSLIntgType, string("adaptive") ) ;
218  GetParamDef( "gsl-relative-tolerance", fGSLRelTol, 1E-2 ) ;
219 
220  int max_eval, min_eval ;
221  GetParamDef( "gsl-max-eval", max_eval, 500000 ) ;
222  GetParamDef( "gsl-min-eval", min_eval, 10000 ) ;
223 
224  fGSLMaxEval = (unsigned int) max_eval ;
225  fGSLMinEval = (unsigned int) min_eval ;
226 
227  // Energy range for cached splines
228  GetParam( "GVLD-Emin", fVldEmin) ;
229  GetParam( "GVLD-Emax", fVldEmax) ;
230 
231 }
string fGSLIntgType
name of GSL numerical integrator
Float_t E
Definition: plot.C:20
double fVldEmax
Definition: DISXSec.h:49
int fGSLMaxEval
GSL max evaluations.
double fVldEmin
Definition: DISXSec.h:48
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
int fGSLMinEval
GSL min evaluations. Ignored by some integrators.
double fGSLRelTol
required relative tolerance (error)
int Algorithm::MergeTopRegistry ( const Registry r)
protectedinherited

Merge with top level registry if first reg of the vector is owned Otherwise an owned copy is added as a top registry

Definition at line 618 of file Algorithm.cxx.

618  {
619 
620  if ( fOwnerships.empty() ) {
621 
622  // this algorithm is not configured right now, the incoming registry is the only configuration
623  Registry * p = new Registry( r ) ;
624  AddTopRegistry( p ) ;
625 
626  return 1 ;
627  }
628 
629  if ( fOwnerships[0] ) {
630  //the top registry is owned: it can be changed with no consequences for other algorithms
631  fConfVect[0] -> Merge( r ) ;
632  }
633  else {
634  // The top registry is not owned so it cannot be changed
635  // The registry will be added with top priority
636 
637  Registry * p = new Registry( r ) ;
638  AddTopRegistry( p ) ;
639  }
640 
641  // The configuration has changed so the summary is not updated anymore and must be deleted
642  if ( fConfig ) {
643  delete fConfig ;
644  fConfig = 0 ;
645  }
646 
647  return fConfVect.size() ;
648 }
const char * p
Definition: xmltok.h:285
int AddTopRegistry(Registry *rp, bool owns=true)
add registry with top priority, also update ownership
Definition: Algorithm.cxx:585
vector< Registry * > fConfVect
Definition: Algorithm.h:161
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition: Algorithm.h:164
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition: Algorithm.h:194
void Algorithm::Print ( ostream &  stream) const
virtualinherited

Print algorithm info.

Definition at line 323 of file Algorithm.cxx.

References GetConfig(), and r().

Referenced by genie::Algorithm::AllowReconfig(), and genie::operator<<().

324 {
325  // print algorithm name & parameter-set
326  stream << "\nAlgorithm Key: " << this->fID.Key();
327  stream << " - Owns Substruc: " << ((fOwnsSubstruc) ? "[true]" : "[false]");
328 
329  // print algorithm configuration
330  const Registry & r = this->GetConfig();
331  stream << r;
332 
333  if(fOwnsSubstruc) {
334  AlgMapConstIter iter = fOwnedSubAlgMp->begin();
335  for(; iter!=fOwnedSubAlgMp->end(); ++iter) {
336  Algorithm * alg = iter->second;
337  stream << "<Next algorithm is owned by : " << this->fID.Key() << ">";
338  stream << *alg;
339  }
340  }
341 }
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:254
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
string Key(void) const
Definition: AlgId.h:47
void Algorithm::SetId ( const AlgId id)
virtualinherited

Set algorithm ID.

Definition at line 313 of file Algorithm.cxx.

Referenced by genie::Algorithm::AllowReconfig().

314 {
315  fID.Copy(id);
316 }
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void Copy(const AlgId &id)
Definition: AlgId.cxx:78
void Algorithm::SetId ( string  name,
string  config 
)
virtualinherited

Definition at line 318 of file Algorithm.cxx.

319 {
320  fID.SetId(name, config);
321 }
const XML_Char * name
Definition: expat.h:151
Definition: config.py:1
AlgId fID
algorithm name and configuration set
Definition: Algorithm.h:156
void SetId(string name, string config="")
Definition: AlgId.cxx:70
const Algorithm * Algorithm::SubAlg ( const RgKey registry_key) const
inherited

Access the sub-algorithm pointed to by the input key, either from the local pool or from AlgFactory's pool

Definition at line 353 of file Algorithm.cxx.

References ana::assert(), genie::AlgFactory::GetAlgorithm(), genie::AlgFactory::Instance(), LOG, pERROR, and pINFO.

Referenced by genie::Algorithm::AllowReconfig(), genie::utils::gsl::FullQELdXSec::FullQELdXSec(), genie::NewQELXSec::Integrate(), genie::HadronTransporter::LoadConfig(), genie::NucleonDecayPrimaryVtxGenerator::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::EmpiricalMECPXSec2015::LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::SlowRsclCharmDISPXSecLO::LoadConfig(), genie::AhrensNCELPXSec::LoadConfig(), genie::AlamSimoAtharVacasSKPXSec2014::LoadConfig(), genie::UnstableParticleDecayer::LoadConfig(), genie::ReinDFRPXSec::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::AlvarezRusoCOHPiPXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::NNBarOscPrimaryVtxGenerator::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::IMDAnnihilationPXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::RESHadronicSystemGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::KovalenkoQELCharmPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::SmithMonizQELCCXSec::LoadConfig(), genie::BardinIMDRadCorPXSec::LoadConfig(), genie::MartiniEricsonChanfrayMarteauMECPXSec2016::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::LwlynSmithFF::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::HAIntranuke::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke2018::LoadConfig(), genie::HNIntranuke2018::LoadConfig(), genie::BSKLNBaseRESPXSec2014::LoadConfig(), genie::ReinSehgalSPPPXSec::LoadConfig(), genie::KNOHadronization::LoadConfig(), and genie::EventGeneratorListAssembler::LoadGenerator().

354 {
355 // Returns the sub-algorithm pointed to this algorithm's XML config file using
356 // the the values of the key.
357 // This method asserts the existence of these keys in the XML config.
358 // Note: Since only 1 parameter is used, the key value should contain both the
359 // algorithm name and its configuration set according to the usual scheme:
360 // namespace::algorithm_name/configuration_set
361 //
362  LOG("Algorithm", pINFO)
363  << "Fetching sub-alg within alg: " << this->Id().Key()
364  << " pointed to by key: " << registry_key;
365 
366  //-- if the algorithm owns its substructure:
367  // return the sub-algorithm from the local pool
368  //
369  if(fOwnsSubstruc) {
370  AlgMapConstIter iter = fOwnedSubAlgMp->find(registry_key);
371  if(iter!=fOwnedSubAlgMp->end()) return iter->second;
372  LOG("Algorithm", pERROR)
373  << "Owned sub-alg pointed to by key: " << registry_key
374  << " was not found within alg: " << this->Id().Key();
375  return 0;
376  }
377 
378  //-- if the algorithm does not own its substructure:
379  // return the sub-algorithm from the AlgFactory's pool
380  RgAlg alg ;
381  GetParam( registry_key, alg ) ;
382 
383  LOG("Algorithm", pINFO)
384  << "Registry key: " << registry_key << " points to algorithm: " << alg;
385 
386  // retrieve the Algorithm object from the the Algorithm factory
387  AlgFactory * algf = AlgFactory::Instance();
388  const Algorithm * algbase = algf->GetAlgorithm(alg.name, alg.config);
389  assert(algbase);
390 
391  return algbase;
392 }
#define pERROR
Definition: Messenger.h:60
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition: Algorithm.h:167
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition: Algorithm.h:155
Algorithm abstract base class.
Definition: Algorithm.h:54
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:86
#define pINFO
Definition: Messenger.h:63
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition: Algorithm.h:51
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
assert(nhit_max >=nhit_nbins)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
string Key(void) const
Definition: AlgId.h:47

Member Data Documentation

bool genie::Algorithm::fAllowReconfig
protectedinherited
vector<Registry*> genie::Algorithm::fConfVect
protectedinherited

ideally these members should go private Registry will be access only through the GetParam method configurations registries from various sources the order of the vector is the precedence in case of repeated parameters position 0 -> Highest precedence

Definition at line 161 of file Algorithm.h.

string genie::XSecIntegratorI::fGSLIntgType
protectedinherited
int genie::XSecIntegratorI::fGSLMaxEval
protectedinherited
unsigned int genie::XSecIntegratorI::fGSLMaxSizeOfSubintervals
protectedinherited

GSL maximum number of sub-intervals for 1D integrator.

Definition at line 49 of file XSecIntegratorI.h.

Referenced by genie::QELXSec::Integrate(), genie::SmithMonizQELCCXSec::Integrate(), genie::QELXSec::LoadConfig(), and genie::SmithMonizQELCCXSec::LoadConfig().

int genie::XSecIntegratorI::fGSLMinEval
protectedinherited
double genie::XSecIntegratorI::fGSLRelTol
protectedinherited
unsigned int genie::XSecIntegratorI::fGSLRule
protectedinherited

GSL Gauss-Kronrod integration rule (only for GSL 1D adaptive type)

Definition at line 50 of file XSecIntegratorI.h.

Referenced by genie::QELXSec::Integrate(), genie::SmithMonizQELCCXSec::Integrate(), genie::QELXSec::LoadConfig(), and genie::SmithMonizQELCCXSec::LoadConfig().

AlgId genie::Algorithm::fID
protectedinherited

algorithm name and configuration set

Definition at line 156 of file Algorithm.h.

Referenced by genie::Algorithm::Id().

const IntegratorI* genie::XSecIntegratorI::fIntegrator
protectedinherited

GENIE numerical integrator.

Definition at line 43 of file XSecIntegratorI.h.

AlgMap* genie::Algorithm::fOwnedSubAlgMp
protectedinherited

local pool for owned sub-algs (taken out of the factory pool)

Definition at line 167 of file Algorithm.h.

vector<bool> genie::Algorithm::fOwnerships
protectedinherited

ownership for every registry in fConfVect

Definition at line 164 of file Algorithm.h.

bool genie::Algorithm::fOwnsSubstruc
protectedinherited

true if it owns its substructure (sub-algs,...)

Definition at line 155 of file Algorithm.h.

AlgStatus_t genie::Algorithm::fStatus
protectedinherited

algorithm execution status

Definition at line 166 of file Algorithm.h.

Referenced by genie::Algorithm::GetStatus().

double genie::DISXSec::fVldEmax
private

Definition at line 49 of file DISXSec.h.

Referenced by CacheFreeNucleonXSec(), and LoadConfig().

double genie::DISXSec::fVldEmin
private

Definition at line 48 of file DISXSec.h.

Referenced by CacheFreeNucleonXSec(), and LoadConfig().


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