42#if defined(G_LEGACY_XML_FORMAT)
48#define G_CONSTRUCTOR "GModelSpatialRadialGauss::GModelSpatialRadialGauss("\
49 "GSkyDir&, double&, std::string&)"
50#define G_EVAL "GModelSpatialRadialGauss::eval(double&, GEnergy&, GTime&, "\
52#define G_READ "GModelSpatialRadialGauss::read(GXmlElement&)"
53#define G_WRITE "GModelSpatialRadialGauss::write(GXmlElement&)"
92 const std::string& type) :
123 const std::string& coordsys) :
128 std::string msg =
"Invalid coordinate system \""+
coordsys+
"\" "
129 "specified. Please specify either \"CEL\" or "
226 if (
this != &model) {
352 const bool& gradients)
const
358 double theta2 = theta * theta;
385 double g_sigma = 0.0;
394 #if defined(G_NAN_CHECK)
396 std::string msg =
"Model value not a number:";
397 for (
int i = 0; i <
m_pars.size(); ++i) {
398 msg +=
" " +
m_pars[i]->name() +
"=";
401 msg +=
" energy=" + energy.
print();
402 msg +=
" time=" + time.
print();
431 double phi = 360.0 * ran.
uniform();
452 const double& margin)
const
566 result.append(
"=== GModelSpatialRadialGauss ===");
571 for (
int i = 0; i <
size(); ++i) {
596 m_type =
"RadialGaussian";
680 double sigma2_rad = sigma_rad * sigma_rad;
681 if (sigma2_rad > 0.0) {
Exception handler interface definition.
Mathematical function definitions.
const GModelSpatialRadialGauss g_radial_gauss_seed
Radial Gaussian model class interface definition.
Spatial model registry class definition.
Class that handles energies in a unit independent way.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
Radial Gaussian model class.
void update(const bool &gradients) const
Update precomputation cache.
GModelSpatialRadialGauss(void)
Void constructor.
double m_value_norm
(2pi sigma(rad))^-2
virtual void read(const GXmlElement &xml)
Read model from XML element.
double m_last_sigma
Last Gaussian sigma.
double sigma(void) const
Return Gaussian sigma.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual GModelSpatialRadialGauss & operator=(const GModelSpatialRadialGauss &model)
Assignment operator.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual void clear(void)
Clear radial Gauss model.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_g_sigma_norm
sigma(rad)^-1 sigma_scale deg2rad
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Gaussian source information.
double m_inv_sigma2_rad
sigma(rad)^-2
GModelPar m_sigma
Gaussian width (deg)
virtual void set_region(void) const
Set boundary sky region.
void copy_members(const GModelSpatialRadialGauss &model)
Copy class members.
virtual ~GModelSpatialRadialGauss(void)
Destructor.
void init_members(void)
Initialise class members.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Gaussian source model.
double m_g_theta_norm
sigma(rad)^-2 deg2rad
virtual GModelSpatialRadialGauss * clone(void) const
Clone radial Gauss model.
void free_members(void)
Delete class members.
Abstract radial spatial model base class.
void free_members(void)
Delete class members.
GModelPar m_lon
Right Ascension or Galactic longitude (deg)
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual void read(const GXmlElement &xml)
Read model from XML element.
std::string coordsys(void) const
Return coordinate system.
void init_members(void)
Initialise class members.
virtual GModelSpatialRadial & operator=(const GModelSpatialRadial &model)
Assignment operator.
const GSkyDir & dir(void) const
Return position of radial spatial model.
GModelPar m_lat
Declination or Galactic latitude (deg)
Interface definition for the spatial model registry class.
std::string m_type
Spatial model type.
std::string type(void) const
Return model type.
const GSkyRegion * region(void) const
Return boundary sky region.
std::vector< GModelPar * > m_pars
Parameter pointers.
void init_members(void)
Initialise class members.
int size(void) const
Return number of parameters.
void free_members(void)
Delete class members.
GSkyRegionCircle m_region
Bounding circle.
bool is_free(void) const
Signal if parameter is free.
void free(void)
Free a parameter.
const double & scale(void) const
Return parameter scale.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
const std::string & unit(void) const
Return parameter unit.
double min(void) const
Return parameter minimum boundary.
const double & factor_gradient(void) const
Return parameter factor gradient.
double gradient(void) const
Return parameter gradient.
void clear(void)
Clear parameter.
double value(void) const
Return parameter value.
const std::string & name(void) const
Return parameter name.
Random number generator class.
double chisq2(void)
Returns Chi2 deviates for 2 degrees of freedom.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
void rotate_deg(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.
Interface for the circular sky region class.
std::string print(const GChatter &chatter=NORMAL) const
Print time.
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.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
void warning(const std::string &origin, const std::string &message)
Emits warning.