Commit 974973c02bfcb535a1d74717c7ad92185ba2e1f5

Authored by knodlseder
1 parent b4f2d809

add FITS file logging

Showing 1 changed file with 20 additions and 2 deletions
src/ctselect/ctselect.cpp
@@ -210,10 +210,17 @@ void ctselect::select(void) @@ -210,10 +210,17 @@ void ctselect::select(void)
210 expression += "[EVENTS]["+selection+"]"; 210 expression += "[EVENTS]["+selection+"]";
211 if (logTerse()) 211 if (logTerse())
212 log << " FITS filename .............: " << expression << std::endl; 212 log << " FITS filename .............: " << expression << std::endl;
213 - 213 +
214 // Open FITS file 214 // Open FITS file
215 GFits file(expression); 215 GFits file(expression);
216 216
  217 + // Log selected FITS file
  218 + if (logExplicit()) {
  219 + log << std::endl;
  220 + log.header1("FITS file content after selection");
  221 + log << file << std::endl;
  222 + }
  223 +
217 // Save output FITS file 224 // Save output FITS file
218 file.saveto(m_outfile, clobber()); 225 file.saveto(m_outfile, clobber());
219 226
@@ -240,9 +247,20 @@ void ctselect::append_gti(void) @@ -240,9 +247,20 @@ void ctselect::append_gti(void)
240 tstop.met(m_tmax); 247 tstop.met(m_tmax);
241 gti.add(tstart, tstop); 248 gti.add(tstart, tstop);
242 249
243 - // Save GTI 250 + // Re-open FITS file
244 GFits file(m_outfile); 251 GFits file(m_outfile);
  252 +
  253 + // Write GTI
245 gti.write(&file); 254 gti.write(&file);
  255 +
  256 + // Log final FITS file
  257 + if (logExplicit()) {
  258 + log << std::endl;
  259 + log.header1("Final FITS file content");
  260 + log << file << std::endl;
  261 + }
  262 +
  263 + // Save and close file
246 file.save(); 264 file.save();
247 file.close(); 265 file.close();
248 266