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

Generates values for the kinematic variables describing coherent neutrino-nucleus pion production events. Is a concrete implementation of the EventRecordVisitorI interface. More...

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

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

Public Member Functions

 COHKinematicsGenerator ()
 
 COHKinematicsGenerator (string config)
 
 ~COHKinematicsGenerator ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
void Configure (const Registry &config)
 
void Configure (string config)
 
void LoadConfig (void)
 
void CalculateKin_ReinSehgal (GHepRecord *event_rec) const
 
void CalculateKin_BergerSehgal (GHepRecord *event_rec) const
 
void CalculateKin_BergerSehgalFM (GHepRecord *event_rec) const
 
void CalculateKin_AlvarezRuso (GHepRecord *event_rec) const
 
void SetKinematics (const double E_l, const double theta_l, const double phi_l, const double theta_pi, const double phi_pi, const Interaction *interaction, Kinematics *kinematics) const
 
bool CheckKinematics (const double E_l, const double theta_l, const double phi_l, const double theta_pi, const double phi_pi, const Interaction *interaction) const
 
double ComputeMaxXSec (const Interaction *in) const
 
double MaxXSec_ReinSehgal (const Interaction *in) const
 
double MaxXSec_BergerSehgal (const Interaction *in) const
 
double MaxXSec_BergerSehgalFM (const Interaction *in) const
 
double MaxXSec_AlvarezRuso (const Interaction *in) const
 
double Energy (const Interaction *in) const
 
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...
 

Public Attributes

TF2 * fEnvelope
 2-D envelope used for importance sampling More...
 
double fRo
 nuclear scale parameter 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 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

double pionMass (const Interaction *in) const
 
void throwOnTooManyIterations (unsigned int iters, GHepRecord *evrec) const
 

Private Attributes

double fQ2Min
 lower bound of integration for Q^2 in Berger-Sehgal Model More...
 
double fQ2Max
 upper bound of integration for Q^2 in Berger-Sehgal Model More...
 
double fTMax
 upper bound for t = (q - p_pi)^2 More...
 

Detailed Description

Generates values for the kinematic variables describing coherent neutrino-nucleus pion production events. Is a concrete implementation of the EventRecordVisitorI interface.

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

October 03, 2004

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

Definition at line 31 of file COHKinematicsGenerator.h.

Constructor & Destructor Documentation

COHKinematicsGenerator::COHKinematicsGenerator ( )

Definition at line 62 of file COHKinematicsGenerator.cxx.

References fEnvelope.

62  :
63  KineGeneratorWithCache("genie::COHKinematicsGenerator")
64 {
65  fEnvelope = 0;
66 }
TF2 * fEnvelope
2-D envelope used for importance sampling
COHKinematicsGenerator::COHKinematicsGenerator ( string  config)

Definition at line 68 of file COHKinematicsGenerator.cxx.

References fEnvelope.

68  :
69  KineGeneratorWithCache("genie::COHKinematicsGenerator", config)
70 {
71  fEnvelope = 0;
72 }
Definition: config.py:1
TF2 * fEnvelope
2-D envelope used for importance sampling
COHKinematicsGenerator::~COHKinematicsGenerator ( )

Definition at line 74 of file COHKinematicsGenerator.cxx.

References fEnvelope.

75 {
76  if(fEnvelope) delete fEnvelope;
77 }
TF2 * fEnvelope
2-D envelope used for importance sampling

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
int Algorithm::AddLowRegistry ( Registry rp,
bool  owns = true 
)
protectedinherited

add registry with lowest priority, also update ownership

Definition at line 601 of file Algorithm.cxx.

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

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

Add registries with top priority, also udated Ownerships.

Definition at line 653 of file Algorithm.cxx.

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

add registry with top priority, also update ownership

Definition at line 585 of file Algorithm.cxx.

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

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

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

Definition at line 394 of file Algorithm.cxx.

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

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

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

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

Definition at line 408 of file Algorithm.cxx.

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

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

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

Definition at line 462 of file COHKinematicsGenerator.cxx.

References genie::KineGeneratorWithCache::AssertXSecLimits(), genie::Kinematics::ClearRunningValues(), genie::units::cm2, E, genie::KineGeneratorWithCache::fGenerateUniformly, genie::Interaction::FSPrimLepton(), genie::KineGeneratorWithCache::fXSecModel, genie::InitialState::GetProbeP4(), genie::Interaction::InitStatePtr(), genie::RandomGen::Instance(), genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::constants::kNucleonMass, kPi, genie::constants::kPionMass, genie::kPSElOlOpifE, genie::kRfLab, genie::controls::kRjMaxIterations, LOG, Mag2(), genie::KineGeneratorWithCache::MaxXSec(), pDEBUG, pINFO, pionMass(), pNOTICE, genie::utils::kinematics::Q2(), generate_hists::rnd, genie::RandomGen::RndKine(), genie::GHepRecord::SetDiffXSec(), SetKinematics(), genie::Kinematics::SetQ2(), genie::Kinematics::Sett(), genie::Kinematics::SetW(), genie::GHepRecord::SetWeight(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), ana::Sqrt(), genie::GHepRecord::Summary(), confusionMatrixTree::t, throwOnTooManyIterations(), genie::GHepRecord::Weight(), submit_syst::x, genie::XSecAlgorithmI::XSec(), xsec, genie::GHepRecord::XSec(), and submit_syst::y.

Referenced by ProcessEventRecord().

