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

Generates values for the kinematic variables describing QEL neutrino interaction events for Smith-Moniz model. Is a concrete implementation of the EventRecordVisitorI interface. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+3.10-2.17-e17-debug/GENIE-Generator/src/Physics/QuasiElastic/EventGen/QELEventGeneratorSM.h"

Inheritance diagram for genie::QELEventGeneratorSM:
genie::KineGeneratorWithCache genie::EventRecordVisitorI genie::Algorithm

Public Member Functions

 QELEventGeneratorSM ()
 
 QELEventGeneratorSM (string config)
 
 ~QELEventGeneratorSM ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
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

virtual double MaxXSec (GHepRecord *evrec) const
 
virtual double FindMaxXSec (const Interaction *in) const
 
virtual void CacheMaxXSec (const Interaction *in, double xsec) const
 
virtual double Energy (const Interaction *in) const
 
virtual CacheBranchFxAccessCacheBranch (const Interaction *in) const
 
virtual void AssertXSecLimits (const Interaction *in, double xsec, double xsec_max) const
 
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 XSecAlgorithmIfXSecModel
 
double fSafetyFactor
 maxxsec -> maxxsec * safety_factor More...
 
double fMaxXSecDiffTolerance
 max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec More...
 
double fEMin
 min E for which maxxsec is cached - forcing explicit calc. More...
 
bool fGenerateUniformly
 uniform over allowed phase space + event weight? 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)
 
double ComputeMaxXSec (const Interaction *in) const
 
void AddTargetNucleusRemnant (GHepRecord *evrec) const
 add a recoiled nucleus remnant More...
 
double ComputeMaxXSec2 (const Interaction *in) const
 
double MaxXSec2 (GHepRecord *evrec) const
 
double FindMaxXSec2 (const Interaction *in) const
 
void CacheMaxXSec2 (const Interaction *in, double xsec) const
 
CacheBranchFxAccessCacheBranch2 (const Interaction *in) const
 
double ComputeMaxDiffv (const Interaction *in) const
 
double MaxDiffv (GHepRecord *evrec) const
 
double FindMaxDiffv (const Interaction *in) const
 
void CacheMaxDiffv (const Interaction *in, double xsec) const
 
CacheBranchFxAccessCacheBranchDiffv (const Interaction *in) const
 

Private Attributes

SmithMonizUtilssm_utils
 
KinePhaseSpace_t fkps
 
bool fGenerateNucleonInNucleus
 generate struck nucleon in nucleus More...
 
double fQ2Min
 Q2-threshold for seeking the second maximum. More...
 
double fSafetyFacor_nu
 

Detailed Description

Generates values for the kinematic variables describing QEL neutrino interaction events for Smith-Moniz model. Is a concrete implementation of the EventRecordVisitorI interface.

[1] R.A.Smith and E.J.Moniz, Nuclear Physics B43, (1972) 605-622
[2] K.S. Kuzmin, V.V. Lyubushkin, V.A.Naumov Eur. Phys. J. C54, (2008) 517-538

Author
Igor Kakorin kakor.nosp@m.in@j.nosp@m.inr.r.nosp@m.u, Joint Institute for Nuclear Research
adopted from fortran code provided by Konstantin Kuzmin kkuzm.nosp@m.in@t.nosp@m.heor..nosp@m.jinr.nosp@m..ru,
Joint Institute for Nuclear Research, Institute for Theoretical and Experimental Physics
Vladimir Lyubushkin,
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 <costas.andreopoulos stfc.ac.uk>
University of Liverpool & STFC Rutherford Appleton Lab

May 05, 2017

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

Definition at line 44 of file QELEventGeneratorSM.h.

Constructor & Destructor Documentation

QELEventGeneratorSM::QELEventGeneratorSM ( )

Definition at line 57 of file QELEventGeneratorSM.cxx.

57  :
58 KineGeneratorWithCache("genie::QELEventGeneratorSM")
59 {
60 
61 }
QELEventGeneratorSM::QELEventGeneratorSM ( string  config)

Definition at line 63 of file QELEventGeneratorSM.cxx.

63  :
64 KineGeneratorWithCache("genie::QELEventGeneratorSM", config)
65 {
66 
67 }
Definition: config.py:1
QELEventGeneratorSM::~QELEventGeneratorSM ( )

Definition at line 69 of file QELEventGeneratorSM.cxx.

70 {
71 
72 }

Member Function Documentation

CacheBranchFx * KineGeneratorWithCache::AccessCacheBranch ( const Interaction in) const
protectedvirtualinherited

Definition at line 225 of file KineGeneratorWithCache.cxx.

References genie::Cache::AddCacheBranch(), ana::assert(), genie::Interaction::AsString(), genie::Cache::CacheBranchKey(), genie::Cache::FindCacheBranch(), genie::Algorithm::Id(), genie::Cache::Instance(), findDuplicateFiles::key, genie::AlgId::Key(), LOG, and pINFO.

Referenced by genie::KineGeneratorWithCache::CacheMaxXSec(), and genie::KineGeneratorWithCache::FindMaxXSec().

227 {
228 // Returns the cache branch for this algorithm and this interaction. If no
229 // branch is found then one is created.
230 
231  Cache * cache = Cache::Instance();
232 
233  // build the cache branch key as: namespace::algorithm/config/interaction
234  string algkey = this->Id().Key();
235  string intkey = interaction->AsString();
236  string key = cache->CacheBranchKey(algkey, intkey);
237 
238  CacheBranchFx * cache_branch =
239  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
240  if(!cache_branch) {
241  //-- create the cache branch at the first pass
242  LOG("Kinematics", pINFO) << "No Max d^nXSec/d{K}^n cache branch found";
243  LOG("Kinematics", pINFO) << "Creating cache branch - key = " << key;
244 
245  cache_branch = new CacheBranchFx("max[d^nXSec/d^n{K}] over phase space");
246  cache->AddCacheBranch(key, cache_branch);
247  }
248  assert(cache_branch);
249 
250  return cache_branch;
251 }
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:97
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:102
#define pINFO
Definition: Messenger.h:63
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:89
GENIE Cache Memory.
Definition: Cache.h:39
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
assert(nhit_max >=nhit_nbins)
static Cache * Instance(void)
Definition: Cache.cxx:76
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
string Key(void) const
Definition: AlgId.h:47
CacheBranchFx * QELEventGeneratorSM::AccessCacheBranch2 ( const Interaction in) const
private

Definition at line 622 of file QELEventGeneratorSM.cxx.

References genie::Cache::AddCacheBranch(), ana::assert(), genie::Interaction::AsString(), genie::Cache::CacheBranchKey(), genie::Cache::FindCacheBranch(), genie::Algorithm::Id(), genie::Cache::Instance(), findDuplicateFiles::key, genie::AlgId::Key(), LOG, and pINFO.

Referenced by CacheMaxXSec2(), and FindMaxXSec2().

624 {
625 // Returns the cache branch for this algorithm and this interaction. If no
626 // branch is found then one is created.
627 
628  Cache * cache = Cache::Instance();
629 
630  // build the cache branch key as: namespace::algorithm/config/interaction
631  string algkey = this->Id().Key();
632  string intkey = interaction->AsString();
633  string key = cache->CacheBranchKey(algkey, intkey, "2nd");
634 
635  CacheBranchFx * cache_branch =
636  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
637  if(!cache_branch) {
638  //-- create the cache branch at the first pass
639  LOG("Kinematics", pINFO) << "No Max d^nXSec/d{K}^n cache branch found";
640  LOG("Kinematics", pINFO) << "Creating cache branch - key = " << key;
641 
642  cache_branch = new CacheBranchFx("max[d^nXSec/d^n{K}] over phase space");
643  cache->AddCacheBranch(key, cache_branch);
644  }
645  assert(cache_branch);
646 
647  return cache_branch;
648 }
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:97
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:102
#define pINFO
Definition: Messenger.h:63
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:89
GENIE Cache Memory.
Definition: Cache.h:39
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
assert(nhit_max >=nhit_nbins)
static Cache * Instance(void)
Definition: Cache.cxx:76
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
string Key(void) const
Definition: AlgId.h:47
CacheBranchFx * QELEventGeneratorSM::AccessCacheBranchDiffv ( const Interaction in) const
private

Definition at line 775 of file QELEventGeneratorSM.cxx.

References genie::Cache::AddCacheBranch(), ana::assert(), genie::Interaction::AsString(), genie::Cache::CacheBranchKey(), genie::Cache::FindCacheBranch(), genie::Algorithm::Id(), genie::Cache::Instance(), findDuplicateFiles::key, genie::AlgId::Key(), LOG, and pINFO.

