ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctcubemask.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctcubemask - Cube filter tool *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2014-2022 by Chia-Chun Lu *
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 ctcubemask.hpp
23  * @brief Cube filter tool definition
24  * @author Chia-Chun Lu
25  */
26 
27 #ifndef CTCUBEMASK_HPP
28 #define CTCUBEMASK_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <vector>
32 #include <string>
33 #include "GammaLib.hpp"
34 #include "GCTALib.hpp"
35 #include "ctobservation.hpp"
36 #include "GCTAEventCube.hpp"
37 
38 /* __Definitions _________________________________________________________ */
39 #define CTCUBEMASK_NAME "ctcubemask"
40 
41 
42 /***********************************************************************//**
43  * @class ctcubemask
44  *
45  * @brief Cube filter tool
46  ***************************************************************************/
47 class ctcubemask : public ctobservation {
48 
49 public:
50  // Constructors and destructors
51  ctcubemask(void);
52  explicit ctcubemask(const GObservations& obs);
53  ctcubemask(int argc, char *argv[]);
54  ctcubemask(const ctcubemask& app);
55  virtual ~ctcubemask(void);
56 
57  // Operators
58  ctcubemask& operator=(const ctcubemask& app);
59 
60  // Methods
61  void clear(void);
62  void process(void);
63  void save(void);
64  void publish(const std::string& name = "");
65 
66 protected:
67  // Protected methods
68  void init_members(void);
69  void copy_members(const ctcubemask& app);
70  void free_members(void);
71  void get_parameters(void);
72  void apply_mask(GCTAObservation* obs);
73  std::string region_string(const GSkyRegion& region) const;
74  std::string set_outfile_name(const std::string& filename) const;
75  void save_fits(void);
76  void save_xml(void);
77 
78  // User parameters
79  GFilename m_outcube; //!< Output event list or XML file
80  std::string m_prefix; //!< Prefix for multiple counts maps
81  double m_emin; //!< Lower energy
82  double m_emax; //!< Upper energy
83  bool m_publish; //!< Publish counts cube?
84 
85  // Protected members
86  std::vector<std::string> m_infiles; //!< Input event filenames
87  bool m_select_energy; //!< Perform energy selection
88 };
89 
90 #endif /* CTCUBEMASK_HPP */
void apply_mask(GCTAObservation *obs)
Apply mask to event cube.
Definition: ctcubemask.cpp:478
void init_members(void)
Initialise class members.
Definition: ctcubemask.cpp:366
bool m_select_energy
Perform energy selection.
Definition: ctcubemask.hpp:87
GFilename m_outcube
Output event list or XML file.
Definition: ctcubemask.hpp:79
Cube filter tool.
Definition: ctcubemask.hpp:47
const GObservations & obs(void) const
Return observation container.
ctcubemask & operator=(const ctcubemask &app)
Assignment operator.
Definition: ctcubemask.cpp:144
void save_xml(void)
Save counts cube(s) in XML format.
Definition: ctcubemask.cpp:711
void publish(const std::string &name="")
Publish counts cube.
Definition: ctcubemask.cpp:324
std::string m_prefix
Prefix for multiple counts maps.
Definition: ctcubemask.hpp:80
void save(void)
Save the masked event cube(s)
Definition: ctcubemask.cpp:288
std::string region_string(const GSkyRegion &region) const
Return region string.
Definition: ctcubemask.cpp:622
void copy_members(const ctcubemask &app)
Copy class members.
Definition: ctcubemask.cpp:389
void get_parameters(void)
Get application parameters.
Definition: ctcubemask.cpp:427
Observation tool base class interface definition.
Base class for observation tools.
ctcubemask(void)
Void constructor.
Definition: ctcubemask.cpp:53
virtual ~ctcubemask(void)
Destructor.
Definition: ctcubemask.cpp:122
double m_emin
Lower energy.
Definition: ctcubemask.hpp:81
std::vector< std::string > m_infiles
Input event filenames.
Definition: ctcubemask.hpp:86
void process(void)
Mask data cube.
Definition: ctcubemask.cpp:208
void clear(void)
Clear ctcubemask tool.
Definition: ctcubemask.cpp:179
std::string set_outfile_name(const std::string &filename) const
Set output file name.
Definition: ctcubemask.cpp:652
bool m_publish
Publish counts cube?
Definition: ctcubemask.hpp:83
void save_fits(void)
Save counts cube in FITS format.
Definition: ctcubemask.cpp:671
void free_members(void)
Delete class members.
Definition: ctcubemask.cpp:410
double m_emax
Upper energy.
Definition: ctcubemask.hpp:82