463 {
464 
465  LOG("COHKinematics", pNOTICE) << "Using AlvarezRuso Model";
466  // Get the Primary Interacton object
467  Interaction * interaction = evrec->Summary();
468  interaction->SetBit(kISkipProcessChk);
469  interaction->SetBit(kISkipKinematicChk);
470 
471  // Initialise a random number generator
473 
474  //-- For the subsequent kinematic selection with the rejection method:
475  // Calculate the max differential cross section or retrieve it from the
476  // cache. Throw an exception and quit the evg thread if a non-positive
477  // value is found.
478  // If the kinematics are generated uniformly over the allowed phase
479  // space the max xsec is irrelevant
480  double xsec_max = (fGenerateUniformly) ? -1 : this->MaxXSec(evrec);
481 
482  //Set up limits of integration variables
483  // Primary lepton energy
484  const double E_l_min = interaction->FSPrimLepton()->Mass();
485  const double E_l_max = interaction->InitStatePtr()->GetProbeP4(kRfLab)->E() - kPionMass;
486  // Primary lepton angle with respect to the beam axis
487  const double ctheta_l_min = 0.4;
488  const double ctheta_l_max = 1.0 - kASmallNum;
489  // Pion angle with respect to the beam axis
490  const double ctheta_pi_min = 0.4;
491  const double ctheta_pi_max = 1.0 - kASmallNum;
492  // Pion angle transverse to the beam axis
493  const double phi_min = kASmallNum;
494  const double phi_max = (2.0 * kPi) - kASmallNum;
495  //
496  const double d_E_l = E_l_max - E_l_min;
497  const double d_ctheta_l = ctheta_l_max - ctheta_l_min;
498  const double d_ctheta_pi = ctheta_pi_max - ctheta_pi_min;
499  const double d_phi = phi_max - phi_min;
500 
501  //------ Try to select a valid set of kinematics
502  unsigned int iter = 0;
503  bool accept=false;
504  double xsec=-1, g_E_l=-1, g_theta_l=-1, g_phi_l=-1, g_theta_pi=-1, g_phi_pi=-1;
505  double g_ctheta_l, g_ctheta_pi;
506 
507  while(1) {
508  iter++;
509  if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
510 
511  //Select kinematic point
512  g_E_l = E_l_min + d_E_l * rnd->RndKine().Rndm();
513  g_ctheta_l = ctheta_l_min + d_ctheta_l * rnd->RndKine().Rndm();
514  g_ctheta_pi = ctheta_pi_min + d_ctheta_pi * rnd->RndKine().Rndm();
515  g_phi_l = phi_min + d_phi * rnd->RndKine().Rndm();
516  // random phi is relative to phi_l
517  g_phi_pi = g_phi_l + (phi_min + d_phi * rnd->RndKine().Rndm());
518  g_theta_l = TMath::ACos(g_ctheta_l);
519  g_theta_pi = TMath::ACos(g_ctheta_pi);
520 
521  LOG("COHKinematics", pINFO) << "Trying: Lep(" <<g_E_l << ", " <<
522  g_theta_l << ", " << g_phi_l << ") Pi(" <<
523  g_theta_pi << ", " << g_phi_pi << ")";
524 
525  this->SetKinematics(g_E_l, g_theta_l, g_phi_l, g_theta_pi, g_phi_pi,
526  interaction, interaction->KinePtr());
527 
528  // computing cross section for the current kinematics
529  xsec = fXSecModel->XSec(interaction,kPSElOlOpifE) / (1E-38 * units::cm2);
530 
531  if (!fGenerateUniformly) {
532  //-- decide whether to accept the current kinematics
533  double t = xsec_max * rnd->RndKine().Rndm();
534 
535  LOG("COHKinematics", pINFO) << "Got: xsec = " << xsec << ", t = " <<
536  t << " (max_xsec = " << xsec_max << ")";
537 
538  this->AssertXSecLimits(interaction, xsec, xsec_max);
539 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
540  LOG("COHKinematics", pDEBUG)
541  << "xsec= " << xsec << ", J= 1, Rnd= " << t;
542 #endif
543  accept = (t<xsec);
544  }
545  else {
546  accept = (xsec>0);
547  }
548 
549  //-- If the generated kinematics are accepted, finish-up module's job
550  if(accept) {
551  LOG("COHKinematics", pNOTICE) << "Selected: Lepton(" <<
552  g_E_l << ", " << g_theta_l << ", " <<
553  g_phi_l << ") Pion(" << g_theta_pi << ", " << g_phi_pi << ")";
554 
555  double E_l = g_E_l;
556  double theta_l = g_theta_l;
557  double theta_pi = g_theta_pi;
558  double phi_l = g_phi_l;
559  double phi_pi = g_phi_pi;
560  const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
561  double E_nu = P4_nu.E();
562  double E_pi= E_nu-E_l;
563  double m_l = interaction->FSPrimLepton()->Mass();
564  double m_pi = this->pionMass(interaction);
565 
566  double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
567  TVector3 lepton_3vector = TVector3(0,0,0);
568  lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
569  TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
570 
571  double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
572  TVector3 pion_3vector = TVector3(0,0,0);
573  pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
574  TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
575 
576  TLorentzVector q = P4_nu - P4_lep;
577  double Q2 = -q.Mag2();
578  double x = Q2/(2*E_pi*constants::kNucleonMass);
579  double y = E_pi/E_nu;
580 
581  double t = TMath::Abs( (q - P4_pion).Mag2() );
582 
583  // for uniform kinematics, compute an event weight as
584  // wght = (phase space volume)*(differential xsec)/(event total xsec)
585  if(fGenerateUniformly) {
586  // Phase space volume needs checking
587  double vol = d_E_l*d_ctheta_l*d_phi*d_ctheta_pi*d_phi;
588  double totxsec = evrec->XSec();
589  double wght = (vol/totxsec)*xsec;
590  LOG("COHKinematics", pNOTICE) << "Kinematics wght = "<< wght;
591 
592  // apply computed weight to the current event weight
593  wght *= evrec->Weight();
594  LOG("COHKinematics", pNOTICE) << "Current event wght = " << wght;
595  evrec->SetWeight(wght);
596  }
597 
598  // reset bits
599  interaction->ResetBit(kISkipProcessChk);
600  interaction->ResetBit(kISkipKinematicChk);
601  // lock selected kinematics & clear running values
602  interaction->KinePtr()->Setx(x, true);
603  interaction->KinePtr()->Sety(y, true);
604  interaction->KinePtr()->Sett(t, true);
605  interaction->KinePtr()->SetW(kPionMass, true);
606  interaction->KinePtr()->SetQ2(2*kNucleonMass*x*y*E_nu, true);
607  interaction->KinePtr()->ClearRunningValues();
608  // set the cross section for the selected kinematics
609  evrec->SetDiffXSec(xsec,kPSElOlOpifE);
610  return;
611  }
612  }//while
613 }
const double kPi
virtual double MaxXSec(GHepRecord *evrec) const
bool fGenerateUniformly
uniform over allowed phase space + event weight?
static const double kNucleonMass
Definition: Constants.h:78
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
void SetKinematics(const double E_l, const double theta_l, const double phi_l, const double theta_pi, const double phi_pi, const Interaction *interaction, Kinematics *kinematics) const
static const double cm2
Definition: Units.h:77
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Summary information for an interaction.
Definition: Interaction.h:56
#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 Sett(double t, bool selected=false)
Definition: Kinematics.cxx:301
static const double kASmallNum
Definition: Controls.h:40
#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
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
float Mag2() const
void SetW(double W, bool selected=false)
Definition: Kinematics.cxx:289
static const double kPionMass
Definition: Constants.h:74
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
double pionMass(const Interaction *in) const
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
#define pNOTICE
Definition: Messenger.h:62
void ClearRunningValues(void)
Definition: Kinematics.cxx:357
static const unsigned int kRjMaxIterations
Definition: Controls.h:27
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
void throwOnTooManyIterations(unsigned int iters, GHepRecord *evrec) const
#define pDEBUG
Definition: Messenger.h:64
void COHKinematicsGenerator::CalculateKin_BergerSehgal ( GHepRecord event_rec) const

Definition at line 106 of file COHKinematicsGenerator.cxx.

References genie::Target::A(), genie::units::A, ana::assert(), b, genie::Kinematics::ClearRunningValues(), dy, genie::units::fermi, fQ2Max, fQ2Min, fRo, genie::KineGeneratorWithCache::fXSecModel, gQ2, gt(), genie::Interaction::InitState(), genie::RandomGen::Instance(), genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::constants::kNucleonMass, genie::constants::kPionMass2, genie::kPSQ2yfE, genie::kRfLab, genie::controls::kRjMaxIterations, LOG, genie::Range1D_t::max, genie::KineGeneratorWithCache::MaxXSec(), genie::Range1D_t::min, genie::Interaction::PhaseSpace(), pINFO, pionMass(), pNOTICE, genie::InitialState::ProbeE(), genie::utils::kinematics::Q2(), R, generate_hists::rnd, genie::RandomGen::RndKine(), genie::GHepRecord::SetDiffXSec(), genie::Kinematics::SetQ2(), genie::Kinematics::Sett(), genie::Kinematics::SetW(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), ana::Sqrt(), genie::GHepRecord::Summary(), genie::InitialState::Tgt(), throwOnTooManyIterations(), genie::utils::kinematics::UpdateXFromQ2Y(), genie::Kinematics::x(), genie::XSecAlgorithmI::XSec(), xsec, submit_syst::y, genie::KPhaseSpace::YLim(), ymax, and ymin.

Referenced by ProcessEventRecord().

