From 81a45bf9994e727f9820c7900f477575ef83c699 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste CAYROU Date: Tue, 14 Aug 2012 14:52:29 +0200 Subject: [PATCH] Fix bug with GLog --- src/ctobssim/ctobssim.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index fb1efcb..e3654af 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -267,17 +267,23 @@ void ctobssim::run(void) #pragma omp parallel { //each thread has his own variable; - GLog wrklog(log); + GLog wrklog; + + //Copy configuration + wrklog.date(log.date()); + wrklog.name(log.name()); + + // Set a big value to block the flush + wrklog.max_size(10000000); #pragma omp for // Loop over all observation in the container for (int i = 0; i < m_obs.size(); ++i) { - // Get CTA observation GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Continue only if observation is a CTA observation - if (obs != NULL) { + if (obs != NULL) { // Write header for observation if (logTerse()) { if (obs->name().length() > 1) { @@ -286,20 +292,26 @@ void ctobssim::run(void) else { wrklog.header3("Observation"); } - } + } // Increment counter n_observations++; - + // Simulate source events simulate_source(obs, m_obs.models(),m_rans[i],&wrklog); - + // Simulate source events simulate_background(obs, m_obs.models(),m_rans[i],&wrklog); - + } // endif: CTA observation found - + } // endfor: looped over observations + // Add wrklog to log + #pragma omp critical (log) + { + log<