Referenced by CacheMaxDiffv(), and FindMaxDiffv().

777 {
778 // Returns the cache branch for this algorithm and this interaction. If no
779 // branch is found then one is created.
780 
781  Cache * cache = Cache::Instance();
782 
783  // build the cache branch key as: namespace::algorithm/config/interaction
784  string algkey = this->Id().Key();
785  string intkey = interaction->AsString();
786  string key = cache->CacheBranchKey(algkey, intkey, "diffv");
787 
788  CacheBranchFx * cache_branch =
789  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
790  if(!cache_branch) {
791  //-- create the cache branch at the first pass
792  LOG("Kinematics", pINFO) << "No Max vmax(Q2)-vmin(Q2) cache branch found";
793  LOG("Kinematics", pINFO) << "Creating cache branch - key = " << key;
794 
795  cache_branch = new CacheBranchFx("max[vmax(Q2)-vmin(Q2)] over phase space");
796  cache->AddCacheBranch(key, cache_branch);
797  }
798  assert(cache_branch);
799 
800  return cache_branch;
801 }
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:97
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:102
#define pINFO
Definition: Messenger.h:63
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:89
GENIE Cache Memory.
Definition: Cache.h:39
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
assert(nhit_max >=nhit_nbins)
static Cache * Instance(void)
Definition: Cache.cxx:76
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
string Key(void) const
Definition: AlgId.h:47
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
void QELEventGeneratorSM::AddTargetNucleusRemnant ( GHepRecord evrec) const
private

add a recoiled nucleus remnant

Definition at line 322 of file QELEventGeneratorSM.cxx.

References genie::units::A, genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), ana::assert(), E, genie::GHepParticle::E(), fd, genie::PDGLibrary::Find(), genie::GHepParticle::FirstDaughter(), genie::PDGLibrary::Instance(), genie::pdg::IonPdgCode(), genie::pdg::IsNeutron(), genie::pdg::IsProton(), genie::kIStStableFinalState, genie::GHepParticle::LastDaughter(), LOG, genie::GHepParticle::Mass(), genie::GHepRecord::Particle(), genie::GHepParticle::Pdg(), pFATAL, pINFO, genie::GHepParticle::Px(), genie::GHepParticle::Py(), genie::GHepParticle::Pz(), genie::GHepRecord::TargetNucleus(), genie::GHepRecord::TargetNucleusPosition(), Z, and genie::GHepParticle::Z().

Referenced by ProcessEventRecord().

323 {
324 // add the remnant nuclear target at the GHEP record
325 
326  LOG("QELEvent", pINFO) << "Adding final state nucleus";
327 
328  double Px = 0;
329  double Py = 0;
330  double Pz = 0;
331  double E = 0;
332 
333  GHepParticle * nucleus = evrec->TargetNucleus();
334  int A = nucleus->A();
335  int Z = nucleus->Z();
336 
337  int fd = nucleus->FirstDaughter();
338  int ld = nucleus->LastDaughter();
339 
340  for(int id = fd; id <= ld; id++) {
341 
342  // compute A,Z for final state nucleus & get its PDG code and its mass
343  GHepParticle * particle = evrec->Particle(id);
344  assert(particle);
345  int pdgc = particle->Pdg();
346  bool is_p = pdg::IsProton (pdgc);
347  bool is_n = pdg::IsNeutron(pdgc);
348 
349  if (is_p) Z--;
350  if (is_p || is_n) A--;
351 
352  Px += particle->Px();
353  Py += particle->Py();
354  Pz += particle->Pz();
355  E += particle->E();
356 
357  }//daughters
358 
359  TParticlePDG * remn = 0;
360  int ipdgc = pdg::IonPdgCode(A, Z);
361  remn = PDGLibrary::Instance()->Find(ipdgc);
362  if(!remn) {
363  LOG("HadronicVtx", pFATAL)
364  << "No particle with [A = " << A << ", Z = " << Z
365  << ", pdgc = " << ipdgc << "] in PDGLibrary!";
366  assert(remn);
367  }
368 
369  double Mi = nucleus->Mass();
370  Px *= -1;
371  Py *= -1;
372  Pz *= -1;
373  E = Mi-E;
374 
375  // Add the nucleus to the event record
376  LOG("QELEvent", pINFO)
377  << "Adding nucleus [A = " << A << ", Z = " << Z
378  << ", pdgc = " << ipdgc << "]";
379 
380  int imom = evrec->TargetNucleusPosition();
381  evrec->AddParticle(
382  ipdgc,kIStStableFinalState, imom,-1,-1,-1, Px,Py,Pz,E, 0,0,0,0);
383 
384  LOG("QELEvent", pINFO) << "Done";
385  LOG("QELEvent", pINFO) << *evrec;
386 }
int Z(void) const
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:148
double E(void) const
Get energy.
Definition: GHepParticle.h:92
int FirstDaughter(void) const
Definition: GHepParticle.h:69
#define pFATAL
Definition: Messenger.h:57
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:91
double Px(void) const
Get Px.
Definition: GHepParticle.h:89
Float_t Z
Definition: plot.C:38
int Pdg(void) const
Definition: GHepParticle.h:64
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:304
int LastDaughter(void) const
Definition: GHepParticle.h:70
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
Float_t E
Definition: plot.C:20
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
#define pINFO
Definition: Messenger.h:63
static const double A
Definition: Units.h:82
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:69
assert(nhit_max >=nhit_nbins)
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
int A(void) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
virtual int TargetNucleusPosition(void) const
Definition: GHepRecord.cxx:406
double Py(void) const
Get Py.
Definition: GHepParticle.h:90
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
void KineGeneratorWithCache::AssertXSecLimits ( const Interaction in,
double  xsec,
double  xsec_max 
) const
protectedvirtualinherited

Definition at line 253 of file KineGeneratorWithCache.cxx.

References exit(), MakeMiniprodValidationCuts::f, genie::KineGeneratorWithCache::fMaxXSecDiffTolerance, LOG, pERROR, pFATAL, and pWARN.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::COHElKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

255 {
256  // check the computed cross section for the current kinematics against the
257  // maximum cross section used in the rejection MC method for the current
258  // interaction at the current energy.
259  if(xsec>xsec_max) {
260  double f = 200*(xsec-xsec_max)/(xsec_max+xsec);
261  if(f>fMaxXSecDiffTolerance) {
262  LOG("Kinematics", pFATAL)
263  << "xsec: (curr) = " << xsec
264  << " > (max) = " << xsec_max << "\n for " << *interaction;
265  LOG("Kinematics", pFATAL)
266  << "*** Exceeding estimated maximum differential cross section";
267  exit(1);
268  } else {
269  LOG("Kinematics", pWARN)
270  << "xsec: (curr) = " << xsec
271  << " > (max) = " << xsec_max << "\n for " << *interaction;
272  LOG("Kinematics", pWARN)
273  << "*** The fractional deviation of " << f << " % was allowed";
274  }
275  }
276 
277  // this should never happen - print an error mesg just in case...
278  if(xsec<0) {
279  LOG("Kinematics", pERROR)
280  << "Negative cross section for current kinematics!! \n" << *interaction;
281  }
282 }
#define pERROR
Definition: Messenger.h:60
#define pFATAL
Definition: Messenger.h:57
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Double_t xsec[nknots]
Definition: testXsec.C:47
#define pWARN
Definition: Messenger.h:61
exit(0)
void QELEventGeneratorSM::CacheMaxDiffv ( const Interaction in,
double  xsec 
) const
private

Definition at line 754 of file QELEventGeneratorSM.cxx.

References AccessCacheBranchDiffv(), genie::CacheBranchFx::AddValues(), genie::CacheBranchFx::CreateSpline(), E, genie::KineGeneratorWithCache::Energy(), LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), and genie::Spline::XMax().

Referenced by MaxDiffv().

756 {
757  LOG("Kinematics", pINFO)
758  << "Adding the computed max{vmax(Q2)-vmin(Q2)} value to cache";
759  CacheBranchFx * cb = this->AccessCacheBranchDiffv(interaction);
760 
761  double E = this->Energy(interaction);
762  if(max_diffv>0) cb->AddValues(E,max_diffv);
763 
764  if(! cb->Spl() ) {
765  if( cb->Map().size() > 40 ) cb->CreateSpline();
766  }
767 
768  if( cb->Spl() ) {
769  if( E < cb->Spl()->XMin() || E > cb->Spl()->XMax() ) {
770  cb->CreateSpline();
771  }
772  }
773 }
CacheBranchFx * AccessCacheBranchDiffv(const Interaction *in) const
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:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
void KineGeneratorWithCache::CacheMaxXSec ( const Interaction in,
double  xsec 
) const
protectedvirtualinherited