107 {
108  // Get the Primary Interacton object
109  Interaction * interaction = evrec->Summary();
110  interaction->SetBit(kISkipProcessChk);
111  interaction->SetBit(kISkipKinematicChk); // TODO: Why turn this off?
112 
113  // Initialise a random number generator
115 
116  //-- For the subsequent kinematic selection with the rejection method:
117  // Calculate the max differential cross section or retrieve it from the
118  // cache. Throw an exception and quit the evg thread if a non-positive
119  // value is found.
120  //
121  // TODO: We are not offering the "fGenerateUniformly" option here.
122  double xsec_max = this->MaxXSec(evrec);
123 
124  //-- Get the kinematical limits for the generated x,y
125  const KPhaseSpace & kps = interaction->PhaseSpace();
126  Range1D_t y = kps.YLim();
128  assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.min<y.max);
129 
130  const double ymin = y.min + kASmallNum;
131  const double ymax = y.max - kASmallNum;
132  const double dy = ymax - ymin;
133  const double Q2min = Q2.min + kASmallNum;
134  const double Q2max = Q2.max - kASmallNum;
135  const double dQ2 = Q2max - Q2min;
136 
137  unsigned int iter = 0;
138  bool accept=false;
139  double xsec=-1, gy=-1, gQ2=-1;
140 
141  while(1) {
142  iter++;
143  if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
144 
145  //-- Select unweighted kinematics using importance sampling method.
146  // TODO: The importance sampling envelope is not used. Currently,
147  // we just employ a standard rejection-method approach.
148 
149  gy = ymin + dy * rnd->RndKine().Rndm();
150  gQ2 = Q2min + dQ2 * rnd->RndKine().Rndm();
151 
152  LOG("COHKinematics", pINFO) <<
153  "Trying: Q^2 = " << gQ2 << ", y = " << gy; /* << ", t = " << gt; */
154 
155  interaction->KinePtr()->Sety(gy);
156  interaction->KinePtr()->SetQ2(gQ2);
157  kinematics::UpdateXFromQ2Y(interaction);
158 
159  // computing cross section for the current kinematics
160  xsec = fXSecModel->XSec(interaction, kPSQ2yfE);
161 
162  //-- decide whether to accept the current kinematics
163  accept = (xsec_max * rnd->RndKine().Rndm() < xsec);
164 
165  //-- If the generated kinematics are accepted, finish-up module's job
166  if(accept) {
167  LOG("COHKinematics", pNOTICE)
168  << "Selected: Q^2 = " << gQ2 << ", y = " << gy; /* << ", t = " << gt; */
169 
170  // the Berger-Sehgal COH cross section should be a triple differential cross section
171  // d^2xsec/dQ2dydt where t is the the square of the 4p transfer to the
172  // nucleus. The cross section used for kinematical selection should have
173  // the t-dependence integrated out. The t-dependence is of the form
174  // ~exp(-bt). Now that the x,y kinematical variables have been selected
175  // we can generate a t using the t-dependence as a PDF.
176  const InitialState & init_state = interaction->InitState();
177  double Ev = init_state.ProbeE(kRfLab);
178  double Epi = gy*Ev; // pion energy
179  double Epi2 = TMath::Power(Epi,2);
180  double pme2 = kPionMass2/Epi2;
181  double gx = interaction->KinePtr()->x(); // utils::kinematics::Q2YtoX(Ev,kNucleonMass,gQ2,gy); // gQ2 / ( 2. * gy * kNucleonMass * Ev);
182  double xME = kNucleonMass*gx/Epi;
183  double tA = 1. + xME - 0.5*pme2;
184  /* Range1D_t tl = kps.TLim(); // this becomes the bounds for t */
185  double tB = TMath::Sqrt(1.+ 2*xME) * TMath::Sqrt(1.-pme2);
186  double tmin = 2*Epi2 * (tA-tB);
187  double tmax = 2*Epi2 * (tA+tB);
188  double A = (double) init_state.Tgt().A();
189  double A13 = TMath::Power(A,1./3.);
190  double R = fRo * A13 * units::fermi; // nuclear radius
191  double R2 = TMath::Power(R,2.);
192  double b = 0.33333 * R2;
193  double tsum = (TMath::Exp(-b*tmin) - TMath::Exp(-b*tmax))/b;
194  double rt = tsum * rnd->RndKine().Rndm();
195  double gt = -1.*TMath::Log(-1.*b*rt + TMath::Exp(-1.*b*tmin))/b;
196 
197  // TODO: If we re-install the fGenerateUniformly option, we
198  // would compute the event weight here.
199 
200  // reset bits
201  interaction->ResetBit(kISkipProcessChk);
202  interaction->ResetBit(kISkipKinematicChk);
203 
204  // lock selected kinematics & clear running values
205  interaction->KinePtr()->Setx(gx, true);
206  interaction->KinePtr()->Sety(gy, true);
207  interaction->KinePtr()->Sett(gt, true);
208  interaction->KinePtr()->SetW(this->pionMass(interaction), true);
209  interaction->KinePtr()->SetQ2(gQ2, true);
210  interaction->KinePtr()->ClearRunningValues();
211 
212  // set the cross section for the selected kinematics
213  evrec->SetDiffXSec(xsec * TMath::Exp(-b * gt) / tsum, kPSQ2yfE);
214 
215  return;
216  }
217  }// iterations
218 }
virtual double MaxXSec(GHepRecord *evrec) const
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
double fRo
nuclear scale parameter
static const double kNucleonMass
Definition: Constants.h:78
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
static const double fermi
Definition: Units.h:63
int A(void) const
Definition: Target.h:71
A simple [min,max] interval for doubles.
Definition: Range1.h:43
double x(bool selected=false) const
Definition: Kinematics.cxx:109
Range1D_t YLim(void) const
y limits
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Double_t ymax
Definition: plot.C:25
Summary information for an interaction.
Definition: Interaction.h:56
double dy[NP][NC]
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double fQ2Min
lower bound of integration for Q^2 in Berger-Sehgal Model
Kinematical phase space.
Definition: KPhaseSpace.h:34
void Sett(double t, bool selected=false)
Definition: Kinematics.cxx:301
#define R(x)
static const double kASmallNum
Definition: Controls.h:40
#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
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
static const double A
Definition: Units.h:82
double max
Definition: Range1.h:54
void SetW(double W, bool selected=false)
Definition: Kinematics.cxx:289
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
void UpdateXFromQ2Y(const Interaction *in)
Definition: KineUtils.cxx:1221
double pionMass(const Interaction *in) const
const hit & b
Definition: hits.cxx:21
assert(nhit_max >=nhit_nbins)
double gQ2
Definition: gtestDISSF.cxx:55
const InitialState & InitState(void) const
Definition: Interaction.h:69
Double_t ymin
Definition: plot.C:24
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
bool gt(unsigned short int a, unsigned short int b)
double ProbeE(RefFrame_t rf) const
double fQ2Max
upper bound of integration for Q^2 in Berger-Sehgal Model
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
void throwOnTooManyIterations(unsigned int iters, GHepRecord *evrec) const
Initial State information.
Definition: InitialState.h:49
static const double kPionMass2
Definition: Constants.h:87
void COHKinematicsGenerator::CalculateKin_BergerSehgalFM ( GHepRecord event_rec) const

Definition at line 220 of file COHKinematicsGenerator.cxx.

References ana::assert(), genie::Kinematics::ClearRunningValues(), dy, fQ2Max, fQ2Min, fTMax, genie::KineGeneratorWithCache::fXSecModel, gQ2, gt(), genie::RandomGen::Instance(), genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kPSxyfE, genie::kPSxytfE, genie::controls::kRjMaxIterations, LOG, genie::Range1D_t::max, genie::KineGeneratorWithCache::MaxXSec(), genie::Range1D_t::min, genie::Interaction::PhaseSpace(), pINFO, pionMass(), pNOTICE, genie::utils::kinematics::Q2(), generate_hists::rnd, genie::RandomGen::RndKine(), genie::GHepRecord::SetDiffXSec(), genie::Kinematics::SetQ2(), genie::Kinematics::Sett(), genie::Kinematics::SetW(), genie::Kinematics::Sety(), genie::GHepRecord::Summary(), throwOnTooManyIterations(), genie::XSecAlgorithmI::XSec(), xsec, submit_syst::y, genie::KPhaseSpace::YLim(), ymax, and ymin.

Referenced by ProcessEventRecord().

221 {
222  // Get the Primary Interacton object
223  Interaction * interaction = evrec->Summary();
224  interaction->SetBit(kISkipProcessChk);
225  interaction->SetBit(kISkipKinematicChk);
226 
227  // Initialise a random number generator
229 
230  //-- For the subsequent kinematic selection with the rejection method:
231  // Calculate the max differential cross section or retrieve it from the
232  // cache. Throw an exception and quit the evg thread if a non-positive
233  // value is found.
234  //
235  // TODO: We are not offering the "fGenerateUniformly" option here.
236  double xsec_max = this->MaxXSec(evrec);
237 
238  //-- Get the kinematical limits for the generated x,y
239  const KPhaseSpace & kps = interaction->PhaseSpace();
240  Range1D_t y = kps.YLim();
242  assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.min<y.max);
243 
244  const double ymin = y.min + kASmallNum;
245  const double ymax = y.max - kASmallNum;
246  const double dy = ymax - ymin;
247  const double Q2min = Q2.min + kASmallNum;
248  const double Q2max = Q2.max - kASmallNum;
249  const double dQ2 = Q2max - Q2min;
250  const double tmin = kASmallNum;
251  const double tmax = fTMax - kASmallNum; // TODO: Choose realistic t bounds
252  const double dt = tmax - tmin;
253 
254  //-- Try to select a valid (Q^2,y,t) triple.
255 
256  unsigned int iter = 0;
257  bool accept=false;
258  double xsec=-1, gy=-1, gt=-1, gQ2=-1;
259 
260  while(1) {
261  iter++;
262  if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
263 
264  //-- Select unweighted kinematics using importance sampling method.
265  // TODO: The importance sampling envelope is not used. Currently,
266  // we just employ a standard rejection-method approach.
267 
268  gy = ymin + dy * rnd->RndKine().Rndm();
269  gt = tmin + dt * rnd->RndKine().Rndm();
270  gQ2 = Q2min + dQ2 * rnd->RndKine().Rndm();
271 
272  LOG("COHKinematics", pINFO) <<
273  "Trying: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
274 
275  interaction->KinePtr()->Sety(gy);
276  interaction->KinePtr()->Sett(gt);
277  interaction->KinePtr()->SetQ2(gQ2);
278 
279  // computing cross section for the current kinematics
280  xsec = fXSecModel->XSec(interaction, kPSxyfE);
281 
282  //-- decide whether to accept the current kinematics
283  accept = (xsec_max * rnd->RndKine().Rndm() < xsec);
284 
285  //-- If the generated kinematics are accepted, finish-up module's job
286  if(accept) {
287  LOG("COHKinematics", pNOTICE)
288  << "Selected: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
289 
290  // TODO: If we re-install the fGenerateUniformly option, we
291  // would compute the event weight here.
292 
293  // reset bits
294  interaction->ResetBit(kISkipProcessChk);
295  interaction->ResetBit(kISkipKinematicChk);
296 
297  // lock selected kinematics & clear running values
298  interaction->KinePtr()->SetQ2(gQ2, true);
299  interaction->KinePtr()->Sety(gy, true);
300  interaction->KinePtr()->Sett(gt, true);
301  interaction->KinePtr()->SetW(this->pionMass(interaction), true);
302  interaction->KinePtr()->ClearRunningValues();
303 
304  // set the cross section for the selected kinematics
305  evrec->SetDiffXSec(xsec, kPSxytfE);
306 
307  return;
308  }
309  }// iterations
310 }
virtual double MaxXSec(GHepRecord *evrec) const
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t YLim(void) const
y limits
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Double_t ymax
Definition: plot.C:25
Summary information for an interaction.
Definition: Interaction.h:56
Definition: Cand.cxx:23
double fTMax
upper bound for t = (q - p_pi)^2
double dy[NP][NC]
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double fQ2Min
lower bound of integration for Q^2 in Berger-Sehgal Model
Kinematical phase space.
Definition: KPhaseSpace.h:34
void Sett(double t, bool selected=false)
Definition: Kinematics.cxx:301
static const double kASmallNum
Definition: Controls.h:40
#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
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
double max
Definition: Range1.h:54
void SetW(double W, bool selected=false)
Definition: Kinematics.cxx:289
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
double pionMass(const Interaction *in) const
assert(nhit_max >=nhit_nbins)
double gQ2
Definition: gtestDISSF.cxx:55
Double_t ymin
Definition: plot.C:24
double min
Definition: Range1.h:53
#define pNOTICE
Definition: Messenger.h:62
void ClearRunningValues(void)
Definition: Kinematics.cxx:357
static const unsigned int kRjMaxIterations
Definition: Controls.h:27
bool gt(unsigned short int a, unsigned short int b)
double fQ2Max
upper bound of integration for Q^2 in Berger-Sehgal Model
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
void throwOnTooManyIterations(unsigned int iters, GHepRecord *evrec) const
void COHKinematicsGenerator::CalculateKin_ReinSehgal ( GHepRecord event_rec) const

