Commit 28bffd7d9bc7d36594cf5a8b548f1e8fe53d8cbd
1 parent
4062c155
improve logging
Showing
1 changed file
with
32 additions
and
11 deletions
src/ctbin/ctbin.cpp
| ... | ... | @@ -113,6 +113,10 @@ void ctbin::run(void) |
| 113 | 113 | // Bin data |
| 114 | 114 | bin(); |
| 115 | 115 | |
| 116 | + // Write separator into logger | |
| 117 | + if (logTerse()) | |
| 118 | + log << std::endl; | |
| 119 | + | |
| 116 | 120 | // Return |
| 117 | 121 | return; |
| 118 | 122 | } |
| ... | ... | @@ -146,7 +150,7 @@ void ctbin::get_parameters(void) |
| 146 | 150 | |
| 147 | 151 | |
| 148 | 152 | /***********************************************************************//** |
| 149 | - * @brief Run gtbin application | |
| 153 | + * @brief Bin the data | |
| 150 | 154 | ***************************************************************************/ |
| 151 | 155 | void ctbin::bin(void) |
| 152 | 156 | { |
| ... | ... | @@ -161,15 +165,8 @@ void ctbin::bin(void) |
| 161 | 165 | emax.TeV(m_emax); |
| 162 | 166 | obs.ebounds()->setlog(emin, emax, m_enumbins); |
| 163 | 167 | |
| 164 | - // Setup time range covered by data | |
| 165 | - GTime tstart; | |
| 166 | - GTime tstop; | |
| 167 | - tstart.met(0.0); | |
| 168 | - tstop.met(10000.0); | |
| 169 | - obs.gti()->add(tstart, tstop); | |
| 170 | - | |
| 171 | 168 | // Log observation |
| 172 | - if (logExplicit()) { | |
| 169 | + if (logTerse()) { | |
| 173 | 170 | log << std::endl; |
| 174 | 171 | log.header1("Observation"); |
| 175 | 172 | log << obs << std::endl; |
| ... | ... | @@ -180,6 +177,11 @@ void ctbin::bin(void) |
| 180 | 177 | m_xref, m_yref, m_binsz, m_binsz, |
| 181 | 178 | m_nxpix, m_nypix, m_enumbins); |
| 182 | 179 | |
| 180 | + // Initialise binning statistics | |
| 181 | + int num_outside_map = 0; | |
| 182 | + int num_outside_ebds = 0; | |
| 183 | + int num_in_map = 0; | |
| 184 | + | |
| 183 | 185 | // Fill sky map |
| 184 | 186 | GCTAEventList* events = (GCTAEventList*)obs.events(); |
| 185 | 187 | for (GCTAEventList::iterator event = events->begin(); event != events->end(); ++event) { |
| ... | ... | @@ -191,19 +193,38 @@ void ctbin::bin(void) |
| 191 | 193 | |
| 192 | 194 | // Skip if pixel is out of range |
| 193 | 195 | if (pixel.x() < -0.5 || pixel.x() > (m_nxpix-0.5) || |
| 194 | - pixel.y() < -0.5 || pixel.y() > (m_nypix-0.5)) | |
| 196 | + pixel.y() < -0.5 || pixel.y() > (m_nypix-0.5)) { | |
| 197 | + num_outside_map++; | |
| 195 | 198 | continue; |
| 199 | + } | |
| 196 | 200 | |
| 197 | 201 | // Determine energy bin. Skip if we are outside the energy range |
| 198 | 202 | int index = obs.ebounds()->index(event->energy()); |
| 199 | - if (index == -1) | |
| 203 | + if (index == -1) { | |
| 204 | + num_outside_ebds++; | |
| 200 | 205 | continue; |
| 206 | + } | |
| 201 | 207 | |
| 202 | 208 | // Fill event in skymap |
| 203 | 209 | map(pixel, index) += 1.0; |
| 210 | + num_in_map++; | |
| 204 | 211 | |
| 205 | 212 | } // endfor: looped over all events |
| 206 | 213 | |
| 214 | + // Log binning results | |
| 215 | + if (logTerse()) { | |
| 216 | + log << std::endl; | |
| 217 | + log.header1("Binning"); | |
| 218 | + log << parformat("Events in list"); | |
| 219 | + log << obs.events()->size() << std::endl; | |
| 220 | + log << parformat("Events in map"); | |
| 221 | + log << num_in_map << std::endl; | |
| 222 | + log << parformat("Events outside map area"); | |
| 223 | + log << num_outside_map << std::endl; | |
| 224 | + log << parformat("Events outside energy bins"); | |
| 225 | + log << num_outside_ebds << std::endl; | |
| 226 | + } | |
| 227 | + | |
| 207 | 228 | // Log observation |
| 208 | 229 | if (logTerse()) { |
| 209 | 230 | log << std::endl; | ... | ... |