Definition at line 193 of file KineGeneratorWithCache.cxx.

References genie::KineGeneratorWithCache::AccessCacheBranch(), genie::CacheBranchFx::AddValues(), genie::CacheBranchFx::CreateSpline(), E, genie::KineGeneratorWithCache::Energy(), LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), and genie::Spline::XMax().

Referenced by genie::KineGeneratorWithCache::MaxXSec().

195 {
196  LOG("Kinematics", pINFO)
197  << "Adding the computed max{dxsec/dK} value to cache";
198  CacheBranchFx * cb = this->AccessCacheBranch(interaction);
199 
200  double E = this->Energy(interaction);
201  if(max_xsec>0) cb->AddValues(E,max_xsec);
202 
203  if(! cb->Spl() ) {
204  if( cb->Map().size() > 40 ) cb->CreateSpline();
205  }
206 
207  if( cb->Spl() ) {
208  if( E < cb->Spl()->XMin() || E > cb->Spl()->XMax() ) {
209  cb->CreateSpline();
210  }
211  }
212 }
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:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
virtual double Energy(const Interaction *in) const
virtual CacheBranchFx * AccessCacheBranch(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
void QELEventGeneratorSM::CacheMaxXSec2 ( const Interaction in,
double  xsec 
) const
private

Definition at line 601 of file QELEventGeneratorSM.cxx.

References AccessCacheBranch2(), genie::CacheBranchFx::AddValues(), genie::CacheBranchFx::CreateSpline(), E, genie::KineGeneratorWithCache::Energy(), LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), and genie::Spline::XMax().

Referenced by MaxXSec2().

603 {
604  LOG("Kinematics", pINFO)
605  << "Adding the computed max{dxsec/dK} value to cache";
606  CacheBranchFx * cb = this->AccessCacheBranch2(interaction);
607 
608  double E = this->Energy(interaction);
609  if(max_xsec>0) cb->AddValues(E,max_xsec);
610 
611  if(! cb->Spl() ) {
612  if( cb->Map().size() > 40 ) cb->CreateSpline();
613  }
614 
615  if( cb->Spl() ) {
616  if( E < cb->Spl()->XMin() || E > cb->Spl()->XMax() ) {
617  cb->CreateSpline();
618  }
619  }
620 }
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:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
CacheBranchFx * AccessCacheBranch2(const Interaction *in) const
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
double QELEventGeneratorSM::ComputeMaxDiffv ( const Interaction in) const
private

Definition at line 650 of file QELEventGeneratorSM.cxx.

References genie::KineGeneratorWithCache::fSafetyFactor, genie::Range1D_t::max, genie::Range1D_t::min, genie::utils::kinematics::Q2(), genie::SmithMonizUtils::Q2QES_SM_lim(), sm_utils, and genie::SmithMonizUtils::vQES_SM_lim().

Referenced by MaxDiffv().

651 {
652  double max_diffv = -1;
653  const int N_Q2 = 10;
654 
656  for (int Q2_n = 0; Q2_n<N_Q2; Q2_n++) // Scan around Q2
657  {
658  double Q2 = rQ2.min + 1.*Q2_n * (rQ2.max-rQ2.min)/N_Q2;
659  Range1D_t rv = sm_utils->vQES_SM_lim(Q2);
660  if (rv.max-rv.min > max_diffv)
661  max_diffv = rv.max-rv.min;
662  } // Done with Q2 scan
663  max_diffv *= fSafetyFactor;
664  return max_diffv;
665 
666 }
Range1D_t Q2QES_SM_lim(void) const
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t vQES_SM_lim(double Q2) const
double max
Definition: Range1.h:54
double min
Definition: Range1.h:53
double QELEventGeneratorSM::ComputeMaxXSec ( const Interaction in) const
privatevirtual

Implements genie::KineGeneratorWithCache.

Definition at line 434 of file QELEventGeneratorSM.cxx.

References fkps, fQ2Min, genie::KineGeneratorWithCache::fSafetyFactor, genie::KineGeneratorWithCache::fXSecModel, kinematics(), genie::Interaction::KinePtr(), genie::kKVQ2, genie::kKVv, genie::Range1D_t::max, genie::Range1D_t::min, genie::utils::kinematics::Q2(), genie::SmithMonizUtils::Q2QES_SM_lim(), genie::Kinematics::SetKV(), sm_utils, registry_explorer::v, genie::SmithMonizUtils::vQES_SM_lim(), and genie::XSecAlgorithmI::XSec().

435 {
436  double xsec_max = -1;
437  const int N_Q2 = 8;
438  const int N_v = 8;
439 
441  const double logQ2min = TMath::Log(TMath::Max(rQ2.min, eps));
442  const double logQ2max = TMath::Log(TMath::Min(rQ2.max, fQ2Min));
443 
444  double tmp_xsec_max = -1;
445  // Now scan through kinematical variables Q2,v
446  for (int Q2_n=0; Q2_n < N_Q2; Q2_n++)
447  { // Scan around Q2
448  double Q2 = TMath::Exp(Q2_n * (logQ2max-logQ2min)/N_Q2 + logQ2min);
449  Range1D_t rv = sm_utils->vQES_SM_lim(Q2);
450  const double logvmin = TMath::Log(TMath::Max(rv.min, eps));
451  const double logvmax = TMath::Log(TMath::Max(rv.max, TMath::Max(rv.min, eps)));
452  for (int v_n=0; v_n < N_v; v_n++)
453  { // Scan around v
454  double v = TMath::Exp(v_n * (logvmax-logvmin)/N_v + logvmin);
455  Kinematics * kinematics = interaction->KinePtr();
456  kinematics->SetKV(kKVQ2, Q2);
457  kinematics->SetKV(kKVv, v);
458  // Compute the QE cross section for the current kinematics
459  double xs = fXSecModel->XSec(interaction, fkps);
460  if (xs > tmp_xsec_max)
461  tmp_xsec_max = xs;
462  } // Done with v scan
463  }// Done with Q2 scan
464 
465 
466  xsec_max = tmp_xsec_max;
467  // Apply safety factor, since value retrieved from the cache might
468  // correspond to a slightly different value
469  xsec_max *= fSafetyFactor;
470  return xsec_max;
471 
472 }
Range1D_t Q2QES_SM_lim(void) const
double fQ2Min
Q2-threshold for seeking the second maximum.
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Generated/set kinematical variables for an event.
Definition: Kinematics.h:40
Range1D_t vQES_SM_lim(double Q2) const
void SetKV(KineVar_t kv, double value)
Definition: Kinematics.cxx:345
double max
Definition: Range1.h:54
double min
Definition: Range1.h:53
void kinematics()
Definition: kinematics.C:10
double QELEventGeneratorSM::ComputeMaxXSec2 ( const Interaction in) const
private

Definition at line 474 of file QELEventGeneratorSM.cxx.

References fkps, fQ2Min, genie::KineGeneratorWithCache::fSafetyFactor, genie::KineGeneratorWithCache::fXSecModel, kinematics(), genie::Interaction::KinePtr(), genie::kKVQ2, genie::kKVv, genie::Range1D_t::max, genie::Range1D_t::min, genie::utils::kinematics::Q2(), genie::SmithMonizUtils::Q2QES_SM_lim(), genie::Kinematics::SetKV(), sm_utils, registry_explorer::v, genie::SmithMonizUtils::vQES_SM_lim(), and genie::XSecAlgorithmI::XSec().

Referenced by MaxXSec2().

