From bb1a20318433a7d0268234d38d6181a74443e7e9 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Tue, 30 Aug 2016 16:09:31 +0200 Subject: [PATCH] Use ctobservation base class for all ctools that hold an observation container --- pyext/ctbkgcube.i | 2 +- pyext/ctbutterfly.i | 4 ++-- pyext/ctcubemask.i | 3 +-- pyext/ctedispcube.i | 2 +- pyext/ctexpcube.i | 2 +- pyext/ctmodel.i | 3 +-- pyext/ctobssim.i | 3 +-- pyext/ctpsfcube.i | 2 +- pyext/ctselect.i | 3 +-- src/ctbin/ctbin.cpp | 2 +- src/ctbkgcube/ctbkgcube.cpp | 17 +++++++---------- src/ctbkgcube/ctbkgcube.hpp | 5 ++--- src/ctbutterfly/ctbutterfly.cpp | 21 +++++++++------------ src/ctbutterfly/ctbutterfly.hpp | 18 ++---------------- src/ctcubemask/ctcubemask.cpp | 17 +++++++---------- src/ctcubemask/ctcubemask.hpp | 17 ++--------------- src/ctedispcube/ctedispcube.cpp | 17 +++++++---------- src/ctedispcube/ctedispcube.hpp | 5 ++--- src/ctexpcube/ctexpcube.cpp | 17 +++++++---------- src/ctexpcube/ctexpcube.hpp | 5 ++--- src/ctmodel/ctmodel.cpp | 18 ++++++++---------- src/ctmodel/ctmodel.hpp | 18 ++---------------- src/ctobssim/ctobssim.cpp | 17 +++++++---------- src/ctobssim/ctobssim.hpp | 18 ++---------------- src/ctpsfcube/ctpsfcube.cpp | 17 +++++++---------- src/ctpsfcube/ctpsfcube.hpp | 5 ++--- src/ctselect/ctselect.cpp | 17 +++++++---------- src/ctselect/ctselect.hpp | 17 ++--------------- 28 files changed, 95 insertions(+), 197 deletions(-) diff --git a/pyext/ctbkgcube.i b/pyext/ctbkgcube.i index ced3574..ca6b16f 100644 --- a/pyext/ctbkgcube.i +++ b/pyext/ctbkgcube.i @@ -34,7 +34,7 @@ * * @brief Background cube generation tool ***************************************************************************/ -class ctbkgcube : public ctool { +class ctbkgcube : public ctobservation { public: // Constructors and destructors ctbkgcube(void); diff --git a/pyext/ctbutterfly.i b/pyext/ctbutterfly.i index cc9f7c9..4d59895 100644 --- a/pyext/ctbutterfly.i +++ b/pyext/ctbutterfly.i @@ -34,7 +34,7 @@ * * @brief Butterfly calculation tool ***************************************************************************/ -class ctbutterfly : public ctool { +class ctbutterfly : public ctlikelihood { public: // Constructors and destructors ctbutterfly(void); @@ -47,7 +47,7 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; + }; diff --git a/pyext/ctcubemask.i b/pyext/ctcubemask.i index 6877bea..a164795 100644 --- a/pyext/ctcubemask.i +++ b/pyext/ctcubemask.i @@ -34,7 +34,7 @@ * * @brief Cube filter tool ***************************************************************************/ -class ctcubemask : public ctool { +class ctcubemask : public ctobservation { public: // Constructors and destructors ctcubemask(void); @@ -48,7 +48,6 @@ public: void run(void); void save(void); void publish(const std::string& name = ""); - const GObservations& obs(void) const; }; diff --git a/pyext/ctedispcube.i b/pyext/ctedispcube.i index 3fd8d20..38a3969 100644 --- a/pyext/ctedispcube.i +++ b/pyext/ctedispcube.i @@ -34,7 +34,7 @@ * * @brief Energy dispersion cube generation tool ***************************************************************************/ -class ctedispcube : public ctool { +class ctedispcube : public ctobservation { public: // Constructors and destructors diff --git a/pyext/ctexpcube.i b/pyext/ctexpcube.i index a672876..ef239ca 100644 --- a/pyext/ctexpcube.i +++ b/pyext/ctexpcube.i @@ -34,7 +34,7 @@ * * @brief Exposure cube generation tool ***************************************************************************/ -class ctexpcube : public ctool { +class ctexpcube : public ctobservation { public: // Constructors and destructors ctexpcube(void); diff --git a/pyext/ctmodel.i b/pyext/ctmodel.i index 9a4e823..69967e8 100644 --- a/pyext/ctmodel.i +++ b/pyext/ctmodel.i @@ -34,7 +34,7 @@ * * @brief Model cube generation tool ***************************************************************************/ -class ctmodel : public ctool { +class ctmodel : public ctobservation { public: // Constructors and destructors ctmodel(void); @@ -48,7 +48,6 @@ public: void run(void); void save(void); void publish(const std::string& name = ""); - const GObservations& obs(void) const; const GCTAEventCube& cube(void) const; void cube(const GCTAEventCube& cube); void models(const GModels& models); diff --git a/pyext/ctobssim.i b/pyext/ctobssim.i index d44fb9f..561bfd4 100644 --- a/pyext/ctobssim.i +++ b/pyext/ctobssim.i @@ -34,7 +34,7 @@ * * @brief Observation simulator tool ***************************************************************************/ -class ctobssim : public ctool { +class ctobssim : public ctobservation { public: // Constructors and destructors ctobssim(void); @@ -47,7 +47,6 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; const double& max_rate(void) const; void max_rate(const double& max_rate); }; diff --git a/pyext/ctpsfcube.i b/pyext/ctpsfcube.i index 0a4f9c6..34896c0 100644 --- a/pyext/ctpsfcube.i +++ b/pyext/ctpsfcube.i @@ -34,7 +34,7 @@ * * @brief PSF cube generation tool ***************************************************************************/ -class ctpsfcube : public ctool { +class ctpsfcube : public ctobservation { public: // Constructors and destructors diff --git a/pyext/ctselect.i b/pyext/ctselect.i index 2b5a236..dae5052 100644 --- a/pyext/ctselect.i +++ b/pyext/ctselect.i @@ -34,7 +34,7 @@ * * @brief Data selection tool ***************************************************************************/ -class ctselect : public ctool { +class ctselect : public ctobservation { public: // Constructors and destructors ctselect(void); @@ -47,7 +47,6 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; }; diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index a049e1a..1287727 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -192,8 +192,8 @@ void ctbin::clear(void) { // Free members free_members(); - this->ctool::free_members(); this->ctobservation::free_members(); + this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) this->GApplication::clear(); diff --git a/src/ctbkgcube/ctbkgcube.cpp b/src/ctbkgcube/ctbkgcube.cpp index ff5443f..80b5b4a 100644 --- a/src/ctbkgcube/ctbkgcube.cpp +++ b/src/ctbkgcube/ctbkgcube.cpp @@ -50,7 +50,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctbkgcube::ctbkgcube(void) : ctool(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) +ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) { // Initialise members init_members(); @@ -69,14 +69,11 @@ ctbkgcube::ctbkgcube(void) : ctool(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) * observations container. ***************************************************************************/ ctbkgcube::ctbkgcube(const GObservations& obs) : - ctool(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) + ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -90,7 +87,7 @@ ctbkgcube::ctbkgcube(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctbkgcube::ctbkgcube(int argc, char *argv[]) : - ctool(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, argc, argv) + ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, argc, argv) { // Initialise members init_members(); @@ -105,7 +102,7 @@ ctbkgcube::ctbkgcube(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctbkgcube::ctbkgcube(const ctbkgcube& app) : ctool(app) +ctbkgcube::ctbkgcube(const ctbkgcube& app) : ctobservation(app) { // Initialise members init_members(); @@ -149,7 +146,7 @@ ctbkgcube& ctbkgcube::operator=(const ctbkgcube& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -182,6 +179,7 @@ void ctbkgcube::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -189,6 +187,7 @@ void ctbkgcube::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -407,7 +406,6 @@ void ctbkgcube::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_background.clear(); m_bkgmdl.clear(); m_outmdl.clear(); @@ -432,7 +430,6 @@ void ctbkgcube::copy_members(const ctbkgcube& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_background = app.m_background; m_bkgmdl = app.m_bkgmdl; m_outmdl = app.m_outmdl; diff --git a/src/ctbkgcube/ctbkgcube.hpp b/src/ctbkgcube/ctbkgcube.hpp index 374f5ba..a2793f0 100644 --- a/src/ctbkgcube/ctbkgcube.hpp +++ b/src/ctbkgcube/ctbkgcube.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTBKGCUBE_NAME "ctbkgcube" @@ -42,7 +42,7 @@ * * @brief Background cube generation tool ***************************************************************************/ -class ctbkgcube : public ctool { +class ctbkgcube : public ctobservation { public: // Constructors and destructors @@ -79,7 +79,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observation container GCTACubeBackground m_background; //!< Background cube GModels m_bkgmdl; //!< CTA background models GModels m_outmdl; //!< Output models diff --git a/src/ctbutterfly/ctbutterfly.cpp b/src/ctbutterfly/ctbutterfly.cpp index 93d336a..454a0bb 100644 --- a/src/ctbutterfly/ctbutterfly.cpp +++ b/src/ctbutterfly/ctbutterfly.cpp @@ -52,7 +52,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctbutterfly::ctbutterfly(void) : ctool(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION) +ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION) { // Initialise members init_members(); @@ -71,14 +71,11 @@ ctbutterfly::ctbutterfly(void) : ctool(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION) * observations container. ***************************************************************************/ ctbutterfly::ctbutterfly(const GObservations& obs) : - ctool(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION) + ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -92,7 +89,7 @@ ctbutterfly::ctbutterfly(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctbutterfly::ctbutterfly(int argc, char *argv[]) : - ctool(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, argc, argv) + ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, argc, argv) { // Initialise members init_members(); @@ -107,7 +104,7 @@ ctbutterfly::ctbutterfly(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctbutterfly::ctbutterfly(const ctbutterfly& app) : ctool(app) +ctbutterfly::ctbutterfly(const ctbutterfly& app) : ctlikelihood(app) { // Initialise members init_members(); @@ -151,7 +148,7 @@ ctbutterfly& ctbutterfly::operator=(const ctbutterfly& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctlikelihood::operator=(app); // Free members free_members(); @@ -184,6 +181,8 @@ void ctbutterfly::clear(void) { // Free members free_members(); + this->ctlikelihood::free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -191,6 +190,8 @@ void ctbutterfly::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); + this->ctlikelihood::init_members(); init_members(); // Write header into logger @@ -512,8 +513,6 @@ void ctbutterfly::init_members(void) m_outfile.clear(); // Initialise protected members - m_opt.clear(); - m_obs.clear(); m_covariance.clear(); m_energies.clear(); m_intensities.clear(); @@ -547,8 +546,6 @@ void ctbutterfly::copy_members(const ctbutterfly& app) m_outfile = app.m_outfile; // Copy protected members - m_obs = app.m_obs; - m_opt = app.m_opt; m_covariance = app.m_covariance; m_energies = app.m_energies; m_intensities = app.m_intensities; diff --git a/src/ctbutterfly/ctbutterfly.hpp b/src/ctbutterfly/ctbutterfly.hpp index a4e8029..4f15ef6 100644 --- a/src/ctbutterfly/ctbutterfly.hpp +++ b/src/ctbutterfly/ctbutterfly.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctlikelihood.hpp" /* __Definitions _________________________________________________________ */ #define CTBUTTERFLY_NAME "ctbutterfly" @@ -53,7 +53,7 @@ * range. The output is saved as an ascii files containing the confidence * band boundaries ***************************************************************************/ -class ctbutterfly : public ctool { +class ctbutterfly : public ctlikelihood { public: // Constructors and destructors @@ -70,7 +70,6 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; protected: // Protected methods @@ -99,8 +98,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GOptimizerLM m_opt; //!< Optimizer - GObservations m_obs; //!< Observation container GMatrixSparse m_covariance; //!< Covariance matrix std::vector m_energies; //!< Energy values std::vector m_intensities; //!< Power law intensity @@ -109,15 +106,4 @@ protected: }; -/***********************************************************************//** - * @brief Return observation container - * - * @return Reference to observation container - ***************************************************************************/ -inline -const GObservations& ctbutterfly::obs(void) const -{ - return m_obs; -} - #endif /* CTBUTTERFLY_HPP */ diff --git a/src/ctcubemask/ctcubemask.cpp b/src/ctcubemask/ctcubemask.cpp index 369592d..3a872df 100644 --- a/src/ctcubemask/ctcubemask.cpp +++ b/src/ctcubemask/ctcubemask.cpp @@ -51,7 +51,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctcubemask::ctcubemask(void) : ctool(CTCUBEMASK_NAME, CTCUBEMASK_VERSION) +ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION) { // Initialise members init_members(); @@ -70,14 +70,11 @@ ctcubemask::ctcubemask(void) : ctool(CTCUBEMASK_NAME, CTCUBEMASK_VERSION) * an observation container. ***************************************************************************/ ctcubemask::ctcubemask(const GObservations& obs) : - ctool(CTCUBEMASK_NAME, CTCUBEMASK_VERSION) + ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -92,7 +89,7 @@ ctcubemask::ctcubemask(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctcubemask::ctcubemask(int argc, char *argv[]) : - ctool(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, argc, argv) + ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, argc, argv) { // Initialise members init_members(); @@ -107,7 +104,7 @@ ctcubemask::ctcubemask(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctcubemask::ctcubemask(const ctcubemask& app) : ctool(app) +ctcubemask::ctcubemask(const ctcubemask& app) : ctobservation(app) { // Initialise members init_members(); @@ -151,7 +148,7 @@ ctcubemask& ctcubemask::operator=(const ctcubemask& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -184,6 +181,7 @@ void ctcubemask::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -191,6 +189,7 @@ void ctcubemask::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -383,7 +382,6 @@ void ctcubemask::init_members(void) m_publish = false; // Initialise protected members - m_obs.clear(); m_infiles.clear(); m_select_energy = true; m_select_roi = true; @@ -411,7 +409,6 @@ void ctcubemask::copy_members(const ctcubemask& app) m_publish = app.m_publish; // Copy protected members - m_obs = app.m_obs; m_infiles = app.m_infiles; m_select_energy = app.m_select_energy; m_select_roi = app.m_select_roi; diff --git a/src/ctcubemask/ctcubemask.hpp b/src/ctcubemask/ctcubemask.hpp index b1c3bb9..cb9c40b 100644 --- a/src/ctcubemask/ctcubemask.hpp +++ b/src/ctcubemask/ctcubemask.hpp @@ -32,7 +32,7 @@ #include #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTCUBEMASK_NAME "ctcubemask" @@ -44,7 +44,7 @@ * * @brief Cube filter tool ***************************************************************************/ -class ctcubemask : public ctool { +class ctcubemask : public ctobservation { public: // Constructors and destructors @@ -62,7 +62,6 @@ public: void run(void); void save(void); void publish(const std::string& name = ""); - const GObservations& obs(void) const; protected: // Protected methods @@ -87,22 +86,10 @@ protected: bool m_publish; //!< Publish counts cube? // Protected members - GObservations m_obs; //!< Observations container std::vector m_infiles; //!< Input event filenames bool m_select_energy; //!< Perform energy selection bool m_select_roi; //!< Perform ROI selection }; -/***********************************************************************//** - * @brief Return observation container - * - * @return Reference to observation container - ***************************************************************************/ -inline -const GObservations& ctcubemask::obs(void) const -{ - return m_obs; -} - #endif /* CTCUBEMASK_HPP */ diff --git a/src/ctedispcube/ctedispcube.cpp b/src/ctedispcube/ctedispcube.cpp index 42385e3..0f804d7 100644 --- a/src/ctedispcube/ctedispcube.cpp +++ b/src/ctedispcube/ctedispcube.cpp @@ -52,7 +52,7 @@ * * Constructs an empty energy dispersion tool. ***************************************************************************/ -ctedispcube::ctedispcube(void) : ctool(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION) +ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION) { // Initialise members init_members(); @@ -71,14 +71,11 @@ ctedispcube::ctedispcube(void) : ctool(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION) * in an observation container @p obs. ***************************************************************************/ ctedispcube::ctedispcube(const GObservations& obs) : - ctool(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION) + ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -95,7 +92,7 @@ ctedispcube::ctedispcube(const GObservations& obs) : * on the command line. ***************************************************************************/ ctedispcube::ctedispcube(int argc, char *argv[]) : - ctool(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, argc, argv) + ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, argc, argv) { // Initialise members init_members(); @@ -113,7 +110,7 @@ ctedispcube::ctedispcube(int argc, char *argv[]) : * Constructs an energy dispersion tool by copying anothere energy * dispersion tool. ***************************************************************************/ -ctedispcube::ctedispcube(const ctedispcube& app) : ctool(app) +ctedispcube::ctedispcube(const ctedispcube& app) : ctobservation(app) { // Initialise members init_members(); @@ -161,7 +158,7 @@ ctedispcube& ctedispcube::operator=(const ctedispcube& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -194,6 +191,7 @@ void ctedispcube::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -201,6 +199,7 @@ void ctedispcube::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -299,7 +298,6 @@ void ctedispcube::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_edispcube.clear(); // Return @@ -320,7 +318,6 @@ void ctedispcube::copy_members(const ctedispcube& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_edispcube = app.m_edispcube; // Return diff --git a/src/ctedispcube/ctedispcube.hpp b/src/ctedispcube/ctedispcube.hpp index fce7c9f..5a89c25 100644 --- a/src/ctedispcube/ctedispcube.hpp +++ b/src/ctedispcube/ctedispcube.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTEDISPCUBE_NAME "ctedispcube" @@ -42,7 +42,7 @@ * * @brief Energy dispersion cube generation tool ***************************************************************************/ -class ctedispcube : public ctool { +class ctedispcube : public ctobservation { public: // Constructors and destructors @@ -75,7 +75,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observation container GCTACubeEdisp m_edispcube; //!< Energy dispersion cube }; diff --git a/src/ctexpcube/ctexpcube.cpp b/src/ctexpcube/ctexpcube.cpp index 3167bba..01cf5d7 100644 --- a/src/ctexpcube/ctexpcube.cpp +++ b/src/ctexpcube/ctexpcube.cpp @@ -50,7 +50,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctexpcube::ctexpcube(void) : ctool(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) +ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) { // Initialise members init_members(); @@ -69,14 +69,11 @@ ctexpcube::ctexpcube(void) : ctool(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) * observations container. ***************************************************************************/ ctexpcube::ctexpcube(const GObservations& obs) : - ctool(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) + ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -90,7 +87,7 @@ ctexpcube::ctexpcube(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctexpcube::ctexpcube(int argc, char *argv[]) : - ctool(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, argc, argv) + ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, argc, argv) { // Initialise members init_members(); @@ -105,7 +102,7 @@ ctexpcube::ctexpcube(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctexpcube::ctexpcube(const ctexpcube& app) : ctool(app) +ctexpcube::ctexpcube(const ctexpcube& app) : ctobservation(app) { // Initialise members init_members(); @@ -149,7 +146,7 @@ ctexpcube& ctexpcube::operator=(const ctexpcube& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -182,6 +179,7 @@ void ctexpcube::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -189,6 +187,7 @@ void ctexpcube::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -322,7 +321,6 @@ void ctexpcube::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_expcube.clear(); // Return @@ -344,7 +342,6 @@ void ctexpcube::copy_members(const ctexpcube& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_expcube = app.m_expcube; // Return diff --git a/src/ctexpcube/ctexpcube.hpp b/src/ctexpcube/ctexpcube.hpp index 108c3c6..c2e159f 100644 --- a/src/ctexpcube/ctexpcube.hpp +++ b/src/ctexpcube/ctexpcube.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTEXPCUBE_NAME "ctexpcube" @@ -42,7 +42,7 @@ * * @brief Exposure cube generation tool ***************************************************************************/ -class ctexpcube : public ctool { +class ctexpcube : public ctobservation { public: // Constructors and destructors @@ -77,7 +77,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observation container GCTACubeExposure m_expcube; //!< Exposure cube }; diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index c3b6c0b..dcebcb0 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -53,7 +53,7 @@ const GEnergy g_energy_margin(1.0e-12, "TeV"); /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctmodel::ctmodel(void) : ctool(CTMODEL_NAME, CTMODEL_VERSION) +ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION) { // Initialise members init_members(); @@ -71,14 +71,12 @@ ctmodel::ctmodel(void) : ctool(CTMODEL_NAME, CTMODEL_VERSION) * This method creates an instance of the class by copying an existing * observations container. ***************************************************************************/ -ctmodel::ctmodel(const GObservations& obs) : ctool(CTMODEL_NAME, CTMODEL_VERSION) +ctmodel::ctmodel(const GObservations& obs) : + ctobservation(CTMODEL_NAME, CTMODEL_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -92,7 +90,7 @@ ctmodel::ctmodel(const GObservations& obs) : ctool(CTMODEL_NAME, CTMODEL_VERSION * @param[in] argv Array of command line arguments. ***************************************************************************/ ctmodel::ctmodel(int argc, char *argv[]) : - ctool(CTMODEL_NAME, CTMODEL_VERSION, argc, argv) + ctobservation(CTMODEL_NAME, CTMODEL_VERSION, argc, argv) { // Initialise members init_members(); @@ -107,7 +105,7 @@ ctmodel::ctmodel(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctmodel::ctmodel(const ctmodel& app) : ctool(app) +ctmodel::ctmodel(const ctmodel& app) : ctobservation(app) { // Initialise members init_members(); @@ -151,7 +149,7 @@ ctmodel& ctmodel::operator=(const ctmodel& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -184,6 +182,7 @@ void ctmodel::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -191,6 +190,7 @@ void ctmodel::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -391,7 +391,6 @@ void ctmodel::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_cube.clear(); m_gti.clear(); m_has_cube = false; @@ -417,7 +416,6 @@ void ctmodel::copy_members(const ctmodel& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_cube = app.m_cube; m_gti = app.m_gti; m_has_cube = app.m_has_cube; diff --git a/src/ctmodel/ctmodel.hpp b/src/ctmodel/ctmodel.hpp index fe2cebc..e350b59 100644 --- a/src/ctmodel/ctmodel.hpp +++ b/src/ctmodel/ctmodel.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTMODEL_NAME "ctmodel" @@ -51,7 +51,7 @@ * in form of FITS files (model maps) and an updated observation definition * XML file. ***************************************************************************/ -class ctmodel : public ctool { +class ctmodel : public ctobservation { public: // Constructors and destructors @@ -69,7 +69,6 @@ public: void run(void); void save(void); void publish(const std::string& name = ""); - const GObservations& obs(void) const; const GCTAEventCube& cube(void) const; void cube(const GCTAEventCube& cube); void models(const GModels& models); @@ -91,7 +90,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observation container GCTAEventCube m_cube; //!< Model cube GGti m_gti; //!< Model cube GTIs bool m_has_cube; //!< Signal if cube has been set or loaded @@ -101,18 +99,6 @@ protected: /***********************************************************************//** - * @brief Return observation container - * - * @return Reference to observation container. - ***************************************************************************/ -inline -const GObservations& ctmodel::obs(void) const -{ - return m_obs; -} - - -/***********************************************************************//** * @brief Return model cube * * @return Reference to model cube. diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index aafd088..8cee905 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -63,7 +63,7 @@ const double g_roi_margin = 0.5; //!< Simulation radius margin (degrees) * * Constructs an empty ctobssim tool. ***************************************************************************/ -ctobssim::ctobssim(void) : ctool(CTOBSSIM_NAME, CTOBSSIM_VERSION) +ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION) { // Initialise members init_members(); @@ -81,14 +81,11 @@ ctobssim::ctobssim(void) : ctool(CTOBSSIM_NAME, CTOBSSIM_VERSION) * Constructs ctobssim tool from an observation container. ***************************************************************************/ ctobssim::ctobssim(const GObservations& obs) : - ctool(CTOBSSIM_NAME, CTOBSSIM_VERSION) + ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -104,7 +101,7 @@ ctobssim::ctobssim(const GObservations& obs) : * setting. ***************************************************************************/ ctobssim::ctobssim(int argc, char *argv[]) : - ctool(CTOBSSIM_NAME, CTOBSSIM_VERSION, argc, argv) + ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION, argc, argv) { // Initialise members init_members(); @@ -121,7 +118,7 @@ ctobssim::ctobssim(int argc, char *argv[]) : * * Constructs ctobssim tool from another ctobssim instance. ***************************************************************************/ -ctobssim::ctobssim(const ctobssim& app) : ctool(app) +ctobssim::ctobssim(const ctobssim& app) : ctobservation(app) { // Initialise members init_members(); @@ -169,7 +166,7 @@ ctobssim& ctobssim::operator=(const ctobssim& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -202,6 +199,7 @@ void ctobssim::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -209,6 +207,7 @@ void ctobssim::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -484,7 +483,6 @@ void ctobssim::init_members(void) // Initialise protected members m_rans.clear(); - m_obs.clear(); m_save_and_dispose = false; // Set fixed parameters @@ -516,7 +514,6 @@ void ctobssim::copy_members(const ctobssim& app) // Copy protected members m_max_photons = app.m_max_photons; m_rans = app.m_rans; - m_obs = app.m_obs; m_save_and_dispose = app.m_save_and_dispose; m_event_id = app.m_event_id; diff --git a/src/ctobssim/ctobssim.hpp b/src/ctobssim/ctobssim.hpp index 38e0132..dc05e6a 100644 --- a/src/ctobssim/ctobssim.hpp +++ b/src/ctobssim/ctobssim.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTOBSSIM_NAME "ctobssim" @@ -48,7 +48,7 @@ * processed and the save method is called, events FITS files will be written * for each observation. ***************************************************************************/ -class ctobssim : public ctool { +class ctobssim : public ctobservation { public: // Constructors and destructors @@ -65,7 +65,6 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; const double& max_rate(void) const; void max_rate(const double& max_rate); @@ -141,7 +140,6 @@ protected: bool m_apply_edisp; //!< Apply energy dispersion? // Protected members - mutable GObservations m_obs; //!< Observation container mutable bool m_save_and_dispose; //!< Save and dispose immediately int m_max_photons; //!< Maximum number of photons/slice double m_max_rate; //!< Maximum photon rate @@ -151,18 +149,6 @@ protected: /***********************************************************************//** - * @brief Return observation container - * - * @return Reference to observation container - ***************************************************************************/ -inline -const GObservations& ctobssim::obs(void) const -{ - return (m_obs); -} - - -/***********************************************************************//** * @brief Return maximum photon rate * * @return Reference to maximum photon rate. diff --git a/src/ctpsfcube/ctpsfcube.cpp b/src/ctpsfcube/ctpsfcube.cpp index 962132b..7174578 100644 --- a/src/ctpsfcube/ctpsfcube.cpp +++ b/src/ctpsfcube/ctpsfcube.cpp @@ -49,7 +49,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctpsfcube::ctpsfcube(void) : ctool(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) +ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) { // Initialise members init_members(); @@ -68,14 +68,11 @@ ctpsfcube::ctpsfcube(void) : ctool(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) * observations container. ***************************************************************************/ ctpsfcube::ctpsfcube(const GObservations& obs) : - ctool(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) + ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -89,7 +86,7 @@ ctpsfcube::ctpsfcube(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctpsfcube::ctpsfcube(int argc, char *argv[]) : - ctool(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, argc, argv) + ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, argc, argv) { // Initialise members init_members(); @@ -104,7 +101,7 @@ ctpsfcube::ctpsfcube(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctpsfcube::ctpsfcube(const ctpsfcube& app) : ctool(app) +ctpsfcube::ctpsfcube(const ctpsfcube& app) : ctobservation(app) { // Initialise members init_members(); @@ -148,7 +145,7 @@ ctpsfcube& ctpsfcube::operator=(const ctpsfcube& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -181,6 +178,7 @@ void ctpsfcube::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -188,6 +186,7 @@ void ctpsfcube::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -283,7 +282,6 @@ void ctpsfcube::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_psfcube.clear(); // Return @@ -304,7 +302,6 @@ void ctpsfcube::copy_members(const ctpsfcube& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_psfcube = app.m_psfcube; // Return diff --git a/src/ctpsfcube/ctpsfcube.hpp b/src/ctpsfcube/ctpsfcube.hpp index 3079e0f..7169ab4 100644 --- a/src/ctpsfcube/ctpsfcube.hpp +++ b/src/ctpsfcube/ctpsfcube.hpp @@ -30,7 +30,7 @@ /* __ Includes ___________________________________________________________ */ #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTPSFCUBE_NAME "ctpsfcube" @@ -42,7 +42,7 @@ * * @brief PSF cube generation tool ***************************************************************************/ -class ctpsfcube : public ctool { +class ctpsfcube : public ctobservation { public: // Constructors and destructors @@ -75,7 +75,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observation container GCTACubePsf m_psfcube; //!< PSF cube }; diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index f745ebe..95fd4db 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -53,7 +53,7 @@ /***********************************************************************//** * @brief Void constructor ***************************************************************************/ -ctselect::ctselect(void) : ctool(CTSELECT_NAME, CTSELECT_VERSION) +ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, CTSELECT_VERSION) { // Initialise members init_members(); @@ -72,14 +72,11 @@ ctselect::ctselect(void) : ctool(CTSELECT_NAME, CTSELECT_VERSION) * provided in an observation container. ***************************************************************************/ ctselect::ctselect(const GObservations& obs) : - ctool(CTSELECT_NAME, CTSELECT_VERSION) + ctobservation(CTSELECT_NAME, CTSELECT_VERSION, obs) { // Initialise members init_members(); - // Set observations - m_obs = obs; - // Return return; } @@ -94,7 +91,7 @@ ctselect::ctselect(const GObservations& obs) : * @param[in] argv Array of command line arguments. ***************************************************************************/ ctselect::ctselect(int argc, char *argv[]) : - ctool(CTSELECT_NAME, CTSELECT_VERSION, argc, argv) + ctobservation(CTSELECT_NAME, CTSELECT_VERSION, argc, argv) { // Initialise members init_members(); @@ -109,7 +106,7 @@ ctselect::ctselect(int argc, char *argv[]) : * * @param[in] app Application. ***************************************************************************/ -ctselect::ctselect(const ctselect& app) : ctool(app) +ctselect::ctselect(const ctselect& app) : ctobservation(app) { // Initialise members init_members(); @@ -153,7 +150,7 @@ ctselect& ctselect::operator=(const ctselect& app) if (this != &app) { // Copy base class members - this->ctool::operator=(app); + this->ctobservation::operator=(app); // Free members free_members(); @@ -186,6 +183,7 @@ void ctselect::clear(void) { // Free members free_members(); + this->ctobservation::free_members(); this->ctool::free_members(); // Clear base class (needed to conserve tool name and version) @@ -193,6 +191,7 @@ void ctselect::clear(void) // Initialise members this->ctool::init_members(); + this->ctobservation::init_members(); init_members(); // Write header into logger @@ -418,7 +417,6 @@ void ctselect::init_members(void) m_chatter = static_cast(2); // Initialise protected members - m_obs.clear(); m_infiles.clear(); m_evtname.clear(); m_gtiname.clear(); @@ -454,7 +452,6 @@ void ctselect::copy_members(const ctselect& app) m_chatter = app.m_chatter; // Copy protected members - m_obs = app.m_obs; m_infiles = app.m_infiles; m_evtname = app.m_evtname; m_gtiname = app.m_gtiname; diff --git a/src/ctselect/ctselect.hpp b/src/ctselect/ctselect.hpp index 9005101..722dab5 100644 --- a/src/ctselect/ctselect.hpp +++ b/src/ctselect/ctselect.hpp @@ -32,7 +32,7 @@ #include #include "GammaLib.hpp" #include "GCTALib.hpp" -#include "ctool.hpp" +#include "ctobservation.hpp" /* __Definitions _________________________________________________________ */ #define CTSELECT_NAME "ctselect" @@ -44,7 +44,7 @@ * * @brief Data selection tool ***************************************************************************/ -class ctselect : public ctool { +class ctselect : public ctobservation { public: // Constructors and destructors @@ -61,7 +61,6 @@ public: void clear(void); void run(void); void save(void); - const GObservations& obs(void) const; protected: // Protected methods @@ -102,7 +101,6 @@ protected: GChatter m_chatter; //!< Chattiness // Protected members - GObservations m_obs; //!< Observations container std::vector m_infiles; //!< Input event filenames std::vector m_evtname; //!< Event extension names std::vector m_gtiname; //!< GTI extension names @@ -114,15 +112,4 @@ protected: }; -/***********************************************************************//** - * @brief Return observation container - * - * @return Reference to observation container - ***************************************************************************/ -inline -const GObservations& ctselect::obs(void) const -{ - return m_obs; -} - #endif /* CTSELECT_HPP */ -- libgit2 0.21.4