Functions
genie::utils::config Namespace Reference

Simple functions for loading and reading nucleus dependent keys from config files. More...

Functions

bool GetValueFromNuclearMaps (const Target &target, const map< int, double > &nuc_to_val, const map< pair< int, int >, double > &nucA_range_to_val, double *val)
 
void LoadAllNucARangesForKey (const char *key_name, const char *log_tool_name, Registry *config, map< pair< int, int >, double > *nuc_rangeA_to_val)
 
void LoadAllIsotopesForKey (const char *key_name, const char *log_tool_name, Registry *config, map< int, double > *nuc_to_val)
 
bool GetDoubleKeyPDG (const char *valName, const int pdgc, Registry *config, double *val)
 
bool GetDoubleKeyRangeNucA (const char *valName, const int lowA, const int highA, Registry *config, double *val)
 
bool GetValueFromNuclearMaps (const Target &target, const std::map< int, double > &nuc_to_val, const std::map< std::pair< int, int >, double > &nucA_range_to_val, double *val)
 
void LoadAllNucARangesForKey (const char *key_name, const char *log_tool_name, Registry *config, std::map< std::pair< int, int >, double > *nuc_rangeA_to_val)
 
void LoadAllIsotopesForKey (const char *key_name, const char *log_tool_name, Registry *config, std::map< int, double > *nuc_to_val)
 

Detailed Description

Simple functions for loading and reading nucleus dependent keys from config files.

Author
Brian Coopersmith, University of Rochester

October 23, 2014

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

Function Documentation

bool genie::utils::config::GetDoubleKeyPDG ( const char *  valName,
const int  pdgc,
Registry config,
double *  val 
)

Definition at line 95 of file ConfigIsotopeMapUtils.cxx.

References genie::Registry::Exists(), genie::Registry::GetDoubleDef(), and findDuplicateFiles::key.

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

97 {
98  ostringstream s;
99  s<<valName<<"@Pdg="<<pdgc;
100  RgKey key = s.str();
101  if(!config->Exists(key)) {
102  return false;
103  }
104  *val = config->GetDoubleDef(key,0);
105  return true;
106 }
Definition: config.py:1
const XML_Char * s
Definition: expat.h:262
string RgKey
bool genie::utils::config::GetDoubleKeyRangeNucA ( const char *  valName,
const int  lowA,
const int  highA,
Registry config,
double *  val 
)

Definition at line 111 of file ConfigIsotopeMapUtils.cxx.

References genie::Registry::Exists(), genie::Registry::GetDoubleDef(), and findDuplicateFiles::key.

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

113 {
114  ostringstream s;
115  s<<valName<<"@LowA="<<lowA<<";HighA="<<highA;
116  RgKey key = s.str();
117  if(!config->Exists(key)) {
118  return false;
119  }
120  *val = config->GetDoubleDef(key,0);
121  return true;
122 }
Definition: config.py:1
const XML_Char * s
Definition: expat.h:262
string RgKey
bool genie::utils::config::GetValueFromNuclearMaps ( const Target target,
const std::map< int, double > &  nuc_to_val,
const std::map< std::pair< int, int >, double > &  nucA_range_to_val,
double *  val 
)
bool genie::utils::config::GetValueFromNuclearMaps ( const Target target,
const map< int, double > &  nuc_to_val,
const map< pair< int, int >, double > &  nucA_range_to_val,
double *  val 
)

Definition at line 32 of file ConfigIsotopeMapUtils.cxx.

References genie::Target::A(), genie::pdg::IonPdgCode(), and genie::Target::Z().

Referenced by genie::EffectiveSF::GetTransEnh1p1hMod(), genie::TransverseEnhancementFFModel::GetTransEnhParams(), genie::EffectiveSF::ReturnBindingEnergy(), and genie::EffectiveSF::Returnf1p1h().

35  {
36  const int pdgc = pdg::IonPdgCode(target.A(), target.Z());
37  map<int, double>::const_iterator nuc_it = nuc_to_val.find(pdgc);
38  if(nuc_it != nuc_to_val.end()) {
39  *val = nuc_it->second;
40  return true;
41  }
42  map<pair<int, int>, double>::const_iterator range_it =
43  nucA_range_to_val.begin();
44  for(; range_it != nucA_range_to_val.end(); ++range_it) {
45  if (target.A() >= range_it->first.first &&
46  target.A() <= range_it->first.second) {
47  *val = range_it->second;
48  return true;
49  }
50  }
51  return false;
52 }
const XML_Char * target
Definition: expat.h:268
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:69
void genie::utils::config::LoadAllIsotopesForKey ( const char *  key_name,
const char *  log_tool_name,
Registry config,
std::map< int, double > *  nuc_to_val 
)
void genie::utils::config::LoadAllIsotopesForKey ( const char *  key_name,
const char *  log_tool_name,
Registry config,
map< int, double > *  nuc_to_val 
)

Definition at line 77 of file ConfigIsotopeMapUtils.cxx.

References genie::units::A, GetDoubleKeyPDG(), genie::pdg::IonPdgCode(), LOG, pINFO, febshutoff_auto::val, and Z.

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

78  {
79  for (int Z = 1; Z < 140; Z++) {
80  for (int A = Z; A < 3 * Z; A++) {
81  const int pdgc = pdg::IonPdgCode(A, Z);
82  double val;
83  if(GetDoubleKeyPDG(key_name, pdgc, config, &val)) {
84  LOG(log_tool_name, pINFO) << "Nucleus: " << pdgc <<
85  " -> using " << key_name << " = " << val;
86  (*nuc_to_val)[pdgc] = val;
87  }
88  }
89  }
90 }
Definition: config.py:1
Float_t Z
Definition: plot.C:38
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
static const double A
Definition: Units.h:82
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:69
bool GetDoubleKeyPDG(const char *valName, const int pdgc, Registry *config, double *val)
void genie::utils::config::LoadAllNucARangesForKey ( const char *  key_name,
const char *  log_tool_name,
Registry config,
std::map< std::pair< int, int >, double > *  nuc_rangeA_to_val 
)
void genie::utils::config::LoadAllNucARangesForKey ( const char *  key_name,
const char *  log_tool_name,
Registry config,
map< pair< int, int >, double > *  nuc_rangeA_to_val 
)

Definition at line 58 of file ConfigIsotopeMapUtils.cxx.

References GetDoubleKeyRangeNucA(), LOG, pINFO, and febshutoff_auto::val.

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

60  {
61  for (int lowA = 1; lowA < 3 * 140; lowA++) {
62  for (int highA = lowA; highA < 3 * 140; highA++) {
63  double val;
64  if (GetDoubleKeyRangeNucA(key_name, lowA, highA, config, &val)) {
65  LOG(log_tool_name, pINFO) << "For "<< lowA - 1 <<" < A < " <<
66  highA + 1 << " -> using " << key_name << " = " << val;
67  (*nuc_rangeA_to_val)[pair<int, int>(lowA, highA)] = val;
68  }
69  }
70  }
71 }
Definition: config.py:1
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
bool GetDoubleKeyRangeNucA(const char *valName, const int lowA, const int highA, Registry *config, double *val)