45#define G_CONSTRUCTOR "GModelSpatialRadialGeneralGauss::"\
46 "GModelSpatialRadialGeneralGauss(GSkyDir&, double&, double&, std::string&)"
47#define G_EVAL "GModelSpatialRadialGeneralGauss::eval(double&, GEnergy&, "\
49#define G_READ "GModelSpatialRadialGeneralGauss::read(GXmlElement&)"
50#define G_WRITE "GModelSpatialRadialGeneralGauss::write(GXmlElement&)"
51#define G_MC "GModelSpatialRadialGeneralGauss::mc(GEnergy&, GTime&, GRan&)"
100 const double& radius,
102 const std::string& coordsys) :
198 if (
this != &model) {
287 const bool& gradients)
const
297 #if defined(G_NAN_CHECK)
299 std::string msg =
"Model value not a number:";
300 for (
int i = 0; i <
m_pars.size(); ++i) {
301 msg +=
" " +
m_pars[i]->name() +
"=";
304 msg +=
" energy=" + energy.
print();
305 msg +=
" time=" + time.
print();
337 #if defined(G_DEBUG_MC)
347 std::string msg =
"Non positive maximum radial genral Gauss model value.";
354 value =
eval(theta, energy, time) * std::sin(theta);
356 #if defined(G_DEBUG_MC)
360 #if defined(G_DEBUG_MC)
361 std::cout <<
"#=" << n_samples <<
" ";
365 double phi = 360.0 * ran.
uniform();
387 const double& margin)
const
508 result.append(
"=== GModelSpatialRadialGeneralGauss ===");
513 for (
int i = 0; i <
size(); ++i) {
539 m_type =
"RadialGeneralGaussian";
631 if (radius_rad > 0.0 &&
ridx() > 0.0) {
Exception handler interface definition.
Mathematical function definitions.
const GModelSpatialRadialGeneralGauss g_radial_general_gauss_seed
Generalized 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.
Generalized radial Gaussian model class.
double ridx(void) const
Return ridx.
GModelPar m_ridx
Reciprocal of exponent of the radial profile.
double radius(void) const
Return radius.
virtual GModelSpatialRadialGeneralGauss & operator=(const GModelSpatialRadialGeneralGauss &model)
Assignment operator.
double m_inv_radius_rad
radius(rad)^-1
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
GModelSpatialRadialGeneralGauss(void)
Void constructor.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print generalised radial Gaussian source information.
void free_members(void)
Delete class members.
double m_inv_ridx
Spatial profile index.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Generalised Gaussian source model.
void update(void) const
Update precomputation cache.
double m_value_norm
1/(2pi radius(rad)^2 ridx Gamma(ridx))
double m_last_ridx
Last reciprocal radial index.
void init_members(void)
Initialise class members.
virtual void set_region(void) const
Set boundary sky region.
virtual GModelSpatialRadialGeneralGauss * clone(void) const
Clone radial Gauss model.
GModelPar m_radius
Gaussian width (deg)
virtual void read(const GXmlElement &xml)
Read model from XML element.
double m_last_radius
Last radius.
virtual ~GModelSpatialRadialGeneralGauss(void)
Destructor.
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.
void copy_members(const GModelSpatialRadialGeneralGauss &model)
Copy class members.
virtual double theta_max(void) const
Return maximum model radius (in radians)
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.
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.
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.
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 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.
double gammln(const double &arg)
Computes logarithm of gamma function.
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.