Commit 1dd2d7df210e1c84ed3751ca58c7684beaf3b5b2
1 parent
51949fa1
add execute() mathod and use GObservation::name() instead of GObservation::obsname()
Showing
3 changed files
with
33 additions
and
8 deletions
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -137,10 +137,31 @@ void ctobssim::clear(void) |
| 137 | 137 | // Return |
| 138 | 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 | 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 | 166 | void ctobssim::run(void) |
| 146 | 167 | { |
| ... | ... | @@ -186,8 +207,12 @@ void ctobssim::run(void) |
| 186 | 207 | if (obs != NULL) { |
| 187 | 208 | |
| 188 | 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 | 217 | // Allocate CTA event list and attach it to the observation. |
| 193 | 218 | // Note that the events() method removes any existing event |
| ... | ... | @@ -227,6 +252,8 @@ void ctobssim::run(void) |
| 227 | 252 | |
| 228 | 253 | /***********************************************************************//** |
| 229 | 254 | * @brief Save simulated observation |
| 255 | + * | |
| 256 | + * This method saves the results. | |
| 230 | 257 | ***************************************************************************/ |
| 231 | 258 | void ctobssim::save(void) |
| 232 | 259 | { | ... | ... |
src/ctobssim/ctobssim.hpp
src/ctobssim/main.cpp
| ... | ... | @@ -40,11 +40,8 @@ int main (int argc, char *argv[]) |
| 40 | 40 | |
| 41 | 41 | // Run application |
| 42 | 42 | try { |
| 43 | - // Run application | |
| 44 | - application.run(); | |
| 45 | - | |
| 46 | - // Save results | |
| 47 | - application.save(); | |
| 43 | + // Execute application | |
| 44 | + application.execute(); | |
| 48 | 45 | |
| 49 | 46 | // Signal success |
| 50 | 47 | rc = 0; | ... | ... |