gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
SLHASimpleSpec.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
5 //
20 
22 
23 #include <boost/preprocessor/tuple/to_seq.hpp>
24 #include <boost/preprocessor/seq/elem.hpp>
25 #include <boost/preprocessor/seq/for_each_product.hpp>
26 
28 // Relies on "tmp_map" being used as the variable name for the temporary maps
29 // inside the fill_map functions.
30 #define addtomap_EL(r, PRODUCT) \
31 { \
32  str key = BOOST_PP_SEQ_ELEM(0,PRODUCT); /* string map key */ \
33  tmp_map[key] = BOOST_PP_SEQ_ELEM(1,PRODUCT); /* function pointer */ \
34 }
35 
36 #define addtomap(__KEYS,FPTR) BOOST_PP_SEQ_FOR_EACH_PRODUCT(addtomap_EL, (BOOST_PP_TUPLE_TO_SEQ(__KEYS))((FPTR)) )
37 
38 using namespace SLHAea;
39 
40 namespace Gambit
41 {
42 
44 
46  SLHAeaModel::SLHAeaModel()
47  : data()
48  {}
49 
51  SLHAeaModel::SLHAeaModel(const SLHAea::Coll& input)
52  : data(input)
53  {
54  // No idea what kind of model this is, so cannot set valid slha_version. Use "0" for "unknown" or "n/a"
55  // If you write a model-specific derived class from this, be sure to add a sensible check for this and
56  // overwrite what we set here in the base class.
58  }
59 
62 
64  const SLHAea::Coll& SLHAeaModel::get_slhaea() const { return data; }
65 
67  const std::map<int, int>& SLHAeaModel::PDG_translator() const
68  {
69  return PDG_translation_map;
70  }
71 
73 
75  double SLHAeaModel::getdata(const std::string& block, int index) const
76  {
77  double output = 0.0;
78  try
79  {
80  output = to<double>(data.at(block).at(index).at(1));
81  }
82  catch (const std::out_of_range& e)
83  {
84  std::ostringstream errmsg;
85  errmsg << "Error accessing data at index "<<index<<" of block "<<block<<". Please check that the SLHAea object was properly filled." << std::endl;
86  errmsg << "(Received out_of_range error from SLHAea class with message: " << e.what() << ")";
87  utils_error().raise(LOCAL_INFO,errmsg.str());
88  }
89  return output;
90  }
91 
93  double SLHAeaModel::getdata(const std::string& block, int i, int j) const
94  {
95  double output = 0.0;
96  try
97  {
98  output = to<double>(data.at(block).at(i,j).at(2));
99  }
100  catch (const std::out_of_range& e)
101  {
102  std::ostringstream errmsg;
103  errmsg << "Error accessing data at index "<<i<<","<<j<<" of block "<<block<<". Please check that the SLHAea object was properly filled." << std::endl;
104  errmsg << "(Received out_of_range error from SLHAea class with message: " << e.what() << ")";
105  utils_error().raise(LOCAL_INFO,errmsg.str());
106  }
107  return output;
108  }
109 
111 
113 
114 
115 } // end Gambit namespace
116 
117 
greatScanData data
Definition: great.cpp:38
SLHAea::Coll data
SLHAea object.
EXPORT_SYMBOLS error & utils_error()
Utility errors.
SLHAeaModel()
Constructors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Helper base class for simple subspectrum wrappers that want to use SLHAea features.
double getdata(const std::string &block, int index) const
Helper functions to do error checking for SLHAea object contents.
int slha_version() const
Get the SLHA version of the internal SLHAea object.
const SLHAea::Coll & get_slhaea() const
Get the internal SLHAea object.
const std::map< int, int > & PDG_translator() const
PDG code translation map, for special cases where an SLHA file has been read in and the PDG codes cha...
int wrapped_slha_version
SLHA version of SLHAea object.
std::map< int, int > PDG_translation_map
PDG translation map (e.g. from SLHA1 to SLHA2 for MSSMskeleton)
TODO: see if we can use this one:
Definition: Analysis.hpp:33