475 {
476  double xsec_max = -1;
477  const int N_Q2 = 8;
478  const int N_v = 8;
479 
481  if (rQ2.max<fQ2Min) return xsec_max;
482  const double logQ2min = TMath::Log(fQ2Min);
483  const double logQ2max = TMath::Log(rQ2.max);
484 
485  double tmp_xsec_max = -1;
486  // Now scan through kinematical variables Q2,v
487  for (int Q2_n=0; Q2_n < N_Q2; Q2_n++)
488  { // Scan around Q2
489  double Q2 = TMath::Exp(Q2_n * (logQ2max-logQ2min)/N_Q2 + logQ2min);
490  Range1D_t rv = sm_utils->vQES_SM_lim(Q2);
491  const double logvmin = TMath::Log(TMath::Max(rv.min, eps));
492  const double logvmax = TMath::Log(TMath::Max(rv.max, TMath::Max(rv.min, eps)));
493  for (int v_n=0; v_n < N_v; v_n++)
494  { // Scan around v
495  double v = TMath::Exp(v_n * (logvmax-logvmin)/N_v + logvmin);
496  Kinematics * kinematics = interaction->KinePtr();
497  kinematics->SetKV(kKVQ2, Q2);
498  kinematics->SetKV(kKVv, v);
499  // Compute the QE cross section for the current kinematics
500  double xs = fXSecModel->XSec(interaction, fkps);
501  if (xs > tmp_xsec_max)
502  tmp_xsec_max = xs;
503  } // Done with v scan
504  }// Done with Q2 scan
505 
506 
507  xsec_max = tmp_xsec_max;
508  // Apply safety factor, since value retrieved from the cache might
509  // correspond to a slightly different value
510  xsec_max *= fSafetyFactor;
511  return xsec_max;
512 
513 }
Range1D_t Q2QES_SM_lim(void) const
double fQ2Min
Q2-threshold for seeking the second maximum.
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Generated/set kinematical variables for an event.
Definition: Kinematics.h:40
Range1D_t vQES_SM_lim(double Q2) const
void SetKV(KineVar_t kv, double value)
Definition: Kinematics.cxx:345
double max
Definition: Range1.h:54
double min
Definition: Range1.h:53
void kinematics()
Definition: kinematics.C:10
void QELEventGeneratorSM::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 388 of file QELEventGeneratorSM.cxx.

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

389 {
390  Algorithm::Configure(config);
391  this->LoadConfig();
392 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void QELEventGeneratorSM::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 394 of file QELEventGeneratorSM.cxx.

References genie::Algorithm::Configure(), LoadConfig(), r(), and genie::Registry::Set().

395 {
397 
398  Registry r( "QELEventGeneratorSM_specific", false ) ;
399  r.Set( "sm_utils_algo", RgAlg("genie::SmithMonizUtils","Default") ) ;
400 
402 
403  this->LoadConfig();
404 }
Definition: config.py:1
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
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
double KineGeneratorWithCache::Energy ( const Interaction in) const
protectedvirtualinherited

Reimplemented in genie::COHKinematicsGenerator, genie::SKKinematicsGenerator, genie::COHElKinematicsGenerator, and genie::NuEKinematicsGenerator.

Definition at line 214 of file KineGeneratorWithCache.cxx.

References E, genie::Interaction::InitState(), genie::kRfHitNucRest, and genie::InitialState::ProbeE().

Referenced by CacheMaxDiffv(), genie::KineGeneratorWithCache::CacheMaxXSec(), CacheMaxXSec2(), FindMaxDiffv(), genie::KineGeneratorWithCache::FindMaxXSec(), and FindMaxXSec2().

215 {
216 // Returns the neutrino energy at the struck nucleon rest frame. Kinematic
217 // generators should override this method if they need to cache the max-xsec
218 // values for another energy value (eg kinematic generators for IMD or COH)
219 
220  const InitialState & init_state = interaction->InitState();
221  double E = init_state.ProbeE(kRfHitNucRest);
222  return E;
223 }
Float_t E
Definition: plot.C:20
double ProbeE(RefFrame_t rf) const
Initial State information.
Definition: InitialState.h:49
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_hdf5record::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
double QELEventGeneratorSM::FindMaxDiffv ( const Interaction in) const
private

Definition at line 708 of file QELEventGeneratorSM.cxx.

References AccessCacheBranchDiffv(), dE, E, genie::KineGeneratorWithCache::Energy(), genie::Spline::Evaluate(), genie::KineGeneratorWithCache::fEMin, LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), genie::Spline::XMax(), and genie::Spline::XMin().

Referenced by MaxDiffv().

710 {
711 // Find a cached maximum of vmax(Q2)-vmin(Q2) for xsec algorithm & interaction and
712 // close to the specified energy
713 
714  // get neutrino energy
715  double E = this->Energy(interaction);
716  LOG("Kinematics", pINFO) << "E = " << E;
717 
718  if(E < fEMin) {
719  LOG("Kinematics", pINFO)
720  << "Below minimum energy - Forcing explicit calculation";
721  return -1.;
722  }
723 
724  // access the the cache branch
725  CacheBranchFx * cb = this->AccessCacheBranchDiffv(interaction);
726 
727  // if there are enough points stored in the cache buffer to build a
728  // spline, then intepolate
729  if( cb->Spl() ) {
730  if( E >= cb->Spl()->XMin() && E <= cb->Spl()->XMax()) {
731  double spl_maxdiffv = cb->Spl()->Evaluate(E);
732  LOG("Kinematics", pINFO)
733  << "\nInterpolated: max vmax(Q2)-vmin(Q2) (E=" << E << ") = " << spl_maxdiffv;
734  return spl_maxdiffv;
735  }
736  LOG("Kinematics", pINFO)
737  << "Outside spline boundaries - Forcing explicit calculation";
738  return -1.;
739  }
740 
741  // if there are not enough points at the cache buffer to have a spline,
742  // look whether there is another point that is sufficiently close
743  double dE = TMath::Min(0.25, 0.05*E);
744  const map<double,double> & fmap = cb->Map();
745  map<double,double>::const_iterator iter = fmap.lower_bound(E);
746  if(iter != fmap.end()) {
747  if(TMath::Abs(E - iter->first) < dE) return iter->second;
748  }
749 
750  return -1;
751 
752 }
double Evaluate(double x) const
Definition: Spline.cxx:362
double dE
CacheBranchFx * AccessCacheBranchDiffv(const Interaction *in) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
double XMin(void) const
Definition: Spline.h:77
double KineGeneratorWithCache::FindMaxXSec ( const Interaction in) const
protectedvirtualinherited

Definition at line 108 of file KineGeneratorWithCache.cxx.

References genie::KineGeneratorWithCache::AccessCacheBranch(), dE, E, genie::KineGeneratorWithCache::Energy(), genie::Spline::Evaluate(), genie::KineGeneratorWithCache::fEMin, LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), genie::Spline::XMax(), and genie::Spline::XMin().

Referenced by genie::KineGeneratorWithCache::MaxXSec().

110 {
111 // Find a cached max xsec for the specified xsec algorithm & interaction and
112 // close to the specified energy
113 
114  // get neutrino energy
115  double E = this->Energy(interaction);
116  LOG("Kinematics", pINFO) << "E = " << E;
117 
118  if(E < fEMin) {
119  LOG("Kinematics", pINFO)
120  << "Below minimum energy - Forcing explicit calculation";
121  return -1.;
122  }
123 
124  // access the the cache branch
125  CacheBranchFx * cb = this->AccessCacheBranch(interaction);
126 
127  // if there are enough points stored in the cache buffer to build a
128  // spline, then intepolate
129  if( cb->Spl() ) {
130  if( E >= cb->Spl()->XMin() && E <= cb->Spl()->XMax()) {
131  double spl_max_xsec = cb->Spl()->Evaluate(E);
132  LOG("Kinematics", pINFO)
133  << "\nInterpolated: max xsec (E=" << E << ") = " << spl_max_xsec;
134  return spl_max_xsec;
135  }
136  LOG("Kinematics", pINFO)
137  << "Outside spline boundaries - Forcing explicit calculation";
138  return -1.;
139  }
140 
141  // if there are not enough points at the cache buffer to have a spline,
142  // look whether there is another point that is sufficiently close
143  double dE = TMath::Min(0.25, 0.05*E);
144  const map<double,double> & fmap = cb->Map();
145  map<double,double>::const_iterator iter = fmap.lower_bound(E);
146  if(iter != fmap.end()) {
147  if(TMath::Abs(E - iter->first) < dE) return iter->second;
148  }
149 
150  return -1;
151 
152 /*
153  // build the search rule
154  double dE = TMath::Min(0.25, 0.05*E);
155  ostringstream search;
156  search << "(x-" << E << " < " << dE << ") && (x>=" << E << ")";
157 
158  // query for all the entries at a window around the current energy
159  TSQLResult * result = cb->Ntuple()->Query("x:y", search.str().c_str());
160  int nrows = result->GetRowCount();
161  LOG("Kinematics", pDEBUG)
162  << "Found " << nrows << " rows with " << search.str();
163  if(nrows <= 0) {
164  delete result;
165  return -1;
166  }
167 
168  // and now select the entry with the closest energy
169  double max_xsec = -1.0;
170  double Ep = 0;
171  double dEmin = 999;
172  TSQLRow * row = 0;
173  while( (row = result->Next()) ) {
174  double cE = atof( row->GetField(0) );
175  double cxsec = atof( row->GetField(1) );
176  double dE = TMath::Abs(E-cE);
177  if(dE < dEmin) {
178  max_xsec = cxsec;
179  Ep = cE;
180  dEmin = TMath::Min(dE,dEmin);
181  }
182  delete row;
183  }
184  delete result;
185 
186  LOG("Kinematics", pINFO)
187  << "\nRetrieved: max xsec = " << max_xsec << " cached at E = " << Ep;
188 
189  return max_xsec;
190 */
191 }
double Evaluate(double x) const
Definition: Spline.cxx:362
double dE
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double Energy(const Interaction *in) const
virtual CacheBranchFx * AccessCacheBranch(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
double XMin(void) const
Definition: Spline.h:77
double QELEventGeneratorSM::FindMaxXSec2 ( const Interaction in) const
private

Definition at line 555 of file QELEventGeneratorSM.cxx.

References AccessCacheBranch2(), dE, E, genie::KineGeneratorWithCache::Energy(), genie::Spline::Evaluate(), genie::KineGeneratorWithCache::fEMin, LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), genie::Spline::XMax(), and genie::Spline::XMin().

