gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
container_factory.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
25 
28 
29 namespace Gambit
30 {
31 
34  : dependencyResolver(dependencyResolver)
35  , iniFile(iniFile)
36  , printer(printer)
37  {
39  std::set<std::string> modelSet = iniFile.getModelNames();
40 
41  if (functorMap.size() < modelSet.size())
42  {
43  std::stringstream err;
44  err << "There are more model entries specified in the inifile than is required by GAMBIT." << std::endl;
45  core_error().raise(LOCAL_INFO, err.str());
46  }
47 
48  for (std::map<std::string, primary_model_functor *>::iterator act_it = functorMap.begin(), end = functorMap.end(); act_it != end; ++act_it)
49  {
50  if (modelSet.find(act_it->first) == modelSet.end())
51  {
52  std::stringstream err;
53  err << "Model " << act_it->first << " is required by GAMBIT but is not in the inifile." << std::endl;
54  core_error().raise(LOCAL_INFO, err.str());
55  }
56 
57  std::vector <std::string> paramkeys = act_it->second->getcontentsPtr()->getKeys();
58  std::vector <std::string> inikeys = iniFile.getModelParameters(act_it->first);
59  if (paramkeys.size() < inikeys.size())
60  {
61  std::stringstream err;
62  err << "There are more parameter entries (of model " << act_it->first << ") specified in the inifile than is required by GAMBIT." << std::endl;
63  core_error().raise(LOCAL_INFO, err.str());
64  }
65 
66  std::unordered_set<std::string> paramSet(inikeys.begin(), inikeys.end());
67  for (std::vector<std::string>::iterator it = paramkeys.begin(), end = paramkeys.end(); it != end; ++it)
68  {
69  if (paramSet.find(*it) == paramSet.end())
70  {
71  std::stringstream err;
72  err << "Parameter " << *it << " of model " << act_it->first << " is required by GAMBIT but is not in the inifile." << std::endl;
73  core_error().raise(LOCAL_INFO, err.str());
74  }
75  }
76  }
77  }
78 
79  void * Likelihood_Container_Factory::operator() (const std::string &purpose) const
80  {
81  return __scanner_factories__["GAMBIT_Scanner_Target_Function"](functorMap, dependencyResolver, iniFile, purpose, printer);
82  }
83 }
std::map< str, primary_model_functor * > functorMap
reg_elem< factory_type > __scanner_factories__
#define LOCAL_INFO
Definition: local_info.hpp:34
error & core_error()
Core errors.
Printers::BaseBasePrinter & printer
Master driver class for a GAMBIT scan.
Definition: core.hpp:35
const std::vector< str > getModelParameters(str model) const
const pmfMap & getActiveModelFunctors() const
Get a reference to the map of all user-activated primary model functors.
Definition: core.cpp:244
Main dependency resolver.
DRes::DependencyResolver & dependencyResolver
Printers::BaseBasePrinter printer
Type of the printer objects.
Likelihood container declarations.
Likelihood_Container_Factory(const gambit_core &core, DRes::DependencyResolver &dependencyResolver, IniParser::IniFile &iniFile, Printers::BaseBasePrinter &printer)
const std::set< str > getModelNames() const
Return list of model names (without "adhoc" model!)
Main inifile class.
Definition: yaml_parser.hpp:89
Simple container used for storing info about which types have been defined as equivalent for depencen...
void * operator()(const str &purpose) const
TODO: see if we can use this one:
Definition: Analysis.hpp:33