36 #define G_ACCESS "GModelSpatial::operator[](std::string&)"
37 #define G_AT "GModelPar& GModelSpatial::at(int&)"
38 #define G_FLUX "GModelSpatial::flux(GSkyRegionCircle&, GEnergy&, GTime&)"
115 if (
this != &model) {
148 for (; index <
size(); ++index) {
149 if (
m_pars[index]->name() == name) {
155 if (index >=
size()) {
156 std::string msg =
"Model parameter \""+name+
"\" not found in model. "
157 "Please specify a valid model parameter name.";
181 for (; index <
size(); ++index) {
182 if (
m_pars[index]->name() == name) {
188 if (index >=
size()) {
189 std::string msg =
"Model parameter \""+name+
"\" not found in model. "
190 "Please specify a valid model parameter name.";
219 if (index < 0 || index >=
size()) {
242 if (index < 0 || index >=
size()) {
266 for (
int i = 0; i <
size(); ++i) {
267 if (
m_pars[i]->name() == name) {
289 for (
int i = 0; i <
size(); ++i) {
290 if (
m_pars[i]->is_free()) {
291 has_free_pars =
true;
309 for (
int i = 0; i <
m_pars.size(); ++i) {
346 const GTime& srcTime)
const
357 if (reg_circle == NULL) {
358 std::string msg =
"Flux can only be computed for a circular "
365 if (model_circle == NULL) {
366 std::string msg =
"Flux can only be computed for spatial model "
367 "with region defined as circle.";
376 double distance = model_centre.
dist(reg_circle->
centre());
380 double rho_min = distance - model_radius;
392 double cosdist =
std::cos(distance);
393 double sindist =
std::sin(distance);
394 double cosmodrad =
std::cos(model_radius);
412 flux = integral.
romberg(rho_min, rho_max);
515 if (rho_kludge < 0.0) {
520 double omega_min = -domega;
521 double omega_max = +domega;
537 flux = integral.
romberg(omega_min, omega_max) * sin_rho;
576 double flux = m_model->eval(photon);
double m_modrad
Model radius (rad)
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.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
Point source spatial model class interface definition.
double m_dist
Distance model-region (rad)
int size(void) const
Return number of parameters.
GModelSpatial(void)
Void constructor.
bool has_free_pars(void) const
Checks if the spatial model has free parameters.
virtual ~GModelSpatial(void)
Destructor.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
double eval(const double &omega)
Kernel for circular sky region azimuth angle integration.
virtual GModelSpatial & operator=(const GModelSpatial &model)
Assignment operator.
Abstract spatial model base class interface definition.
virtual GModelPar & operator[](const int &index)
Returns model parameter.
GIntegral class interface definition.
Interface for the circular sky region class.
GSkyRegionCircle m_region
Bounding circle.
void copy_members(const GModelSpatial &model)
Copy class members.
const double & radius(void) const
Return circular region radius (in degrees)
double m_sindist
Sin of distance model-region.
Class that handles photons.
Abstract interface for the sky region class.
double eval(const double &rho)
Kernel for circular sky region radial integration.
const GModelSpatial * m_model
Spatial model.
GTime m_srcTime
Photon time.
std::vector< GModelPar * > m_pars
Parameter pointers.
void rotate(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
double m_cosmodrad
Cos of model radius.
const GSkyRegionCircle * m_reg
Integration region.
virtual bool overlaps(const GSkyRegion ®) const =0
const double g_kludge_radius
Tiny angle (radians)
void silent(const bool &silent)
Set silence flag.
const GSkyRegion * region(void) const
Return boundary sky region.
const GSkyDir & centre(void) const
Return circular region centre.
void free_members(void)
Delete class members.
std::string m_type
Spatial model type.
GModelPar & at(const int &index)
Returns model parameter.
bool has_par(const std::string &name) const
Checks if parameter name exists.
virtual double flux(const GSkyRegion ®ion, const GEnergy &srcEng=GEnergy(), const GTime &srcTime=GTime()) const
Returns model flux integrated in circular sky region.
GVector sin(const GVector &vector)
Computes sine of vector elements.
Exception handler interface definition.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
Abstract spatial model base class.
void init_members(void)
Initialise class members.
GEnergy m_srcEng
Photon energy.
void autoscale(void)
Autoscale parameters.
double m_cosdist
Cos of distance model-region.
void clear(void)
Clear instance.
Class that handles energies in a unit independent way.