Referenced by MaxXSec2().

557 {
558 // Find a cached max xsec for the specified xsec algorithm & interaction and
559 // close to the specified energy
560 
561  // get neutrino energy
562  double E = this->Energy(interaction);
563  LOG("Kinematics", pINFO) << "E = " << E;
564 
565  if(E < fEMin) {
566  LOG("Kinematics", pINFO)
567  << "Below minimum energy - Forcing explicit calculation";
568  return -1.;
569  }
570 
571  // access the the cache branch
572  CacheBranchFx * cb = this->AccessCacheBranch2(interaction);
573 
574  // if there are enough points stored in the cache buffer to build a
575  // spline, then intepolate
576  if( cb->Spl() ) {
577  if( E >= cb->Spl()->XMin() && E <= cb->Spl()->XMax()) {
578  double spl_max_xsec = cb->Spl()->Evaluate(E);
579  LOG("Kinematics", pINFO)
580  << "\nInterpolated: max xsec (E=" << E << ") = " << spl_max_xsec;
581  return spl_max_xsec;
582  }
583  LOG("Kinematics", pINFO)
584  << "Outside spline boundaries - Forcing explicit calculation";
585  return -1.;
586  }
587 
588  // if there are not enough points at the cache buffer to have a spline,
589  // look whether there is another point that is sufficiently close
590  double dE = TMath::Min(0.25, 0.05*E);
591  const map<double,double> & fmap = cb->Map();
592  map<double,double>::const_iterator iter = fmap.lower_bound(E);
593  if(iter != fmap.end()) {
594  if(TMath::Abs(E - iter->first) < dE) return iter->second;
595  }
596 
597  return -1;
598 
599 }
double Evaluate(double x) const
Definition: Spline.cxx:362
double dE
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Spline * Spl(void) const
Definition: CacheBranchFx.h:48
Float_t E
Definition: plot.C:20
#define pINFO
Definition: Messenger.h:63
double XMax(void) const
Definition: Spline.h:78
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:47
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:38
double XMin(void) const
Definition: Spline.h:77
CacheBranchFx * AccessCacheBranch2(const Interaction *in) const
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::DISXSec::LoadConfig(), genie::INukeDeltaPropg::LoadConfig(), genie::COHXSec::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::MECGenerator::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::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::BBA03ELFormFactorsModel::LoadConfig(), genie::BBA05ELFormFactorsModel::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::PrimaryLeptonGenerator::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::FGMBodekRitchie::LoadConfig(), genie::SpectralFunc1d::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::OutgoingDarkGenerator::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::LHAPDF6::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::EventGenerator::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(), genie::DISXSec::LoadConfig(), genie::RESXSec::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::COHXSecAR::LoadConfig(), genie::COHElKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::QELXSec::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::SKKinematicsGenerator::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::MECXSec::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AlamSimoAtharVacasSKXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::NuElectronXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::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(), 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::RESInteractionListGenerator::LoadConfigData(), genie::SKInteractionListGenerator::LoadConfigData(), genie::COHInteractionListGenerator::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(), AccessCacheBranch2(), AccessCacheBranchDiffv(), genie::InteractionListAssembler::AssembleInteractionList(), genie::XSecAlgorithmMap::BuildMap(), genie::InteractionGeneratorMap::BuildMap(), genie::XSecSplineList::BuildSplineKey(), genie::DISXSec::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
void QELEventGeneratorSM::LoadConfig ( void  )
private

Definition at line 406 of file QELEventGeneratorSM.cxx.

References ana::assert(), genie::KineGeneratorWithCache::fEMin, fGenerateNucleonInNucleus, genie::KineGeneratorWithCache::fGenerateUniformly, genie::KineGeneratorWithCache::fMaxXSecDiffTolerance, fQ2Min, fSafetyFacor_nu, genie::KineGeneratorWithCache::fSafetyFactor, genie::Algorithm::GetParamDef(), sm_utils, and genie::Algorithm::SubAlg().

Referenced by Configure().

