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) :
125 if ((coordsys !=
"CEL") && (coordsys !=
"GAL")) {
126 std::string msg =
"Invalid coordinate system \""+coordsys+
"\" "
127 "specified. Please specify either \"CEL\" or "
136 if (coordsys ==
"CEL") {
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;
364 double phi = 360.0 * ran.
uniform();
385 const double& margin)
const
388 double distance = dir.
dist(this->
dir());
505 result.append(
"=== GModelSpatialRadialDisk ===");
510 for (
int i = 0; i <
size(); ++i) {
621 m_norm = (denom > 0.0) ? 1.0 / denom : 0.0;
virtual GModelSpatialRadialDisk & operator=(const GModelSpatialRadialDisk &model)
Assignment operator.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual void write(GXmlElement &xml) const
Write model into XML element.
void update(void) const
Update precomputation cache.
const std::string & name(void) const
Return parameter name.
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
double radius(void) const
Return disk radius.
virtual void clear(void)
Clear radial disk model.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
const GModelSpatialRadialDisk g_radial_disk_seed
double acos(const double &arg)
Computes acos by avoiding NaN due to rounding errors.
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
Disk radius (degrees)
virtual ~GModelSpatialRadialDisk(void)
Destructor.
GSkyRegionCircle m_region
Bounding circle.
bool is_notanumber(const double &x)
Signal if argument is not a number.
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.
virtual double eval(const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
const GSkyDir & dir(void) const
Return position of radial spatial model.
virtual void read(const GXmlElement &xml)
Read model from XML element.
void free_members(void)
Delete class members.
void free(void)
Free a parameter.
Radial disk model class interface definition.
std::vector< GModelPar * > m_pars
Parameter pointers.
void rotate_deg(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
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 uniform(void)
Returns random double precision floating value in range 0 to 1.
void clear(void)
Clear parameter.
Spatial model registry class definition.
GModelSpatialRadialDisk(void)
Void constructor.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Return MC sky direction.
std::string type(void) const
Return model type.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual void set_region(void) const
Set boundary sky region.
virtual void write(GXmlElement &xml) const
Write model into XML element.
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)
virtual GModelSpatialRadialDisk * clone(void) const
Clone radial disk model.
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)
const std::string & unit(void) const
Return parameter unit.
Exception handler interface definition.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
void free_members(void)
Delete class members.
Abstract radial spatial model base class.
void init_members(void)
Initialise class members.
double m_radius_rad
Radius in radians.
double m_last_radius
Last disk radius.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void copy_members(const GModelSpatialRadialDisk &model)
Copy class members.
double m_norm
Normalization.
void init_members(void)
Initialise class members.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
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.
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.
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.