63#define G_IRF "GCOMResponse::irf(GEvent&, GPhoton&, GObservation&)"
64#define G_IRF_SPATIAL "GCOMResponse::irf_spatial(GEvent&, GSource&, "\
66#define G_NROI "GCOMResponse::nroi(GModelSky&, GEnergy&, GTime&, "\
68#define G_EBOUNDS "GCOMResponse::ebounds(GEnergy&)"
69#define G_BACKPROJECT "GCOMResponse::backproject(GObservation&, GEvents*, "\
71#define G_IRF_PTSRC "GCOMResponse::irf_ptsrc(GModelSky&, GObservation&, "\
73#define G_IRF_RADIAL "GCOMResponse::irf_radial(GModelSky&, GObservation&, "\
75#define G_IRF_ELLIPTICAL "GCOMResponse::irf_elliptical(GModelSky&, "\
76 " GObservation&, GMatrix*)"
77#define G_IRF_DIFFUSE "GCOMResponse::irf_diffuse(GModelSky&, GObservation&, "\
83#define G_IRF_RADIAL_METHOD 2
84#define G_IRF_ELLIPTICAL_METHOD 2
85#define G_IRF_DIFFUSE_DIRECT
143 const std::string& iaqname) :
GResponse()
299 if (observation == NULL) {
300 std::string cls = std::string(
typeid(&obs).name());
301 std::string msg =
"Observation of type \""+cls+
"\" is not a COMPTEL "
302 "observations. Please specify a COMPTEL observation "
310 std::string cls = std::string(
typeid(&cube).name());
311 std::string msg =
"Event cube of type \""+cls+
"\" is not a COMPTEL "
312 "event cube. Please specify a COMPTEL event cube "
320 std::string cls = std::string(
typeid(&event).name());
321 std::string msg =
"Event of type \""+cls+
"\" is not a COMPTEL event. "
322 "Please specify a COMPTEL event as argument.";
328 std::string msg =
"COMPTEL response is empty. Please initialise the "
329 "response with an \"IAQ\".";
333 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
334 "Please initialise the response with a valid "
360 int iphigeo = int(phirat);
361 double eps = phirat - iphigeo - 0.5;
366 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
369 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
374 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
377 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
387 double drg = observation->
drg().
map()(obsDir.
dir(), iphibar);
390 double drx = observation->
drx().
map()(srcDir);
393 double ontime = observation->
ontime();
402 irf = iaq * drg * drx / (ontime * tofcor) * phasecor;
413 #if defined(G_NAN_CHECK)
415 std::cout <<
"*** ERROR: GCOMResponse::irf:";
416 std::cout <<
" NaN/Inf encountered";
417 std::cout <<
" (irf=" <<
irf;
418 std::cout <<
", iaq=" << iaq;
419 std::cout <<
", drg=" << drg;
420 std::cout <<
", drx=" << drx;
422 std::cout << std::endl;
447 const GTime& obsTime,
451 std::string msg =
"Spatial integration of sky model over the data space "
452 "is not implemented.";
475 std::string msg =
"Energy dispersion not implemented.";
536 GFits fits(filename);
586 if (image.
naxis() == 2) {
611 m_iaq.assign(size, 0.0);
614 for (
int i = 0; i < size; ++i) {
628 double phigeo = iphigeo * phigeo_bin + phigeo_min;
629 double omega = omega0 * std::sin(phigeo);
669 image(iphigeo, iphibar) =
m_iaq[i] * omega;
674 image.
card(
"CTYPE1",
"Phigeo",
"Geometrical scatter angle");
676 "[deg] Geometrical scatter angle for reference bin");
678 "[deg] Geometrical scatter angle bin size");
680 "Reference bin of geometrical scatter angle");
681 image.
card(
"CTYPE2",
"Phibar",
"Compton scatter angle");
683 "[deg] Compton scatter angle for reference bin");
686 "Reference bin of Compton scatter angle");
687 image.
card(
"BUNIT",
"Probability per bin",
"Unit of bins");
688 image.
card(
"TELESCOP",
"GRO",
"Name of telescope");
689 image.
card(
"INSTRUME",
"COMPTEL",
"Name of instrument");
690 image.
card(
"ORIGIN",
"GammaLib",
"Origin of FITS file");
691 image.
card(
"OBSERVER",
"Unknown",
"Observer that created FITS file");
775 if (events == NULL) {
776 std::string msg =
"Invalid events pointer. Please specify a "
777 "valid COMPTEL events pointer as argument.";
783 std::string msg =
"Invalid sky map pointer. Please specify a "
784 "pointer to a valid sky map as argument.";
790 if (obs_ptr == NULL) {
791 std::string cls = std::string(
typeid(&obs).name());
792 std::string msg =
"Observation of type \""+cls+
"\" is not a COMPTEL "
793 "observations. Please specify a COMPTEL observation "
801 std::string cls = std::string(
typeid(*events).name());
802 std::string msg =
"Events of type \""+cls+
"\" is not a COMPTEL event "
803 "cube. Please specify an event cube.";
809 std::string msg =
"COMPTEL response is empty. Please initialise the "
810 "response with an \"IAQ\".";
814 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
815 "Please initialise the response with a valid "
826 int nevents = dri.
size();
831 std::string msg =
"DRI has "+
gammalib::str(nphibar)+
" Phibar layers "
833 "bins. Please specify a compatible IAQ.";
840 double omega0 = 2.0 * std::sin(0.5 * phigeo_bin);
845 double iaq_norm = obs_ptr->
deadc() /
850 std::vector<GSkyDir> dirs;
851 std::vector<double> drxs;
852 dirs.reserve(map->
npix());
853 drxs.reserve(map->
npix());
854 for (
int isky = 0; isky < map->
npix(); ++isky) {
860 dirs.push_back(skyDir);
864 drxs.push_back(drx(skyDir));
876 for (
int ipix = 0; ipix < npix; ++ipix) {
882 for (
int isky = 0; isky < map->
npix(); ++isky) {
888 double phigeo = chipsi.
dist_deg(skyDir);
892 int iphigeo = int(phirat);
893 double eps = phirat - iphigeo - 0.5;
901 double drx_value = drxs[isky];
904 for (
int iphibar = 0; iphibar < nphibar; ++iphibar) {
907 int idri = ipix + iphibar * npix;
910 if (dri[idri] == 0.0) {
923 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
926 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
931 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
934 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
944 double irf = iaq * drg[idri] * iaq_norm * drx_value;
948 (*map)(isky) +=
irf * dri[idri];
950 (*map)(isky,1) +=
irf;
980 result.append(
"=== GCOMResponse ===");
1133 for (
int ipsi = 0, ifaq = 0; ipsi < bins; ++ipsi) {
1138 double psi2 = psi * psi;
1141 for (
int ichi = 0; ichi < bins; ++ichi, ++ifaq) {
1148 double phigeo = std::sqrt(chi*chi + psi2);
1152 double cos_zenith = std::cos(zenith);
1153 double sin_zenith = std::sin(zenith);
1154 double azimuth = 0.0 - std::atan2(psi_rad, chi_rad);
1155 double cos_phi = std::cos(azimuth);
1156 double sin_phi = std::sin(azimuth);
1158 sin_phi * sin_zenith,
1166 int iphigeo = int(phirat);
1167 double eps = phirat - iphigeo - 0.5;
1185 faq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
1188 faq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
1193 faq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
1196 faq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
1209 m_faq(ifaq, iphibar) = faq;
1225 #if defined(G_DEBUG_COMPUTE_FAQ)
1226 std::cout <<
"GCOMResponse::compute_faq" << std::endl;
1229 double iaq_sum = 0.0;
1230 double faq_sum = 0.0;
1233 iaq_sum +=
m_iaq[i];
1235 for (
int ipix = 0; ipix <
m_faq.
npix(); ++ipix) {
1236 faq_sum +=
m_faq(ipix, iphibar);
1238 std::cout <<
"iphibar=" << iphibar;
1239 std::cout <<
" iaq=" << iaq_sum;
1240 std::cout <<
" faq=" << faq_sum;
1241 std::cout <<
" ratio=" << faq_sum/iaq_sum << std::endl;
1283 if (obs_ptr == NULL) {
1284 std::string cls = std::string(
typeid(&obs).name());
1285 std::string msg =
"Observation of type \""+cls+
"\" is not a COMPTEL "
1286 "observations. Please specify a COMPTEL observation "
1294 std::string msg =
"Observation \""+obs.
name()+
"\" ("+obs.
id()+
") does "
1295 "not contain a COMPTEL event cube. Please specify "
1296 "a COMPTEL observation containing and event cube.";
1301 if (
m_iaq.empty()) {
1302 std::string msg =
"COMPTEL response is empty. Please initialise the "
1303 "response with an \"IAQ\".";
1307 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
1308 "Please initialise the response with a valid "
1315 int nphibar = cube->
naxis(2);
1316 int nevents = cube->
size();
1321 std::string msg =
"DRE has "+
gammalib::str(nphibar)+
" Phibar layers "
1323 "bins. Please specify a compatible IAQ.";
1335 double iaq_norm = obs_ptr->
drx().
map()(srcDir) * obs_ptr->
deadc() /
1343 for (
int ipix = 0; ipix < npix; ++ipix) {
1356 double phigeo = srcDir.
dist_deg(phigeoDir);
1360 int iphigeo = int(phirat);
1361 double eps = phirat - iphigeo - 0.5;
1368 for (
int iphibar = 0; iphibar < nphibar; ++iphibar) {
1379 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
1382 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
1387 iaq = (1.0 - eps) *
m_iaq[i] + eps *
m_iaq[i+1];
1390 iaq = (1.0 + eps) *
m_iaq[i] - eps *
m_iaq[i-1];
1398 int idri = ipix + iphibar * npix;
1401 double irf = iaq * drg[idri] * iaq_norm;
1484 static const int iter_rho = 6;
1485 static const int iter_omega = 6;
1486 static const double extent_integration = 10.0;
1487 static const double extent_direct = 15.0;
1495 #if G_IRF_RADIAL_METHOD == 0
1496 double wgt_integration = 1.0;
1497 double wgt_direct = 0.0;
1498 #elif G_IRF_RADIAL_METHOD == 1
1499 double wgt_integration = 0.0;
1500 double wgt_direct = 1.0;
1502 double extent = (*radial)[2].value();
1503 double wgt_direct = (extent-extent_integration)/(extent_direct-extent_integration);
1504 double wgt_integration = 1.0 - wgt_direct;
1505 if (wgt_direct < 0.0) {
1507 wgt_integration = 1.0;
1509 else if (wgt_direct > 1.0) {
1511 wgt_integration = 0.0;
1516 #if defined(G_DEBUG_IRF_TIMING)
1518 std::cout <<
"GCOMResponse::irf_radial(";
1519 std::cout <<
"iter_rho=" << iter_rho;
1520 std::cout <<
",iter_omega=" << iter_omega;
1521 #if G_IRF_RADIAL_METHOD == 2
1522 std::cout <<
",extent=" << extent;
1523 std::cout <<
",extent_integration=" << extent_integration;
1524 std::cout <<
",extent_direct=" << extent_direct;
1526 std::cout <<
",wgt_direct=" << wgt_direct;
1527 std::cout <<
",wgt_integration=" << wgt_integration <<
")" << std::endl;
1532 int nphibar = cube->
naxis(2);
1533 int nevents = cube->
size();
1538 std::string msg =
"DRE has "+
gammalib::str(nphibar)+
" Phibar layers "
1540 "bins. Please specify a compatible IAQ.";
1550 double phigeo_max = phigeo_min + phigeo_bin *
m_phigeo_bins;
1555 double iaq_norm = obs_ptr->
deadc() /
1562 if (wgt_direct > 0.0) {
1566 std::string msg =
"COMPTEL response is empty. Please initialise the "
1567 "response with an \"IAQ\".";
1572 double norm = iaq_norm * wgt_direct;
1575 for (
int ipix = 0; ipix < npix; ++ipix) {
1588 double centre_distance = scatter.
dist(radial->
dir());
1592 if (centre_distance < (phigeo_max + radial->
theta_max())) {
1601 GMatrix rot = (ry * rz).transpose();
1616 double theta = radial->
dir().
dist(dir);
1619 if (theta < radial->theta_max()) {
1634 model *= drx(dir) *
norm;
1637 for (
int iphibar = 0, idri = ipix; iphibar < nphibar; ++iphibar, idri += npix) {
1638 double faq =
m_faq(inx, iphibar);
1640 irfs[idri] += model * faq * drg[idri];
1661 if (wgt_integration > 0.0) {
1664 if (
m_iaq.empty()) {
1665 std::string msg =
"COMPTEL response is empty. Please initialise the "
1666 "response with an \"IAQ\".";
1670 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
1671 "Please initialise the response with a valid "
1677 double norm = iaq_norm * wgt_integration;
1681 double theta_max = radial->
theta_max() - 1.0e-12;
1688 GMatrix rot = (ry * rz).transpose();
1691 for (
int ipix = 0; ipix < npix; ++ipix) {
1704 double zeta = phigeoDir.
dist(radial->
dir());
1707 double rho_min = (zeta > phigeo_max) ? zeta - phigeo_max : 0.0;
1708 double rho_max = zeta + phigeo_max;
1709 if (rho_min > theta_max) {
1710 rho_min = theta_max;
1712 if (rho_max > theta_max) {
1713 rho_max = theta_max;
1717 if (rho_max > rho_min) {
1739 irf = integral.
romberg(rho_min, rho_max, iter_rho);
1742 for (
int iphibar = 0, idri = ipix; iphibar < nphibar; ++iphibar, idri += npix) {
1743 irfs[idri] +=
irf[iphibar] * drg[idri] *
norm;
1753 #if defined(G_DEBUG_IRF_TIMING)
1755 std::cout <<
"GCOMResponse::irf_radial consumed " << celapse;
1756 std::cout <<
" seconds of CPU time." << std::endl;
1824 static const int iter_rho = 6;
1825 static const int iter_omega = 6;
1826 static const double extent_integration = 10.0;
1827 static const double extent_direct = 15.0;
1835 #if G_IRF_ELLIPTICAL_METHOD == 0
1836 double wgt_integration = 1.0;
1837 double wgt_direct = 0.0;
1838 #elif G_IRF_ELLIPTICAL_METHOD == 1
1839 double wgt_integration = 0.0;
1840 double wgt_direct = 1.0;
1842 double extent_maj = (*elliptical)[3].value();
1843 double extent_min = (*elliptical)[4].value();
1844 double extent = (extent_maj > extent_min) ? extent_maj : extent_min;
1845 double wgt_direct = (extent-extent_integration)/(extent_direct-extent_integration);
1846 double wgt_integration = 1.0 - wgt_direct;
1847 if (wgt_direct < 0.0) {
1849 wgt_integration = 1.0;
1851 else if (wgt_direct > 1.0) {
1853 wgt_integration = 0.0;
1858 #if defined(G_DEBUG_IRF_TIMING)
1860 std::cout <<
"GCOMResponse::irf_elliptical(";
1861 std::cout <<
"iter_rho=" << iter_rho;
1862 std::cout <<
",iter_omega=" << iter_omega;
1863 #if G_IRF_ELLIPTICAL_METHOD == 2
1864 std::cout <<
",extent=" << extent;
1865 std::cout <<
",extent_integration=" << extent_integration;
1866 std::cout <<
",extent_direct=" << extent_direct;
1868 std::cout <<
",wgt_direct=" << wgt_direct;
1869 std::cout <<
",wgt_integration=" << wgt_integration <<
")" << std::endl;
1874 int nphibar = cube->
naxis(2);
1875 int nevents = cube->
size();
1880 std::string msg =
"DRE has "+
gammalib::str(nphibar)+
" Phibar layers "
1882 "bins. Please specify a compatible IAQ.";
1892 double phigeo_max = phigeo_min + phigeo_bin *
m_phigeo_bins;
1897 double iaq_norm = obs_ptr->
deadc() /
1904 if (wgt_direct > 0.0) {
1908 std::string msg =
"COMPTEL response is empty. Please initialise the "
1909 "response with an \"IAQ\".";
1914 double norm = iaq_norm * wgt_direct;
1917 for (
int ipix = 0; ipix < npix; ++ipix) {
1930 double centre_distance = scatter.
dist(elliptical->
dir());
1934 if (centre_distance < (phigeo_max + elliptical->
theta_max())) {
1943 GMatrix rot = (ry * rz).transpose();
1958 double theta = elliptical->
dir().
dist(dir);
1961 if (theta < elliptical->theta_max()) {
1968 double model = elliptical->
eval(theta, posang, bin->
energy(), bin->
time());
1980 model *= drx(dir) *
norm;
1983 for (
int iphibar = 0, idri = ipix; iphibar < nphibar; ++iphibar, idri+=npix) {
1984 double faq =
m_faq(inx, iphibar);
1986 irfs[idri] += model * faq * drg[idri];
2007 if (wgt_integration > 0.0) {
2010 if (
m_iaq.empty()) {
2011 std::string msg =
"COMPTEL response is empty. Please initialise the "
2012 "response with an \"IAQ\".";
2016 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
2017 "Please initialise the response with a valid "
2023 double norm = iaq_norm * wgt_integration;
2027 double theta_max = elliptical->
theta_max() - 1.0e-12;
2034 GMatrix rot = (ry * rz).transpose();
2037 for (
int ipix = 0; ipix < npix; ++ipix) {
2050 double zeta = phigeoDir.
dist(elliptical->
dir());
2053 double rho_min = (zeta > phigeo_max) ? zeta - phigeo_max : 0.0;
2054 double rho_max = zeta + phigeo_max;
2055 if (rho_min > theta_max) {
2056 rho_min = theta_max;
2058 if (rho_max > theta_max) {
2059 rho_max = theta_max;
2063 if (rho_max > rho_min) {
2085 irf = integral.
romberg(rho_min, rho_max, iter_rho);
2088 for (
int iphibar = 0, idri = ipix; iphibar < nphibar; ++iphibar, idri+=npix) {
2089 irfs[idri] +=
irf[iphibar] * drg[idri] *
norm;
2099 #if defined(G_DEBUG_IRF_TIMING)
2101 std::cout <<
"GCOMResponse::irf_elliptical consumed " << celapse;
2102 std::cout <<
" seconds of CPU time." << std::endl;
2149 #if defined(G_DEBUG_IRF_TIMING)
2160 int nphibar = cube->
naxis(2);
2161 int nevents = cube->
size();
2166 std::string msg =
"DRE has "+
gammalib::str(nphibar)+
" Phibar layers "
2168 "bins. Please specify a compatible IAQ.";
2178 double phigeo_max = phigeo_min + phigeo_bin *
m_phigeo_bins;
2183 double iaq_norm = obs_ptr->
deadc() /
2187 #if defined(G_IRF_DIFFUSE_DIRECT)
2188 #if defined(G_DEBUG_IRF_TIMING)
2189 std::cout <<
"GCOMResponse::irf_diffuse - direct computation" << std::endl;
2194 std::string msg =
"COMPTEL response is empty. Please initialise the "
2195 "response with an \"IAQ\".";
2200 for (
int ipix = 0; ipix < npix; ++ipix) {
2216 GMatrix rot = (ry * rz).transpose();
2234 double model = diffuse->
eval(photon);
2246 model *= drx(dir) * iaq_norm;
2249 for (
int iphibar = 0, idri = ipix; iphibar < nphibar; ++iphibar, idri+=npix) {
2250 double faq =
m_faq(inx, iphibar);
2252 irfs[idri] += model * faq * drg[idri];
2264 #if defined(G_DEBUG_IRF_TIMING)
2265 std::cout <<
"GCOMResponse::irf_diffuse - numerical integration" << std::endl;
2269 if (
m_iaq.empty()) {
2270 std::string msg =
"COMPTEL response is empty. Please initialise the "
2271 "response with an \"IAQ\".";
2275 std::string msg =
"COMPTEL response has a zero Phigeo bin size. "
2276 "Please initialise the response with a valid "
2282 double omega0 = 2.0 * std::sin(0.5 * phigeo_bin);
2285 for (
int ipix = 0; ipix < npix; ++ipix) {
2301 double phigeo = phigeo_min + double(iphigeo) * phigeo_bin;
2302 double sin_phigeo = std::sin(phigeo);
2307 int naz = int(length / phigeo_bin + 0.5);
2314 double omega = omega0 * az_step * sin_phigeo;
2318 for (
int iaz = 0; iaz < naz; ++iaz, az += az_step) {
2322 skyDir.
rotate(az, phigeo);
2336 if (intensity == 0.0) {
2341 intensity *= drx(skyDir);
2347 for (
int iphibar = 0; iphibar < nphibar; ++iphibar) {
2353 double iaq =
m_iaq[i];
2361 int idri = ipix + iphibar * npix;
2364 double irf = iaq * drg[idri] * iaq_norm * intensity;
2381 #if defined(G_DEBUG_IRF_TIMING)
2383 std::cout <<
"GCOMResponse::irf_diffuse consumed " << celapse;
2384 std::cout <<
" seconds of CPU time." << std::endl;
COMPTEL event bin class interface definition.
COMPTEL event bin container class interface definition.
COMPTEL instrument direction class definition.
COMPTEL observation class interface definition.
COMPTEL instrument response function class interface definition.
Calibration database class interface definition.
Energy value class definition.
Abstract event base class definition.
Filename class interface definition.
Single precision FITS image class definition.
Abstract FITS image base class definition.
FITS file class interface definition.
Integration class for set of functions interface definition.
Mathematical function definitions.
Generic matrix class definition.
Sky model class interface definition.
Abstract diffuse spatial model base class interface definition.
Abstract elliptical spatial model base class interface definition.
Point source spatial model class interface definition.
Abstract radial spatial model base class interface definition.
Abstract observation base class interface definition.
Time class interface definition.
double norm(const GVector &vector)
Computes vector norm.
Vector class interface definition.
COMPTEL Data Space class.
const double & phase_correction(void) const
Return pulsar phase correction factor.
int nchi(void) const
Return number of Chi bins.
const double & tof_correction(void) const
Return ToF correction factor.
const GSkyMap & map(void) const
Return DRI sky map.
int npsi(void) const
Return number of Psi bins.
int size(void) const
Return number of bins.
int nphibar(void) const
Return number of Phibar bins.
virtual const GTime & time(void) const
Return time of event bin.
virtual const GCOMInstDir & dir(void) const
Return instrument direction of event bin.
virtual const GEnergy & energy(void) const
Return energy of event bin.
COMPTEL event bin container class.
virtual int size(void) const
Return number of bins in event cube.
const GCOMDri & dre(void) const
Return reference to DRE data.
virtual int naxis(const int &axis) const
Return number of bins in axis.
Interface for the COMPTEL instrument direction class.
void dir(const GSkyDir &dir)
Set event scatter direction.
void phibar(const double &phibar)
Set event Compton scatter angle.
Interface class for COMPTEL observations.
virtual double ontime(void) const
Return ontime.
virtual double deadc(const GTime &time=GTime()) const
Return deadtime correction factor.
const GCOMDri & drx(void) const
Return exposure.
const GCOMDri & drg(void) const
Return geometry factors.
Interface for the COMPTEL instrument response function.
virtual double irf(const GEvent &event, const GPhoton &photon, const GObservation &obs) const
Return value of instrument response function.
void free_members(void)
Delete class members.
void save_cache(const GFilename &filename) const
Save response cache.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL response information.
virtual GVector irf_ptsrc(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to point source.
int m_phigeo_bins
Number of Phigeo bins.
std::vector< GVector > m_faq_native
Array of native FAQ vectors.
double m_phibar_min
Phigeo value of first bin (deg)
void write(GFitsImageFloat &image) const
Write COMPTEL response into FITS image.
GCOMResponse(void)
Void constructor.
virtual GVector irf_radial(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to radial source.
int m_phibar_bins
Number of Phibar bins.
GVector m_faq_solidangle
Array of FAQ solid angles.
const std::string & rspname(void) const
Return response name.
double m_phibar_bin_size
Phigeo binsize (deg)
void copy_members(const GCOMResponse &rsp)
Copy class members.
std::vector< double > m_iaq
IAQ array.
double m_phigeo_min
Phigeo value of first bin (deg)
void backproject(const GObservation &obs, const GEvents *events, GSkyMap *map) const
Backproject events using instrument response function to sky map.
virtual ~GCOMResponse(void)
Destructor.
void compute_faq(void)
Compute FAQ.
void load_cache(const GFilename &filename)
Load response cache.
virtual GVector irf_elliptical(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to elliptical source.
const GCaldb & caldb(void) const
Return calibration database.
double m_phibar_ref_value
Phigeo reference value (deg)
void read(const GFitsImage &hdu)
Read COMPTEL response from FITS image.
int m_faq_bins
Number of FAQ bins.
double m_phigeo_ref_value
Phigeo reference value (deg)
std::string m_rspname
Response name.
virtual GEbounds ebounds(const GEnergy &obsEnergy) const
Return true energy boundaries for a specific observed energy.
GCaldb m_caldb
Calibration database.
void init_members(void)
Initialise class members.
virtual double nroi(const GModelSky &model, const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return integral of event probability for a given sky model over ROI.
virtual void clear(void)
Clear instance.
double m_phigeo_ref_pixel
Phigeo reference pixel (starting from 1)
double m_phigeo_bin_size
Phigeo binsize (deg)
virtual GVector irf_diffuse(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to diffuse source.
virtual GCOMResponse * clone(void) const
Clone instance.
double m_phibar_ref_pixel
Phigeo reference pixel (starting from 1)
virtual GCOMResponse & operator=(const GCOMResponse &rsp)
Assignment operator.
std::vector< bool > m_faq_zero
Array of zero FAQ bins.
void load(const std::string &rspname)
Load COMPTEL response.
Calibration database class.
std::string rootdir(void) const
Return path to CALDB root directory.
GFilename filename(const std::string &detector, const std::string &filter, const std::string &codename, const std::string &date, const std::string &time, const std::string &expr)
Return calibration file name based on selection parameters.
void clear(void)
Clear calibration database.
std::string print(const GChatter &chatter=NORMAL) const
Print calibration database information.
Energy boundaries container class.
Class that handles energies in a unit independent way.
Abstract interface for the event classes.
Abstract event container class.
bool is_fits(void) const
Checks whether file is a FITS file.
bool exists(void) const
Checks whether file exists.
bool is_empty(void) const
Signal if filename is empty.
double real(const std::string &keyname) const
Return card value as double precision.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Single precision FITS image class.
Abstract FITS image base class.
virtual double pixel(const int &ix) const =0
int naxes(const int &axis) const
Return dimension of an image axis.
const int & naxis(void) const
Return dimension of image.
GFitsImage * image(const int &extno)
Get pointer to image HDU.
void close(void)
Close FITS file.
Integration class for set of functions.
GVector romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void fixed_iter(const int &iter)
Set fixed number of iterations.
Generic matrix class definition.
void eulerz(const double &angle)
Set Euler rotation matrix around z axis.
void eulery(const double &angle)
Set Euler rotation matrix around y axis.
GModelSpatial * spatial(void) const
Return spatial model component.
Abstract diffuse spatial model base class.
virtual double eval(const GPhoton &photon, const bool &gradients=false) const =0
Abstract elliptical spatial model base class.
virtual double eval(const double &theta, const double &posangle, const GEnergy &energy, const GTime &time, const bool &gradients=false) const =0
const GSkyDir & dir(void) const
Return position of elliptical spatial model.
std::string coordsys(void) const
Return coordinate system.
virtual double theta_max(void) const =0
Point source spatial model.
Abstract radial spatial model base class.
virtual double theta_max(void) const =0
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const =0
const GSkyDir & dir(void) const
Return position of radial spatial model.
virtual double eval(const GPhoton &photon, const bool &gradients=false) const =0
Abstract observation base class.
virtual GEvents * events(void)
Return events.
virtual double deadc(const GTime &time=GTime()) const =0
void name(const std::string &name)
Set observation name.
void id(const std::string &id)
Set observation identifier.
Class that handles photons.
const GTime & time(void) const
Return photon time.
const GSkyDir & dir(void) const
Return photon sky direction.
void save(const GFilename &filename, const bool &clobber=false) const
Save the response vector cache into FITS file.
void load(const GFilename &filename)
Load response vector cache from FITS file.
Abstract instrument response base class.
GResponseVectorCache m_irf_vector_cache
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
virtual GResponse & operator=(const GResponse &rsp)
Assignment operator.
double dec_deg(void) const
Returns Declination in degrees.
double ra_deg(void) const
Returns Right Ascension in degrees.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
void rotate(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
double posang(const GSkyDir &dir, const std::string &coordsys="CEL") const
Compute position angle between sky directions in radians.
double solidangle(const int &index) const
Returns solid angle of pixel.
const int & nmaps(void) const
Returns number of maps.
void clear(void)
Clear instance.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
bool is_empty(void) const
Signals if sky map is empty.
void save(const GFilename &filename, const bool &clobber=false) const
Save sky map into FITS file.
const int & npix(void) const
Returns number of pixels.
bool contains(const GSkyDir &dir) const
Checks if sky direction falls in map.
const double * pixels(void) const
Returns pointer to pixel data.
void clear(void)
Clear vector.
Kernel for rho angle integration of elliptical models.
Kernel for rho angle integration of radial models.
Defintion of COMPTEL helper classes for vector response.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool is_notanumber(const double &x)
Signal if argument is not a number.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
std::string filepath(const std::string &pathname, const std::string &filename)
Build file path from path name and file name.
double get_current_clock(void)
Get current clock in seconds.