407 {
408 
409  // Safety factor for the maximum differential cross section
410  GetParamDef( "MaxXSec-SafetyFactor", fSafetyFactor, 1.2) ;
411  GetParamDef( "MaxDiffv-SafetyFactor",fSafetyFacor_nu, 1.1);
412 
413  // Minimum energy for which max xsec would be cached, forcing explicit
414  // calculation for lower eneries
415  GetParamDef( "Cache-MinEnergy", fEMin, 1.00) ;
416  GetParamDef( "Threshold-Q2", fQ2Min, 2.00);
417 
418  // Maximum allowed fractional cross section deviation from maxim cross
419  // section used in rejection method
420  GetParamDef( "MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999.);
422 
423  //-- Generate kinematics uniformly over allowed phase space and compute
424  // an event weight?
425  GetParamDef( "UniformOverPhaseSpace", fGenerateUniformly, false);
426 
427  //-- Generate kinematics uniformly over allowed phase space and compute
428  // an event weight?
429  GetParamDef( "IsNucleonInNucleus", fGenerateNucleonInNucleus, true);
430 
431  sm_utils = const_cast<genie::SmithMonizUtils *>(dynamic_cast<const genie::SmithMonizUtils *>( this -> SubAlg("sm_utils_algo") ) ) ;
432 }
double fQ2Min
Q2-threshold for seeking the second maximum.
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
bool fGenerateNucleonInNucleus
generate struck nucleon in nucleus
Contains auxiliary functions for Smith-Moniz model. Is a concrete implementation of the XSecAlgorit...
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
assert(nhit_max >=nhit_nbins)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:353
double QELEventGeneratorSM::MaxDiffv ( GHepRecord evrec) const
private

Definition at line 668 of file QELEventGeneratorSM.cxx.

References CacheMaxDiffv(), ComputeMaxDiffv(), genie::GHepRecord::EventFlags(), FindMaxDiffv(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kKineGenErr, genie::kPSNull, LOG, pINFO, pNOTICE, genie::GHepRecord::SetDiffXSec(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepRecord::Summary(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by ProcessEventRecord().

669 {
670  LOG("Kinematics", pINFO)
671  << "Getting max. vmax(Q2)-vmin(Q2) for the rejection method";
672 
673  double max_diffv = -1;
674  Interaction * interaction = event_rec->Summary();
675 
676  LOG("Kinematics", pINFO)
677  << "Attempting to find a cached max{vmax(Q2)-vmin(Q2)} value";
678  max_diffv = this->FindMaxDiffv(interaction);
679  if(max_diffv>0) return max_diffv;
680 
681  LOG("Kinematics", pINFO)
682  << "Attempting to compute the max{vmax(Q2)-vmin(Q2)} value";
683  max_diffv = this->ComputeMaxDiffv(interaction);
684  if(max_diffv>0) {
685  LOG("Kinematics", pINFO) << "max{vmax(Q2)-vmin(Q2)} = " << max_diffv;
686  this->CacheMaxDiffv(interaction, max_diffv);
687  return max_diffv;
688  }
689 
690  LOG("Kinematics", pNOTICE)
691  << "Can not generate event kinematics (max{vmax(Q2)-vmin(Q2);E}<=0)";
692  // xsec for selected kinematics = 0
693  event_rec->SetDiffXSec(0,kPSNull);
694  // switch on error flag
695  event_rec->EventFlags()->SetBitNumber(kKineGenErr, true);
696  // reset 'trust' bits
697  interaction->ResetBit(kISkipProcessChk);
698  interaction->ResetBit(kISkipKinematicChk);
699  // throw exception
701  exception.SetReason("kinematics generation: max{vmax(Q2)-vmin(Q2);E}<=0");
702  exception.SwitchOnFastForward();
703  throw exception;
704 
705  return 0;
706 }
double ComputeMaxDiffv(const Interaction *in) const
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Summary information for an interaction.
Definition: Interaction.h:56
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
void CacheMaxDiffv(const Interaction *in, double xsec) const
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
double FindMaxDiffv(const Interaction *in) const
#define pNOTICE
Definition: Messenger.h:62
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
double KineGeneratorWithCache::MaxXSec ( GHepRecord evrec) const
protectedvirtualinherited

Definition at line 68 of file KineGeneratorWithCache.cxx.

References genie::KineGeneratorWithCache::CacheMaxXSec(), genie::KineGeneratorWithCache::ComputeMaxXSec(), genie::GHepRecord::EventFlags(), genie::KineGeneratorWithCache::FindMaxXSec(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kKineGenErr, genie::kPSNull, LOG, pINFO, pNOTICE, genie::GHepRecord::SetDiffXSec(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepRecord::Summary(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::COHElKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

69 {
70  LOG("Kinematics", pINFO)
71  << "Getting max. differential xsec for the rejection method";
72 
73  double xsec_max = -1;
74  Interaction * interaction = event_rec->Summary();
75 
76  LOG("Kinematics", pINFO)
77  << "Attempting to find a cached max{dxsec/dK} value";
78  xsec_max = this->FindMaxXSec(interaction);
79  if(xsec_max>0) return xsec_max;
80 
81  LOG("Kinematics", pINFO)
82  << "Attempting to compute the max{dxsec/dK} value";
83  xsec_max = this->ComputeMaxXSec(interaction);
84  if(xsec_max>0) {
85  LOG("Kinematics", pINFO) << "max{dxsec/dK} = " << xsec_max;
86  this->CacheMaxXSec(interaction, xsec_max);
87  return xsec_max;
88  }
89 
90  LOG("Kinematics", pNOTICE)
91  << "Can not generate event kinematics {K} (max_xsec({K};E)<=0)";
92  // xsec for selected kinematics = 0
93  event_rec->SetDiffXSec(0,kPSNull);
94  // switch on error flag
95  event_rec->EventFlags()->SetBitNumber(kKineGenErr, true);
96  // reset 'trust' bits
97  interaction->ResetBit(kISkipProcessChk);
98  interaction->ResetBit(kISkipKinematicChk);
99  // throw exception
101  exception.SetReason("kinematics generation: max_xsec({K};E)<=0");
102  exception.SwitchOnFastForward();
103  throw exception;
104 
105  return 0;
106 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Summary information for an interaction.
Definition: Interaction.h:56
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
virtual double ComputeMaxXSec(const Interaction *in) const =0
#define pINFO
Definition: Messenger.h:63
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
virtual void CacheMaxXSec(const Interaction *in, double xsec) const
#define pNOTICE
Definition: Messenger.h:62
virtual double FindMaxXSec(const Interaction *in) const
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
double QELEventGeneratorSM::MaxXSec2 ( GHepRecord evrec) const
private

Definition at line 515 of file QELEventGeneratorSM.cxx.

References CacheMaxXSec2(), ComputeMaxXSec2(), genie::GHepRecord::EventFlags(), FindMaxXSec2(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kKineGenErr, genie::kPSNull, LOG, pINFO, pNOTICE, genie::GHepRecord::SetDiffXSec(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepRecord::Summary(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by ProcessEventRecord().

516 {
517  LOG("Kinematics", pINFO)
518  << "Getting max. differential xsec for the rejection method";
519 
520  double xsec_max = -1;
521  Interaction * interaction = event_rec->Summary();
522 
523  LOG("Kinematics", pINFO)
524  << "Attempting to find a cached max{dxsec/dK} value";
525  xsec_max = this->FindMaxXSec2(interaction);
526  if(xsec_max>0) return xsec_max;
527 
528  LOG("Kinematics", pINFO)
529  << "Attempting to compute the max{dxsec/dK} value";
530  xsec_max = this->ComputeMaxXSec2(interaction);
531  if(xsec_max>0) {
532  LOG("Kinematics", pINFO) << "max{dxsec/dK} = " << xsec_max;
533  this->CacheMaxXSec2(interaction, xsec_max);
534  return xsec_max;
535  }
536 
537  LOG("Kinematics", pNOTICE)
538  << "Can not generate event kinematics {K} (max_xsec({K};E)<=0)";
539  // xsec for selected kinematics = 0
540  event_rec->SetDiffXSec(0,kPSNull);
541  // switch on error flag
542  event_rec->EventFlags()->SetBitNumber(kKineGenErr, true);
543  // reset 'trust' bits
544  interaction->ResetBit(kISkipProcessChk);
545  interaction->ResetBit(kISkipKinematicChk);
546  // throw exception
548  exception.SetReason("kinematics generation: max_xsec({K};E)<=0");
549  exception.SwitchOnFastForward();
550  throw exception;
551 
552  return 0;
553 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
Summary information for an interaction.
Definition: Interaction.h:56
void CacheMaxXSec2(const Interaction *in, double xsec) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double ComputeMaxXSec2(const Interaction *in) const
#define pINFO
Definition: Messenger.h:63
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
double FindMaxXSec2(const Interaction *in) const
#define pNOTICE
Definition: Messenger.h:62
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
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 QELEventGeneratorSM::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 74 of file QELEventGeneratorSM.cxx.

References genie::Target::A(), genie::GHepRecord::AddParticle(), AddTargetNucleusRemnant(), ana::assert(), genie::KineGeneratorWithCache::AssertXSecLimits(), genie::Kinematics::ClearRunningValues(), genie::EventGeneratorI::CrossSectionAlg(), E, genie::GHepRecord::EventFlags(), exit(), fGenerateNucleonInNucleus, genie::KineGeneratorWithCache::fGenerateUniformly, genie::PDGLibrary::Find(), fkps, fQ2Min, genie::Interaction::FSPrimLeptonPdg(), genie::KineGeneratorWithCache::fXSecModel, genie::gAbortingInErr, genie::SmithMonizUtils::GetBindingEnergy(), genie::GHepParticle::GetP4(), gQ2, genie::GHepRecord::HitNucleon(), genie::GHepRecord::HitNucleonPosition(), genie::Target::HitNucP4(), genie::Target::HitNucP4Ptr(), genie::Interaction::InitState(), genie::RunningThreadInfo::Instance(), genie::PDGLibrary::Instance(), genie::RandomGen::Instance(), genie::Target::IsNucleus(), genie::utils::mec::J(), genie::SmithMonizUtils::kFQES_SM_lim(), kinematics(), genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kIStHadronInTheNucleus, genie::kIStStableFinalState, genie::kKineGenErr, genie::kKVQ2, genie::kKVv, genie::kPSQ2fE, genie::kPSQ2vfE, genie::kRfHitNucRest, genie::controls::kRjMaxIterations, LOG, genie::Range1D_t::max, MaxDiffv(), genie::KineGeneratorWithCache::MaxXSec(), MaxXSec2(), genie::Range1D_t::min, make_associated_cosmic_defs::p4, pDEBUG, pFATAL, genie::SmithMonizUtils::PhaseSpaceVolume(), pINFO, pNOTICE, genie::GHepRecord::Probe(), genie::InitialState::ProbeE(), genie::GHepRecord::ProbePosition(), pWARN, genie::SmithMonizUtils::Q2QES_SM_lim(), genie::Interaction::RecoilNucleonPdg(), generate_hists::rnd, genie::RandomGen::RndGen(), genie::RandomGen::RndKine(), genie::RunningThreadInfo::RunningThread(), genie::GHepRecord::SetDiffXSec(), genie::SmithMonizUtils::SetInteraction(), genie::Kinematics::SetKV(), genie::GHepParticle::SetMomentum(), genie::Kinematics::SetQ2(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepParticle::SetRemovalEnergy(), genie::Kinematics::SetW(), genie::GHepRecord::SetWeight(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), sm_utils, ana::Sqrt(), genie::GHepRecord::Summary(), genie::exceptions::EVGThreadException::SwitchOnFastForward(), confusionMatrixTree::t, genie::InitialState::Tgt(), genie::InitialState::TgtPtr(), chisquared::theta, registry_explorer::v, genie::SmithMonizUtils::vQES_SM_lim(), genie::GHepRecord::Weight(), genie::utils::kinematics::WQ2toXY(), genie::XSecAlgorithmI::XSec(), xsec, and genie::GHepRecord::XSec().

75 {
76  LOG("QELEvent", pINFO) << "Generating QE event kinematics...";
77 
78  if(fGenerateUniformly) {
79  LOG("QELEvent", pNOTICE)
80  << "Generating kinematics uniformly over the allowed phase space";
81  }
82 
83  // Get the interaction and set the 'trust' bits
84  Interaction * interaction = evrec->Summary();
85  const InitialState & init_state = interaction -> InitState();
86  interaction->SetBit(kISkipProcessChk);
87  interaction->SetBit(kISkipKinematicChk);
88 
89  // Skip if no hit nucleon is set
90  if(! evrec->HitNucleon())
91  {
92  LOG("QELEvent", pFATAL) << "No hit nucleon was set";
93  gAbortingInErr = true;
94  exit(1);
95  }
96 
97  // Access the target from the interaction summary
98  Target * tgt = init_state.TgtPtr();
99 
100  // Get the random number generators
102 
103  // Access cross section algorithm for running thread
105  const EventGeneratorI * evg = rtinfo->RunningThread();
106  fXSecModel = evg->CrossSectionAlg();
107 
108  // heavy nucleus is nucleus that heavier than hydrogen and deuterium
109  bool isHeavyNucleus = tgt->A()>=3;
110 
111  sm_utils->SetInteraction(interaction);
112  // phase space for heavy nucleus is different from light one
113  fkps = isHeavyNucleus?kPSQ2vfE:kPSQ2fE;
115  // Try to calculate the maximum cross-section in kinematical limits
116  // if not pre-computed already
117  double xsec_max1 = (fGenerateUniformly) ? -1 : this->MaxXSec(evrec);
118  double xsec_max2 = (fGenerateUniformly) ? -1 : (rQ2.max<fQ2Min)? 0: this->MaxXSec2(evrec);// this make correct calculation of probability
119  double vmax= isHeavyNucleus?this->MaxDiffv(evrec) : 0.;
120 
121 
122  // generate Q2, v
123  double gQ2, v, xsec;
124  unsigned int iter = 0;
125  bool accept = false;
126  TLorentzVector q;
127  while(1)
128  {
129  LOG("QELEvent", pINFO) << "Attempt #: " << iter;
130  if(iter > kRjMaxIterations)
131  {
132  LOG("QELEvent", pWARN)
133  << "Couldn't select a valid Q2 after " << iter << " iterations";
134  evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
136  exception.SetReason("Couldn't select kinematics");
137  exception.SwitchOnFastForward();
138  throw exception;
139  }
140 
141  // Pick Q2 and v
142  double xsec_max = 0.;
143  double pth = rnd->RndKine().Rndm();
144  //pth < prob1/(prob1+prob2), where prob1,prob2 - probabilities to generate event in area1 (Q2<fQ2Min) and area2 (Q2>fQ2Min) which are not normalized
145  if (pth <= xsec_max1*(TMath::Min(rQ2.max, fQ2Min)-rQ2.min)/(xsec_max1*(TMath::Min(rQ2.max, fQ2Min)-rQ2.min)+xsec_max2*(rQ2.max-fQ2Min)))
146  {
147  xsec_max = xsec_max1;
148  gQ2 = (rnd->RndKine().Rndm() * (TMath::Min(rQ2.max, fQ2Min)-rQ2.min)) + rQ2.min;
149  }
150  else
151  {
152  xsec_max = xsec_max2;
153  gQ2 = (rnd->RndKine().Rndm() * (rQ2.max-fQ2Min)) + fQ2Min;
154  }
155  Range1D_t rv = sm_utils->vQES_SM_lim(gQ2);
156  // for nuclei heavier than deuterium generate energy transfer in defined energy interval
157  v = 0.;
158  if (isHeavyNucleus)
159  {
160  v = vmax * rnd->RndKine().Rndm();
161  if (v > (rv.max-rv.min)){
162  continue;
163  }
164  }
165  v += rv.min;
166 
167  Kinematics * kinematics = interaction->KinePtr();
168  kinematics->SetKV(kKVQ2, gQ2);
169  kinematics->SetKV(kKVv, v);
170  xsec = fXSecModel->XSec(interaction, fkps);
171 
172  //-- Decide whether to accept the current kinematics
173  if(!fGenerateUniformly) {
174  this->AssertXSecLimits(interaction, xsec, xsec_max);
175 
176  double t = xsec_max * rnd->RndKine().Rndm();
177 
178 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
179  LOG("QELEvent", pDEBUG)
180  << "xsec= " << xsec << ", J= " << J << ", Rnd= " << t;
181 #endif
182  accept = (t < xsec);
183  }
184  else {
185  accept = (xsec>0);
186  }
187 
188  // If the generated kinematics are accepted, finish-up module's job
189  if(accept)
190  {
191 
192  break;
193  }
194  iter++;
195  }
196 
197 
198  // Z-frame is frame where momentum transfer is (v,0,0,qv)
199  double qv = TMath::Sqrt(v*v+gQ2);
200  TLorentzVector transferMom(0, 0, qv, v);
201 
202  Range1D_t rkF = sm_utils->kFQES_SM_lim(gQ2, v);
203  double kF = (rnd->RndKine().Rndm() * (rkF.max-rkF.min)) + rkF.min;
204 
205  // Momentum of initial neutrino in LAB frame
206  TLorentzVector * tempTLV = evrec->Probe()->GetP4();
207  TLorentzVector neutrinoMom = *tempTLV;
208  delete tempTLV;
209 
210  // define all angles in Z frame
211  double theta = neutrinoMom.Vect().Theta();
212  double phi = neutrinoMom.Vect().Phi();
213  double theta_k = sm_utils-> GetTheta_k(v, qv);
214  double costheta_k = TMath::Cos(theta_k);
215  double sintheta_k = TMath::Sin(theta_k);
216  double E_p; //energy of initial nucleon
217  double theta_p = sm_utils-> GetTheta_p(kF, v, qv, E_p);
218  double costheta_p = TMath::Cos(theta_p);
219  double sintheta_p = TMath::Sin(theta_p);
220  double fi_p = 2 * TMath::Pi() * rnd->RndGen().Rndm();
221  double cosfi_p = TMath::Cos(fi_p);
222  double sinfi_p = TMath::Sin(fi_p);
223  double psi = 2 * TMath::Pi() * rnd->RndGen().Rndm();
224 
225  // 4-momentum of initial neutrino in Z-frame
226  TLorentzVector neutrinoMomZ(neutrinoMom.P()*sintheta_k, 0, neutrinoMom.P()*costheta_k, neutrinoMom.E());
227 
228  // 4-momentum of final lepton in Z-frame
229  TLorentzVector outLeptonMom = neutrinoMomZ-transferMom;
230 
231  // 4-momentum of initial nucleon in Z-frame
232  TLorentzVector inNucleonMom(kF*sintheta_p*cosfi_p, kF*sintheta_p*sinfi_p, kF*costheta_p, E_p);
233 
234  // 4-momentum of final nucleon in Z-frame
235  TLorentzVector outNucleonMom = inNucleonMom+transferMom;
236 
237 
238  // Rotate all vectors from Z frame to LAB frame
239  TVector3 yvec (0.0, 1.0, 0.0);
240  TVector3 zvec (0.0, 0.0, 1.0);
241  TVector3 unit_nudir = neutrinoMom.Vect().Unit();
242 
243  outLeptonMom.Rotate(theta-theta_k, yvec);
244  outLeptonMom.Rotate(phi, zvec);
245 
246  inNucleonMom.Rotate(theta-theta_k, yvec);
247  inNucleonMom.Rotate(phi, zvec);
248 
249  outNucleonMom.Rotate(theta-theta_k, yvec);
250  outNucleonMom.Rotate(phi, zvec);
251 
252  outLeptonMom.Rotate(psi, unit_nudir);
253  inNucleonMom.Rotate(psi, unit_nudir);
254  outNucleonMom.Rotate(psi, unit_nudir);
255 
256  // set 4-momentum of struck nucleon
257  TLorentzVector * p4 = tgt->HitNucP4Ptr();
258  p4->SetPx( inNucleonMom.Px() );
259  p4->SetPy( inNucleonMom.Py() );
260  p4->SetPz( inNucleonMom.Pz() );
261  p4->SetE ( inNucleonMom.E() );
262 
263  int rpdgc = interaction->RecoilNucleonPdg();
264  assert(rpdgc);
265  double gW = PDGLibrary::Instance()->Find(rpdgc)->Mass();
266  LOG("QELEvent", pNOTICE) << "Selected: W = "<< gW;
267  double M = init_state.Tgt().HitNucP4().M();
268  double E = init_state.ProbeE(kRfHitNucRest);
269 
270  // (W,Q2) -> (x,y)
271  double gx=0, gy=0;
272  kinematics::WQ2toXY(E,M,gW,gQ2,gx,gy);
273 
274  // lock selected kinematics & clear running values
275  interaction->KinePtr()->SetQ2(gQ2, true);
276  interaction->KinePtr()->SetW (gW, true);
277  interaction->KinePtr()->Setx (gx, true);
278  interaction->KinePtr()->Sety (gy, true);
279  interaction->KinePtr()->ClearRunningValues();
280 
281  // set the cross section for the selected kinematics
282  evrec->SetDiffXSec(xsec,fkps);
283  if(fGenerateUniformly) {
284  double vol = sm_utils->PhaseSpaceVolume(fkps);
285  double totxsec = evrec->XSec();
286  double wght = (vol/totxsec)*xsec;
287  LOG("QELEvent", pNOTICE) << "Kinematics wght = "<< wght;
288 
289  // apply computed weight to the current event weight
290  wght *= evrec->Weight();
291  LOG("QELEvent", pNOTICE) << "Current event wght = " << wght;
292  evrec->SetWeight(wght);
293  }
294  TLorentzVector x4l(*(evrec->Probe())->X4());
295 
296  evrec->AddParticle(interaction->FSPrimLeptonPdg(), kIStStableFinalState, evrec->ProbePosition(),-1,-1,-1, outLeptonMom, x4l);
297 
298  GHepStatus_t ist;
300  ist = kIStStableFinalState;
301  else
303 
304  GHepParticle outNucleon(interaction->RecoilNucleonPdg(), ist, evrec->HitNucleonPosition(),-1,-1,-1, outNucleonMom , x4l);
305  evrec->AddParticle(outNucleon);
306 
307  // Store struck nucleon momentum
308  GHepParticle * nucleon = evrec->HitNucleon();
309  LOG("QELEvent",pNOTICE) << "pn: " << inNucleonMom.X() << ", " <<inNucleonMom.Y() << ", " <<inNucleonMom.Z() << ", " <<inNucleonMom.E();
310  nucleon->SetMomentum(inNucleonMom);
312 
313  // skip if not a nuclear target
314  if(evrec->Summary()->InitState().Tgt().IsNucleus())
315  // add a recoiled nucleus remnant
316  this->AddTargetNucleusRemnant(evrec);
317 
318 
319  LOG("QELEvent", pINFO) << "Done generating QE event kinematics!";
320 }
void SetInteraction(const Interaction *i)
Range1D_t Q2QES_SM_lim(void) const
virtual double MaxXSec(GHepRecord *evrec) const
double fQ2Min
Q2-threshold for seeking the second maximum.
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double J(double q0, double q3, double Enu, double ml)
Definition: MECUtils.cxx:141
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
void SetQ2(double Q2, bool selected=false)
Definition: Kinematics.cxx:265
Kinematics * KinePtr(void) const
Definition: Interaction.h:76
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
int RecoilNucleonPdg(void) const
recoil nucleon pdg
int A(void) const
Definition: Target.h:71
A simple [min,max] interval for doubles.
Definition: Range1.h:43
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
enum genie::EGHepStatus GHepStatus_t
#define pFATAL
Definition: Messenger.h:57
bool IsNucleus(void) const
Definition: Target.cxx:289
double MaxDiffv(GHepRecord *evrec) const
Defines the EventGeneratorI interface.
Generated/set kinematical variables for an event.
Definition: Kinematics.h:40
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
void SetMomentum(const TLorentzVector &p4)
Range1D_t vQES_SM_lim(double Q2) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
double GetBindingEnergy(void) const
Summary information for an interaction.
Definition: Interaction.h:56
const TLorentzVector & HitNucP4(void) const
Definition: Target.h:92
Range1D_t kFQES_SM_lim(double nu, double Q2) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Float_t E
Definition: plot.C:20
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
Definition: KineUtils.cxx:1046
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
bool fGenerateNucleonInNucleus
generate struck nucleon in nucleus
double MaxXSec2(GHepRecord *evrec) const
#define pINFO
Definition: Messenger.h:63
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Definition: RandomGen.h:51
Double_t xsec[nknots]
Definition: testXsec.C:47
#define pWARN
Definition: Messenger.h:61
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
void SetKV(KineVar_t kv, double value)
Definition: Kinematics.cxx:345
void SetRemovalEnergy(double Erm)
static RunningThreadInfo * Instance(void)
double max
Definition: Range1.h:54
void SetW(double W, bool selected=false)
Definition: Kinematics.cxx:289
TLorentzVector * HitNucP4Ptr(void) const
Definition: Target.cxx:264
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
void AddTargetNucleusRemnant(GHepRecord *evrec) const
add a recoiled nucleus remnant
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
double PhaseSpaceVolume(KinePhaseSpace_t ps) const
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
Target * TgtPtr(void) const
Definition: InitialState.h:68
TRandom3 & RndGen(void) const
rnd number generator for generic usage
Definition: RandomGen.h:81
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
exit(0)
assert(nhit_max >=nhit_nbins)
double gQ2
Definition: gtestDISSF.cxx:55
double min
Definition: Range1.h:53
#define pNOTICE
Definition: Messenger.h:62
void ClearRunningValues(void)
Definition: Kinematics.cxx:357
const Target & Tgt(void) const
Definition: InitialState.h:67
static const unsigned int kRjMaxIterations
Definition: Controls.h:27
const EventGeneratorI * RunningThread(void)
void kinematics()
Definition: kinematics.C:10
bool gAbortingInErr
Definition: Messenger.cxx:56
double ProbeE(RefFrame_t rf) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
Keep info on the event generation thread currently on charge. This is used so that event generation m...
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
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::EmpiricalMECPXSec2015::LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::DISHadronicSystemGenerator::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::LwlynSmithFF::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), LoadConfig(), genie::MartiniEricsonChanfrayMarteauMECPXSec2016::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.

double genie::KineGeneratorWithCache::fEMin
protectedinherited
bool genie::QELEventGeneratorSM::fGenerateNucleonInNucleus
private

generate struck nucleon in nucleus

Definition at line 81 of file QELEventGeneratorSM.h.

Referenced by LoadConfig(), and ProcessEventRecord().

bool genie::KineGeneratorWithCache::fGenerateUniformly
protectedinherited

uniform over allowed phase space + event weight?

Definition at line 66 of file KineGeneratorWithCache.h.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::COHElKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::QELEventGenerator::LoadConfig(), LoadConfig(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::SKKinematicsGenerator::ProcessEventRecord(), genie::COHElKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), and ProcessEventRecord().

AlgId genie::Algorithm::fID
protectedinherited

algorithm name and configuration set

Definition at line 156 of file Algorithm.h.

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

KinePhaseSpace_t genie::QELEventGeneratorSM::fkps
mutableprivate

Definition at line 79 of file QELEventGeneratorSM.h.

Referenced by ComputeMaxXSec(), ComputeMaxXSec2(), and ProcessEventRecord().

double genie::KineGeneratorWithCache::fMaxXSecDiffTolerance
protectedinherited
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.

double genie::QELEventGeneratorSM::fQ2Min
private

Q2-threshold for seeking the second maximum.

Definition at line 82 of file QELEventGeneratorSM.h.

Referenced by ComputeMaxXSec(), ComputeMaxXSec2(), LoadConfig(), and ProcessEventRecord().

double genie::QELEventGeneratorSM::fSafetyFacor_nu
private

Definition at line 84 of file QELEventGeneratorSM.h.

Referenced by LoadConfig().

double genie::KineGeneratorWithCache::fSafetyFactor
protectedinherited
AlgStatus_t genie::Algorithm::fStatus
protectedinherited

algorithm execution status

Definition at line 166 of file Algorithm.h.

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

const XSecAlgorithmI* genie::KineGeneratorWithCache::fXSecModel
mutableprotectedinherited

Definition at line 61 of file KineGeneratorWithCache.h.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::ComputeMaxXSec(), genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::IBDKinematicsGenerator::ComputeMaxXSec(), genie::QELKinematicsGenerator::ComputeMaxXSec(), genie::COHElKinematicsGenerator::ComputeMaxXSec(), genie::NuEKinematicsGenerator::ComputeMaxXSec(), genie::DISKinematicsGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), genie::DMELKinematicsGenerator::ComputeMaxXSec(), genie::DMDISKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::ComputeMaxXSec(), ComputeMaxXSec(), ComputeMaxXSec2(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), genie::COHKinematicsGenerator::MaxXSec_BergerSehgal(), genie::COHKinematicsGenerator::MaxXSec_BergerSehgalFM(), genie::COHKinematicsGenerator::MaxXSec_ReinSehgal(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::COHElKinematicsGenerator::ProcessEventRecord(), genie::SKKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

SmithMonizUtils* genie::QELEventGeneratorSM::sm_utils
mutableprivate

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