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) :
109 if (coordsys ==
"CEL") {
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.";
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
390 double distance = dir.
dist(this->
dir());
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) {
Generalized radial Gaussian model class interface definition.
virtual void clear(void)
Clear radial Gauss model.
const std::string & name(void) const
Return parameter name.
GModelPar m_ridx
Reciprocal of exponent of the radial profile.
void warning(const std::string &origin, const std::string &message)
Emits warning.
virtual ~GModelSpatialRadialGeneralGauss(void)
Destructor.
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
virtual void read(const GXmlElement &xml)
Read model from XML element.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
void update(void) const
Update precomputation cache.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
virtual void set_region(void) const
Set boundary sky region.
Random number generator class.
Interface for the circular sky region class.
Interface definition for the spatial model registry class.
double min(void) const
Return parameter minimum boundary.
void init_members(void)
Initialise class members.
GModelPar m_radius
Gaussian width (deg)
GSkyRegionCircle m_region
Bounding circle.
bool is_notanumber(const double &x)
Signal if argument is not a number.
double ridx(void) const
Return ridx.
const double & scale(void) const
Return parameter scale.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
void init_members(void)
Initialise class members.
const GSkyDir & dir(void) const
Return position of radial spatial model.
virtual GModelSpatialRadialGeneralGauss & operator=(const GModelSpatialRadialGeneralGauss &model)
Assignment operator.
virtual double theta_max(void) const
Return maximum model radius (in radians)
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
void free_members(void)
Delete class members.
void free(void)
Free a parameter.
std::vector< GModelPar * > m_pars
Parameter pointers.
void rotate_deg(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
double m_inv_radius_rad
radius(rad)^-1
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
virtual void read(const GXmlElement &xml)
Read model from XML element.
double m_last_radius
Last radius.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
void clear(void)
Clear parameter.
Spatial model registry class definition.
virtual GModelSpatialRadialGeneralGauss * clone(void) const
Clone radial Gauss model.
double radius(void) const
Return radius.
std::string print(const GChatter &chatter=NORMAL) const
Print time.
const GModelSpatialRadialGeneralGauss g_radial_general_gauss_seed
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
double m_inv_ridx
Spatial profile index.
double m_last_ridx
Last reciprocal radial index.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void free_members(void)
Delete class members.
double gammln(const double &arg)
Computes logarithm of gamma function.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
const GSkyRegion * region(void) const
Return boundary sky region.
virtual GModelSpatialRadial & operator=(const GModelSpatialRadial &model)
Assignment operator.
void free_members(void)
Delete class members.
std::string m_type
Spatial model type.
GModelPar m_lat
Declination or Galactic latitude (deg)
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
double value(void) const
Return parameter value.
GModelPar m_lon
Right Ascension or Galactic longitude (deg)
Generalized radial Gaussian model class.
const std::string & unit(void) const
Return parameter unit.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
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.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print generalised radial Gaussian source information.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
void copy_members(const GModelSpatialRadialGeneralGauss &model)
Copy class members.
Abstract radial spatial model base class.
void init_members(void)
Initialise class members.
virtual void write(GXmlElement &xml) const
Write model into XML element.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
double m_value_norm
1/(2pi radius(rad)^2 ridx Gamma(ridx))
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.
GModelSpatialRadialGeneralGauss(void)
Void constructor.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate Generalised Gaussian source model.
Mathematical function definitions.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.