ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
cttsmap.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * cttsmap - TS map calculation tool *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2014-2022 by Michael Mayer *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file cttsmap.hpp
23  * @brief TS map calculation tool interface definition
24  * @author Michael Mayer
25  */
26 
27 #ifndef CTTSMAP_HPP
28 #define CTTSMAP_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "ctlikelihood.hpp"
32 
33 /* __Definitions _________________________________________________________ */
34 #define CTTSMAP_NAME "cttsmap"
35 
36 
37 /***********************************************************************//**
38  * @class cttsmap
39  *
40  * @brief TS map calculation tool
41  *
42  * This class computes a set of maps from any kind of observations:
43  *
44  * - TS map
45  * - Flux map
46  * - Map of spectral index
47  *
48  * The class operates on predefined observation containers, an individual
49  * event list or an observation definition XML file.
50  *
51  * During the computation a putative point-like source is moved along a
52  * grid of coordinates. The best fit results (TS, flux, index) are stored in
53  * maps which are saved in the output FITS files.
54  ***************************************************************************/
55 class cttsmap : public ctlikelihood {
56 
57 public:
58  // Constructors and destructors
59  cttsmap(void);
60  explicit cttsmap(const GObservations& obs);
61  cttsmap(int argc, char *argv[]);
62  cttsmap(const cttsmap& app);
63  virtual ~cttsmap(void);
64 
65  // Operators
66  cttsmap& operator=(const cttsmap& app);
67 
68  // Methods
69  void clear(void);
70  void process(void);
71  void save(void);
72  void publish(const std::string& name = "");
73  const GSkyMap& tsmap(void) const;
74 
75 protected:
76  // Protected methods
77  void init_members(void);
78  void copy_members(const cttsmap& app);
79  void free_members(void);
80  void get_parameters(void);
81  void init_maps(const GSkyMap& map);
82 
83  // User parameters
84  std::string m_srcname; //!< Name of source which is moved around
85  GFilename m_outmap; //!< Output TS map file name
86  bool m_apply_edisp; //!< Apply energy dispersion?
87  bool m_publish; //!< Publish TS map?
88  bool m_errors; //!< Compute and store parameter errors?
89 
90  // Parameters to control speed and job splitting
91  int m_binmin; //!< Map bin number from which computation should start
92  int m_binmax; //!< Map bin number where map computation should end
93  double m_logL0; //!< Likelihood value of null hypothesis
94 
95  // Protected members
96  GSkyMap m_tsmap; //!< TS map
97  GSkyMap m_statusmap; //!< Map of optimizer fit status
98  std::vector<std::string> m_mapnames; //!< Names of free parameters
99  std::vector<GSkyMap> m_maps; //!< Sky maps for each free parameter
100  GModel* m_testsource; //!< Pointer to test source for TS computation
101 };
102 
103 
104 /***********************************************************************//**
105  * @brief Return TS skymap
106  *
107  * @return Reference to TS skymap
108  ***************************************************************************/
109 inline
110 const GSkyMap& cttsmap::tsmap(void) const
111 {
112  return m_tsmap;
113 }
114 
115 #endif /* CTTSMAP_HPP */
void get_parameters(void)
Get application parameters.
Definition: cttsmap.cpp:553
void init_members(void)
Initialise class members.
Definition: cttsmap.cpp:473
void clear(void)
Clear instance.
Definition: cttsmap.cpp:178
void copy_members(const cttsmap &app)
Copy class members.
Definition: cttsmap.cpp:502
bool m_publish
Publish TS map?
Definition: cttsmap.hpp:87
const GObservations & obs(void) const
Return observation container.
cttsmap(void)
Void constructor.
Definition: cttsmap.cpp:54
TS map calculation tool.
Definition: cttsmap.hpp:55
void save(void)
Save maps.
Definition: cttsmap.cpp:388
Likelihood tool base class interface definition.
std::vector< std::string > m_mapnames
Names of free parameters.
Definition: cttsmap.hpp:98
void process(void)
Computes the TS maps.
Definition: cttsmap.cpp:207
void free_members(void)
Delete class members.
Definition: cttsmap.cpp:532
GSkyMap m_statusmap
Map of optimizer fit status.
Definition: cttsmap.hpp:97
GSkyMap m_tsmap
TS map.
Definition: cttsmap.hpp:96
cttsmap & operator=(const cttsmap &app)
Assignment operator.
Definition: cttsmap.cpp:145
bool m_errors
Compute and store parameter errors?
Definition: cttsmap.hpp:88
bool m_apply_edisp
Apply energy dispersion?
Definition: cttsmap.hpp:86
double m_logL0
Likelihood value of null hypothesis.
Definition: cttsmap.hpp:93
std::vector< GSkyMap > m_maps
Sky maps for each free parameter.
Definition: cttsmap.hpp:99
int m_binmin
Map bin number from which computation should start.
Definition: cttsmap.hpp:91
GFilename m_outmap
Output TS map file name.
Definition: cttsmap.hpp:85
void init_maps(const GSkyMap &map)
Initialise skymaps.
Definition: cttsmap.cpp:625
void publish(const std::string &name="")
Publish TS map.
Definition: cttsmap.cpp:442
virtual ~cttsmap(void)
Destructor.
Definition: cttsmap.cpp:123
int m_binmax
Map bin number where map computation should end.
Definition: cttsmap.hpp:92
std::string m_srcname
Name of source which is moved around.
Definition: cttsmap.hpp:84
Base class for likelihood tools.
GModel * m_testsource
Pointer to test source for TS computation.
Definition: cttsmap.hpp:100
const GSkyMap & tsmap(void) const
Return TS skymap.
Definition: cttsmap.hpp:110