ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
ctselect.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * ctselect - Data selection tool *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2022 by Juergen Knoedlseder *
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 ctselect.hpp
23  * @brief Data selection tool definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef CTSELECT_HPP
28 #define CTSELECT_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <vector>
32 #include <string>
33 #include "GammaLib.hpp"
34 #include "GCTALib.hpp"
35 #include "ctobservation.hpp"
36 
37 /* __Definitions _________________________________________________________ */
38 #define CTSELECT_NAME "ctselect"
39 
40 
41 /***********************************************************************//**
42  * @class ctselect
43  *
44  * @brief Data selection tool
45  ***************************************************************************/
46 class ctselect : public ctobservation {
47 
48 public:
49  // Constructors and destructors
50  ctselect(void);
51  explicit ctselect(const GObservations& obs);
52  ctselect(int argc, char *argv[]);
53  ctselect(const ctselect& app);
54  virtual ~ctselect(void);
55 
56  // Operators
57  ctselect& operator=(const ctselect& app);
58 
59  // Methods
60  void clear(void);
61  void process(void);
62  void save(void);
63  void publish(const std::string& name = "");
64 
65 protected:
66  // Protected methods
67  void init_members(void);
68  void copy_members(const ctselect& app);
69  void free_members(void);
70  void get_parameters(void);
71  void select_events(GCTAObservation* obs,
72  const std::string& filename,
73  const std::string& evtname,
74  const std::string& gtiname);
75  GEbounds set_ebounds(GCTAObservation* obs,
76  const GEbounds& ebounds) const;
77  std::string check_infile(const std::string& filename,
78  const std::string& evtname) const;
79  void save_fits(void);
80  void save_xml(void);
81 
82  // User parameters
83  std::string m_outobs; //!< Output event list or XML file
84  double m_emin; //!< Lower energy
85  double m_emax; //!< Upper energy
86  std::string m_expr; //!< Selection expression
87  std::string m_usethres; //!< Energy threshold type
88  GChatter m_chatter; //!< Chattiness
89  bool m_forcesel; //!< Enforce RoI selection
90 
91  // Protected members
92  std::vector<std::string> m_infiles; //!< Input event filenames
93  std::vector<std::string> m_evtname; //!< Event extension names
94  std::vector<std::string> m_gtiname; //!< GTI extension names
95  GPhases m_phases; //!< Phase intervals
96  bool m_select_energy; //!< Perform energy selection
97  bool m_select_phase; //!< Perform phase selection
98 };
99 
100 #endif /* CTSELECT_HPP */
virtual ~ctselect(void)
Destructor.
Definition: ctselect.cpp:125
void free_members(void)
Delete class members.
Definition: ctselect.cpp:503
void publish(const std::string &name="")
Publish event lists.
Definition: ctselect.cpp:389
double m_emin
Lower energy.
Definition: ctselect.hpp:84
void clear(void)
Clear ctselect tool.
Definition: ctselect.cpp:182
void save_fits(void)
Save event list in FITS format.
Definition: ctselect.cpp:1304
std::vector< std::string > m_gtiname
GTI extension names.
Definition: ctselect.hpp:94
const GObservations & obs(void) const
Return observation container.
void save_xml(void)
Save event list(s) in XML format.
Definition: ctselect.cpp:1364
double m_emax
Upper energy.
Definition: ctselect.hpp:85
std::vector< std::string > m_evtname
Event extension names.
Definition: ctselect.hpp:93
GPhases m_phases
Phase intervals.
Definition: ctselect.hpp:95
ctselect(void)
Void constructor.
Definition: ctselect.cpp:56
bool m_forcesel
Enforce RoI selection.
Definition: ctselect.hpp:89
Observation tool base class interface definition.
Base class for observation tools.
void init_members(void)
Initialise class members.
Definition: ctselect.cpp:447
bool m_select_energy
Perform energy selection.
Definition: ctselect.hpp:96
void process(void)
Select event data.
Definition: ctselect.cpp:215
std::string m_expr
Selection expression.
Definition: ctselect.hpp:86
Data selection tool.
Definition: ctselect.hpp:46
void copy_members(const ctselect &app)
Copy class members.
Definition: ctselect.cpp:476
std::string m_usethres
Energy threshold type.
Definition: ctselect.hpp:87
GEbounds set_ebounds(GCTAObservation *obs, const GEbounds &ebounds) const
Return energy boundaries for a given observation.
Definition: ctselect.cpp:1120
bool m_select_phase
Perform phase selection.
Definition: ctselect.hpp:97
void save(void)
Save the selected event list(s)
Definition: ctselect.cpp:364
GChatter m_chatter
Chattiness.
Definition: ctselect.hpp:88
ctselect & operator=(const ctselect &app)
Assignment operator.
Definition: ctselect.cpp:147
void get_parameters(void)
Get application parameters.
Definition: ctselect.cpp:520
std::string m_outobs
Output event list or XML file.
Definition: ctselect.hpp:83
std::string check_infile(const std::string &filename, const std::string &evtname) const
Check input filename.
Definition: ctselect.cpp:1234
void select_events(GCTAObservation *obs, const std::string &filename, const std::string &evtname, const std::string &gtiname)
Select events.
Definition: ctselect.cpp:673
std::vector< std::string > m_infiles
Input event filenames.
Definition: ctselect.hpp:92