GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
Created:
October 23, 2014
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Function Documentation

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

Definition at line 91 of file ConfigIsotopeMapUtils.cxx.

References genie::Registry::Exists(), genie::Registry::GetDoubleDef(), and genie::units::s.

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

93 {
94  ostringstream s;
95  s<<valName<<"@Pdg="<<pdgc;
96  RgKey key = s.str();
97  if(!config->Exists(key)) {
98  return false;
99  }
100  *val = config->GetDoubleDef(key,0);
101  return true;
102 }
static constexpr double s
Definition: Units.h:95
string RgKey
bool genie::utils::config::GetDoubleKeyRangeNucA ( const char *  valName,
const int  lowA,
const int  highA,
Registry *  config,
double *  val 
)

Definition at line 107 of file ConfigIsotopeMapUtils.cxx.

References genie::Registry::Exists(), genie::Registry::GetDoubleDef(), and genie::units::s.

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

109 {
110  ostringstream s;
111  s<<valName<<"@LowA="<<lowA<<";HighA="<<highA;
112  RgKey key = s.str();
113  if(!config->Exists(key)) {
114  return false;
115  }
116  *val = config->GetDoubleDef(key,0);
117  return true;
118 }
static constexpr double s
Definition: Units.h:95
string RgKey
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 28 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().

31  {
32  const int pdgc = pdg::IonPdgCode(target.A(), target.Z());
33  map<int, double>::const_iterator nuc_it = nuc_to_val.find(pdgc);
34  if(nuc_it != nuc_to_val.end()) {
35  *val = nuc_it->second;
36  return true;
37  }
38  map<pair<int, int>, double>::const_iterator range_it =
39  nucA_range_to_val.begin();
40  for(; range_it != nucA_range_to_val.end(); ++range_it) {
41  if (target.A() >= range_it->first.first &&
42  target.A() <= range_it->first.second) {
43  *val = range_it->second;
44  return true;
45  }
46  }
47  return false;
48 }
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
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 
)
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 73 of file ConfigIsotopeMapUtils.cxx.

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

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

74  {
75  for (int Z = 1; Z < 140; Z++) {
76  for (int A = Z; A < 3 * Z; A++) {
77  const int pdgc = pdg::IonPdgCode(A, Z);
78  double val;
79  if(GetDoubleKeyPDG(key_name, pdgc, config, &val)) {
80  LOG(log_tool_name, pINFO) << "Nucleus: " << pdgc <<
81  " -> using " << key_name << " = " << val;
82  (*nuc_to_val)[pdgc] = val;
83  }
84  }
85  }
86 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double A
Definition: Units.h:74
#define pINFO
Definition: Messenger.h:62
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
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 54 of file ConfigIsotopeMapUtils.cxx.

References GetDoubleKeyRangeNucA(), LOG, and pINFO.

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

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