36 #define G_GET_PARAMETERS "cttsmap::get_parameters()"
187 this->GApplication::clear();
220 log_header1(TERSE,
"Initialise TS map");
231 static_cast<GOptimizerLM*
>(&
m_opt)->logger(&log);
234 static_cast<GOptimizerLM*
>(&
m_opt)->logger(NULL);
238 GModels models_orig =
m_obs.models();
241 GModels models =
m_obs.models();
247 if ((*
this)[
"fix_spat"].
boolean()) {
250 for (
int i = 0; i < models.size(); ++i) {
253 GModelSky* sky=
dynamic_cast<GModelSky*
>(models[i]);
257 GModelSpatial* spatial = sky->spatial();
258 for (
int j = 0; j < spatial->size(); j++) {
272 log_header1(TERSE,
"Compute NULL Hypothesis for TS computation");
275 m_obs.models(models);
282 log_header1(TERSE,
"Generate TS map");
285 for (
int i = binmin; i < binmax; ++i) {
288 GSkyDir bincentre =
m_tsmap.inx2dir(i);
291 log_header2(EXPLICIT,
"Computing TS for bin number "+gammalib::str(i)+
292 " at "+bincentre.print());
295 (*m_testsource)[
"RA"].value(bincentre.ra_deg());
296 (*m_testsource)[
"DEC"].value(bincentre.dec_deg());
300 m_obs.models(models);
314 int status =
m_opt.status();
317 double logL1 = -(
m_opt.value());
320 double ts = 2.0 * (logL1 -
m_logL0);
324 log_value(EXPLICIT,
"TS value", ts);
326 else if (logNormal()) {
327 log_value(NORMAL,
"TS value (bin "+gammalib::str(i)+
")",
328 gammalib::str(ts)+
" ("+bincentre.print()+
")");
332 GModels best_fit_model =
m_obs.models();
333 GModel* testsource = best_fit_model[
m_srcname];
348 m_maps[j](i) = (*testsource)[parname].error();
368 m_obs.models(models_orig);
391 log_header1(TERSE,
"Save TS map");
394 if ((*
this)[
"outmap"].is_valid() && !
m_tsmap.is_empty()) {
397 m_outmap = (*this)[
"outmap"].filename();
415 fits[fits.size()-1]->extname(
"STATUS MAP");
428 fname.append(
" (TS map is empty, no file created)");
430 log_value(NORMAL,
"TS map file", fname);
445 log_header1(TERSE,
"Publish TS map");
448 std::string user_name(name);
449 if (user_name.empty()) {
454 log_value(NORMAL,
"TS map name", user_name);
575 std::string msg =
"Source \""+
m_srcname+
"\" has no \"RA\" and "
576 "\"DEC\" parameters. Only sources with \"RA\" "
577 "and \"DEC\" parameters can be used as test "
583 (*m_testsource)[
"RA"].fix();
584 (*m_testsource)[
"DEC"].fix();
590 m_errors = (*this)[
"errors"].boolean();
599 m_binmin = (*this)[
"binmin"].integer();
600 m_binmax = (*this)[
"binmax"].integer();
601 m_logL0 = (*this)[
"logL0"].real();
602 m_publish = (*this)[
"publish"].boolean();
605 (*this)[
"fix_spat"].boolean();
609 (*this)[
"outmap"].query();
void get_parameters(void)
Get application parameters.
void init_members(void)
Initialise class members.
void clear(void)
Clear instance.
void copy_members(const cttsmap &app)
Copy class members.
ctlikelihood & operator=(const ctlikelihood &app)
Assignment operator.
bool m_publish
Publish TS map?
cttsmap(void)
Void constructor.
void save(void)
Save maps.
std::vector< std::string > m_mapnames
Names of free parameters.
void process(void)
Computes the TS maps.
void set_obs_statistic(const std::string &statistic)
Set fit statistic for CTA observations.
void free_members(void)
Delete class members.
GSkyMap m_statusmap
Map of optimizer fit status.
cttsmap & operator=(const cttsmap &app)
Assignment operator.
TS map calculation tool interface implementation.
void free_members(void)
Delete class members.
void free_members(void)
Delete class members.
bool m_errors
Compute and store parameter errors?
bool m_apply_edisp
Apply energy dispersion?
double m_logL0
Likelihood value of null hypothesis.
void init_members(void)
Initialise class members.
std::vector< GSkyMap > m_maps
Sky maps for each free parameter.
int m_binmin
Map bin number from which computation should start.
GFilename m_outmap
Output TS map file name.
void init_maps(const GSkyMap &map)
Initialise skymaps.
void init_members(void)
Initialise class members.
void publish(const std::string &name="")
Publish TS map.
virtual ~cttsmap(void)
Destructor.
GObservations m_obs
Observation container.
int m_binmax
Map bin number where map computation should end.
std::string m_srcname
Name of source which is moved around.
Base class for likelihood tools.
GModel * m_testsource
Pointer to test source for TS computation.
GOptimizerLM m_opt
Optimizer.