Definition at line 312 of file COHKinematicsGenerator.cxx.

References genie::Target::A(), genie::units::A, ana::assert(), genie::KineGeneratorWithCache::AssertXSecLimits(), b, genie::Kinematics::ClearRunningValues(), dx, dy, fEnvelope, genie::units::fermi, genie::KineGeneratorWithCache::fGenerateUniformly, fRo, genie::KineGeneratorWithCache::fXSecModel, gt(), genie::Interaction::InitState(), genie::RandomGen::Instance(), genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::constants::kNucleonMass, genie::constants::kPionMass, genie::constants::kPionMass2, genie::kPSxyfE, genie::kPSxytfE, genie::kRfLab, genie::controls::kRjMaxIterations, LOG, cet::sqlite::max(), genie::Range1D_t::max, genie::KineGeneratorWithCache::MaxXSec(), genie::Range1D_t::min, pDEBUG, genie::Interaction::PhaseSpace(), pINFO, pNOTICE, genie::InitialState::ProbeE(), R, generate_hists::rnd, genie::RandomGen::RndKine(), genie::GHepRecord::SetDiffXSec(), genie::Kinematics::SetQ2(), genie::Kinematics::Sett(), genie::Kinematics::SetW(), genie::GHepRecord::SetWeight(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), ana::Sqrt(), genie::GHepRecord::Summary(), confusionMatrixTree::t, genie::InitialState::Tgt(), throwOnTooManyIterations(), genie::GHepRecord::Weight(), xmax, make_mec_shifts_plots::xmin, genie::XSecAlgorithmI::XSec(), xsec, genie::GHepRecord::XSec(), submit_syst::y, genie::KPhaseSpace::YLim(), ymax, and ymin.

Referenced by ProcessEventRecord().

313 {
314  // Get the Primary Interacton object
315  Interaction * interaction = evrec->Summary();
316  interaction->SetBit(kISkipProcessChk);
317  interaction->SetBit(kISkipKinematicChk);
318 
319  //-- Get the random number generators
321 
322  //-- For the subsequent kinematic selection with the rejection method:
323  // Calculate the max differential cross section or retrieve it from the
324  // cache. Throw an exception and quit the evg thread if a non-positive
325  // value is found.
326  // If the kinematics are generated uniformly over the allowed phase
327  // space the max xsec is irrelevant
328  double xsec_max = (fGenerateUniformly) ? -1 : this->MaxXSec(evrec);
329 
330  //-- Get the kinematical limits for the generated x,y
331  const KPhaseSpace & kps = interaction->PhaseSpace();
332  Range1D_t y = kps.YLim();
333  assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.min<y.max);
334 
335  const double xmin = kASmallNum;
336  const double xmax = 1.- kASmallNum;
337  const double ymin = y.min + kASmallNum;
338  const double ymax = y.max - kASmallNum;
339  const double dx = xmax - xmin;
340  const double dy = ymax - ymin;
341 
342  //------ Try to select a valid x,y pair
343 
344  unsigned int iter = 0;
345  bool accept=false;
346  double xsec=-1, gx=-1, gy=-1;
347 
348  while(1) {
349  iter++;
350  if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
351 
352  if(fGenerateUniformly) {
353  //-- Generate a x,y pair uniformly in the kinematically allowed range.
354  gx = xmin + dx * rnd->RndKine().Rndm();
355  gy = ymin + dy * rnd->RndKine().Rndm();
356 
357  } else {
358  //-- Select unweighted kinematics using importance sampling method.
359 
360  if(iter==1) {
361  LOG("COHKinematics", pNOTICE) << "Initializing the sampling envelope";
362  double Ev = interaction->InitState().ProbeE(kRfLab);
363  fEnvelope->SetRange(xmin,ymin,xmax,ymax);
364  fEnvelope->SetParameter(0, xsec_max);
365  fEnvelope->SetParameter(1, Ev);
366  }
367 
368  // Generate W,QD2 using the 2-D envelope as PDF
369  fEnvelope->GetRandom2(gx,gy);
370  }
371 
372  LOG("COHKinematics", pINFO) << "Trying: x = " << gx << ", y = " << gy;
373 
374  interaction->KinePtr()->Setx(gx);
375  interaction->KinePtr()->Sety(gy);
376 
377  // computing cross section for the current kinematics
378  xsec = fXSecModel->XSec(interaction, kPSxyfE);
379 
380  //-- decide whether to accept the current kinematics
381  if(!fGenerateUniformly) {
382  double max = fEnvelope->Eval(gx, gy);
383  double t = max * rnd->RndKine().Rndm();
384 
385  this->AssertXSecLimits(interaction, xsec, max);
386 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
387  LOG("COHKinematics", pDEBUG)
388  << "xsec= " << xsec << ", J= 1, Rnd= " << t;
389 #endif
390  accept = (t<xsec);
391  }
392  else {
393  accept = (xsec>0);
394  }
395 
396  //-- If the generated kinematics are accepted, finish-up module's job
397  if(accept) {
398  LOG("COHKinematics", pNOTICE) << "Selected: x = "<< gx << ", y = "<< gy;
399 
400  // the Rein-Sehgal COH cross section should be a triple differential cross section
401  // d^2xsec/dxdydt where t is the the square of the 4p transfer to the
402  // nucleus. The cross section used for kinematical selection should have
403  // the t-dependence integrated out. The t-dependence is of the form
404  // ~exp(-bt). Now that the x,y kinematical variables have been selected
405  // we can generate a t using the t-dependence as a PDF.
406  const InitialState & init_state = interaction->InitState();
407  double Ev = init_state.ProbeE(kRfLab);
408  double Epi = gy*Ev; // pion energy
409  double Epi2 = TMath::Power(Epi,2);
410  double pme2 = kPionMass2/Epi2;
411  double xME = kNucleonMass*gx/Epi;
412  double tA = 1. + xME - 0.5*pme2;
413  double tB = TMath::Sqrt(1.+ 2*xME) * TMath::Sqrt(1.-pme2);
414  double tmin = 2*Epi2 * (tA-tB);
415  double tmax = 2*Epi2 * (tA+tB);
416  double A = (double) init_state.Tgt().A();
417  double A13 = TMath::Power(A,1./3.);
418  double R = fRo * A13 * units::fermi; // nuclear radius
419  double R2 = TMath::Power(R,2.);
420  double b = 0.33333 * R2;
421  double tsum = (TMath::Exp(-b*tmin) - TMath::Exp(-b*tmax))/b;
422  double rt = tsum * rnd->RndKine().Rndm();
423  double gt = -1.*TMath::Log(-1.*b*rt + TMath::Exp(-1.*b*tmin))/b;
424 
425  LOG("COHKinematics", pNOTICE)
426  << "Selected: t = "<< gt << ", from ["<< tmin << ", "<< tmax << "]";
427 
428  // for uniform kinematics, compute an event weight as
429  // wght = (phase space volume)*(differential xsec)/(event total xsec)
430  if(fGenerateUniformly) {
431  double vol = y.max-y.min; // dx=1, dt: irrelevant
432  double totxsec = evrec->XSec();
433  double wght = (vol/totxsec)*xsec;
434  LOG("COHKinematics", pNOTICE) << "Kinematics wght = "<< wght;
435 
436  // apply computed weight to the current event weight
437  wght *= evrec->Weight();
438  LOG("COHKinematics", pNOTICE) << "Current event wght = " << wght;
439  evrec->SetWeight(wght);
440  }
441 
442  // reset bits
443  interaction->ResetBit(kISkipProcessChk);
444  interaction->ResetBit(kISkipKinematicChk);
445 
446  // lock selected kinematics & clear running values
447  interaction->KinePtr()->Setx(gx, true);
448  interaction->KinePtr()->Sety(gy, true);
449  interaction->KinePtr()->Sett(gt, true);
450  interaction->KinePtr()->SetW(kPionMass, true);
451  interaction->KinePtr()->SetQ2(2*kNucleonMass*gx*gy*Ev, true);
452  interaction->KinePtr()->ClearRunningValues();
453 
454  // set the cross section for the selected kinematics
455  evrec->SetDiffXSec(xsec * TMath::Exp(-b * gt) / tsum, kPSxytfE);
456 
457  return;
458  }
459  }// iterations
460 }
virtual double MaxXSec(GHepRecord *evrec) const
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
std::map< std::string, double > xmax
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double fRo
nuclear scale parameter
static const double kNucleonMass
Definition: Constants.h:78
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.
static const double fermi
Definition: Units.h:63
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
Range1D_t YLim(void) const
y limits
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Double_t ymax
Definition: plot.C:25
Summary information for an interaction.
Definition: Interaction.h:56
double dy[NP][NC]
double dx[NP][NC]
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Kinematical phase space.
Definition: KPhaseSpace.h:34
void Sett(double t, bool selected=false)
Definition: Kinematics.cxx:301
#define R(x)
static const double kASmallNum
Definition: Controls.h:40
#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
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
static const double A
Definition: Units.h:82
double max
Definition: Range1.h:54
void SetW(double W, bool selected=false)
Definition: Kinematics.cxx:289
static const double kPionMass
Definition: Constants.h:74
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
const hit & b
Definition: hits.cxx:21
assert(nhit_max >=nhit_nbins)
TF2 * fEnvelope
2-D envelope used for importance sampling
const InitialState & InitState(void) const
Definition: Interaction.h:69
Double_t ymin
Definition: plot.C:24
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
bool gt(unsigned short int a, unsigned short int b)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
double ProbeE(RefFrame_t rf) const
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
void throwOnTooManyIterations(unsigned int iters, GHepRecord *evrec) const
Initial State information.
Definition: InitialState.h:49
#define pDEBUG
Definition: Messenger.h:64
static const double kPionMass2
Definition: Constants.h:87
bool COHKinematicsGenerator::CheckKinematics ( const double  E_l,
const double  theta_l,
const double  phi_l,
const double  theta_pi,
const double  phi_pi,
const Interaction interaction 
) const

