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.";
278 if (mc_max_value <= 0.0) {
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 ) {
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=" +
virtual GCTAInstDir mc(const GEnergy &energy, const GTime &time, const GCTAObservation &obs, GRan &ran) const
Returns MC instrument direction.
Abstract spatial model class.
CTA response helper classes definition.
CTA event list class interface definition.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void detx(const double &x)
Set DETX coordinate (in radians)
void warning(const std::string &origin, const std::string &message)
Emits warning.
const double g_npred_resolution
Scale of bkg.
virtual void roi(const GRoi &roi)
Set ROI.
void copy_members(const GCTAModelSpatial &model)
Copy class members.
double eval(const double &phi)
Kernel for azimuth angle integration of spatial component.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
GCTAModelSpatial(void)
Void constructor.
const GCTAPointing & cta_pnt(const std::string &origin, const GObservation &obs)
Retrieve CTA pointing from generic observation.
virtual double mc_max_value(const GCTAObservation &obs) const =0
virtual GCTAModelSpatial & operator=(const GCTAModelSpatial &model)
Assignment operator.
const double & radius(void) const
Returns radius of region of interest in degrees.
Random number generator class.
Interface for the CTA region of interest class.
GIntegral class interface definition.
void pointing(const GCTAPointing &pointing)
Set CTA pointing.
void dir(const GSkyDir &dir)
Set sky direction.
int m_min_iter
Minimum number of Romberg iterations.
bool is_notanumber(const double &x)
Signal if argument is not a number.
bool is_infinite(const double &x)
Signal if argument is infinite.
Definition of support function used by CTA classes.
int m_max_iter
Maximum number of Romberg iterations.
virtual ~GCTAModelSpatial(void)
Destructor.
GCTARoi roi(void) const
Get Region of Interest.
const GCTAInstDir & centre(void) const
Returns region of interest centre.
void free_members(void)
Delete class members.
const GCTAModelSpatial * m_spatial
Pointer to spatial component.
GCTAInstDir instdir(const GSkyDir &skydir) const
Get instrument direction from sky direction.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
void init_members(void)
Initialise class members.
CTA instrument direction class interface definition.
const GCTAEventList & cta_event_list(const std::string &origin, const GObservation &obs)
Retrieve CTA event list from generic observation.
virtual bool contains(const GEvent &event) const
Check if region of interest contains an event.
int size(void) const
Return number of model parameters.
virtual GModelPar & operator[](const int &index)
Returns model parameter.
Abstract observation base class.
Abstract observation base class interface definition.
int iter_phi(const double &rho, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of azimuthal Romberg iterations.
Abstract spatial model class interface definition.
GVector sin(const GVector &vector)
Computes sine of vector elements.
Exception handler interface definition.
virtual double eval(const GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const =0
void fixed_iter(const int &iter)
Set fixed number of iterations.
CTA instrument direction class.
void dety(const double &y)
Set DETY coordinate (in radians)
std::vector< GModelPar * > m_pars
Parameter pointers.
virtual double npred(const GEnergy &energy, const GTime &time, const GObservation &obs) const
Return integral of spatial model component.
double eval(const double &theta)
Kernel for offset angle integration of spatial component.
Integration class interface definition.
int iter_rho(const double &rho_max, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of radial Romberg iterations.
GCTAInstDir m_roi_centre
RoI centre.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.