42#define G_ACCESS1 "GCTAModelSpatial::operator[](int&)"
43#define G_ACCESS2 "GCTAModelSpatial::operator[](std::string&)"
44#define G_MC "GCTAModelSpatial::mc(GEnergy&, GTime&, GCTAObservation&, "\
46#define G_NPRED "GCTAModelSpatial::npred(GEnergy&, GTime&, GObservation&)"
123 if (
this != &model) {
152 #if defined(G_RANGE_CHECK)
153 if (index < 0 || index >=
size()) {
175 #if defined(G_RANGE_CHECK)
176 if (index < 0 || index >=
size()) {
199 for (; index <
size(); ++index) {
200 if (
m_pars[index]->name() == name)
205 if (index >=
size()) {
206 std::string msg =
"Parameter \""+name+
"\" not found in spatial "
207 "component of background model.";
228 for (; index <
size(); ++index) {
229 if (
m_pars[index]->name() == name)
234 if (index >=
size()) {
235 std::string msg =
"Parameter \""+name+
"\" not found in spatial "
236 "component of background model.";
279 std::string msg =
"Spatial background model is empty. Please provide "
280 "a valid spatial background model.";
287 double detx_centre = roi_centre.
detx();
288 double dety_centre = roi_centre.
dety();
292 double detx_min = detx_centre - radius;
293 double detx_max = detx_centre + radius;
294 double dety_min = dety_centre - radius;
295 double dety_max = dety_centre + radius;
296 double detx_width = detx_max - detx_min;
297 double dety_width = dety_max - dety_min;
302 const int max_subsequent_zeros = 10;
315 double detx = detx_min + detx_width * ran.
uniform();
316 double dety = dety_min + dety_width * ran.
uniform();
331 f =
eval(dir, energy, time,
false);
340 if (zeros > max_subsequent_zeros) {
341 std::string msg =
"Method repeatedly encounters zero values "
342 "of spatial background model. Make sure "
343 "that the background model is correct.";
382 static const int min_iter_theta = 5;
383 static const int min_iter_phi = 5;
384 static const int max_iter_theta = 8;
385 static const int max_iter_phi = 8;
399 min_iter_theta, max_iter_theta);
420 #if defined(G_NAN_CHECK)
422 std::string origin =
"GCTAModelSpatial::npred";
423 std::string message =
" NaN/Inf encountered (npred=" +
524 #if defined(G_NAN_CHECK)
526 std::string origin =
"GCTAModelSpatial::npred_roi_kern_theta::eval"
528 std::string message =
" NaN/Inf encountered (value=" +
562 double detx = m_roi_centre.detx();
563 double dety = m_roi_centre.dety();
564 if (m_theta > 0.0 ) {
565 detx += m_theta * std::cos(phi);
566 dety += m_theta * std::sin(phi);
573 double value = m_spatial->eval(dir, m_energy, m_time);
576 #if defined(G_NAN_CHECK)
578 std::string origin =
"GCTAModelSpatial::npred_roi_kern_phi::eval"
580 std::string message =
" NaN/Inf encountered (value=" +
CTA event list class interface definition.
CTA instrument direction class interface definition.
const double g_npred_resolution
Scale of bkg.
Abstract spatial model class interface definition.
CTA response helper classes definition.
Definition of support function used by CTA classes.
Exception handler interface definition.
Integration class interface definition.
Abstract observation base class interface definition.
virtual void roi(const GRoi &roi)
Set ROI.
CTA instrument direction class.
void dir(const GSkyDir &dir)
Set sky direction.
void dety(const double &y)
Set DETY coordinate (in radians)
void detx(const double &x)
Set DETX coordinate (in radians)
double eval(const double &phi)
Kernel for azimuth angle integration of spatial component.
const GCTAModelSpatial * m_spatial
Pointer to spatial component.
int m_min_iter
Minimum number of Romberg iterations.
double eval(const double &theta)
Kernel for offset angle integration of spatial component.
int m_max_iter
Maximum number of Romberg iterations.
GCTAInstDir m_roi_centre
RoI centre.
Abstract spatial model class.
void init_members(void)
Initialise class members.
GCTAModelSpatial(void)
Void constructor.
virtual double mc_max_value(const GCTAObservation &obs) const =0
virtual ~GCTAModelSpatial(void)
Destructor.
std::vector< GModelPar * > m_pars
Parameter pointers.
virtual GModelPar & operator[](const int &index)
Returns model parameter.
int size(void) const
Return number of model parameters.
virtual double eval(const GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const =0
virtual double npred(const GEnergy &energy, const GTime &time, const GObservation &obs) const
Return integral of spatial model component.
virtual GCTAModelSpatial & operator=(const GCTAModelSpatial &model)
Assignment operator.
virtual GCTAInstDir mc(const GEnergy &energy, const GTime &time, const GCTAObservation &obs, GRan &ran) const
Returns MC instrument direction.
void copy_members(const GCTAModelSpatial &model)
Copy class members.
void free_members(void)
Delete class members.
void pointing(const GCTAPointing &pointing)
Set CTA pointing.
GCTARoi roi(void) const
Get Region of Interest.
GCTAInstDir instdir(const GSkyDir &skydir) const
Get instrument direction from sky direction.
Interface for the CTA region of interest class.
const double & radius(void) const
Returns radius of region of interest in degrees.
virtual bool contains(const GEvent &event) const
Check if region of interest contains an event.
const GCTAInstDir & centre(void) const
Returns region of interest centre.
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.
Abstract observation base class.
Random number generator class.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool is_notanumber(const double &x)
Signal if argument is not a number.
const GCTAPointing & cta_pnt(const std::string &origin, const GObservation &obs)
Retrieve CTA pointing from generic observation.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
const GCTAEventList & cta_event_list(const std::string &origin, const GObservation &obs)
Retrieve CTA event list from generic observation.
int iter_phi(const double &rho, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of azimuthal Romberg iterations.
void warning(const std::string &origin, const std::string &message)
Emits warning.
int iter_rho(const double &rho_max, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of radial Romberg iterations.