ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctbkgcube.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctbkgcube - Background cube generation 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 ctbkgcube.hpp
23  * @brief Background cube generation tool definition
24  * @author Chia-Chun Lu
25  */
26 
27 #ifndef CTBKGCUBE_HPP
28 #define CTBKGCUBE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "GammaLib.hpp"
32 #include "GCTALib.hpp"
33 #include "ctobservation.hpp"
34 
35 /* __Definitions _________________________________________________________ */
36 #define CTBKGCUBE_NAME "ctbkgcube"
37 
38 
39 /***********************************************************************//**
40  * @class ctbkgcube
41  *
42  * @brief Background cube generation tool
43  ***************************************************************************/
44 class ctbkgcube : public ctobservation {
45 
46 public:
47  // Constructors and destructors
48  ctbkgcube(void);
49  explicit ctbkgcube(const GObservations& obs);
50  ctbkgcube(int argc, char *argv[]);
51  ctbkgcube(const ctbkgcube& app);
52  virtual ~ctbkgcube(void);
53 
54  // Operators
55  ctbkgcube& operator=(const ctbkgcube& app);
56 
57  // Methods
58  void clear(void);
59  void process(void);
60  void save(void);
61  void publish(const std::string& name = "");
62  void cntcube(const GCTAEventCube& cntcube);
63  const GCTACubeBackground& bkgcube(void) const;
64  const GModels& models(void) const;
65 
66 protected:
67  // Protected methods
68  void init_members(void);
69  void copy_members(const ctbkgcube& app);
70  void free_members(void);
71  void get_parameters(void);
72 
73  // User parameters
74  GFilename m_outcube; //!< Filename of output cube
75  GFilename m_outmodel; //!< Filename of output XML model
76  bool m_publish; //!< Publish background cube?
77  GChatter m_chatter; //!< Chattiness
78 
79  // Protected members
80  GCTACubeBackground m_background; //!< Background cube
81  GCTAEventCube m_cube; //!< Event cube
82  GModels m_bkgmdl; //!< CTA background models
83  GModels m_outmdl; //!< Output models
84 };
85 
86 
87 /***********************************************************************//**
88  * @brief Set event cube
89  *
90  * @param[in] cntcube Event cube.
91  ***************************************************************************/
92 inline
93 void ctbkgcube::cntcube(const GCTAEventCube& cntcube)
94 {
95  // Set counts cube
96  m_cube = cntcube;
97 
98  // Return
99  return;
100 }
101 
102 
103 /***********************************************************************//**
104  * @brief Return background response cube containing background rate
105  *
106  * @return Background response cube.
107  ***************************************************************************/
108 inline
109 const GCTACubeBackground& ctbkgcube::bkgcube(void) const
110 {
111  // Return background cube
112  return (m_background);
113 }
114 
115 
116 /***********************************************************************//**
117  * @brief Return background model container
118  *
119  * @return Background model container.
120  ***************************************************************************/
121 inline
122 const GModels& ctbkgcube::models(void) const
123 {
124  // Return background model container
125  return (m_outmdl);
126 }
127 
128 #endif /* CTBKGCUBE_HPP */
void free_members(void)
Delete class members.
Definition: ctbkgcube.cpp:479
ctbkgcube(void)
Void constructor.
Definition: ctbkgcube.cpp:54
GModels m_outmdl
Output models.
Definition: ctbkgcube.hpp:83
Background cube generation tool.
Definition: ctbkgcube.hpp:44
GModels m_bkgmdl
CTA background models.
Definition: ctbkgcube.hpp:82
void cntcube(const GCTAEventCube &cntcube)
Set event cube.
Definition: ctbkgcube.hpp:93
const GObservations & obs(void) const
Return observation container.
void clear(void)
Clear ctbkgcube tool.
Definition: ctbkgcube.cpp:179
const GModels & models(void) const
Return background model container.
Definition: ctbkgcube.hpp:122
GCTAEventCube m_cube
Event cube.
Definition: ctbkgcube.hpp:81
void save(void)
Save background cube.
Definition: ctbkgcube.cpp:350
void process(void)
Generate the background cube(s).
Definition: ctbkgcube.cpp:209
void copy_members(const ctbkgcube &app)
Copy class members.
Definition: ctbkgcube.cpp:457
ctbkgcube & operator=(const ctbkgcube &app)
Assignment operator.
Definition: ctbkgcube.cpp:144
const GCTACubeBackground & bkgcube(void) const
Return background response cube containing background rate.
Definition: ctbkgcube.hpp:109
GCTACubeBackground m_background
Background cube.
Definition: ctbkgcube.hpp:80
Observation tool base class interface definition.
Base class for observation tools.
GChatter m_chatter
Chattiness.
Definition: ctbkgcube.hpp:77
virtual ~ctbkgcube(void)
Destructor.
Definition: ctbkgcube.cpp:122
void init_members(void)
Initialise class members.
Definition: ctbkgcube.cpp:433
GFilename m_outcube
Filename of output cube.
Definition: ctbkgcube.hpp:74
void publish(const std::string &name="")
Publish background cube.
Definition: ctbkgcube.cpp:402
GFilename m_outmodel
Filename of output XML model.
Definition: ctbkgcube.hpp:75
void get_parameters(void)
Get application parameters.
Definition: ctbkgcube.cpp:492
bool m_publish
Publish background cube?
Definition: ctbkgcube.hpp:76