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

Computes the MEC differential cross section. Is a concrete implementation of the XSecAlgorithmI interface.
. More...

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

Inheritance diagram for genie::EmpiricalMECPXSec2015:
genie::XSecAlgorithmI genie::Algorithm

Public Member Functions

 EmpiricalMECPXSec2015 ()
 
 EmpiricalMECPXSec2015 (string config)
 
virtual ~EmpiricalMECPXSec2015 ()
 
double XSec (const Interaction *i, KinePhaseSpace_t k) const
 Compute the cross section for the input interaction. More...
 
double Integral (const Interaction *i) const
 
bool ValidProcess (const Interaction *i) const
 Can this cross section algorithm handle the input process? More...
 
void Configure (const Registry &config)
 
void Configure (string param_set)
 
virtual bool ValidKinematics (const Interaction *i) const
 Is the input kinematical point a physically allowed one? More...
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Protected Member Functions

void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
bool GetParamVect (const std::string &comm_name, std::vector< T > &v, unsigned int max, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 

Protected Attributes

bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Private Member Functions

void LoadConfig (void)
 

Private Attributes

double fMq2d
 toy model param: `mass' in dipole (Q2 - dependence) form factor (GeV) More...
 
double fMass
 toy model param: peak of W distribution (GeV) More...
 
double fWidth
 toy model param: width of W distribution (GeV) More...
 
double fMECAPower
 power of A relative to carbon More...
 
double fFracPN_NC
 toy model param: fraction of nucleon pairs that are pn, not nn or pp More...
 
double fFracPN_CC
 toy model param: fraction of nucleon pairs that are pn, not nn or pp More...
 
double fFracPN_EM
 toy model param: fraction of nucleon pairs that are pn, not nn or pp More...
 
double fFracCCQE
 empirical model param: MEC cross section is taken to be this fraction of CCQE cross section More...
 
double fFracNCQE
 empirical model param: MEC cross section is taken to be this fraction of NCQE cross section More...
 
double fFracEMQE
 empirical model param: MEC cross section is taken to be this fraction of Rosenbluth xs More...
 
const XSecAlgorithmIfXSecAlgCCQE
 cross section algorithm for CCQE More...
 
const XSecAlgorithmIfXSecAlgNCQE
 cross section algorithm for NCQE More...
 
const XSecAlgorithmIfXSecAlgEMQE
 cross section algorithm for EMQE More...
 

Detailed Description

Computes the MEC differential cross section. Is a concrete implementation of the XSecAlgorithmI interface.
.

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

Steve Dytman <dytman+ pitt.edu> Pittsburgh University

May 05, 2009

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 30 of file EmpiricalMECPXSec2015.h.

Constructor & Destructor Documentation

EmpiricalMECPXSec2015::EmpiricalMECPXSec2015 ( )

Definition at line 50 of file EmpiricalMECPXSec2015.cxx.

50  :
51 XSecAlgorithmI("genie::EmpiricalMECPXSec2015")
52 {
53 
54 }
EmpiricalMECPXSec2015::EmpiricalMECPXSec2015 ( string  config)

Definition at line 56 of file EmpiricalMECPXSec2015.cxx.

56  :
57 XSecAlgorithmI("genie::EmpiricalMECPXSec2015", config)
58 {
59 
60 }
Definition: config.py:1
EmpiricalMECPXSec2015::~EmpiricalMECPXSec2015 ( )
virtual

Definition at line 62 of file EmpiricalMECPXSec2015.cxx.

63 {
64 
65 }

Member Function Documentation

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

add registry with lowest priority, also update ownership

Definition at line 601 of file Algorithm.cxx.

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

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

Add registries with top priority, also udated Ownerships.

Definition at line 653 of file Algorithm.cxx.

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

add registry with top priority, also update ownership

Definition at line 585 of file Algorithm.cxx.

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

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

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

Definition at line 394 of file Algorithm.cxx.

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

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

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

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

Definition at line 408 of file Algorithm.cxx.

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

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

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

Compare with input algorithm.

Definition at line 294 of file Algorithm.cxx.

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

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

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

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

320 {
321  Algorithm::Configure(config);
322  this->LoadConfig();
323 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
void EmpiricalMECPXSec2015::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 325 of file EmpiricalMECPXSec2015.cxx.

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

326 {
328 
329  Registry* algos = AlgConfigPool::Instance() -> GlobalParameterList() ;
330  string global_key_head = "XSecModel@genie::EventGenerator/" ;
331  string local_key_head = "XSecModel-" ;
332 
333  Registry r( "EmpiricalMECPXSec2015_specific", false ) ;
334  r.Set( local_key_head + "QEL-NC", algos -> GetAlg( global_key_head + "QEL-NC") ) ;
335  r.Set( local_key_head + "QEL-CC", algos -> GetAlg( global_key_head + "QEL-CC") ) ;
336  r.Set( local_key_head + "QEL-EM", algos -> GetAlg( global_key_head + "QEL-EM") ) ;
337 
339 
340  this->LoadConfig();
341 }
Definition: config.py:1
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
TRandom3 r(0)
static AlgConfigPool * Instance()
void Algorithm::DeleteConfig ( void  )
protectedinherited

Definition at line 471 of file Algorithm.cxx.

References MECModelEnuComparisons::i.

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

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

Definition at line 496 of file Algorithm.cxx.

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

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

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

Definition at line 518 of file Algorithm.cxx.

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

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

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

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

Definition at line 549 of file Algorithm.cxx.

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

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

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

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

Definition at line 135 of file Algorithm.cxx.

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

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

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

Definition at line 254 of file Algorithm.cxx.

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

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

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

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

Definition at line 287 of file Algorithm.cxx.

References GetConfig().

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

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

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

Referenced by genie::CollinsSpillerFragm::BuildFunction(), genie::PetersonFragm::BuildFunction(), genie::DISXSec::LoadConfig(), genie::INukeDeltaPropg::LoadConfig(), genie::COHXSec::LoadConfig(), genie::HadronTransporter::LoadConfig(), genie::DFRKinematicsGenerator::LoadConfig(), genie::RSHelicityAmplModelNCn::LoadConfig(), genie::RSHelicityAmplModelNCp::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::DipoleAxialFormFactorModel::LoadConfig(), genie::DipoleELFormFactorsModel::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::VertexGenerator::LoadConfig(), genie::H3AMNuGammaPXSec::LoadConfig(), genie::RSPPResonanceSelector::LoadConfig(), genie::IBDXSecMap::LoadConfig(), genie::Decayer::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), 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::DFRXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::ZExpAxialFormFactorModel::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BBA03ELFormFactorsModel::LoadConfig(), genie::BBA05ELFormFactorsModel::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::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::NuclearModelMap::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::EventGenerator::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::RESKinematicsGenerator::LoadConfig(), genie::DMDISXSec::LoadConfig(), genie::BaryonResonanceDecayer::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::COHElKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::QELXSec::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::NuEInteractionListGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DMELXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::NucBindEnergyAggregator::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::DFRXSec::LoadConfig(), genie::NuElectronXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::MECXSec::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AlamSimoAtharVacasSKXSec::LoadConfig(), genie::AhrensDMELPXSec::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::RESInteractionListGenerator::LoadConfigData(), genie::SKInteractionListGenerator::LoadConfigData(), genie::COHInteractionListGenerator::LoadConfigData(), genie::DMELInteractionListGenerator::LoadConfigData(), genie::RSPPInteractionListGenerator::LoadConfigData(), genie::DISInteractionListGenerator::LoadConfigData(), and genie::DMDISInteractionListGenerator::LoadConfigData().

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

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

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

Get algorithm status.

Definition at line 101 of file Algorithm.h.

References genie::Algorithm::fStatus.

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

Get algorithm ID.

Definition at line 98 of file Algorithm.h.

References genie::Algorithm::fID.

Referenced by genie::KineGeneratorWithCache::AccessCacheBranch(), 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(), genie::COHKinematicsGenerator::ComputeMaxXSec(), genie::Algorithm::Configure(), genie::GEVGDriver::CreateSplines(), genie::QPMDISPXSec::DISRESJoinSuppressionFactor(), genie::QPMDMDISPXSec::DMDISRESJoinSuppressionFactor(), genie::AlgConfigPool::FindRegistry(), genie::AlgFactory::ForceReconfiguration(), genie::GEVGDriver::GenerateEvent(), GetAlgorithms(), genie::LwlynSmithQELCCPXSec::Integral(), genie::NievesQELCCPXSec::Integral(), genie::COHXSec::Integrate(), genie::QPMDISPXSec::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::EventGenerator::LoadConfig(), genie::EventGeneratorListAssembler::LoadGenerator(), main(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), genie::XSecAlgorithmMap::Print(), genie::InteractionGeneratorMap::Print(), genie::AlgFactory::Print(), genie::COHHadronicSystemGenerator::ProcessEventRecord(), genie::COHPrimaryLeptonGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::MECGenerator::ProcessEventRecord(), genie::EventGenerator::ProcessEventRecord(), genie::KNOPythiaHadronization::SelectHadronizer(), TestPythiaTauDecays(), and genie::GEVGDriver::UseSplines().

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

Definition at line 343 of file Algorithm.cxx.

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

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

Integrate the model over the kinematic phase space available to the input interaction (kinematical cuts can be included)

Implements genie::XSecAlgorithmI.

Definition at line 177 of file EmpiricalMECPXSec2015.cxx.

References genie::Target::A(), genie::units::A, E, exit(), fFracCCQE, fFracEMQE, fFracNCQE, fFracPN_CC, fFracPN_EM, fFracPN_NC, fMECAPower, fXSecAlgCCQE, fXSecAlgEMQE, fXSecAlgNCQE, genie::Target::HitNucPdg(), in, genie::Interaction::InitState(), genie::XSecAlgorithmI::Integral(), genie::pdg::IsAntiNeutrino(), iscc, genie::ProcessInfo::IsEM(), genie::pdg::IsNeutrino(), genie::ProcessInfo::IsWeakCC(), genie::ProcessInfo::IsWeakNC(), genie::kPdgNeutron, genie::kPdgProton, genie::kRfLab, genie::Target::Pdg(), genie::InitialState::ProbeE(), genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), genie::Interaction::QELCC(), genie::Interaction::QELEM(), genie::Interaction::QELNC(), genie::InitialState::Tgt(), xsec, Z, and genie::Target::Z().

178 {
179 // Calculate the CCMEC cross section as a fraction of the CCQE cross section
180 // for the given nuclear target at the given energy.
181 // Alternative strategy is to calculate the MEC cross section as the difference
182 // of CCQE cross section for two different M_A values (eg ~1.3 GeV and ~1.0 GeV)
183 // Include hit-object combinatorial factor? Would yield different A-dependence
184 // for MEC and QE.
185 //
186 
187  bool iscc = interaction->ProcInfo().IsWeakCC();
188  bool isnc = interaction->ProcInfo().IsWeakNC();
189  bool isem = interaction->ProcInfo().IsEM();
190 
191  int nupdg = interaction->InitState().ProbePdg();
192  int tgtpdg = interaction->InitState().Tgt().Pdg();
193  double E = interaction->InitState().ProbeE(kRfLab);
194  int nucleon_cluster_pdg = interaction->InitState().Tgt().HitNucPdg();
195  double Z=interaction->InitState().Tgt().Z();
196  double A=interaction->InitState().Tgt().A();
197  double N=A-Z;
198 
199  if(iscc) {
200 
201  int nucpdg = 0;
202  // neutrino CC: calculate the CCQE cross section resetting the
203  // hit nucleon cluster to neutron
204  if(pdg::IsNeutrino(nupdg)) {
205  nucpdg = kPdgNeutron;
206  }
207  // anti-neutrino CC: calculate the CCQE cross section resetting the
208  // hit nucleon cluster to proton
209  else
210  if(pdg::IsAntiNeutrino(nupdg)) {
211  nucpdg = kPdgProton;
212  }
213  else {
214  exit(1);
215  }
216 
217  // Create a tmp QE process
218  Interaction * in = Interaction::QELCC(tgtpdg,nucpdg,nupdg,E);
219 
220  // Calculate cross section for the QE process
221  double xsec = fXSecAlgCCQE->Integral(in);
222 
223  // Add A dependence which is not known from theory
224  double fFracADep = 1.;
225  if(A>=12) fFracADep = TMath::Power((N/6.),fMECAPower-1.);
226 
227  // Use tunable fraction
228  // FFracCCQE is fraction of QE going to MEC
229  // fFracCCQE_cluster is fraction of MEC going to each NN pair
230  // double fFracCCQE = fFracCCQElo;
231 
232  double fFracCCQE_cluster=0.;
233  if(pdg::IsNeutrino(nupdg) && nucleon_cluster_pdg==2000000201) fFracCCQE_cluster= fFracPN_CC; //n+p
234  if(pdg::IsNeutrino(nupdg) && nucleon_cluster_pdg==2000000200) fFracCCQE_cluster= 1.0-fFracPN_CC; //n+n
235  if(pdg::IsAntiNeutrino(nupdg) && nucleon_cluster_pdg==2000000201) fFracCCQE_cluster= fFracPN_CC; //n+p
236  if(pdg::IsAntiNeutrino(nupdg) && nucleon_cluster_pdg==2000000202) fFracCCQE_cluster= 1.0-fFracPN_CC; //p+p
237 
238 
239  xsec *= fFracCCQE*fFracCCQE_cluster*fFracADep;
240 
241  // Use gross combinatorial factor (number of 2-nucleon targets over number
242  // of 1-nucleon targets) : (A-1)/2
243  // double combfact = (in->InitState().Tgt().A()-1)/2.;
244  // xsec *= combfact;
245 
246  delete in;
247  return xsec;
248  }
249 
250  else if(isnc) {
251  int nucpdg = kPdgProton;
252  // Create a tmp QE process
253  Interaction * inp = Interaction::QELNC(tgtpdg,nucpdg,nupdg,E);
254  nucpdg = kPdgNeutron;
255  // Create a tmp QE process
256  Interaction * inn = Interaction::QELNC(tgtpdg,nucpdg,nupdg,E);
257 
258  // Calculate cross section for the QE process - avg of p and n - best for isoscalar nuclei
259  double xsec = (Z*fXSecAlgNCQE->Integral(inp) + N*fXSecAlgNCQE->Integral(inn))/A;
260 
261  // Add A dependence which is not known from theory
262  double fFracADep = 1.;
263  if(A>=12) fFracADep = TMath::Power((A/12.),fMECAPower-1.);
264 
265  // Use tunable fraction
266  // FFracNCQE is fraction of QE going to MEC
267  // fFracNCQE_cluster is fraction of MEC going to each NN pair
268  double fFracNCQE_cluster=0.;
269  if(nucleon_cluster_pdg==2000000200) fFracNCQE_cluster= 0.5*(1-fFracPN_NC); //n+n
270  if(nucleon_cluster_pdg==2000000201) fFracNCQE_cluster= fFracPN_NC; //n+p
271  if(nucleon_cluster_pdg==2000000202) fFracNCQE_cluster= 0.5*(1-fFracPN_NC); //p+p
272  xsec *= fFracNCQE*fFracNCQE_cluster*fFracADep;
273  delete inn;
274  delete inp;
275  return xsec;
276  }
277 
278  else if(isem) {
279  int nucpdg = kPdgProton;
280  // Create a tmp QE process
281  Interaction * inp = Interaction::QELEM(tgtpdg,nucpdg,nupdg,E);
282  nucpdg = kPdgNeutron;
283  // Create a tmp QE process
284  Interaction * inn = Interaction::QELEM(tgtpdg,nucpdg,nupdg,E);
285 
286  // Calculate cross section for the QE process - avg of p and n - best for isoscalar nuclei
287  double xsec = (Z*fXSecAlgEMQE->Integral(inp) + N*fXSecAlgEMQE->Integral(inn))/A;
288 
289  // Add A dependence which is not known from theory, data wants high A suppression
290  double fFracADep = 1.;
291  if(A>=12) fFracADep = TMath::Power((A/12.),fMECAPower-1.);
292 
293  // Use tunable fraction
294  // FFracEMQE is fraction of QE going to MEC
295  // fFracEMQE_cluster is fraction of MEC going to each NN pair
296  double fFracEMQE_cluster=0.;
297  if(nucleon_cluster_pdg==2000000200) fFracEMQE_cluster= 0.5*(1-fFracPN_EM); //n+n
298  if(nucleon_cluster_pdg==2000000201) fFracEMQE_cluster= fFracPN_EM; //n+p
299  if(nucleon_cluster_pdg==2000000202) fFracEMQE_cluster= 0.5*(1-fFracPN_EM); //p+p
300  xsec *= fFracEMQE*fFracEMQE_cluster*fFracADep;
301  delete inn;
302  delete inp;
303  return xsec;
304  }
305 
306  return 0;
307 }
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:108
double fFracPN_NC
toy model param: fraction of nucleon pairs that are pn, not nn or pp
const XSecAlgorithmI * fXSecAlgCCQE
cross section algorithm for CCQE
const XSecAlgorithmI * fXSecAlgNCQE
cross section algorithm for NCQE
static Interaction * QELCC(int tgt, int nuc, int probe, double E=0)
Float_t Z
Definition: plot.C:38
Summary information for an interaction.
Definition: Interaction.h:56
int iscc
double fFracPN_CC
toy model param: fraction of nucleon pairs that are pn, not nn or pp
Float_t E
Definition: plot.C:20
static Interaction * QELNC(int tgt, int nuc, int probe, double E=0)
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:116
virtual double Integral(const Interaction *i) const =0
Double_t xsec[nknots]
Definition: testXsec.C:47
double fFracPN_EM
toy model param: fraction of nucleon pairs that are pn, not nn or pp
static const double A
Definition: Units.h:82
ifstream in
Definition: comparison.C:7
const XSecAlgorithmI * fXSecAlgEMQE
cross section algorithm for EMQE
static Interaction * QELEM(int tgt, int nuc, int probe, double E=0)
double fFracEMQE
empirical model param: MEC cross section is taken to be this fraction of Rosenbluth xs ...
double fFracNCQE
empirical model param: MEC cross section is taken to be this fraction of NCQE cross section ...
exit(0)
double fFracCCQE
empirical model param: MEC cross section is taken to be this fraction of CCQE cross section ...
const int kPdgProton
Definition: PDGCodes.h:65
double fMECAPower
power of A relative to carbon
const int kPdgNeutron
Definition: PDGCodes.h:67
void EmpiricalMECPXSec2015::LoadConfig ( void  )
private

Definition at line 343 of file EmpiricalMECPXSec2015.cxx.

References ana::assert(), fFracCCQE, fFracEMQE, fFracNCQE, fFracPN_CC, fFracPN_EM, fFracPN_NC, fMass, fMECAPower, fMq2d, fWidth, fXSecAlgCCQE, fXSecAlgEMQE, fXSecAlgNCQE, genie::Algorithm::GetParam(), and genie::Algorithm::SubAlg().

Referenced by Configure().

344 {
345  fXSecAlgCCQE = 0;
346  fXSecAlgNCQE = 0;
347  fXSecAlgEMQE = 0;
348 
349  GetParam( "EmpiricalMEC-Mq2d", fMq2d ) ;
350  GetParam( "EmpiricalMEC-Mass", fMass ) ;
351  GetParam( "EmpiricalMEC-Width", fWidth ) ;
352  GetParam( "EmpiricalMEC-APower", fMECAPower ) ;
353 
354  GetParam( "EmpiricalMEC-FracPN_NC", fFracPN_NC ) ;
355  GetParam( "EmpiricalMEC-FracPN_CC", fFracPN_CC ) ;
356  GetParam( "EmpiricalMEC-FracPN_EM", fFracPN_EM ) ;
357 
358  GetParam( "EmpiricalMEC-FracCCQE", fFracCCQE ) ;
359  GetParam( "EmpiricalMEC-FracNCQE", fFracNCQE ) ;
360  GetParam( "EmpiricalMEC-FracEMQE", fFracEMQE ) ;
361 
362  string key_head = "XSecModel-" ;
363 
364  fXSecAlgNCQE =
365  dynamic_cast<const XSecAlgorithmI *> ( this -> SubAlg( key_head + "QEL-NC" ) ) ;
367 
368  fXSecAlgCCQE =
369  dynamic_cast<const XSecAlgorithmI *> ( this -> SubAlg( key_head + "QEL-CC" ) ) ;
371 
372  fXSecAlgEMQE =
373  dynamic_cast<const XSecAlgorithmI *> ( this -> SubAlg( key_head + "QEL-EM" ) ) ;
375 }
Cross Section Calculation Interface.
double fFracPN_NC
toy model param: fraction of nucleon pairs that are pn, not nn or pp
const XSecAlgorithmI * fXSecAlgCCQE
cross section algorithm for CCQE
const XSecAlgorithmI * fXSecAlgNCQE
cross section algorithm for NCQE
double fMass
toy model param: peak of W distribution (GeV)
double fFracPN_CC
toy model param: fraction of nucleon pairs that are pn, not nn or pp
double fWidth
toy model param: width of W distribution (GeV)
double fMq2d
toy model param: `mass&#39; in dipole (Q2 - dependence) form factor (GeV)
double fFracPN_EM
toy model param: fraction of nucleon pairs that are pn, not nn or pp
const XSecAlgorithmI * fXSecAlgEMQE
cross section algorithm for EMQE
double fFracEMQE
empirical model param: MEC cross section is taken to be this fraction of Rosenbluth xs ...
double fFracNCQE
empirical model param: MEC cross section is taken to be this fraction of NCQE cross section ...
assert(nhit_max >=nhit_nbins)
double fFracCCQE
empirical model param: MEC cross section is taken to be this fraction of CCQE cross section ...
double fMECAPower
power of A relative to carbon
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:353
int Algorithm::MergeTopRegistry ( const Registry r)
protectedinherited

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

Definition at line 618 of file Algorithm.cxx.

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

Print algorithm info.

Definition at line 323 of file Algorithm.cxx.

References GetConfig(), and r().

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

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

Set algorithm ID.

Definition at line 313 of file Algorithm.cxx.

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

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

Definition at line 318 of file Algorithm.cxx.

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

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

Definition at line 353 of file Algorithm.cxx.

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

Referenced by genie::Algorithm::AllowReconfig(), genie::utils::gsl::FullQELdXSec::FullQELdXSec(), genie::NewQELXSec::Integrate(), genie::HadronTransporter::LoadConfig(), genie::NucleonDecayPrimaryVtxGenerator::LoadConfig(), genie::IBDXSecMap::LoadConfig(), LoadConfig(), genie::COHElasticPXSec::LoadConfig(), genie::DISHadronicSystemGenerator::LoadConfig(), genie::SlowRsclCharmDISPXSecLO::LoadConfig(), genie::AhrensNCELPXSec::LoadConfig(), genie::AlamSimoAtharVacasSKPXSec2014::LoadConfig(), genie::UnstableParticleDecayer::LoadConfig(), genie::ReinDFRPXSec::LoadConfig(), genie::PythiaHadronization::LoadConfig(), genie::BYPDF::LoadConfig(), genie::QPMDISPXSec::LoadConfig(), genie::AlvarezRusoCOHPiPXSec::LoadConfig(), genie::RosenbluthPXSec::LoadConfig(), genie::StrumiaVissaniIBDPXSec::LoadConfig(), genie::MECGenerator::LoadConfig(), genie::NNBarOscPrimaryVtxGenerator::LoadConfig(), genie::FermiMover::LoadConfig(), genie::AhrensDMELPXSec::LoadConfig(), genie::IMDAnnihilationPXSec::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::KNOPythiaHadronization::LoadConfig(), genie::AivazisCharmPXSecLO::LoadConfig(), genie::RESHadronicSystemGenerator::LoadConfig(), genie::P33PaschosLalakulichPXSec::LoadConfig(), genie::BergerSehgalFMCOHPiPXSec2015::LoadConfig(), genie::QPMDMDISPXSec::LoadConfig(), genie::BergerSehgalCOHPiPXSec2015::LoadConfig(), genie::LwlynSmithQELCCPXSec::LoadConfig(), genie::NuElectronPXSec::LoadConfig(), genie::PaisQELLambdaPXSec::LoadConfig(), genie::ReinSehgalCOHPiPXSec::LoadConfig(), genie::NievesSimoVacasMECPXSec2016::LoadConfig(), genie::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
bool XSecAlgorithmI::ValidKinematics ( const Interaction i) const
virtualinherited

Is the input kinematical point a physically allowed one?

Reimplemented in genie::KovalenkoQELCharmPXSec, genie::PaisQELLambdaPXSec, genie::NuElectronPXSec, genie::KLVOxygenIBDPXSec, genie::IMDAnnihilationPXSec, genie::StrumiaVissaniIBDPXSec, genie::H3AMNuGammaPXSec, genie::GLRESPXSec, and genie::IBDXSecMap.

Definition at line 46 of file XSecAlgorithmI.cxx.

References genie::KPhaseSpace::IsAboveThreshold(), genie::KPhaseSpace::IsAllowed(), genie::kISkipKinematicChk, LOG, genie::Interaction::PhaseSpace(), and pINFO.

Referenced by genie::IBDXSecMap::ValidKinematics(), genie::COHElasticPXSec::XSec(), genie::SlowRsclCharmDISPXSecLO::XSec(), genie::AlamSimoAtharVacasSKPXSec2014::XSec(), genie::ReinDFRPXSec::XSec(), genie::AhrensNCELPXSec::XSec(), genie::RosenbluthPXSec::XSec(), genie::AivazisCharmPXSecLO::XSec(), genie::QPMDISPXSec::XSec(), genie::AlvarezRusoCOHPiPXSec::XSec(), genie::P33PaschosLalakulichPXSec::XSec(), genie::AhrensDMELPXSec::XSec(), genie::BergerSehgalFMCOHPiPXSec2015::XSec(), genie::LwlynSmithQELCCPXSec::XSec(), genie::QPMDMDISPXSec::XSec(), genie::BergerSehgalCOHPiPXSec2015::XSec(), genie::ReinSehgalCOHPiPXSec::XSec(), genie::BardinIMDRadCorPXSec::XSec(), genie::ReinSehgalRESPXSec::XSec(), genie::BSKLNBaseRESPXSec2014::XSec(), genie::NievesQELCCPXSec::XSec(), and genie::ReinSehgalSPPPXSec::XSec().

47 {
48 // can offer common implementation for all concrete x-section models because
49 // the input interaction is aware of its kinematic limits
50 
51  if ( interaction->TestBit(kISkipKinematicChk) ) return true;
52 
53  const KPhaseSpace& kps = interaction->PhaseSpace();
54 
55  if ( ! kps.IsAboveThreshold() ) {
56  LOG("XSecBase", pINFO) << "*** Below energy threshold";
57  return false;
58  }
59  if ( ! kps.IsAllowed() ) {
60  LOG("XSecBase", pINFO) << "*** Not in allowed kinematical space";
61  return false;
62  }
63  return true;
64 }
#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
#define pINFO
Definition: Messenger.h:63
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
bool IsAllowed(void) const
Check whether the current kinematics is in the allowed phase space.
bool IsAboveThreshold(void) const
Checks whether the interaction is above the energy threshold.
bool EmpiricalMECPXSec2015::ValidProcess ( const Interaction i) const
virtual

Can this cross section algorithm handle the input process?

Implements genie::XSecAlgorithmI.

Definition at line 309 of file EmpiricalMECPXSec2015.cxx.

References genie::ProcessInfo::IsMEC(), genie::kISkipProcessChk, and genie::Interaction::ProcInfo().

310 {
311  if(interaction->TestBit(kISkipProcessChk)) return true;
312 
313  const ProcessInfo & proc_info = interaction->ProcInfo();
314  if(!proc_info.IsMEC()) return false;
315 
316  return true;
317 }
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:44
bool IsMEC(void) const
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
double EmpiricalMECPXSec2015::XSec ( const Interaction i,
KinePhaseSpace_t  k 
) const
virtual

Compute the cross section for the input interaction.

Implements genie::XSecAlgorithmI.

Definition at line 67 of file EmpiricalMECPXSec2015.cxx.

References genie::units::A, genie::KinePhaseSpace::AsString(), C, E, genie::PDGLibrary::Find(), fMass, fMq2d, genie::Interaction::FSPrimLepton(), fWidth, Gaus(), genie::Target::HitNucPdg(), genie::utils::kinematics::InelQ2Lim_W(), genie::utils::kinematics::electromagnetic::InelQ2Lim_W(), genie::utils::kinematics::InelWLim(), genie::utils::kinematics::electromagnetic::InelWLim(), genie::Interaction::InitState(), genie::PDGLibrary::Instance(), iscc, genie::ProcessInfo::IsEM(), genie::ProcessInfo::IsWeakCC(), genie::ProcessInfo::IsWeakNC(), genie::utils::mec::J(), genie::utils::kinematics::Jacobian(), genie::constants::kAem2, kinematics(), genie::controls::kMinQ2Limit, genie::kPSWQ2fE, genie::kRfHitNucRest, LOG, genie::utils::res::Mass(), genie::Range1D_t::max, pDEBUG, genie::InitialState::ProbeE(), genie::Interaction::ProcInfo(), genie::Kinematics::Q2(), genie::utils::kinematics::Q2(), genie::InitialState::Tgt(), W, genie::Kinematics::W(), genie::utils::kinematics::WQ2toXY(), submit_syst::x, xsec, and submit_syst::y.

69 {
70 
71 // meson exchange current contribution depends a lot on QE model.
72 // This is an empirical model in development, not used in default event generation.
73 
74 // if(! this -> ValidProcess (interaction) ) return 0.;
75 // if(! this -> ValidKinematics (interaction) ) return 0.;
76  bool iscc = interaction->ProcInfo().IsWeakCC();
77  bool isnc = interaction->ProcInfo().IsWeakNC();
78  bool isem = interaction->ProcInfo().IsEM();
79 
80  const Kinematics & kinematics = interaction -> Kine();
81  double W = kinematics.W();
82  double Q2 = kinematics.Q2();
83  //LOG("MEC", pINFO) << "W, Q2 trial= " << W << " " << Q2 ;
84 
85  //
86  // Do a check whether W,Q2 is allowed. Return 0 otherwise.
87  //
88  double Ev = interaction->InitState().ProbeE(kRfHitNucRest); // kRfLab
89  int nucleon_cluster_pdg = interaction->InitState().Tgt().HitNucPdg();
90  double M2n = PDGLibrary::Instance()->Find(nucleon_cluster_pdg)-> Mass(); // nucleon cluster mass
91  double M2n2 = M2n*M2n;
92  double ml = interaction->FSPrimLepton()->Mass();
93  Range1D_t Wlim = isem ? genie::utils::kinematics::electromagnetic::InelWLim(Ev, ml, M2n) : genie::utils::kinematics::InelWLim(Ev, M2n, ml);
94 
95  //LOG("MEC", pINFO) << "Ev, ml, M2n = " << Ev << " " << ml << " " << M2n;
96  //LOG("MEC", pINFO) << "Wlim= " << Wlim.min << " " <<Wlim.max ;
97  if(W < Wlim.min || W > Wlim.max)
98  {double xsec = 0.;
99  return xsec;
100  }
101  //use proper Q2 limit from Controls.h
102  Range1D_t Q2lim = isem ? genie::utils::kinematics::electromagnetic::InelQ2Lim_W(Ev, ml, M2n, W) : genie::utils::kinematics::InelQ2Lim_W (Ev, M2n, ml, W, kMinQ2Limit);
103 
104  //LOG("MEC", pINFO) << "Q2lim= " << Q2lim.min << " " <<Q2lim.max ;
105  if(Q2 < Q2lim.min || Q2 > Q2lim.max)
106  {double xsec = 0.;
107  return xsec;
108  }
109 
110  //get x and y
111  double x = 0.;
112  double y = 0.;
113  genie::utils::kinematics::WQ2toXY(Ev,M2n,W,Q2,x,y);
114  // LOG("MEC", pINFO) << "x = " << x << ", y = " << y;
115  // double Tmu = (1.-y)*Ev; // UNUSED - comment to quiet compiler warnings
116 
117  // Calculate d^2xsec/dWdQ2 - first form factor which is common to both
118  double Wdep = TMath::Gaus(W, fMass, fWidth);
119  double Q2dep = Q2*TMath::Power((1+Q2/fMq2d),-8.);
120  // double nudep = TMath::Power(Tmu,2.5);
121  // LOG("MEC", pINFO) << "Tmu = " << Tmu << ", nudep = " << nudep;
122  double FF2 = Wdep * Q2dep;// * nudep;
123  //LOG("MEC", pINFO) << "form factor = " << FF2 << ", Q2 = " << Q2 << ", W = " << W;
124 
125 // using formulas in Bodek and Budd for (e,e') inclusive cross section
126  double xsec = 1.;
127  if(isem) {
128  // Calculate scattering angle
129  //
130  // Q^2 = 4 * E^2 * sin^2 (theta/2) / ( 1 + 2 * (E/M) * sin^2(theta/2) ) =>
131  // sin^2 (theta/2) = MQ^2 / (4ME^2 - 2EQ^2)
132 
133  double E = Ev;
134  double E2 = E*E;
135  double sin2_halftheta = M2n*Q2 / (4*M2n*E2 - 2*E*Q2);
136  // double sin4_halftheta = TMath::Power(sin2_halftheta, 2.);
137  double cos2_halftheta = 1.-sin2_halftheta;
138  // double cos_halftheta = TMath::Sqrt(cos2_halftheta);
139  double tan2_halftheta = sin2_halftheta/cos2_halftheta;
140  double Q4 = Q2*Q2;
141 
142  // Calculate tau and the virtual photon polarization (epsilon)
143  double tau = Q2/(4*M2n2);
144  // double epsilon = 1. / (1. + 2.*(tau/x))*tan2_halftheta); //different than RosenbluthPXSec.cxx
145 
146  // Calculate the scattered lepton energy
147  double Ep = E / (1. + 2.*(E/M2n)*sin2_halftheta);
148  double Ep2 = Ep*Ep;
149 
150  //calculate cross section - d2sig/dOmega dE for purely transverse process
151  xsec = 4*kAem2*Ep2*cos2_halftheta/Q4 * FF2 * (tau/(1+tau) +2*tau*tan2_halftheta);
152  }
153  // use BB formula which seems to be same as Llewlyn-Smith
154  // note B term is only difference between nu and antinu, so both same here
155  else if(isnc||iscc){
156  double tau = Q2/(4*M2n2);
157  double tau2 = tau*tau;
158  double smufac = 4*M2n*Ev - Q2 - ml*ml;
159  double A = (ml*ml+Q2)/M2n2 * (tau*(1+tau) - tau2*(1-tau)+4*tau2)/TMath::Power(1+tau,2.) * FF2;
160  double C = tau/4/(1+tau) * FF2;
161  xsec = A + smufac*smufac*C; // CC or NC case - Llewelyn-Smith for transverse vector process.
162  }
163  // Check whether variable tranformation is needed
164  if(kps!=kPSWQ2fE) {
165  double J = utils::kinematics::Jacobian(interaction,kPSWQ2fE,kps);
166 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
167  LOG("MEC", pDEBUG)
168  << "Jacobian for transformation to: "
169  << KinePhaseSpace::AsString(kps) << ", J = " << J;
170 #endif
171  xsec *= J;
172  }
173 
174  return xsec;
175 }
double W(bool selected=false) const
Definition: Kinematics.cxx:167
double J(double q0, double q3, double Enu, double ml)
Definition: MECUtils.cxx:141
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
Range1D_t InelWLim(double El, double ml, double M)
Definition: KineUtils.cxx:477
double Q2(const Interaction *const i)
Definition: KineUtils.cxx:991
Range1D_t InelWLim(double Ev, double M, double ml)
Definition: KineUtils.cxx:288
A simple [min,max] interval for doubles.
Definition: Range1.h:43
Generated/set kinematical variables for an event.
Definition: Kinematics.h:40
double Mass(Resonance_t res)
resonance mass (GeV)
double fMass
toy model param: peak of W distribution (GeV)
static const double kMinQ2Limit
Definition: Controls.h:41
Range1D_t InelQ2Lim_W(double Ev, double M, double ml, double W, double Q2min_cut=controls::kMinQ2Limit)
Definition: KineUtils.cxx:309
const double C
int iscc
#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
static const double kAem2
Definition: Constants.h:58
static string AsString(KinePhaseSpace_t kps)
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
Definition: KineUtils.cxx:1046
double fWidth
toy model param: width of W distribution (GeV)
double Gaus(TH1D *h, double &err, bool isTruth)
Definition: absCal.cxx:489
Double_t xsec[nknots]
Definition: testXsec.C:47
double fMq2d
toy model param: `mass&#39; in dipole (Q2 - dependence) form factor (GeV)
static const double A
Definition: Units.h:82
double max
Definition: Range1.h:54
Range1D_t InelQ2Lim_W(double El, double ml, double M, double W)
Definition: KineUtils.cxx:499
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
double Jacobian(const Interaction *const i, KinePhaseSpace_t f, KinePhaseSpace_t t)
Definition: KineUtils.cxx:128
double Q2(bool selected=false) const
Definition: Kinematics.cxx:135
void kinematics()
Definition: kinematics.C:10
#define W(x)
#define pDEBUG
Definition: Messenger.h:64

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::EmpiricalMECPXSec2015::fFracCCQE
private

empirical model param: MEC cross section is taken to be this fraction of CCQE cross section

Definition at line 60 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fFracEMQE
private

empirical model param: MEC cross section is taken to be this fraction of Rosenbluth xs

Definition at line 62 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fFracNCQE
private

empirical model param: MEC cross section is taken to be this fraction of NCQE cross section

Definition at line 61 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fFracPN_CC
private

toy model param: fraction of nucleon pairs that are pn, not nn or pp

Definition at line 57 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fFracPN_EM
private

toy model param: fraction of nucleon pairs that are pn, not nn or pp

Definition at line 58 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fFracPN_NC
private

toy model param: fraction of nucleon pairs that are pn, not nn or pp

Definition at line 56 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

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::EmpiricalMECPXSec2015::fMass
private

toy model param: peak of W distribution (GeV)

Definition at line 52 of file EmpiricalMECPXSec2015.h.

Referenced by LoadConfig(), and XSec().

double genie::EmpiricalMECPXSec2015::fMECAPower
private

power of A relative to carbon

Definition at line 54 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

double genie::EmpiricalMECPXSec2015::fMq2d
private

toy model param: `mass' in dipole (Q2 - dependence) form factor (GeV)

Definition at line 51 of file EmpiricalMECPXSec2015.h.

Referenced by LoadConfig(), and XSec().

AlgMap* genie::Algorithm::fOwnedSubAlgMp
protectedinherited

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

Definition at line 167 of file Algorithm.h.

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

ownership for every registry in fConfVect

Definition at line 164 of file Algorithm.h.

bool genie::Algorithm::fOwnsSubstruc
protectedinherited

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

Definition at line 155 of file Algorithm.h.

AlgStatus_t genie::Algorithm::fStatus
protectedinherited

algorithm execution status

Definition at line 166 of file Algorithm.h.

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

double genie::EmpiricalMECPXSec2015::fWidth
private

toy model param: width of W distribution (GeV)

Definition at line 53 of file EmpiricalMECPXSec2015.h.

Referenced by LoadConfig(), and XSec().

const XSecAlgorithmI* genie::EmpiricalMECPXSec2015::fXSecAlgCCQE
private

cross section algorithm for CCQE

Definition at line 64 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

const XSecAlgorithmI* genie::EmpiricalMECPXSec2015::fXSecAlgEMQE
private

cross section algorithm for EMQE

Definition at line 66 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().

const XSecAlgorithmI* genie::EmpiricalMECPXSec2015::fXSecAlgNCQE
private

cross section algorithm for NCQE

Definition at line 65 of file EmpiricalMECPXSec2015.h.

Referenced by Integral(), and LoadConfig().


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