Commit 1dd2d7df210e1c84ed3751ca58c7684beaf3b5b2

Authored by knodlseder
1 parent 51949fa1

add execute() mathod and use GObservation::name() instead of GObservation::obsname()

src/ctobssim/ctobssim.cpp
@@ -137,10 +137,31 @@ void ctobssim::clear(void) @@ -137,10 +137,31 @@ void ctobssim::clear(void)
137 // Return 137 // Return
138 return; 138 return;
139 } 139 }
140 - 140 +
  141 +
  142 +/***********************************************************************//**
  143 + * @brief Execute application
  144 + *
  145 + * This method runs the simulation and saves the results.
  146 + ***************************************************************************/
  147 +void ctobssim::execute(void)
  148 +{
  149 + // Run the simulation
  150 + run();
  151 +
  152 + // Save results
  153 + save();
  154 +
  155 + // Return
  156 + return;
  157 +}
  158 +
141 159
142 /***********************************************************************//** 160 /***********************************************************************//**
143 * @brief Simulate event data 161 * @brief Simulate event data
  162 + *
  163 + * This method runs the simulation. Results are not saved by this method.
  164 + * Invoke "save" to save the results.
144 ***************************************************************************/ 165 ***************************************************************************/
145 void ctobssim::run(void) 166 void ctobssim::run(void)
146 { 167 {
@@ -186,8 +207,12 @@ void ctobssim::run(void) @@ -186,8 +207,12 @@ void ctobssim::run(void)
186 if (obs != NULL) { 207 if (obs != NULL) {
187 208
188 // Write header for observation 209 // Write header for observation
189 - if (logTerse())  
190 - log.header3("Observation "+obs->obsname()); 210 + if (logTerse()) {
  211 + if (obs->name().length() > 1)
  212 + log.header3("Observation "+obs->name());
  213 + else
  214 + log.header3("Observation");
  215 + }
191 216
192 // Allocate CTA event list and attach it to the observation. 217 // Allocate CTA event list and attach it to the observation.
193 // Note that the events() method removes any existing event 218 // Note that the events() method removes any existing event
@@ -227,6 +252,8 @@ void ctobssim::run(void) @@ -227,6 +252,8 @@ void ctobssim::run(void)
227 252
228 /***********************************************************************//** 253 /***********************************************************************//**
229 * @brief Save simulated observation 254 * @brief Save simulated observation
  255 + *
  256 + * This method saves the results.
230 ***************************************************************************/ 257 ***************************************************************************/
231 void ctobssim::save(void) 258 void ctobssim::save(void)
232 { 259 {
src/ctobssim/ctobssim.hpp
@@ -49,6 +49,7 @@ public: @@ -49,6 +49,7 @@ public:
49 49
50 // Methods 50 // Methods
51 void clear(void); 51 void clear(void);
  52 + void execute(void);
52 void run(void); 53 void run(void);
53 void save(void); 54 void save(void);
54 GObservations& obs(void) { return m_obs; } 55 GObservations& obs(void) { return m_obs; }
src/ctobssim/main.cpp
@@ -40,11 +40,8 @@ int main (int argc, char *argv[]) @@ -40,11 +40,8 @@ int main (int argc, char *argv[])
40 40
41 // Run application 41 // Run application
42 try { 42 try {
43 - // Run application  
44 - application.run();  
45 -  
46 - // Save results  
47 - application.save(); 43 + // Execute application
  44 + application.execute();
48 45
49 // Signal success 46 // Signal success
50 rc = 0; 47 rc = 0;