Definition at line 661 of file COHKinematicsGenerator.cxx.

References genie::Interaction::FSPrimLepton(), genie::InitialState::GetProbeP4(), genie::Interaction::InitStatePtr(), genie::ProcessInfo::IsWeakCC(), genie::constants::kPi0Mass, genie::constants::kPionMass, genie::kRfLab, and genie::Interaction::ProcInfo().

667 {
668  const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
669  double E_nu = P4_nu.E();
670  double E_pi= E_nu-E_l;
671  double m_l = interaction->FSPrimLepton()->Mass();
672  double m_pi;
673  if ( interaction->ProcInfo().IsWeakCC() ) {
674  m_pi = constants::kPionMass;
675  }
676  else {
677  m_pi = constants::kPi0Mass;
678  }
679  if (E_l <= m_l) {
680  return false;
681  }
682  if (E_pi <= m_pi) {
683  return false;
684  }
685  return true;
686 }
bool IsWeakCC(void) const
static const double kPi0Mass
Definition: Constants.h:75
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
static const double kPionMass
Definition: Constants.h:74
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) 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 COHKinematicsGenerator::ComputeMaxXSec ( const Interaction in) const
virtual

Implements genie::KineGeneratorWithCache.

Definition at line 688 of file COHKinematicsGenerator.cxx.

References genie::Interaction::AsString(), genie::KineGeneratorWithCache::fSafetyFactor, genie::KineGeneratorWithCache::fXSecModel, genie::Algorithm::Id(), LOG, MaxXSec_AlvarezRuso(), MaxXSec_BergerSehgal(), MaxXSec_BergerSehgalFM(), MaxXSec_ReinSehgal(), genie::AlgId::Name(), pDEBUG, pFATAL, and SLOG.

