diff --git a/pyext/ctobssim.i b/pyext/ctobssim.i index f3f4cf4..f96c074 100644 --- a/pyext/ctobssim.i +++ b/pyext/ctobssim.i @@ -31,15 +31,19 @@ class ctobssim : public GApplication { public: // Constructors and destructors ctobssim(void); + explicit ctobssim(GObservations obs); ctobssim(int argc, char *argv[]); - ~ctobssim(void); + virtual ~ctobssim(void); // Methods + void clear(void); void run(void); + void save(void); + GObservations& obs(void); void get_parameters(void); - GPhotons simulate_photons(void); - GCTAEventList* simulate_events(const GPhotons& photons); - void save_events(const GCTAEventList* events); + GPhotons simulate_photons(const GCTAObservation* obs, const GModels& models); + void simulate_source(GCTAObservation* obs, const GPhotons& photons); + void simulate_background(GCTAObservation* obs, const GModels& models); }; diff --git a/src/ctobssim/ctobssim.hpp b/src/ctobssim/ctobssim.hpp index 31b26e0..6bd4b76 100644 --- a/src/ctobssim/ctobssim.hpp +++ b/src/ctobssim/ctobssim.hpp @@ -25,28 +25,37 @@ /* __Definitions _________________________________________________________ */ #define CTOBSSIM_NAME "ctobssim" -#define CTOBSSIM_VERSION "00-01-00" +#define CTOBSSIM_VERSION "00-02-00" /***********************************************************************//** * @class ctobssim * - * @brief CTA observation simulator tool interface defintion. + * @brief CTA observation simulator tool interface defintion + * + * This class simulates CTA observation(s) using Monte Carlo sampling of the + * source and background models. The class supports simulation of data of + * multiple CTA observations in one shot. If multiple CTA observations are + * processed and the save method is called, events FITS files will be written + * for each observation. ***************************************************************************/ class ctobssim : public GApplication { public: // Constructors and destructors ctobssim(void); + explicit ctobssim(GObservations obs); ctobssim(int argc, char *argv[]); - ~ctobssim(void); + virtual ~ctobssim(void); // Methods + void clear(void); void run(void); + void save(void); + GObservations& obs(void) { return m_obs; } void get_parameters(void); - GPhotons simulate_photons(void); - GCTAEventList* simulate_events(const GPhotons& photons); - void save_events(const GCTAEventList* events); - void set_events_keywords(GFits* file); + GPhotons simulate_photons(const GCTAObservation* obs, const GModels& models); + void simulate_source(GCTAObservation* obs, const GPhotons& photons); + void simulate_background(GCTAObservation* obs, const GModels& models); protected: // Protected methods @@ -54,23 +63,23 @@ protected: void free_members(void); // User parameters - std::string m_infile; //!< Input model - std::string m_outfile; //!< Output events file - std::string m_caldb; //!< Calibration database repository - std::string m_irf; //!< Instrument response function - int m_seed; //!< Random number generator seed - double m_ra; //!< RA of pointing direction - double m_dec; //!< DEC of pointing direction - double m_rad; //!< FOV radius - double m_tmin; //!< Start time (MET) - double m_tmax; //!< Stop time (MET) - double m_emin; //!< Lower energy (TeV) - double m_emax; //!< Upper energy (TeV) - double m_area; //!< Surface area for simulation (cm2) - GRan m_ran; //!< Random number generator - GCTAPointing m_pnt; //!< CTA pointing - GCTAObservation m_obs; //!< CTA observation - GModels m_models; //!< Models + std::string m_infile; //!< Input model + std::string m_outfile; //!< Output events file + std::string m_caldb; //!< Calibration database repository + std::string m_irf; //!< Instrument response function + int m_seed; //!< Random number generator seed + double m_ra; //!< RA of pointing direction + double m_dec; //!< DEC of pointing direction + double m_rad; //!< FOV radius + double m_tmin; //!< Start time (MET) + double m_tmax; //!< Stop time (MET) + double m_emin; //!< Lower energy (TeV) + double m_emax; //!< Upper energy (TeV) + + // Protected members + double m_area; //!< Surface area for simulation (cm2) + GRan m_ran; //!< Random number generator + GObservations m_obs; //!< Observation container }; #endif /* CTOBSSIM_HPP */ diff --git a/src/ctobssim/main.cpp b/src/ctobssim/main.cpp index 4b6675c..a82e390 100644 --- a/src/ctobssim/main.cpp +++ b/src/ctobssim/main.cpp @@ -20,15 +20,15 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "ctobssim.hpp" /***********************************************************************//** * @brief Main entry point * - * @param[in] argc Number of arguments - * @param[in] argv Arguments + * @param[in] argc Number of arguments. + * @param[in] argv Arguments. ***************************************************************************/ int main (int argc, char *argv[]) { @@ -40,7 +40,13 @@ int main (int argc, char *argv[]) // Run application try { + // Run application application.run(); + + // Save results + application.save(); + + // Signal success rc = 0; } catch (std::exception &e) { @@ -48,7 +54,7 @@ int main (int argc, char *argv[]) // Extract error message std::string message = e.what(); std::string signal = "*** ERROR encounterted in the execution of" - " ctobssim. Run aborted ..."; + " ctobssim. Run aborted ..."; // Write error in logger application.log << signal << std::endl;