36 #define G_OPT "ctlikelihood::opt(GOptimizer*)"
37 #define G_EVALUATE "ctlikelihood::evaluate(GModelPar&, double&)"
60 const std::string& version) :
83 const std::string& version,
84 const GApplicationPars& pars) :
107 const std::string& version,
131 const std::string& version,
132 const GObservations& obs) :
238 const GOptimizerLM* lm =
dynamic_cast<const GOptimizerLM*
>(
opt);
240 std::string cls = std::string(
typeid(opt).name());
241 std::string msg =
"Method requires \"GOptimizerLM\" optimizer yet the "
242 "provided optimizer is of type \""+cls+
"\". Please "
243 "specify an instance of \"GOptimizerLM\" as "
245 throw GException::invalid_argument(
G_OPT, msg);
277 if (par.has_min() && value < par.factor_min()) {
278 std::string msg =
"Parameter \""+par.name()+
"\" value"+
279 gammalib::str(value)+
" is below its minimum boundary "+
280 gammalib::str(par.factor_min())+
". To omit this "
281 "error please lower the minimum parameter boundary.";
282 throw GException::invalid_value(
G_EVALUATE, msg);
286 if (par.has_max() && value > par.factor_max()) {
287 std::string msg =
"Parameter \""+par.name()+
"\" value"+
288 gammalib::str(value)+
" is above its maximum boundary "+
289 gammalib::str(par.factor_max())+
". To omit this "
290 "error please raise the maximum parameter boundary.";
291 throw GException::invalid_value(
G_EVALUATE, msg);
295 par.factor_value(value);
330 m_opt.max_stalls(10);
334 if (has_par(
"like_accuracy")) {
335 m_opt.eps((*
this)[
"like_accuracy"].real());
337 if (has_par(
"max_iter")) {
338 m_opt.max_iter((*
this)[
"max_iter"].integer());
void copy_members(const ctlikelihood &app)
Copy class members.
ctlikelihood & operator=(const ctlikelihood &app)
Assignment operator.
double evaluate(GModelPar &par, const double &value)
Evaluates the log-likelihood function.
virtual ~ctlikelihood(void)
Destructor.
const GOptimizer * opt(void) const
Return optimizer.
Likelihood tool base class interface definition.
Base class for observation tools.
void free_members(void)
Delete class members.
ctobservation & operator=(const ctobservation &app)
Assignment operator.
void init_members(void)
Initialise class members.
GObservations m_obs
Observation container.
ctlikelihood(const std::string &name, const std::string &version)
Name constructor.
Base class for likelihood tools.
GOptimizerLM m_opt
Optimizer.