689 {
690  // Computes the maximum differential cross section in the requested phase
691  // space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
692  // method and the value is cached at a circular cache branch for retrieval
693  // during subsequent event generation.
694 
695 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
696  SLOG("COHKinematics", pDEBUG)
697  << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
698 #endif
699  double max_xsec = 0.;
700  if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
701  max_xsec = MaxXSec_ReinSehgal(in);
702  } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
703  max_xsec = MaxXSec_BergerSehgal(in);
704  } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
705  max_xsec = MaxXSec_BergerSehgalFM(in);
706  } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
707  max_xsec = MaxXSec_AlvarezRuso(in);
708  }
709  else {
710  LOG("COHKinematicsGenerator",pFATAL) <<
711  "ComputeMaxXSec >> Cannot calculate max cross-section for " <<
712  fXSecModel->Id().Name();
713  }
714 
715  // Apply safety factor, since value retrieved from the cache might
716  // correspond to a slightly different energy.
717  max_xsec *= fSafetyFactor;
718 
719 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
720  SLOG("COHKinematics", pDEBUG) << in->AsString();
721  SLOG("COHKinematics", pDEBUG) << "Max xsec in phase space = " << max_xsec;
722  SLOG("COHKinematics", pDEBUG) << "Computed using alg = " << fXSecModel->Id();
723 #endif
724 
725  return max_xsec;
726 }
double MaxXSec_ReinSehgal(const Interaction *in) const
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
#define pFATAL
Definition: Messenger.h:57
double MaxXSec_AlvarezRuso(const Interaction *in) const
string AsString(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
string Name(void) const
Definition: AlgId.h:45
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
double MaxXSec_BergerSehgal(const Interaction *in) const
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:85
double MaxXSec_BergerSehgalFM(const Interaction *in) const
#define pDEBUG
Definition: Messenger.h:64
void COHKinematicsGenerator::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 975 of file COHKinematicsGenerator.cxx.

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

976 {
977  Algorithm::Configure(config);
978  this->LoadConfig();
979 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void COHKinematicsGenerator::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 981 of file COHKinematicsGenerator.cxx.

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

982 {
984  this->LoadConfig();
985 }
Definition: config.py:1
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void Algorithm::DeleteConfig ( void  )
protectedinherited

Definition at line 471 of file Algorithm.cxx.

References MECModelEnuComparisons::i.

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

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

Definition at line 496 of file Algorithm.cxx.

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

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

Reimplemented from genie::KineGeneratorWithCache.

Definition at line 941 of file COHKinematicsGenerator.cxx.

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

942 {
943  // Override the base class Energy() method to cache the max xsec for the
944  // neutrino energy in the LAB rather than in the hit nucleon rest frame.
945 
946  const InitialState & init_state = interaction->InitState();
947  double E = init_state.ProbeE(kRfLab);
948  return E;
949 }
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_flatrecord::config, exit(), genie::AlgConfigPool::FindRegistry(), genie::Registry::GetItemMap(), genie::Registry::GetString(), MECModelEnuComparisons::i, genie::AlgConfigPool::Instance(), it, genie::Registry::ItemIsLocal(), parse_dependency_file_t::list, LOG, pDEBUG, pFATAL, time_estimates::pool, pWARN, moon_position_table_new3::second, genie::utils::str::Split(), string, and APDHVSetting::temp.

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

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

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

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

Get algorithm status.

Definition at line 101 of file Algorithm.h.

References genie::Algorithm::fStatus.

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

Get algorithm ID.

Definition at line 98 of file Algorithm.h.

References genie::Algorithm::fID.

Referenced by genie::KineGeneratorWithCache::AccessCacheBranch(), genie::QELEventGeneratorSM::AccessCacheBranch2(), genie::QELEventGeneratorSM::AccessCacheBranchDiffv(), genie::InteractionListAssembler::AssembleInteractionList(), genie::XSecAlgorithmMap::BuildMap(), genie::InteractionGeneratorMap::BuildMap(), genie::XSecSplineList::BuildSplineKey(), genie::DISXSec::CacheBranchName(), genie::ReinSehgalRESXSecWithCache::CacheBranchName(), genie::DMDISXSec::CacheBranchName(), genie::ReinSehgalRESXSecWithCacheFast::CacheBranchName(), genie::Algorithm::Compare(), genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::COHElKinematicsGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), 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(), MaxXSec_AlvarezRuso(), genie::XSecAlgorithmMap::Print(), genie::InteractionGeneratorMap::Print(), genie::AlgFactory::Print(), genie::COHHadronicSystemGenerator::ProcessEventRecord(), genie::COHPrimaryLeptonGenerator::ProcessEventRecord(), 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 COHKinematicsGenerator::LoadConfig ( void  )

Definition at line 987 of file COHKinematicsGenerator.cxx.

References ana::assert(), genie::utils::kinematics::COHImportanceSamplingEnvelope(), genie::KineGeneratorWithCache::fEMin, fEnvelope, genie::KineGeneratorWithCache::fGenerateUniformly, genie::KineGeneratorWithCache::fMaxXSecDiffTolerance, fQ2Max, fQ2Min, fRo, genie::KineGeneratorWithCache::fSafetyFactor, fTMax, genie::Algorithm::GetParam(), and genie::Algorithm::GetParamDef().

Referenced by Configure().

988 {
989  //-- COH model parameter Ro
990  GetParam( "COH-Ro", fRo );
991  //-- COH model parameter t_max for t = (q - p_pi)^2
992  GetParam( "COH-t-max", fTMax ) ;
993  //-- COH model bounds of integration for Q^2
994  GetParam( "COH-Q2-min", fQ2Min ) ;
995  GetParam( "COH-Q2-max", fQ2Max ) ;
996 
997  //-- max xsec safety factor (for rejection method) and min cached energy
998  GetParamDef( "MaxXSec-SafetyFactor", fSafetyFactor, 1.6 ) ;
999  GetParamDef( "Cache-MinEnergy", fEMin, -1.0 ) ;
1000 
1001  //-- Generate kinematics uniformly over allowed phase space and compute
1002  // an event weight?
1003  GetParamDef( "UniformOverPhaseSpace", fGenerateUniformly, false ) ;
1004 
1005  //-- Maximum allowed fractional cross section deviation from maxim cross
1006  // section used in rejection method
1007  GetParamDef( "MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999. ) ;
1009 
1010  //-- Envelope employed when importance sampling is used
1011  // (initialize with dummy range)
1012  if(fEnvelope) delete fEnvelope;
1013  fEnvelope = new TF2("CohKinEnvelope",
1015  // stop ROOT from deleting this object of its own volition
1016  gROOT->GetListOfFunctions()->Remove(fEnvelope);
1017 }
double COHImportanceSamplingEnvelope(double *x, double *par)
Definition: KineUtils.cxx:1343
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double fRo
nuclear scale parameter
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
double fTMax
upper bound for t = (q - p_pi)^2
double fQ2Min
lower bound of integration for Q^2 in Berger-Sehgal Model
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
assert(nhit_max >=nhit_nbins)
TF2 * fEnvelope
2-D envelope used for importance sampling
bool GetParamDef(const RgKey &name, T &p, const T &def) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
double fQ2Max
upper bound of integration for Q^2 in Berger-Sehgal Model
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 CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), 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(), genie::QELEventGeneratorSM::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 COHKinematicsGenerator::MaxXSec_AlvarezRuso ( const Interaction in) const

Definition at line 871 of file COHKinematicsGenerator.cxx.

References genie::Interaction::AsString(), MakeMiniprodValidationCuts::f, genie::KineGeneratorWithCache::fSafetyFactor, genie::Interaction::FSPrimLepton(), genie::KineGeneratorWithCache::fXSecModel, genie::Algorithm::Id(), genie::Interaction::InitState(), genie::controls::kASmallNum, kPi, genie::constants::kPionMass, genie::kRfLab, min(), pDEBUG, genie::Interaction::PhaseSpace(), genie::InitialState::ProbeE(), genie::utils::gsl::d4Xsec_dEldThetaldOmegapi::SetFactor(), SLOG, submit_syst::y, and genie::KPhaseSpace::YLim().

Referenced by ComputeMaxXSec().

872 {
873  // Computes the maximum differential cross section in the requested phase
874  // space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
875  // method and the value is cached at a circular cache branch for retrieval
876  // during subsequent event generation.
877 
878 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
879  SLOG("COHKinematics", pDEBUG)
880  << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
881 #endif
882  double max_xsec = 0.;
883  double Ev = in->InitState().ProbeE(kRfLab);
884 
885  const KPhaseSpace & kps = in->PhaseSpace();
886  Range1D_t y = kps.YLim();
887 
888  ROOT::Math::Minimizer * min = ROOT::Math::Factory::CreateMinimizer("Minuit2");
890  f.SetFactor(-1.); // Make it return negative of cross-section so we can minimize
891 
892  min->SetFunction( f );
893  min->SetMaxFunctionCalls(10000);
894  min->SetTolerance(0.05);
895 
896  const double min_el = in->FSPrimLepton()->Mass();
897  const double max_el = Ev - kPionMass;
898  const unsigned int n_el = 100;
899  const double d_el = (max_el - min_el) / double(n_el - 1);
900 
901  const double min_thetal = kASmallNum;
902  const double max_thetal = kPi / 4.0;
903  const unsigned int n_thetal = 10;
904  const double d_thetal = (max_thetal - min_thetal) / double(n_thetal - 1);
905 
906  const double min_thetapi = kASmallNum;
907  const double max_thetapi = kPi / 2.0;
908  const unsigned int n_thetapi = 10;
909  const double d_thetapi = (max_thetapi - min_thetapi) / double(n_thetapi - 1);
910 
911  //~ const double min_phipi = kPi;
912  //~ const double max_phipi = 0.5 * kPi;
913  const double min_phipi = kASmallNum;
914  const double max_phipi = 2*kPi-kASmallNum;
915  const unsigned int n_phipi = 10;
916  const double d_phipi = (max_phipi - min_phipi) / double(n_phipi - 1);
917 
918  min->SetLimitedVariable ( 0 ,"E_lep" , max_el -kASmallNum , d_el , min_el , max_el );
919  min->SetLimitedVariable ( 1 ,"theta_l" , min_thetal +kASmallNum , d_thetal , min_thetal , max_thetal );
920  min->SetLimitedVariable ( 2 ,"theta_pi" , min_thetapi+kASmallNum , d_thetapi , min_thetapi, max_thetapi );
921  min->SetLimitedVariable ( 3 ,"phi_pi" , min_phipi +kASmallNum , d_phipi , min_phipi , max_phipi );
922 
923  min->Minimize();
924  max_xsec = -min->MinValue(); //back to positive xsec
925 
926  // Apply safety factor, since value retrieved from the cache might
927  // correspond to a slightly different energy.
928  max_xsec *= fSafetyFactor;
929 
930 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
931  SLOG("COHKinematics", pDEBUG) << in->AsString();
932  SLOG("COHKinematics", pDEBUG) << "Max xsec in phase space = " << max_xsec;
933  SLOG("COHKinematics", pDEBUG) << "Computed using alg = " << fXSecModel->Id();
934 #endif
935 
936  delete min;
937 
938  return max_xsec;
939 }
const double kPi
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t YLim(void) const
y limits
string AsString(void) const
Kinematical phase space.
Definition: KPhaseSpace.h:34
static const double kASmallNum
Definition: Controls.h:40
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static const double kPionMass
Definition: Constants.h:74
const InitialState & InitState(void) const
Definition: Interaction.h:69
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:85
double ProbeE(RefFrame_t rf) const
#define pDEBUG
Definition: Messenger.h:64
double COHKinematicsGenerator::MaxXSec_BergerSehgal ( const Interaction in) const

Definition at line 728 of file COHKinematicsGenerator.cxx.

References fQ2Max, genie::KineGeneratorWithCache::fXSecModel, gt(), MECModelEnuComparisons::i, calib::j, genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kPSQ2yfE, LOG, genie::Range1D_t::max, genie::Range1D_t::min, pDEBUG, genie::Interaction::PhaseSpace(), genie::utils::kinematics::Q2(), genie::KPhaseSpace::Q2Lim(), genie::Kinematics::SetQ2(), genie::Kinematics::Sety(), genie::utils::kinematics::UpdateXFromQ2Y(), genie::XSecAlgorithmI::XSec(), xsec, and genie::KPhaseSpace::YLim().

Referenced by ComputeMaxXSec().

729 {
730  double max_xsec = 0;
731  const int NQ2 = 50;
732  const int Ny = 50;
733 
734  const KPhaseSpace & kps = in->PhaseSpace();
735  Range1D_t Q2r = kps.Q2Lim();
736  Q2r.max = fQ2Max;
737 
738  const double logQ2min = TMath::Log10(Q2r.min + kASmallNum);
739  const double logQ2max = TMath::Log10(Q2r.max);
740  const double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
741 
742  for(int i=0; i<NQ2; i++) {
743  double Q2 = TMath::Power(10, logQ2min + i * dlogQ2);
744  in->KinePtr()->SetQ2(Q2);
745 
746  Range1D_t yr = kps.YLim();
747  if ((yr.max < 0) || (yr.max < yr.min) ||
748  (yr.max > 1) || (yr.min < 0)) { // forbidden kinematics
749  continue;
750  }
751  const double logymin = TMath::Log10(yr.min);
752  const double logymax = TMath::Log10(yr.max);
753  const double dlogy = (logymax - logymin) /(Ny-1);
754 
755  for(int j=0; j<Ny; j++) {
756  double gy = TMath::Power(10, logymin + j * dlogy);
757  in->KinePtr()->Sety(gy);
758 
759  /* Range1D_t tl = kps.TLim(); // TESTING! - this becomes a loop over t */
761 
762  // Note: We're not stepping through log Q^2, log y - we "unpacked"
763  double xsec = fXSecModel->XSec(in, kPSQ2yfE);
764 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
765  LOG("COHKinematics", pDEBUG)
766  << "xsec(Q2= " << Q2 << ", y= " << gy << ", t = " << gt << ") = " << xsec;
767 #endif
768  max_xsec = TMath::Max(max_xsec, xsec);
769 
770  } // y
771  } // Q2
772  return max_xsec;
773 }
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t YLim(void) const
y limits
Range1D_t Q2Lim(void) const
Q2 limits.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Kinematical phase space.
Definition: KPhaseSpace.h:34
const double j
Definition: BetheBloch.cxx:29
static const double kASmallNum
Definition: Controls.h:40
Double_t xsec[nknots]
Definition: testXsec.C:47
double max
Definition: Range1.h:54
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
void UpdateXFromQ2Y(const Interaction *in)
Definition: KineUtils.cxx:1221
double min
Definition: Range1.h:53
bool gt(unsigned short int a, unsigned short int b)
double fQ2Max
upper bound of integration for Q^2 in Berger-Sehgal Model
#define pDEBUG
Definition: Messenger.h:64
double COHKinematicsGenerator::MaxXSec_BergerSehgalFM ( const Interaction in) const

Definition at line 775 of file COHKinematicsGenerator.cxx.

References fQ2Max, fTMax, genie::KineGeneratorWithCache::fXSecModel, gt(), MECModelEnuComparisons::i, calib::j, genie::controls::kASmallNum, genie::Interaction::KinePtr(), genie::kPSxyfE, LOG, genie::Range1D_t::max, genie::Range1D_t::min, pDEBUG, genie::Interaction::PhaseSpace(), genie::utils::kinematics::Q2(), genie::KPhaseSpace::Q2Lim(), genie::Kinematics::SetQ2(), genie::Kinematics::Sett(), genie::Kinematics::Sety(), genie::XSecAlgorithmI::XSec(), xsec, and genie::KPhaseSpace::YLim().

Referenced by ComputeMaxXSec().

776 {
777  double max_xsec = 0;
778  // How many sampling bins in each variable for max xsec calculation?
779  const int NQ2 = 50;
780  const int Ny = 50;
781  const int Nt = 50;
782 
783  const KPhaseSpace & kps = in->PhaseSpace();
784  Range1D_t Q2r = kps.Q2Lim();
785  Q2r.max = fQ2Max;
786 
787  const double logQ2min = TMath::Log10(Q2r.min + kASmallNum);
788  const double logQ2max = TMath::Log10(Q2r.max);
789  const double logtmin = TMath::Log10(kASmallNum);
790  const double logtmax = TMath::Log10(fTMax - kASmallNum);
791  const double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
792  const double dlogt = (logtmax - logtmin) /(Nt-1);
793 
794  for(int i=0; i<NQ2; i++) {
795  double Q2 = TMath::Power(10, logQ2min + i * dlogQ2);
796  in->KinePtr()->SetQ2(Q2);
797 
798  Range1D_t yr = kps.YLim();
799  if ((yr.max < 0) || (yr.max < yr.min) ||
800  (yr.max > 1) || (yr.min < 0)) { // forbidden kinematics
801  continue;
802  }
803  const double logymin = TMath::Log10(yr.min);
804  const double logymax = TMath::Log10(yr.max);
805  const double dlogy = (logymax - logymin) /(Ny-1);
806 
807  for(int j=0; j<Ny; j++) {
808  double gy = TMath::Power(10, logymin + j * dlogy);
809 
810  for(int k=0; k<Nt; k++) {
811  double gt = TMath::Power(10, logtmin + k * dlogt);
812 
813  in->KinePtr()->Sety(gy);
814  in->KinePtr()->Sett(gt);
815 
816  double xsec = fXSecModel->XSec(in, kPSxyfE);
817 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
818  LOG("COHKinematics", pDEBUG)
819  << "xsec(Q2= " << Q2 << ", y= " << gy << ", t = " << gt << ") = " << xsec;
820 #endif
821  max_xsec = TMath::Max(max_xsec, xsec);
822 
823  } // t
824  } // y
825  } // Q2
826  return max_xsec;
827 }
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t YLim(void) const
y limits
Range1D_t Q2Lim(void) const
Q2 limits.
double fTMax
upper bound for t = (q - p_pi)^2
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
Kinematical phase space.
Definition: KPhaseSpace.h:34
void Sett(double t, bool selected=false)
Definition: Kinematics.cxx:301
const double j
Definition: BetheBloch.cxx:29
static const double kASmallNum
Definition: Controls.h:40
Double_t xsec[nknots]
Definition: testXsec.C:47
double max
Definition: Range1.h:54
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
double min
Definition: Range1.h:53
bool gt(unsigned short int a, unsigned short int b)
double fQ2Max
upper bound of integration for Q^2 in Berger-Sehgal Model
#define pDEBUG
Definition: Messenger.h:64
double COHKinematicsGenerator::MaxXSec_ReinSehgal ( const Interaction in) const

Definition at line 829 of file COHKinematicsGenerator.cxx.

References E, genie::KineGeneratorWithCache::fXSecModel, MECModelEnuComparisons::i, genie::Interaction::InitState(), calib::j, genie::Interaction::KinePtr(), genie::constants::kNucleonMass, genie::kPSxyfE, genie::kRfLab, LOG, genie::Range1D_t::max, genie::Range1D_t::min, pDEBUG, genie::Interaction::PhaseSpace(), genie::InitialState::ProbeE(), genie::utils::kinematics::Q2(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), genie::XSecAlgorithmI::XSec(), xsec, submit_syst::y, and genie::KPhaseSpace::YLim().

Referenced by ComputeMaxXSec().

830 {
831  double max_xsec = 0;
832  double Ev = in->InitState().ProbeE(kRfLab);
833 
834  const int Nx = 50;
835  const int Ny = 50;
836 
837  const KPhaseSpace & kps = in->PhaseSpace();
838  Range1D_t y = kps.YLim();
839 
840  const double logxmin = TMath::Log10(1E-5);
841  const double logxmax = TMath::Log10(1.0);
842  const double logymin = TMath::Log10(y.min);
843  const double logymax = TMath::Log10(y.max);
844 
845  const double dlogx = (logxmax - logxmin) /(Nx-1);
846  const double dlogy = (logymax - logymin) /(Ny-1);
847 
848  for(int i=0; i<Nx; i++) {
849  double gx = TMath::Power(10, logxmin + i * dlogx);
850  for(int j=0; j<Ny; j++) {
851  double gy = TMath::Power(10, logymin + j * dlogy);
852 
853  double Q2 = 2*kNucleonMass*gx*gy*Ev;
854  if(Ev>1.0 && Q2>0.01) continue;
855 
856  in->KinePtr()->Setx(gx);
857  in->KinePtr()->Sety(gy);
858 
859  double xsec = fXSecModel->XSec(in, kPSxyfE);
860 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
861  LOG("COHKinematics", pDEBUG)
862  << "xsec(x= " << gx << ", y= " << gy << ") = " << xsec;
863 #endif
864  max_xsec = TMath::Max(max_xsec, xsec);
865 
866  }//y
867  }//x
868  return max_xsec;
869 }
const KPhaseSpace & PhaseSpace(void) const
Definition: Interaction.h:73
static const double kNucleonMass
Definition: Constants.h:78
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
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.
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Range1D_t YLim(void) const
y limits
#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
Kinematical phase space.
Definition: KPhaseSpace.h:34
const double j
Definition: BetheBloch.cxx:29
Double_t xsec[nknots]
Definition: testXsec.C:47
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
double max
Definition: Range1.h:54
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
const InitialState & InitState(void) const
Definition: Interaction.h:69
double min
Definition: Range1.h:53
double ProbeE(RefFrame_t rf) const
#define pDEBUG
Definition: Messenger.h:64
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
double COHKinematicsGenerator::pionMass ( const Interaction in) const
private

Definition at line 951 of file COHKinematicsGenerator.cxx.

References genie::ProcessInfo::IsWeakCC(), genie::constants::kPi0Mass, genie::constants::kPionMass, and genie::Interaction::ProcInfo().

Referenced by CalculateKin_AlvarezRuso(), CalculateKin_BergerSehgal(), and CalculateKin_BergerSehgalFM().

952 {
953  double m_pi = 0.0;
954  if ( in->ProcInfo().IsWeakCC() ) {
955  m_pi = constants::kPionMass;
956  } else {
957  m_pi = constants::kPi0Mass;
958  }
959  return m_pi;
960 }
bool IsWeakCC(void) const
static const double kPi0Mass
Definition: Constants.h:75
static const double kPionMass
Definition: Constants.h:74
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
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 COHKinematicsGenerator::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 79 of file COHKinematicsGenerator.cxx.

References CalculateKin_AlvarezRuso(), CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), CalculateKin_ReinSehgal(), genie::EventGeneratorI::CrossSectionAlg(), genie::KineGeneratorWithCache::fGenerateUniformly, genie::KineGeneratorWithCache::fXSecModel, genie::Algorithm::Id(), genie::RunningThreadInfo::Instance(), LOG, genie::AlgId::Name(), pFATAL, pNOTICE, and genie::RunningThreadInfo::RunningThread().

80 {
81  if(fGenerateUniformly) {
82  LOG("COHKinematics", pNOTICE)
83  << "Generating kinematics uniformly over the allowed phase space";
84  }
85 
86  //-- Access cross section algorithm for running thread
88  const EventGeneratorI * evg = rtinfo->RunningThread();
89  fXSecModel = evg->CrossSectionAlg();
90  if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
92  } else if (fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015") {
94  } else if (fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015") {
96  } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
98  }
99  else {
100  LOG("COHKinematicsGenerator",pFATAL) <<
101  "ProcessEventRecord >> Cannot calculate kinematics for " <<
102  fXSecModel->Id().Name();
103  }
104 }
bool fGenerateUniformly
uniform over allowed phase space + event weight?
void CalculateKin_BergerSehgalFM(GHepRecord *event_rec) const
#define pFATAL
Definition: Messenger.h:57
Defines the EventGeneratorI interface.
void CalculateKin_AlvarezRuso(GHepRecord *event_rec) const
void CalculateKin_ReinSehgal(GHepRecord *event_rec) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
string Name(void) const
Definition: AlgId.h:45
void CalculateKin_BergerSehgal(GHepRecord *event_rec) const
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
static RunningThreadInfo * Instance(void)
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
#define pNOTICE
Definition: Messenger.h:62
const EventGeneratorI * RunningThread(void)
Keep info on the event generation thread currently on charge. This is used so that event generation m...
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
void COHKinematicsGenerator::SetKinematics ( const double  E_l,
const double  theta_l,
const double  phi_l,
const double  theta_pi,
const double  phi_pi,
const Interaction interaction,
Kinematics kinematics 
) const

