Commit a19727e552bdba306fc0b0bc1be8d81f81ecc62f
1 parent
0cce0e45
Fix instrument response for LAT (#3203)
Showing
2 changed files
with
69 additions
and
1 deletions
inst/lat/include/GLATResponse.hpp
| @@ -110,6 +110,14 @@ private: | @@ -110,6 +110,14 @@ private: | ||
| 110 | void copy_members(const GLATResponse& rsp); | 110 | void copy_members(const GLATResponse& rsp); |
| 111 | void free_members(void); | 111 | void free_members(void); |
| 112 | 112 | ||
| 113 | + // Overloaded virtual base class methods | ||
| 114 | + virtual double irf_ptsrc(const GEvent& event, | ||
| 115 | + const GSource& source, | ||
| 116 | + const GObservation& obs) const; | ||
| 117 | + virtual double irf_diffuse(const GEvent& event, | ||
| 118 | + const GSource& source, | ||
| 119 | + const GObservation& obs) const; | ||
| 120 | + | ||
| 113 | // Private members | 121 | // Private members |
| 114 | std::string m_rspname; //!< Name of the instrument response | 122 | std::string m_rspname; //!< Name of the instrument response |
| 115 | bool m_force_mean; //!< Use mean PSF in any case | 123 | bool m_force_mean; //!< Use mean PSF in any case |
inst/lat/src/GLATResponse.cpp
| @@ -830,7 +830,7 @@ void GLATResponse::copy_members(const GLATResponse& rsp) | @@ -830,7 +830,7 @@ void GLATResponse::copy_members(const GLATResponse& rsp) | ||
| 830 | for (int i = 0; i < rsp.m_aeff.size(); ++i) { | 830 | for (int i = 0; i < rsp.m_aeff.size(); ++i) { |
| 831 | m_aeff.push_back(rsp.m_aeff[i]->clone()); | 831 | m_aeff.push_back(rsp.m_aeff[i]->clone()); |
| 832 | } | 832 | } |
| 833 | - | 833 | + |
| 834 | // Clone Psf response components | 834 | // Clone Psf response components |
| 835 | m_psf.clear(); | 835 | m_psf.clear(); |
| 836 | for (int i = 0; i < rsp.m_psf.size(); ++i) { | 836 | for (int i = 0; i < rsp.m_psf.size(); ++i) { |
| @@ -890,3 +890,63 @@ void GLATResponse::free_members(void) | @@ -890,3 +890,63 @@ void GLATResponse::free_members(void) | ||
| 890 | // Return | 890 | // Return |
| 891 | return; | 891 | return; |
| 892 | } | 892 | } |
| 893 | + | ||
| 894 | + | ||
| 895 | +/***********************************************************************//** | ||
| 896 | + * @brief Return instrument response to point source | ||
| 897 | + * | ||
| 898 | + * @param[in] event Observed event. | ||
| 899 | + * @param[in] source Source. | ||
| 900 | + * @param[in] obs Observation. | ||
| 901 | + * @return Instrument response to point source. | ||
| 902 | + * | ||
| 903 | + * Returns the instrument response to a point source. | ||
| 904 | + ***************************************************************************/ | ||
| 905 | +double GLATResponse::irf_ptsrc(const GEvent& event, | ||
| 906 | + const GSource& source, | ||
| 907 | + const GObservation& obs) const | ||
| 908 | +{ | ||
| 909 | + // Initialise IRF value | ||
| 910 | + double irf = 0.0; | ||
| 911 | + | ||
| 912 | + // Get IRF value | ||
| 913 | + if (event.is_atom()) { | ||
| 914 | + irf = irf_spatial_atom(static_cast<const GLATEventAtom&>(event), source, obs); | ||
| 915 | + } | ||
| 916 | + else { | ||
| 917 | + irf = irf_spatial_bin(static_cast<const GLATEventBin&>(event), source, obs); | ||
| 918 | + } | ||
| 919 | + | ||
| 920 | + // Return IRF value | ||
| 921 | + return irf; | ||
| 922 | +} | ||
| 923 | + | ||
| 924 | + | ||
| 925 | +/***********************************************************************//** | ||
| 926 | + * @brief Return instrument response to diffuse source | ||
| 927 | + * | ||
| 928 | + * @param[in] event Observed event. | ||
| 929 | + * @param[in] source Source. | ||
| 930 | + * @param[in] obs Observation. | ||
| 931 | + * @return Instrument response to point source. | ||
| 932 | + * | ||
| 933 | + * Returns the instrument response to a diffuse source. | ||
| 934 | + ***************************************************************************/ | ||
| 935 | +double GLATResponse::irf_diffuse(const GEvent& event, | ||
| 936 | + const GSource& source, | ||
| 937 | + const GObservation& obs) const | ||
| 938 | +{ | ||
| 939 | + // Initialise IRF value | ||
| 940 | + double irf = 0.0; | ||
| 941 | + | ||
| 942 | + // Get IRF value | ||
| 943 | + if (event.is_atom()) { | ||
| 944 | + irf = irf_spatial_atom(static_cast<const GLATEventAtom&>(event), source, obs); | ||
| 945 | + } | ||
| 946 | + else { | ||
| 947 | + irf = irf_spatial_bin(static_cast<const GLATEventBin&>(event), source, obs); | ||
| 948 | + } | ||
| 949 | + | ||
| 950 | + // Return IRF value | ||
| 951 | + return irf; | ||
| 952 | +} |