From 1dd2d7df210e1c84ed3751ca58c7684beaf3b5b2 Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Mon, 7 Feb 2011 08:32:12 +0000 Subject: [PATCH] add execute() mathod and use GObservation::name() instead of GObservation::obsname() --- src/ctobssim/ctobssim.cpp | 33 ++++++++++++++++++++++++++++++--- src/ctobssim/ctobssim.hpp | 1 + src/ctobssim/main.cpp | 7 ++----- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 053556c..e73eb15 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -137,10 +137,31 @@ void ctobssim::clear(void) // Return return; } - + + +/***********************************************************************//** + * @brief Execute application + * + * This method runs the simulation and saves the results. + ***************************************************************************/ +void ctobssim::execute(void) +{ + // Run the simulation + run(); + + // Save results + save(); + + // Return + return; +} + /***********************************************************************//** * @brief Simulate event data + * + * This method runs the simulation. Results are not saved by this method. + * Invoke "save" to save the results. ***************************************************************************/ void ctobssim::run(void) { @@ -186,8 +207,12 @@ void ctobssim::run(void) if (obs != NULL) { // Write header for observation - if (logTerse()) - log.header3("Observation "+obs->obsname()); + if (logTerse()) { + if (obs->name().length() > 1) + log.header3("Observation "+obs->name()); + else + log.header3("Observation"); + } // Allocate CTA event list and attach it to the observation. // Note that the events() method removes any existing event @@ -227,6 +252,8 @@ void ctobssim::run(void) /***********************************************************************//** * @brief Save simulated observation + * + * This method saves the results. ***************************************************************************/ void ctobssim::save(void) { diff --git a/src/ctobssim/ctobssim.hpp b/src/ctobssim/ctobssim.hpp index 6bd4b76..a0655ac 100644 --- a/src/ctobssim/ctobssim.hpp +++ b/src/ctobssim/ctobssim.hpp @@ -49,6 +49,7 @@ public: // Methods void clear(void); + void execute(void); void run(void); void save(void); GObservations& obs(void) { return m_obs; } diff --git a/src/ctobssim/main.cpp b/src/ctobssim/main.cpp index a82e390..d64d970 100644 --- a/src/ctobssim/main.cpp +++ b/src/ctobssim/main.cpp @@ -40,11 +40,8 @@ int main (int argc, char *argv[]) // Run application try { - // Run application - application.run(); - - // Save results - application.save(); + // Execute application + application.execute(); // Signal success rc = 0; -- libgit2 0.21.4