Definition at line 615 of file COHKinematicsGenerator.cxx.

References genie::Interaction::FSPrimLepton(), genie::InitialState::GetProbeP4(), genie::Interaction::InitStatePtr(), genie::ProcessInfo::IsWeakCC(), genie::constants::kNucleonMass, genie::constants::kPi0Mass, genie::constants::kPionMass, genie::kRfLab, Mag2(), genie::Interaction::ProcInfo(), genie::utils::kinematics::Q2(), genie::Kinematics::SetFSLeptonP4(), genie::Kinematics::SetHadSystP4(), genie::Kinematics::Setx(), genie::Kinematics::Sety(), ana::Sqrt(), genie::utils::kinematics::UpdateWQ2FromXY(), submit_syst::x, and submit_syst::y.

Referenced by CalculateKin_AlvarezRuso().

622 {
623  const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
624  double E_nu = P4_nu.E();
625  double E_pi= E_nu-E_l;
626  double m_l = interaction->FSPrimLepton()->Mass();
627  double m_pi;
628  if ( interaction->ProcInfo().IsWeakCC() ) {
629  m_pi = constants::kPionMass;
630  } else {
631  m_pi = constants::kPi0Mass;
632  }
633  double p_l=0.0;
634  if (E_l > m_l) {
635  p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
636  }
637  TVector3 lepton_3vector = TVector3(0,0,0);
638  lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
639  TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
640 
641  double p_pi=0.0;
642  if (E_pi > m_pi) {
643  p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
644  }
645  TVector3 pion_3vector = TVector3(0,0,0);
646  pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
647  TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
648 
649  double Q2 = -(P4_nu-P4_lep).Mag2();
650  double x = Q2/(2*E_pi*constants::kNucleonMass);
651  double y = E_pi/E_nu;
652 
653  kinematics->Setx(x);
654  kinematics->Sety(y);
655  kinematics::UpdateWQ2FromXY(interaction);
656 
657  kinematics->SetFSLeptonP4(P4_lep );
658  kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
659 }
bool IsWeakCC(void) const
static const double kNucleonMass
Definition: Constants.h:78
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
static const double kPi0Mass
Definition: Constants.h:75
void SetFSLeptonP4(const TLorentzVector &p4)
Definition: Kinematics.cxx:307
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
void Setx(double x, bool selected=false)
Definition: Kinematics.cxx:241
float Mag2() const
void UpdateWQ2FromXY(const Interaction *in)
Definition: KineUtils.cxx:1185
static const double kPionMass
Definition: Constants.h:74
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
void Sety(double y, bool selected=false)
Definition: Kinematics.cxx:253
void SetHadSystP4(const TLorentzVector &p4)
Definition: Kinematics.cxx:317
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
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::COHElasticPXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::EmpiricalMECPXSec2015::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::KovalenkoQELCharmPXSec::LoadConfig(), genie::CharmHadronization::LoadConfig(), genie::NuclearModelMap::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::SmithMonizQELCCXSec::LoadConfig(), genie::BardinIMDRadCorPXSec::LoadConfig(), genie::ReinSehgalRESPXSec::LoadConfig(), genie::MartiniEricsonChanfrayMarteauMECPXSec2016::LoadConfig(), genie::LwlynSmithFF::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::QPMDISStrucFuncBase::LoadConfig(), genie::SmithMonizQELCCPXSec::LoadConfig(), genie::NievesQELCCPXSec::LoadConfig(), genie::HAIntranuke::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
void COHKinematicsGenerator::throwOnTooManyIterations ( unsigned int  iters,
GHepRecord evrec 
) const
private

