Commit 7036d72bece4087715b0c5999f021a68d47b4ac4

Authored by Jürgen Knödlseder
1 parent f46e2957

Weight effective area by PSF in GCTAOnOffObservation::compute_arf (#2263)

inst/cta/src/GCTAOnOffObservation.cpp
... ... @@ -1035,7 +1035,7 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation& obs,
1035 1035  
1036 1036 // Continue only if there are ARF bins
1037 1037 if (ntrue > 0) {
1038   -
  1038 +
1039 1039 // Get CTA response pointer. Throw an exception if no response is found
1040 1040 const GCTAResponseIrf* response =
1041 1041 dynamic_cast<const GCTAResponseIrf*>(obs.response());
... ... @@ -1061,10 +1061,6 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation&amp; obs,
1061 1061 // Initialize effective area for this bin
1062 1062 m_arf[i] = 0.0;
1063 1063  
1064   - // Initialize totals
1065   - double totsolid = 0.0;
1066   - double totpsf = 0.0;
1067   -
1068 1064 // Loop over regions
1069 1065 for (int k = 0; k < on.size(); ++k) {
1070 1066  
... ... @@ -1088,43 +1084,30 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation&amp; obs,
1088 1084 double theta = obsdir.dist(pixdir);
1089 1085 double phi = obsdir.posang(pixdir);
1090 1086  
1091   - // Add up effective area
1092   - m_arf[i] += response->aeff(theta,
  1087 + // Compute offset angle to source
  1088 + double delta = srcdir.dist(pixdir);
  1089 +
  1090 + // Get PSF value times the solid angle
  1091 + double psf = response->psf(delta,
  1092 + theta,
1093 1093 phi,
1094 1094 zenith,
1095 1095 azimuth,
1096 1096 logEtrue) * pixsolid;
1097 1097  
1098   - // Add pixel solid angle to total for averaging later
1099   - totsolid += pixsolid;
1100   -
1101   - // Compute offset angle to source
1102   - double delta = srcdir.dist(pixdir);
1103   -
1104   - // Integrate PSF
1105   - totpsf += response->psf(delta,
1106   - theta,
1107   - phi,
1108   - zenith,
1109   - azimuth,
1110   - logEtrue) * pixsolid;
  1098 + // Add up effective area
  1099 + m_arf[i] += response->aeff(theta,
  1100 + phi,
  1101 + zenith,
  1102 + azimuth,
  1103 + logEtrue) * psf;
1111 1104  
1112 1105 } // endfor: looped over all pixels in region map
1113 1106  
1114 1107 } // endfor: looped over all regions
1115 1108  
1116   - // Average effective area over solid angle
1117   - if (totsolid > 0.0) {
1118   - m_arf[i] /= totsolid;
1119   - }
1120   -
1121   - // Correct effective area by containment fraction
1122   - if (totpsf >= 0.0 && totpsf <= 1.0) {
1123   - m_arf[i] *= totpsf;
1124   - }
1125   -
1126 1109 } // endfor: looped over true energies
1127   -
  1110 +
1128 1111 } // endif: there were energy bins
1129 1112  
1130 1113 // Return
... ...