40#define G_PSF_RADIAL_KERNS_PHI "cta_psf_radial_kerns_phi::eval(double&)"
73 int size = (
m_grad) ? nengs * (npars+1) : nengs;
97 const double& theta_max,
137 double alpha_reco =
m_par_cel ? obsDir.
ra() : obsDir.
l();
139 double sin_beta_0 = std::sin(beta_0);
140 double cos_beta_0 = std::cos(beta_0);
141 double tan_beta_0 = std::tan(beta_0);
142 double sin_beta_reco = std::sin(beta_reco);
143 double cos_beta_reco = std::cos(beta_reco);
144 double sin_dalpha = std::sin(alpha_0 - alpha_reco);
145 double cos_dalpha = std::cos(alpha_0 - alpha_reco);
146 double arg = cos_beta_reco * tan_beta_0 -
147 sin_beta_reco * cos_dalpha;
148 double denom = sin_dalpha * sin_dalpha + arg * arg;
159 m_dphi_dalpha_0 = (sin_beta_reco - cos_dalpha * cos_beta_reco * tan_beta_0) /
161 m_dphi_dbeta_0 = (sin_dalpha * cos_beta_reco * (1.0 + tan_beta_0 * tan_beta_0)) /
230 double phi_min = -dphi;
231 double phi_max = +dphi;
234 double sin_delta = std::sin(delta);
235 double cos_delta = std::cos(delta);
236 double sin_delta_sin_zeta = sin_delta *
m_sin_zeta;
237 double sin_delta_cos_zeta = sin_delta *
m_cos_zeta;
243 double cos_delta_sin_zeta = cos_delta *
m_sin_zeta;
244 double cos_delta_cos_zeta = cos_delta *
m_cos_zeta;
261 double value = irf[0];
264 for (
int i = 0; i < nengs; ++i) {
274 values[i] = value * psf;
279 for (
int k = 1, ig = i+nengs; k <= npars; ++k, ig += nengs) {
280 values[ig] = irf[k] * psf;
295 static const GTime srcTime;
309 double value = integral.
romberg(phi_min, phi_max,
m_iter) * sin_delta;
312 for (
int i = 0; i < nengs; ++i) {
320 values[i] = value * psf;
378 static const GTime srcTime;
385 sin_phi = std::sin(phi);
386 cos_phi = std::cos(phi);
389 cos_phi = std::cos(phi);
394 double theta = std::acos(cos_theta);
398 double theta_kluge = theta - 1.0e-12;
399 if (theta_kluge < 0.0) {
413 double sin_theta2 = 1.0 - cos_theta * cos_theta;
414 double sin_theta = (sin_theta2 > 0.0) ? std::sqrt(sin_theta2) : 0.0;
417 if (sin_theta != 0.0) {
418 double norm = 1.0 / sin_theta;
447 for (
int i = 1, k = 0; i <
m_size; ++i, ++k) {
453 #if defined(G_NAN_CHECK)
456 std::string msg =
"NaN/Inf encountered for phi="+
gammalib::str(phi);
CTA cube-style response function class definition.
CTA response helper classes definition.
Integration class for set of functions interface definition.
Model parameter class interface definition.
Abstract radial spatial model base class interface definition.
double norm(const GVector &vector)
Computes vector norm.
CTA cube-style response function class.
const GCTACubePsf & psf(void) const
Return cube analysis point spread function.
int size(void) const
Return number of energies in container.
Class that handles energies in a unit independent way.
GIntegral class interface definition.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void fixed_iter(const int &iter)
Set fixed number of iterations.
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.
Abstract radial spatial model base class.
std::string coordsys(void) const
Return coordinate system.
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.
int size(void) const
Return number of parameters.
const double & factor_gradient(void) const
Return parameter factor gradient.
const double & dec(void) const
Return Declination in radians.
const double & l(void) const
Return galactic longitude in radians.
const double & ra(void) const
Return Right Ascension in radians.
const double & b(void) const
Return galactic latitude in radians.
Kernel for Psf phi angle integration used for stacked analysis.
double m_cos_zeta
Cosine of m_zeta.
bool m_par_cel
Celestial or galactic coordinates.
bool m_grad
Compute gradients.
double m_dphi_dalpha_0
d(phi)/d(alpha0)
double m_dzeta_dbeta_0
d(zeta)/d(beta0)
cta_psf_radial_kerns_delta(const GCTAResponseCube *rsp, const GModelSpatialRadial *model, const GSkyDir &obsDir, const GEnergies &srcEngs, const double &zeta, const double &theta_max, const int &iter, const bool &grad)
Kernel constructor for PSF integration of radial model.
const GModelSpatialRadial * m_model
Radial model.
GModelPar * m_par_lat
Latitude parameter.
GSkyDir m_obsDir
Reconstructed event direction.
double m_cos_theta_max
Cosine of m_theta_max.
double m_sin_zeta
Sine of m_zeta.
double m_dzeta_dalpha_0
d(zeta)/d(alpha0)
double m_theta_max
Maximum model radius.
GVector eval(const double &delta)
Kernel for PSF integration of radial model.
int m_iter
Integration iterations.
GModelPar * m_par_lon
Longitude parameter.
GEnergies m_srcEngs
True photon energies.
int size(void) const
Return size of vector kernel for PSF integration of radial model.
double m_dphi_dbeta_0
d(phi)/d(beta0)
const GCTAResponseCube * m_rsp
Response cube.
double m_zeta
Distance of model from Psf.
Kernel for radial spatial model PSF phi angle integration.
double m_sin_delta_sin_zeta
sin(delta) * sin(zeta)
cta_psf_radial_kerns_delta * m_outer
Pointer to outer integr.
double m_cos_delta_sin_zeta
cos(delta) * sin(zeta)
double m_cos_delta_cos_zeta
cos(delta) * cos(zeta)
GVector eval(const double &phi)
Kernel for azimuthal radial model integration.
GVector m_values
Return value.
double m_sin_delta_cos_zeta
sin(delta) * cos(zeta)
#define G_PSF_RADIAL_KERNS_PHI
Implementation of CTA helper classes for stacked vector response.
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.
double roi_arclength(const double &rad, const double &dist, const double &cosdist, const double &sindist, const double &roi, const double &cosroi)
Returns length of circular arc within circular ROI.
void warning(const std::string &origin, const std::string &message)
Emits warning.