42#if defined(G_LEGACY_XML_FORMAT)
48#define G_CONSTRUCTOR "GModelSpatialRadialDisk::GModelSpatialRadialDisk("\
49 "GSkyDir&, double&, std::string&)"
50#define G_READ "GModelSpatialRadialDisk::read(GXmlElement&)"
51#define G_WRITE "GModelSpatialRadialDisk::write(GXmlElement&)"
90 const std::string& type) :
120 const double& radius,
121 const std::string& coordsys) :
126 std::string msg =
"Invalid coordinate system \""+
coordsys+
"\" "
127 "specified. Please specify either \"CEL\" or "
224 if (
this != &model) {
320 const bool& gradients)
const
329 #if defined(G_NAN_CHECK)
331 std::cout <<
"*** ERROR: GModelSpatialRadialDisk::eval";
332 std::cout <<
"(theta=" << theta <<
"): NaN/Inf encountered";
333 std::cout <<
" (value=" << value;
335 std::cout <<
", m_norm=" <<
m_norm;
336 std::cout <<
")" << std::endl;
362 double theta = std::acos(1.0 - ran.
uniform() * (1.0 - cosrad)) *
364 double phi = 360.0 * ran.
uniform();
385 const double& margin)
const
505 result.append(
"=== GModelSpatialRadialDisk ===");
510 for (
int i = 0; i <
size(); ++i) {
621 m_norm = (denom > 0.0) ? 1.0 / denom : 0.0;
Exception handler interface definition.
Mathematical function definitions.
const GModelSpatialRadialDisk g_radial_disk_seed
Radial disk model class interface definition.
Spatial model registry class definition.
Class that handles energies in a unit independent way.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
double radius(void) const
Return disk radius.
void copy_members(const GModelSpatialRadialDisk &model)
Copy class members.
virtual ~GModelSpatialRadialDisk(void)
Destructor.
GModelPar m_radius
Disk radius (degrees)
void update(void) const
Update precomputation cache.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Return MC sky direction.
void free_members(void)
Delete class members.
virtual void clear(void)
Clear radial disk model.
double m_norm
Normalization.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
double m_last_radius
Last disk radius.
virtual GModelSpatialRadialDisk & operator=(const GModelSpatialRadialDisk &model)
Assignment operator.
virtual void set_region(void) const
Set boundary sky region.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_radius_rad
Radius in radians.
virtual GModelSpatialRadialDisk * clone(void) const
Clone radial disk model.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual void read(const GXmlElement &xml)
Read model from XML element.
GModelSpatialRadialDisk(void)
Void constructor.
void init_members(void)
Initialise 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.
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 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 xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.