Definition at line 962 of file COHKinematicsGenerator.cxx.

References genie::GHepRecord::EventFlags(), genie::kKineGenErr, LOG, pWARN, genie::exceptions::EVGThreadException::SetReason(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by CalculateKin_AlvarezRuso(), CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), and CalculateKin_ReinSehgal().

964 {
965  LOG("COHKinematics", pWARN)
966  << "*** Could not select valid kinematics after "
967  << iters << " iterations";
968  evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
970  exception.SetReason("Couldn't select kinematics");
971  exception.SwitchOnFastForward();
972  throw exception;
973 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
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 pWARN
Definition: Messenger.h:61
virtual TBits * EventFlags(void) const
Definition: GHepRecord.h:118

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
TF2* genie::COHKinematicsGenerator::fEnvelope
mutable

2-D envelope used for importance sampling

Definition at line 72 of file COHKinematicsGenerator.h.

Referenced by CalculateKin_ReinSehgal(), COHKinematicsGenerator(), LoadConfig(), and ~COHKinematicsGenerator().

bool genie::KineGeneratorWithCache::fGenerateUniformly
protectedinherited
AlgId genie::Algorithm::fID
protectedinherited

algorithm name and configuration set

Definition at line 156 of file Algorithm.h.

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

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::COHKinematicsGenerator::fQ2Max
private

upper bound of integration for Q^2 in Berger-Sehgal Model

Definition at line 80 of file COHKinematicsGenerator.h.

Referenced by CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), LoadConfig(), MaxXSec_BergerSehgal(), and MaxXSec_BergerSehgalFM().

double genie::COHKinematicsGenerator::fQ2Min
private

lower bound of integration for Q^2 in Berger-Sehgal Model

Definition at line 79 of file COHKinematicsGenerator.h.

Referenced by CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), and LoadConfig().

double genie::COHKinematicsGenerator::fRo

nuclear scale parameter

Definition at line 73 of file COHKinematicsGenerator.h.

Referenced by CalculateKin_BergerSehgal(), CalculateKin_ReinSehgal(), and 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().

double genie::COHKinematicsGenerator::fTMax
private

upper bound for t = (q - p_pi)^2

Definition at line 81 of file COHKinematicsGenerator.h.

Referenced by CalculateKin_BergerSehgalFM(), LoadConfig(), and MaxXSec_BergerSehgalFM().

const XSecAlgorithmI* genie::KineGeneratorWithCache::fXSecModel
mutableprotectedinherited

Definition at line 61 of file KineGeneratorWithCache.h.

Referenced by CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), CalculateKin_BergerSehgal(), CalculateKin_BergerSehgalFM(), 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(), ComputeMaxXSec(), genie::QELEventGeneratorSM::ComputeMaxXSec(), genie::QELEventGeneratorSM::ComputeMaxXSec2(), MaxXSec_AlvarezRuso(), MaxXSec_BergerSehgal(), MaxXSec_BergerSehgalFM(), MaxXSec_ReinSehgal(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::SKKinematicsGenerator::ProcessEventRecord(), genie::COHElKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().


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