Commit 7f5315dfa342193bf576551a4cc88e03af5102fe
1 parent
a1be2960
Dump total number of simulated counts in log file.
Showing
1 changed file
with
12 additions
and
0 deletions
src/ctobssim/ctobssim.cpp
| @@ -324,12 +324,24 @@ void ctobssim::run(void) | @@ -324,12 +324,24 @@ void ctobssim::run(void) | ||
| 324 | // Increment counter | 324 | // Increment counter |
| 325 | n_observations++; | 325 | n_observations++; |
| 326 | 326 | ||
| 327 | + // Save number of events before entering simulation | ||
| 328 | + int events_before = obs->events()->size(); | ||
| 329 | + | ||
| 327 | // Simulate source events | 330 | // Simulate source events |
| 328 | simulate_source(obs, m_obs.models(), m_rans[i], &wrklog); | 331 | simulate_source(obs, m_obs.models(), m_rans[i], &wrklog); |
| 329 | 332 | ||
| 330 | // Simulate source events | 333 | // Simulate source events |
| 331 | simulate_background(obs, m_obs.models(), m_rans[i], &wrklog); | 334 | simulate_background(obs, m_obs.models(), m_rans[i], &wrklog); |
| 332 | 335 | ||
| 336 | + // Dump simulation results | ||
| 337 | + if (logNormal()) { | ||
| 338 | + wrklog << gammalib::parformat("MC events"); | ||
| 339 | + wrklog << obs->events()->size() - events_before; | ||
| 340 | + wrklog << " (all models)"; | ||
| 341 | + wrklog << std::endl; | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + | ||
| 333 | } // endif: CTA observation found | 345 | } // endif: CTA observation found |
| 334 | 346 | ||
| 335 | } // endfor: looped over observations | 347 | } // endfor: looped over observations |