/***********************************************************************//** * @brief Read LAT event cube from FITS file. * * @param[in] fits FITS file. * * It is assumed that the counts map resides in the primary extension of the * FITS file, the energy boundaries reside in the EBOUNDS extension and the * Good Time Intervals reside in the GTI extension. The method clears the * object before loading, thus any events residing in the object before * loading will be lost. ***************************************************************************/ void GLATEventCube::read(const GFits& fits) { // Clear object clear(); // Get HDUs const GFitsImage& hdu_cntmap = *fits.image("Primary"); const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS"); const GFitsTable& hdu_gti = *fits.table("GTI"); // Load counts map read_cntmap(hdu_cntmap); // Load energy boundaries read_ebds(hdu_ebounds); // Load GTIs read_gti(hdu_gti); // Load additional source maps for (int i = 1; i < fits.size(); ++i) { if (fits.at(i)->exttype() == GFitsHDU::HT_IMAGE) { const GFitsImage& hdu_srcmap = *fits.image(i); read_srcmap(hdu_srcmap); } } // Return return; }
/***********************************************************************//** * @brief Read CTA event cube from FITS file * * @param[in] fits FITS file. * * Read an event cube from a FITS file. The following HDUs will be read * * COUNTS - Counts cube (or primary extension if COUNTS does not exist) * WEIGHTS - Weights for each counts cube bin (optional) * EBOUNDS - Energy boundaries * GTI - Good Time Intervals * * The method clears the event cube before reading, thus any events residing * in the event cube will be lost. ***************************************************************************/ void GCTAEventCube::read(const GFits& fits) { // Clear object clear(); // Set counts cube HDU std::string counts_hdu("Primary"); if (fits.contains("COUNTS")) { counts_hdu = "COUNTS"; } // Get HDUs const GFitsImage& hdu_cntmap = *fits.image(counts_hdu); const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS"); const GFitsTable& hdu_gti = *fits.table("GTI"); // Load counts map read_cntmap(hdu_cntmap); // Load energy boundaries read_ebds(hdu_ebounds); // Load GTIs read_gti(hdu_gti); // If a WEIGHTS HDU exist then load it from the FITS file ... if (fits.contains("WEIGHTS")) { // Get WEIGHTS HDU const GFitsImage& hdu_weights = *fits.image("WEIGHTS"); // Read HDU m_weights.read(hdu_weights); } // ... otherwise set the weight map to unity else { m_weights = m_map; m_weights = 1.0; } // Return return; }
/***********************************************************************//** * @brief Read CTA event cube from FITS file * * @param[in] file FITS file. * * It is assumed that the counts map resides in the primary extension of the * FITS file, the energy boundaries reside in the EBOUNDS extension and the * Good Time Intervals reside in the GTI extension. The method clears the * object before loading, thus any events residing in the object before * loading will be lost. ***************************************************************************/ void GCTAEventCube::read(const GFits& file) { // Clear object clear(); // Get HDUs GFitsImage* hdu_cntmap = file.image("Primary"); GFitsTable* hdu_ebounds = file.table("EBOUNDS"); GFitsTable* hdu_gti = file.table("GTI"); // Load counts map read_cntmap(hdu_cntmap); // Load energy boundaries read_ebds(hdu_ebounds); // Load GTIs read_gti(hdu_gti); // Return return; }