a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
ThObsFactory.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 HEPfit Collaboration
3 *
4 *
5 * For the licensing terms see doc/COPYING.
6 */
7
8#include "ThObsFactory.h"
9#include "ThObservable.h"
10#include "ParamObs.h"
11
13{
23}
24
26{
28}
29
30void ThObsFactory::addObsToFactory(const std::string name, std::function<ThObservable*(const StandardModel&) > funct)
31{
32 if (obsThFactory.find(name) == obsThFactory.end()) obsThFactory[name] = funct;
33 else throw std::runtime_error("ERROR: Observable named: " + name + " already exists. Please give a different name to the user-defined observable " + name + ".");
34}
35
36ThObservable * ThObsFactory::CreateThMethod(const std::string& name, StandardModel& model) const
37{
38 if (model.isModelParam(name))
39 return new ParamObs(model, name);
40 if (obsThFactory.find(name) == obsThFactory.end())
41 throw std::runtime_error("ERROR: Wrong observable " + name + " passed to ThObsFactory.\nIf " + name + " is a parameter that is specific to an observable, please list it after the observable in the configuration file.\n");
42 ThObservable * myThObs = obsThFactory.at(name)(model);
43 if (!myThObs->getParametersForObservable().empty()) model.addParameters(myThObs->getParametersForObservable());
44 return (myThObs);
45}
bool isModelParam(std::string name) const
Definition: Model.h:173
A class for setting a parameter as an observable.
Definition: ParamObs.h:22
void addParameters(std::vector< std::string > params_i)
A method to add parameters that are specific to only one set of observables.
Definition: QCD.cpp:199
A model class for the Standard Model.
A class for.
Definition: ThObsFactory.h:25
void registerTopQuarkObservables()
void registerDiBosonObservables()
void registerFlavourObservables()
std::map< std::string, std::function< ThObservable *(const StandardModel &) > > obsThFactory
Definition: ThObsFactory.h:49
void registerEWObservables()
void registerBSMObservables()
ThObservable * CreateThMethod(const std::string &name, StandardModel &model) const
This method checks for the existence of an observable of a specific name in the map thobs and returns...
void addObsToFactory(const std::string name, std::function< ThObservable *(const StandardModel &) >)
void registerHiggsObservables()
void registerLEP2Observables()
A class for a model prediction of an observable.
Definition: ThObservable.h:25
const std::vector< std::string > getParametersForObservable()
A get method to get the parameters for the specific observable.
Definition: ThObservable.h:118