GammaLib  2.0.0.dev
gammalib Namespace Reference

Functions

int fits_move_to_hdu (const std::string &caller, void *vptr, const int &hdunum=0)
Move to FITS extension. More...

double acos (const double &arg)
Computes acos by avoiding NaN due to rounding errors. More...

double atan2 (const double &y, const double &x)
Compute arc tangens in radians. More...

double cosd (const double &angle)
Compute cosine of angle in degrees. More...

double sind (const double &angle)
Compute sine of angle in degrees. More...

double tand (const double &angle)
Compute tangens of angle in degrees. More...

double asind (const double &value)
Compute arc sine in degrees. More...

double acosd (const double &value)
Compute arc cosine in degrees. More...

double atand (const double &value)
Compute arc tangens in degrees. More...

double atan2d (const double &y, const double &x)
Compute arc tangens in degrees. More...

void sincosd (const double &angle, double *s, double *c)
Compute sine and cosine of angle in degrees. More...

double gammln (const double &arg)
Computes logarithm of gamma function. More...

double erf (const double &arg)
Computes error function. More...

double erfc (const double &arg)
Computes complementary error function. More...

double erfinv (const double &arg)
Computes inverse error function. More...

double modulo (const double &v1, const double &v2)
Returns the remainder of the division. More...

double plaw_integral (const double &x1, const double &f1, const double &x2, const double &f2)
Returns the integral of a power law. More...

double gauss_integral (const double &x1, const double &x2)
Returns the integral of a Gaussian function. More...

std::string strip_whitespace (const std::string &arg)
Strip leading and trailing whitespace from string. More...

std::string strip_chars (const std::string &arg, const std::string &chars)
Strip leading and trailing character from string. More...

std::string rstrip_chars (const std::string &arg, const std::string &chars)
Strip trailing character from string. More...

std::string replace_segment (const std::string &arg, const std::string &segment, const std::string &replacement)
Replace string segment in string. More...

std::string expand_env (const std::string &arg)
Expand environment variables in string. More...

std::string filepath (const std::string &pathname, const std::string &filename)
Build file path from path name and file name. More...

std::string str (const unsigned short int &value)
Convert unsigned short integer value into string. More...

std::string str (const unsigned int &value)
Convert unsigned integer value into string. More...

std::string str (const unsigned long int &value)
Convert unsigned long integer value into string. More...

std::string str (const unsigned long long int &value)
Convert unsigned long long integer value into string. More...

std::string str (const short int &value)
Convert short integer value into string. More...

std::string str (const int &value, const std::string &fmt="%d")
Convert integer value into string. More...

std::string str (const long int &value)
Convert long integer value into string. More...

std::string str (const long long int &value)
Convert long long integer value into string. More...

std::string str (const float &value, const int &precision=0)
Convert single precision value into string. More...

std::string str (const double &value, const int &precision=0)
Convert double precision value into string. More...

std::string str (const std::complex< double > &value, const int &precision=0)
Convert complex value into string. More...

char * tochar (const std::string &arg)
Convert string to C string. More...

short toshort (const std::string &arg)
Convert string into short value. More...

unsigned short toushort (const std::string &arg)
Convert string into unsigned short value. More...

int toint (const std::string &arg)
Convert string into integer value. More...

unsigned int touint (const std::string &arg)
Convert string into unsigned integer value. More...

long tolong (const std::string &arg)
Convert string into long value. More...

unsigned long toulong (const std::string &arg)
Convert string into unsigned long value. More...

long long tolonglong (const std::string &arg)
Convert string into long long value. More...

unsigned long long toulonglong (const std::string &arg)
Convert string into unsigned long long value. More...

float tofloat (const std::string &arg)
Convert string into single precision value. More...

double todouble (const std::string &arg)
Convert string into double precision value. More...

std::string toupper (const std::string &s)
Convert string to upper case. More...

std::string tolower (const std::string &s)
Convert string to lower case. More...

std::vector< std::string > split (const std::string &s, const std::string &sep)
Split string. More...

std::string fill (const std::string &s, const int &n)
Fill string with n strings of same type. More...

std::string left (const std::string &s, const int &n, const char &c= ' ')
Left justify string to achieve a length of n characters. More...

std::string right (const std::string &s, const int &n, const char &c= ' ')
Right justify string to achieve a length of n characters. More...

std::string centre (const std::string &s, const int &n, const char &c= ' ')
Centre string to achieve a length of n characters. More...

std::string parformat (const std::string &s, const int &indent=0)
Convert string in parameter format. More...

std::string number (const std::string &noun, const int &number)
Convert singular noun into number noun. More...

double plaw_photon_flux (const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute photon flux between two energies for a power law. More...

double plaw_energy_flux (const double &emin, const double &emax, const double &epivot, const double &gamma)
Compute energy flux between two energies for a power law. More...

GEnergy elogmean (const GEnergy &a, const GEnergy &b)
Computes log mean energy. More...

bool dir_exists (const std::string &dirname)
Checks if directory exists. More...

bool is_infinite (const double &x)
Signal if argument is infinite. More...

bool is_notanumber (const double &x)
Signal if argument is not a number. More...

bool contains (const std::string &str, const std::string &substring)
Checks if a substring is in a string. More...

bool contains (const std::vector< std::string > &strings, const std::string &string)
Checks if a string is contained in a vector of strings. More...

void warning (const std::string &origin, const std::string &message)
Emits warning. More...

std::string xml2str (const std::string &arg)
Convert XML character references in string to characters. More...

std::string str2xml (const std::string &arg)
Convert special characters in string to XML character references. More...

bool xml_has_par (const GXmlElement &xml, const std::string &name)
Checks if parameter with given name in XML element exists. More...

GXmlElementxml_need_par (const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element. More...

const GXmlElementxml_get_par (const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element. More...

std::string xml_get_attr (const std::string &origin, const GXmlElement &xml, const std::string &name, const std::string &attribute)
Return attribute value for a given parameter in XML element. More...

void xml_check_par (const std::string &origin, const std::string &name, const int &number)
Checks whether a parameter has occured once. More...

GFilename xml_file_expand (const GXmlElement &xml, const std::string &filename)

GFilename xml_file_reduce (const GXmlElement &xml, const std::string &filename)
Reduce file name provided for writing as XML attribute. More...

void xml_get_name_value_pair (const GXmlNode *node, std::string &name, std::string &value)
Extract name / value pair from XML node. More...

int recv (int fd, char *buffer, int len, int flags, int timeout)
Checks whether a parameter has occured once. More...

double roi_arclength (const double &rad, const double &dist, const double &cosdist, const double &sindist, const double &roi, const double &cosroi)
Returns length of circular arc within circular ROI. More...

GChatter reduce (const GChatter &chatter)
Reduce chattiness by one level. More...

void com_wcs_mer2car (GSkyMap &map)
Changes Mercator's projection to cartesian projection. More...

double com_energy1 (const double &energy, const double &phigeo)
Return D1 energy deposit. More...

double com_energy2 (const double &energy, const double &phigeo)
Return D2 energy deposit. More...

GTime com_time (const int &tjd, const int &tics)
Convert TJD and COMPTEL ticks in GTime object. More...

int com_tjd (const GTime &time)
Convert GTime in COMPTEL TJD. More...

int com_tics (const GTime &time)
Convert GTime in COMPTEL tics. More...

cta_omega_intervals limit_omega (const double &min, const double &max, const double &domega)
Limit omega interval. More...

double resolution (const GModelSpatial *model)
Determine resolution of spatial model. More...

Extract ROI from data sub-space keywords. More...

Read energy boundary data sub-space keywords. More...

Read phase boundary data sub-space keywords. More...

Return Good Time Intervals extension name from data sub-space keywords. More...

std::string gadf_hduclas4 (const GFits &fits, const std::string &hduclas4)
Return extension name for GADF response table of given HDU class 4. More...

int iter_rho (const double &rho_max, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of radial Romberg iterations. More...

int iter_phi (const double &rho, const double &resolution, const int &iter_min, const int &iter_max)
Determine number of azimuthal Romberg iterations. More...

const GCTAObservationcta_obs (const std::string &origin, const GObservation &obs)
Retrieve CTA observation from generic observation. More...

const GCTAPointingcta_pnt (const std::string &origin, const GObservation &obs)
Retrieve CTA pointing from generic observation. More...

const GCTAResponsecta_rsp (const std::string &origin, const GResponse &rsp)
Retrieve CTA response from generic observation. More...

const GCTAResponseIrfcta_rsp_irf (const std::string &origin, const GObservation &obs)
Retrieve CTA IRF response from generic observation. More...

const GCTAResponseCubecta_rsp_cube (const std::string &origin, const GObservation &obs)
Retrieve CTA cube response from generic observation. More...

const GCTAAeffcta_rsp_aeff (const std::string &origin, const GObservation &obs)
Retrieve CTA effective area response from generic observation. More...

const GCTABackgroundcta_rsp_bkg (const std::string &origin, const GObservation &obs)
Retrieve CTA background response from generic observation. More...

const GCTAEventListcta_event_list (const std::string &origin, const GObservation &obs)
Retrieve CTA event list from generic observation. More...

const GCTAEventCubecta_event_cube (const std::string &origin, const GObservation &obs)
Retrieve CTA event cube from generic observation. More...

const GCTAInstDircta_dir (const std::string &origin, const GEvent &event)
Retrieve CTA instrument direction from generic event. More...

const GModelSpectralcta_model_spectral (const GModelData &model)
Retrieve spectral component from CTA background model. More...

const GModelTemporalcta_model_temporal (const GModelData &model)
Retrieve temporal component from CTA background model. More...

const GFitsTablespi_hdu (const GFits &fits, const std::string &extname, const int &extver=1)
Return FITS table. More...

int spi_num_hdus (const GFits &fits, const std::string &extname)
Return number of HDU versions. More...

GTime spi_ijd2time (const double &ijd)
Convert IJD to GTime. More...

GTimes spi_annealing_start_times (void)
Return start time of annealing operations. More...

GTimes spi_gedfail_times (void)
Return times of detector failures. More...

Variables

const std::string extname_arf = "SPECRESP"

const std::string extname_ebounds = "EBOUNDS"

const std::string extname_energies = "ENERGIES"

const std::string extname_gti = "GTI"

const double pi = 3.141592653589793238462643383279502884197

const double twopi = 6.283185307179586476925286766559005768394

const double fourpi = 12.56637061435917295385057353311801153679

const double pihalf = 1.570796326794896619231321691639751442099

const double inv_pihalf = 0.6366197723675813430755350534900574

const double inv_sqrt4pi = 0.2820947917738781434740397257803862929220

const double inv_sqrt2pi = 0.3989422804014327028632180827116826549172

const double pi2 = pi*pi

const double ln2 = 0.6931471805599453094172321214581766

const double ln10 = 2.3025850929940456840179914546843642

const double inv_ln2 = 1.4426950408889634073599246810018921

const double inv_ln10 = 1.0/ln10

const double inv_loge = 1.0/std::log10(std::exp(1.0))

const double onethird = 1.0/3.0

const double twothird = 2.0/3.0

const double fourthird = 4.0/3.0

const double sqrt_onehalf = std::sqrt(1.0/2.0)

const double sqrt_two = std::sqrt(2.0)

const double sqrt_pihalf = std::sqrt(pihalf)

const double sqrt_twopi = std::sqrt(twopi)

const std::string extname_pha = "SPECTRUM"

const std::string extname_rmf = "MATRIX"

const double MeV2erg = 1.6021765e-6

const double erg2MeV = 624150.96

const double MeV2Angstrom = 1.239841875e-2

const double pc2cm = 3.08568025e18

const double sec_in_day = 86400.0

const double sec2day = 1.0 / sec_in_day

const double tai2tt = 32.184

const double mec2 = 0.5109989461

const double gkx1 [5]

const double gkw10 [5]

const double gkx2 [5]

const double gkw21a [5]

const double gkw21b [6]

const double gkx3 [11]

const double gkw43a [10]

const double gkw43b [12]

const double gkx4 [22]

const double gkw87a [21]

const double gkw87b [23]

const std::string extname_dri = "DRI"

const std::string extname_cta_aeff2d = "EFFECTIVE AREA"

const std::string extname_cta_background3d = "BACKGROUND"

const std::string extname_cta_migras = "MIGRAS"

const std::string extname_deltas = "DELTAS"

const std::string extname_cta_edisp2d = "ENERGY DISPERSION"

const std::string extname_cta_counts = "COUNTS"

const std::string extname_cta_weights = "WEIGHTS"

const std::string extname_cta_events = "EVENTS"

const std::string extname_cta_spatial_lookup = "RADIAL BACKGROUND LOOKUP"

const std::string extname_cta_psf2d = "POINT SPREAD FUNCTION"

const std::string extname_cta_psfking = "POINT SPREAD FUNCTION"

const std::string extname_cta_psftable = "PSF_2D_TABLE"

const std::string extname_lat_aeff = "EFFECTIVE AREA"

const std::string extname_lat_efficiency = "EFFICIENCY_PARAMS"

const std::string extname_lat_edisp = "ENERGY DISPERSION"

const std::string extname_lat_edisp_scale = "EDISP_SCALING_PARAMS"

const std::string extname_lat_events = "EVENTS"

const std::string extname_lat_exposure = "EXPOSURE"

const std::string extname_lat_wgtexposure = "WEIGHTED_EXPOSURE"

const std::string extname_lat_cthetabounds = "CTHETABOUNDS"

const std::string extname_lat_ltcubemap = "EXPOSURE"

Function Documentation

 double gammalib::acos ( const double & arg )

Computes acos by avoiding NaN due to rounding errors.

Parameters
 [in] arg Argument.
Returns
Arc cosine of argument.

Returns the arc cosine by restricting the argument to [-1,1].

If the compile option G_USE_ASIN_FOR_ACOS is defined, the function will compute

$acos(x) = \frac{\pi}{2} - asin(x)$

which happens to be faster on most systems.

Definition at line 69 of file GMath.cpp.

References asin(), pi, and pihalf.

 double gammalib::acosd ( const double & value )

Compute arc cosine in degrees.

Parameters
 [in] value Value

This code has been adapted from the WCSLIB function wcstrig.c::acosd().

Definition at line 218 of file GMath.cpp.

Referenced by GWcs::cel_set(), GWcsSIN::prj_x2s(), GWcs::sph_s2x(), and GWcs::sph_x2s().

 double gammalib::asind ( const double & value )

Compute arc sine in degrees.

Parameters
 [in] value Value

This code has been adapted from the WCSLIB function wcstrig.c::asind().

Definition at line 250 of file GMath.cpp.

 double gammalib::atan2 ( const double & y, const double & x )

Parameters
 [in] y Nominator [in] x Denominator

This code has been adapted from the WCSLIB function wcstrig.c::atan2d().

Definition at line 102 of file GMath.cpp.

References pi, and pihalf.

 double gammalib::atan2d ( const double & y, const double & x )

Compute arc tangens in degrees.

Parameters
 [in] y Nominator [in] x Denominator

This code has been adapted from the WCSLIB function wcstrig.c::atan2d().

Definition at line 308 of file GMath.cpp.

 double gammalib::atand ( const double & value )

Compute arc tangens in degrees.

Parameters
 [in] value Value

This code has been adapted from the WCSLIB function wcstrig.c::atand().

Definition at line 282 of file GMath.cpp.

Referenced by GWcsAZP::prj_s2x(), GWcsSIN::prj_s2x(), GWcsSTG::prj_x2s(), and GWcsMER::prj_x2s().

 std::string gammalib::centre ( const std::string & s, const int & n, const char & c = ' ' )

Centre string to achieve a length of n characters.

Parameters
 [in] s String to be centred. [in] n Requested total width. [in] c Left fill character.
Returns
Centred string.

Centre string by adding whitespace to the left and the right to achieve a length of n characters.

Definition at line 1008 of file GTools.cpp.

References fill().

 double gammalib::com_energy1 ( const double & energy, const double & phigeo )

Return D1 energy deposit.

Parameters
 [in] energy Input photon energy (MeV). [in] phigeo Geometrical scatter angle (deg).
Returns
D1 energy deposit in MeV.

Definition at line 108 of file GCOMSupport.cpp.

References com_energy2().

Referenced by GCOMInstChars::psd_correction().

 double gammalib::com_energy2 ( const double & energy, const double & phigeo )

Return D2 energy deposit.

Parameters
 [in] energy Input photon energy (MeV). [in] phigeo Geometrical scatter angle (deg).
Returns
D2 energy deposit in MeV.

Definition at line 125 of file GCOMSupport.cpp.

 int gammalib::com_tics ( const GTime & time )

Convert GTime in COMPTEL tics.

Parameters
 [in] time Time.
Returns
COMPTEL ticks (1/8 ms).

Converts GTime object in COMPTEL ticks (1/8 ms).

Definition at line 196 of file GCOMSupport.cpp.

References com_time(), and com_tjd().

 GTime gammalib::com_time ( const int & tjd, const int & tics )

Convert TJD and COMPTEL ticks in GTime object.

Parameters
 [in] tjd Truncated Julian Days (days). [in] tics COMPTEL ticks (1/8 ms).
Returns
Time.

Converts TJD and COMPTEL ticks into a GTime object. COMPTEL times are given in UTC, i.e. 8393:0 converts into 1991-05-17T00:00:00 UT (see COM-RP-UNH-DRG-037).

Definition at line 149 of file GCOMSupport.cpp.

References GTime::mjd(), and GTime::secs().

 int gammalib::com_tjd ( const GTime & time )

Convert GTime in COMPTEL TJD.

Parameters
 [in] time Time.
Returns
Truncated Julian Days (days).

Converts GTime object in TJD.

Definition at line 178 of file GCOMSupport.cpp.

References GTime::mjd().

 void gammalib::com_wcs_mer2car ( GSkyMap & map )

Changes Mercator's projection to cartesian projection.

Parameters
 [in,out] map Skymap.

Changes the World Coordinate System of a sky map from Mercartor's projection to a cartesian projection. This transformation is needed to correct the wrong WCS headers that are found in the COMPTEL files distributed through the HEASARC web site.

The method operates only on sky maps that use Mercator's projection. Nothing is done for all other sky map. This method can thus be transparently be applied to the sky maps read from COMPTEL data files.

Definition at line 58 of file GCOMSupport.cpp.

 bool gammalib::contains ( const std::string & str, const std::string & substring )

Checks if a substring is in a string.

Parameters
 [in] str String you want to search in. [in] substring String you are looking for in str.
Returns
True if a string contains a sub string.

Checks if substring is contained in str

Definition at line 1232 of file GTools.cpp.

 bool gammalib::contains ( const std::vector< std::string > & strings, const std::string & string )

Checks if a string is contained in a vector of strings.

Parameters
 [in] strings Vector of strings you want to search in. [in] string string you are looking for in strings.
Returns
True if a string is contained a vector.

Checks if a string is contained in a vector of strings

Definition at line 1256 of file GTools.cpp.

 double gammalib::cosd ( const double & angle )

Compute cosine of angle in degrees.

Parameters
 [in] angle Angle in degrees

This code has been adapted from the WCSLIB function wcstrig.c::cosd().

Definition at line 134 of file GMath.cpp.

 const GCTAInstDir & gammalib::cta_dir ( const std::string & origin, const GEvent & event )

Retrieve CTA instrument direction from generic event.

Parameters
 [in] origin Method asking for pointer retrieval. [in] event Generic event.
Returns
Reference to CTA RoI.
Exceptions
 GException::invalid_argument event does not contain a CTA instrument direction.

Extract CTA Instrument Direction from an event.

Definition at line 804 of file GCTASupport.cpp.

 const GCTAEventCube & gammalib::cta_event_cube ( const std::string & origin, const GObservation & obs )

Retrieve CTA event cube from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA event cube.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA event cube.

Extract CTA event cube from a CTA observation.

Definition at line 770 of file GCTASupport.cpp.

References cta_obs(), and GObservation::events().

 const GCTAEventList & gammalib::cta_event_list ( const std::string & origin, const GObservation & obs )

Retrieve CTA event list from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA event list.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA event list.

Extract CTA event list from a CTA observation.

Definition at line 736 of file GCTASupport.cpp.

References cta_obs(), and GObservation::events().

 const GModelSpectral * gammalib::cta_model_spectral ( const GModelData & model )

Retrieve spectral component from CTA background model.

Parameters
 [in] model Data model.
Returns
Pointer to spectral component.

Retrieves the spectral component from a CTA background model. If the background model has no spectral component, a NULL pointer will be returned.

Definition at line 834 of file GCTASupport.cpp.

Referenced by GCTAOnOffObservation::N_bgd().

 const GModelTemporal * gammalib::cta_model_temporal ( const GModelData & model )

Retrieve temporal component from CTA background model.

Parameters
 [in] model Data model.
Returns
Pointer to temporal component.

Retrieves the temporal component from a CTA background model. If the background model has no temporal component, a NULL pointer will be returned.

Definition at line 878 of file GCTASupport.cpp.

 const GCTAObservation & gammalib::cta_obs ( const std::string & origin, const GObservation & obs )

Retrieve CTA observation from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA observation.
Exceptions
 GException::invalid_argument Observation obs is not a CTA observations.

Dynamically casts generic observation into a CTA observation. If the generic observation is not a CTA observation, an exception is thrown.

Definition at line 516 of file GCTASupport.cpp.

References GObservation::id(), and GObservation::name().

 const GCTAPointing & gammalib::cta_pnt ( const std::string & origin, const GObservation & obs )

Retrieve CTA pointing from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA pointing.

Extract CTA pointing from a CTA observation.

Definition at line 546 of file GCTASupport.cpp.

References cta_obs(), and GCTAObservation::pointing().

 const GCTAResponse * gammalib::cta_rsp ( const std::string & origin, const GResponse & rsp )

Retrieve CTA response from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] rsp Generic response.
Returns
Pointer to CTA response.
Exceptions
 GException::invalid_argument Response rsp is not a CTA response.

Extract CTA response from a CTA observation.

Definition at line 569 of file GCTASupport.cpp.

Referenced by GCTAObservation::response(), and GCTAOnOffObservation::response().

 const GCTAAeff & gammalib::cta_rsp_aeff ( const std::string & origin, const GObservation & obs )

Retrieve CTA effective area response from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA effective area response.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA effective area response.

Extract CTA effective area response from a CTA observation.

Definition at line 672 of file GCTASupport.cpp.

References GCTAResponseIrf::aeff(), and cta_rsp_irf().

 const GCTABackground & gammalib::cta_rsp_bkg ( const std::string & origin, const GObservation & obs )

Retrieve CTA background response from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA background response.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA background response.

Extract CTA background response from a CTA observation.

Definition at line 704 of file GCTASupport.cpp.

References GCTAResponseIrf::background(), and cta_rsp_irf().

 const GCTAResponseCube & gammalib::cta_rsp_cube ( const std::string & origin, const GObservation & obs )

Retrieve CTA cube response from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA cube response.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA cube response.

Extract CTA cube response from a CTA observation.

Definition at line 636 of file GCTASupport.cpp.

References cta_obs(), and GCTAObservation::response().

Referenced by GCTAModelCubeBackground::eval(), and GCTAModelCubeBackground::npred().

 const GCTAResponseIrf & gammalib::cta_rsp_irf ( const std::string & origin, const GObservation & obs )

Retrieve CTA IRF response from generic observation.

Parameters
 [in] origin Method asking for pointer retrieval. [in] obs Generic observation.
Returns
Reference to CTA IRF response.
Exceptions
 GException::invalid_argument Observation obs does not contain a CTA IRF response.

Extract CTA IRF response from a CTA observation.

Definition at line 600 of file GCTASupport.cpp.

 bool gammalib::dir_exists ( const std::string & dirname )

Checks if directory exists.

Parameters
 [in] dirname Directory name.
Returns
True if directory exists, false otherwise.

Checks if a directory exists. The function expands any environment variable prior to checking.

Definition at line 1202 of file GTools.cpp.

References expand_env().

Referenced by GCaldb::path(), and GCaldb::rootdir().

 GEnergy gammalib::elogmean ( const GEnergy & a, const GEnergy & b )

Computes log mean energy.

Parameters
 [in] a First energy. [in] b Second energy.
Returns
Log mean energy.

Computes the logarithmic mean energy $$10^{0.5 * (\log E_{\rm a} + \log E_{\rm b})}$$ for two energies.

Definition at line 1180 of file GTools.cpp.

References GEnergy::log10MeV(), GEnergy::MeV(), and pow().

Referenced by GLATEventCube::set_energies(), and GCTAEventCube::set_energies().

 double gammalib::erf ( const double & arg )

Computes error function.

Parameters
 [in] arg Argument.
Returns
Error function.

Definition at line 417 of file GMath.cpp.

References abs(), and exp().

Referenced by erfc(), and erfinv().

 double gammalib::erfc ( const double & arg )

Computes complementary error function.

Parameters
 [in] arg Argument.
Returns
Complementary error function.

Definition at line 450 of file GMath.cpp.

References erf().

Referenced by gauss_integral().

 double gammalib::erfinv ( const double & arg )

Computes inverse error function.

Parameters
 [in] arg Argument.
Returns
Inverse error function.

Definition at line 463 of file GMath.cpp.

References abs(), copysign, erf(), exp(), log(), pi, and sqrt().

 std::string gammalib::expand_env ( const std::string & arg )

Expand environment variables in string.

Parameters
 [in] arg String.
Returns
String with expected environment variables.

Expands any environment variable that is found in a string. Valid delimiters for environment variables are $ENV{<name>},$ENV(<name>), ${<name>},$(<name>) and \$<name> (in the last case the terminating delimiter is either a / or a blank character or the end of the string). Environment variables occuring within single quotes (') are ignored. Environment variables that do not exist will be kept as specified.

The method also replaces ~ or ~user by the user's home directory, ~+ by the value of the PWD environment variable and ~- by the value of the OLDPWD variable. If the user or the PWD or OLDPWD variable are not found, no replacement is done.

This function has been inspired by the function ape_util_expand_env_var from ape_util.c in the ape software developed at HEASARC.

Definition at line 209 of file GTools.cpp.

 std::string gammalib::filepath ( const std::string & pathname, const std::string & filename )

Build file path from path name and file name.

Parameters
 [in] pathname Path name. [in] filename File name.
Returns
File path.

Builds a file path by combining the pathname and the filename following

 filepath = pathname/filename


If pathname is an empty string, the method simply returns the filename.

Definition at line 388 of file GTools.cpp.

 std::string gammalib::fill ( const std::string & s, const int & n )

Fill string with n strings of same type.

Parameters
 [in] s String to be filled. [in] n Number of fillings.
Returns
Filled strings.

Replicates a given string n time.

Definition at line 934 of file GTools.cpp.

 int gammalib::fits_move_to_hdu ( const std::string & caller, void * vptr, const int & hdunum = 0 )

Move to FITS extension.

Parameters
 [in] caller Name of caller. [in] vptr FITS file void pointer. [in] hdunum HDU number (optional)
Exceptions
 GException::fits_error cfitsio error occured.

If hdunum is >0, moves the FITS file void pointer to the HDU specified by hdunum. Otherwise, the FITS file void pointer is moved to the HDU specified by the HDUposition attribute of the void pointer.

Definition at line 1745 of file GFits.cpp.

References __ffmahd, FPTR, and str().

 std::string gammalib::gadf_hduclas4 ( const GFits & fits, const std::string & hduclas4 )

Return extension name for GADF response table of given HDU class 4.

Parameters
 [in] fits FITS file. [in] hduclas4 HDU class 4.
Returns
Extension name.

Returns the extension name for GADF response table of given HDU class 4. If the response table is not found, an empty extension name is returned.

Definition at line 374 of file GCTASupport.cpp.

 double gammalib::gammln ( const double & arg )

Computes logarithm of gamma function.

Parameters
 [in] arg Argument.
Returns
Logarithm of gamma function.

Definition at line 383 of file GMath.cpp.

References log().

Referenced by GRan::poisson().

 double gammalib::gauss_integral ( const double & x1, const double & x2 )

Returns the integral of a Gaussian function.

Parameters
 [in] x1 Lower x boundary (in units of Gaussian sigma). [in] x2 Upper x boundary (in units of Gaussian sigma).
Returns
Integral of Gaussian

Analytically computes

$\frac{1}{\sqrt{\pi}}\int_{x_1}^{x_2} e^{-\frac{1}{2}x^2} dx$

Definition at line 605 of file GMath.cpp.

References erfc(), norm(), and sqrt_two.

Referenced by GModelSpectralGauss::flux(), and GCTAEdispPerfTable::prob_erecobin().

 int gammalib::iter_phi ( const double & rho, const double & resolution, const int & iter_min, const int & iter_max )

Determine number of azimuthal Romberg iterations.

Parameters
 [in] rho Radial offset (radians). [in] resolution Requested angular resolution (radians). [in] iter_min Minimum number of iterations. [in] iter_max Maximum number of iterations.
Returns
Number of azimuthal Romberg iterations.

Determines the number of azimuthal Romberg iterations using the formula

$iter = \log_2 \left( \frac{2\pi \rho}{resolution} \right) + 1$

where $$\rho$$ is the radial offset and $$resolution$$ is the required angular resolution.

The result will be constrained to the interval [iter_min,iter_max].

Definition at line 478 of file GCTASupport.cpp.

References inv_ln2, log(), resolution(), and twopi.

 int gammalib::iter_rho ( const double & rho_max, const double & resolution, const int & iter_min, const int & iter_max )

Determine number of radial Romberg iterations.

Parameters
 [in] rho_max Maximum radial offset (radians). [in] resolution Requested angular resolution (radians). [in] iter_min Minimum number of iterations. [in] iter_max Maximum number of iterations.
Returns

Determines the number of radial Romberg iterations using the formula

$iter = \log_2 \left( \frac{\rho_{\rm max}}{resolution} \right) + 1$

where $$\rho_{\rm max}$$ is the maximum radial offset and $$resolution$$ is the required angular resolution.

The result will be constrained to the interval [iter_min,iter_max].

Definition at line 432 of file GCTASupport.cpp.

References inv_ln2, log(), and resolution().

 std::string gammalib::left ( const std::string & s, const int & n, const char & c = ' ' )

Left justify string to achieve a length of n characters.

Parameters
 [in] s String to be centred. [in] n Requested total width. [in] c Fill character.
Returns
Left justified string.

Left justify string by adding whitespace to the right to achieve a length of n characters.

Definition at line 960 of file GTools.cpp.

References fill().

 cta_omega_intervals gammalib::limit_omega ( const double & min, const double & max, const double & domega )

Limit omega interval.

Parameters
 [in] min Interval minimum (radians). [in] max Interval maximum (radians). [in] domega Half length of interval (radians).
Returns
Vector of intervals.

Limits an omega interval [min,max] to the interval specified by [-domega,domega]. This may lead to a split of [min,max] in several intervals. The method thus returns a vector of intervals that overlap with [-domega,domega]. If there is no overlap with the interval, the method returns an empty vector.

The method takes care of wrap arounds. It is assumed that on input [min,max] is contained within [-2pi,+2pi].

Definition at line 90 of file GCTAResponse_helpers.cpp.

References max(), min(), pi, and twopi.

 double gammalib::modulo ( const double & v1, const double & v2 )

Returns the remainder of the division.

Parameters
 [in] v1 Nominator. [in] v2 Denominator.
Returns
Remainder of division

Returns the remainder of the division v1/v2. The result is non-negative. v1 can be positive or negative; v2 must be positive.

Definition at line 526 of file GMath.cpp.

 std::string gammalib::number ( const std::string & noun, const int & number )

Convert singular noun into number noun.

Parameters
 [in] noun Singular noun. [in] number Number of instance of noun.
Returns
Converted noun.

Converts a singular noun into a number noun by appending a "s" to the noun if the number of the instances of the noun is not one.

Definition at line 1057 of file GTools.cpp.

 double gammalib::plaw_energy_flux ( const double & emin, const double & emax, const double & epivot, const double & gamma )

Compute energy flux between two energies for a power law.

Parameters
 [in] emin Minimum energy. [in] emax Maximum energy. [in] epivot Pivot energy. [in] gamma Spectral index.
Returns
Energy flux under power law.

Analytically computes

$\int_{E_{\rm min}}^{E_{\rm max}} \left( E/E_{\rm pivot} \right)^{\gamma} E dE$

where $$E_{\rm min}$$ and $$E_{\rm max}$$ are the minimum and maximum energy, respectively, and $$E_{\rm pivot}$$ is the pivot energy, and $$\gamma$$ is the spectral index.

Definition at line 1138 of file GTools.cpp.

References abs(), log(), and pow().

 double gammalib::plaw_integral ( const double & x1, const double & f1, const double & x2, const double & f2 )

Returns the integral of a power law.

Parameters
 [in] x1 First x value. [in] f1 Power law value at first x value. [in] x2 Second x value. [in] f2 Power law value at second x value.
Returns
Integral of power law

Analytically computes

$\int_{x_1}^{x_2} F_1 \left( \frac{x}{x_1} \right)^m dx$

where

$m = \frac{\ln (F_2 / F_1)}{\ln (x_2 / x_1)}$

and $$F_1$$ is the power law value at point $$x_1$$ and $$F_2$$ is the power law value at point $$x_2$$.

Definition at line 566 of file GMath.cpp.

References abs(), log(), and pow().

 double gammalib::plaw_photon_flux ( const double & emin, const double & emax, const double & epivot, const double & gamma )

Compute photon flux between two energies for a power law.

Parameters
 [in] emin Minimum energy. [in] emax Maximum energy. [in] epivot Pivot energy. [in] gamma Spectral index.
Returns
Photon flux under power law.

Analytically computes

$\int_{E_{\rm min}}^{E_{\rm max}} \left( E/E_{\rm pivot} \right)^{\gamma} dE$

where $$E_{\rm min}$$ and $$E_{\rm max}$$ are the minimum and maximum energy, respectively, and $$E_{\rm pivot}$$ is the pivot energy, and $$\gamma$$ is the spectral index.

Definition at line 1090 of file GTools.cpp.

References abs(), log(), and pow().

 GEbounds gammalib::read_ds_ebounds ( const GFitsHDU & hdu )

Read energy boundary data sub-space keywords.

Parameters
 [in] hdu FITS HDU
Exceptions
 GException::invalid_value Invalid energy data sub-space encountered

Reads the energy boundary data sub-space keywords by searching for a DSTYPx keyword named "ENERGY". The data sub-space information is expected to be in the format "200:50000", where the 2 arguments are the minimum and maximum energy. The energy unit is given by the keyword DSUNIx, which supports keV, MeV, GeV and TeV (case independent). No detailed syntax checking is performed.

Definition at line 180 of file GCTASupport.cpp.

 std::string gammalib::read_ds_gti_extname ( const GFitsHDU & hdu )

Return Good Time Intervals extension name from data sub-space keywords.

Parameters
 [in] hdu FITS HDU
Returns
Good Time Interval extension name
Exceptions
 GException::invalid_value Invalid Good Time Intervals data sub-space encountered

Returns the name of the FITS extension that contains the Good Time Intervals by screening the data sub-space keywords that are present in the FITS header. The method searches for a DSTYPx keyword named "TIME" and a corresponding DSVALx keyword named "TABLE", and the extension name is extracted from the corresponding DSREFx keyword. Note that by convention the extension name is preceeded by a colon, which is stripped by this method.

Definition at line 308 of file GCTASupport.cpp.

 GPhases gammalib::read_ds_phase ( const GFitsHDU & hdu )

Read phase boundary data sub-space keywords.

Parameters
 [in] hdu FITS HDU
Returns
Phase intervals
Exceptions
 GException::invalid_value Invalid phase data sub-space encountered

Reads the phase boundary data sub-space keywords by searching for a DSTYPx keyword named "PHASE". The data sub-space information is expected to be in the format "0.1:0.3,0.5:0.7", where each subset of numbers represents the minimum and maximum phase. No detailed syntax checking is performed.

Definition at line 242 of file GCTASupport.cpp.

 GCTARoi gammalib::read_ds_roi ( const GFitsHDU & hdu )

Extract ROI from data sub-space keywords.

Parameters
 [in] hdu FITS HDU
Exceptions
 GException::invalid_value Invalid ROI data sub-space encountered

Reads the ROI data sub-space keywords by searching for a DSTYPx keyword named "POS(RA,DEC)". The data sub-space information is expected to be in the format "CIRCLE(267.0208,-24.78,4.5)", where the 3 arguments are Right Ascension, Declination and radius in units of degrees. No detailed syntax checking is performed.

If no ROI information has been found, an GCTARoi object with initial values will be returned.

Definition at line 92 of file GCTASupport.cpp.

 int gammalib::recv ( int fd, char * buffer, int len, int flags, int timeout )

Checks whether a parameter has occured once.

Parameters
 [in] fd Socket file descriptor. [out] buffer Buffer to hold data. [in] len Maximum number of bytes to recv(). [in] flags Flags (as the fourth param to recv() ). [in] timeout Timeout in milliseconds.
Returns
recv() error code, -2 == timeout

This function implements the recv() function with a timeout. The timeout is specified in milliseconds.

Definition at line 1809 of file GTools.cpp.

 GChatter gammalib::reduce ( const GChatter & chatter )
inline

Reduce chattiness by one level.

Parameters
 [in] chatter Chattiness.
Returns
Reduced chattiness.

Definition at line 65 of file GTypemaps.hpp.

References EXPLICIT, NORMAL, SILENT, TERSE, and VERBOSE.

 std::string gammalib::replace_segment ( const std::string & arg, const std::string & segment, const std::string & replacement )

Replace string segment in string.

Parameters
 [in] arg String in which character segements are to be replaced [in] segment String segment to be replaced. [in] replacement Replacement string.
Returns
String with replaced segements.

Replaces string segments by a replacement string in a given string.

If the input string arg is "Wonderful", the segment is "onder" and the replacement is "ish" the method will return "Wishful".

Definition at line 163 of file GTools.cpp.

 double gammalib::resolution ( const GModelSpatial * model )

Determine resolution of spatial model.

Parameters
 [in] model Pointer to spatial model.
Returns

Determine the resolution of a spatial model. So far the method only works for a spatial map or cube model holding a WCS projection. If a constant spatial model is encountered a resolution of 180 deg is returned.

If the resolution of the model could not be determined, the method returns a resolution of 0.01 deg.

Definition at line 178 of file GCTAResponse_helpers.cpp.

 std::string gammalib::right ( const std::string & s, const int & n, const char & c = ' ' )

Right justify string to achieve a length of n characters.

Parameters
 [in] s String to be centred. [in] n Requested total width. [in] c Fill character.
Returns
Right justified string.

Right justify string by adding whitespace to the left to achieve a length of n characters.

Definition at line 984 of file GTools.cpp.

References fill().

 double gammalib::roi_arclength ( const double & rad, const double & dist, const double & cosdist, const double & sindist, const double & roi, const double & cosroi )

Returns length of circular arc within circular ROI.

Parameters

This method returns the arclength in radians of a circle of radius 'rad' with a centre that is offset by 'dist' from the ROI centre, where the ROI radius is given by 'roi'. To speed-up computations, the cosines and sinus of 'roi' and 'psf' should be calculated by the client and be passed to the method.

Definition at line 1880 of file GTools.cpp.

References acos(), cos(), is_infinite(), is_notanumber(), sin(), and twopi.

 std::string gammalib::rstrip_chars ( const std::string & arg, const std::string & chars )

Strip trailing character from string.

Parameters
 [in] arg String from which character should be stripped. [in] chars Character(s) to be stripped.
Returns
String with stripped characters.

Definition at line 126 of file GTools.cpp.

 void gammalib::sincosd ( const double & angle, double * s, double * c )

Compute sine and cosine of angle in degrees.

Parameters
 [in] angle Angle [degrees]. [out] s Sine of angle. [out] c Cosine of angle.

This code has been adapted from the WCSLIB function wcstrig.c::sincosd().

Definition at line 342 of file GMath.cpp.

References abs(), cos(), deg2rad, and sin().

 double gammalib::sind ( const double & angle )

Compute sine of angle in degrees.

Parameters
 [in] angle Angle in degrees

This code has been adapted from the WCSLIB function wcstrig.c::sind().

Definition at line 163 of file GMath.cpp.

Referenced by GWcs::cel_set(), GWcsTAN::prj_s2x(), GWcsSTG::prj_s2x(), GWcsSIN::prj_s2x(), and GWcsAZP::prj_set().

 GTimes gammalib::spi_annealing_start_times ( void )

Return start time of annealing operations.

Returns
Start time of annealing operations.

Returns the start time of the SPI annealing operations.

Definition at line 248 of file GSPITools.cpp.

References GTimes::append().

 GTimes gammalib::spi_gedfail_times ( void )

Return times of detector failures.

Returns
Times of detector failures.

Returns the times of detector failures.

Definition at line 301 of file GSPITools.cpp.

References GTimes::append().

 const GFitsTable * gammalib::spi_hdu ( const GFits & fits, const std::string & extname, const int & extver = 1 )

Return FITS table.

Parameters
 [in] fits FITS file. [in] extname Extension name. [in] extver Extension version.
Returns
Pointer to FITS table.

Returns the HDU with a specific extension name and version from the FITS file. The method searched in the FITS file as well as grouping tables and nested grouping tables.

The method allocates a copy of the HDU, hence the client needs to deallocate the HDU after usage.

Definition at line 57 of file GSPITools.cpp.

 GTime gammalib::spi_ijd2time ( const double & ijd )

Convert IJD to GTime.

Parameters
 [in] ijd INTEGRAL Julian Days (days).
Returns
time.

Converts time given in INTEGRAL Julian Days into a GTime object.

Definition at line 225 of file GSPITools.cpp.

References GTime::mjd().

 int gammalib::spi_num_hdus ( const GFits & fits, const std::string & extname )

Return number of HDU versions.

Parameters
 [in] fits FITS file. [in] extname Extension name.
Returns
Number of HDU versions.

Returns the number of HDU versions with a specific extension name in the FITS file and associated or nested grouping tables.

Definition at line 166 of file GSPITools.cpp.

 std::vector< std::string > gammalib::split ( const std::string & s, const std::string & sep )

Split string.

Parameters
 [in] s String to be splitted. [in] sep Separator(s).
Returns
Vector of split strings.

Splits a string on the basis of one or multiple separator characters. The separator characters are provided by the sep argument. Subsequent separator characters that are not seperated by some other characters will lead to an empty string element, except for a blank separator where subsequent blanks are takens as a single separator. Below a few examples that illustrate how the function will split a given string.

"Name;RA;DEC" => ["Name","RA","DEC"] (sep=";")
"My house is    red" => ["My","house","is","red"] (sep=" ")
"IRF::FRONT" => ["IRF","","FRONT"] (sep=":")
"Fields;RA,DEC,Flux" => ["Fields","RA","DEC","Flux"] (sep=";,")
"Last;Field;" => ["Last","Field",""] (sep=";")

Definition at line 873 of file GTools.cpp.

 std::string gammalib::str ( const unsigned int & value )

Convert unsigned integer value into string.

Parameters
 [in] value Unsigned integer to be converted into string.
Returns
String with unsigned integer value.

Definition at line 429 of file GTools.cpp.

 std::string gammalib::str ( const unsigned long int & value )

Convert unsigned long integer value into string.

Parameters
 [in] value Unsigned long integer to be converted into string.
Returns
String with unsigned long integer value.

Definition at line 443 of file GTools.cpp.

 std::string gammalib::str ( const unsigned long long int & value )

Convert unsigned long long integer value into string.

Parameters
 [in] value Unsigned long long integer to be converted into string.
Returns
String with unsigned long long integer value.

Definition at line 457 of file GTools.cpp.

 std::string gammalib::str ( const short int & value )

Convert short integer value into string.

Parameters
 [in] value Short integer to be converted into string.
Returns
String with short integer value.

Definition at line 471 of file GTools.cpp.

 std::string gammalib::str ( const int & value, const std::string & fmt = "%d" )

Convert integer value into string.

Parameters
 [in] value Integer to be converted into string. [in] fmt Format string.
Returns
String with integer value.

Definition at line 486 of file GTools.cpp.

References G_CHAR_BUFFER.

 std::string gammalib::str ( const long int & value )

Convert long integer value into string.

Parameters
 [in] value Long integer to be converted into string.
Returns
String with long integer value.

Definition at line 508 of file GTools.cpp.

 std::string gammalib::str ( const long long int & value )

Convert long long integer value into string.

Parameters
 [in] value Long long integer to be converted into string.
Returns
String with long long integer value.

Definition at line 522 of file GTools.cpp.

 std::string gammalib::str ( const float & value, const int & precision = 0 )

Convert single precision value into string.

Parameters
 [in] value Single precision value to be converted into string. [in] precision Floating point precision.
Returns
String with single precision value.

Converts a single precision value into a string. Any positive precision argument specifies the exact number of digits after the comma.

Definition at line 541 of file GTools.cpp.

 std::string gammalib::str ( const double & value, const int & precision = 0 )

Convert double precision value into string.

Parameters
 [in] value Double precision value to be converted into string. [in] precision Floating point precision.
Returns
String with double precision value.

Converts a double precision value into a string. Any positive precision argument specifies the exact number of digits after the comma.

Definition at line 578 of file GTools.cpp.

 std::string gammalib::str ( const std::complex< double > & value, const int & precision = 0 )

Convert complex value into string.

Parameters
 [in] value Complex value to be converted into string. [in] precision Floating point precision.
Returns
String with complex value.

Converts a complex value into a string. Any positive precision argument specifies the exact number of digits after the comma.

Definition at line 614 of file GTools.cpp.

References abs().

 std::string gammalib::str2xml ( const std::string & arg )

Convert special characters in string to XML character references.

Parameters
 [in] arg String.
Returns
String with special characters replaced by character references.

Definition at line 1439 of file GTools.cpp.

Referenced by GXmlText::write(), and GXmlAttribute::write().

 std::string gammalib::strip_chars ( const std::string & arg, const std::string & chars )

Strip leading and trailing character from string.

Parameters
 [in] arg String from which character should be stripped. [in] chars Character(s) to be stripped.
Returns
String with stripped characters.

Definition at line 89 of file GTools.cpp.

 std::string gammalib::strip_whitespace ( const std::string & arg )

Strip leading and trailing whitespace from string.

Parameters
 [in] arg String from which whitespace should be stripped.
Returns
String with stripped whitespace.

Definition at line 75 of file GTools.cpp.

References strip_chars().

 double gammalib::tand ( const double & angle )

Compute tangens of angle in degrees.

Parameters
 [in] angle Angle in degrees

This code has been adapted from the WCSLIB function wcstrig.c::tand().

Definition at line 192 of file GMath.cpp.

Referenced by GWcsMER::prj_s2x().

 char * gammalib::tochar ( const std::string & arg )

Convert string to C string.

Parameters
 [in] arg String to be converted.
Returns
C string.

Allocates a C string with the content of a C++ string.

Definition at line 657 of file GTools.cpp.

References str().

 double gammalib::todouble ( const std::string & arg )

Convert string into double precision value.

Parameters
 [in] arg String to be converted.
Returns
Double precision value.

Definition at line 816 of file GTools.cpp.

 float gammalib::tofloat ( const std::string & arg )

Convert string into single precision value.

Parameters
 [in] arg String to be converted.
Returns
Single precision value.

Definition at line 801 of file GTools.cpp.

 int gammalib::toint ( const std::string & arg )

Convert string into integer value.

Parameters
 [in] arg String to be converted.
Returns
Integer value.

Definition at line 711 of file GTools.cpp.

 long gammalib::tolong ( const std::string & arg )

Convert string into long value.

Parameters
 [in] arg String to be converted.
Returns
Long value.

Definition at line 741 of file GTools.cpp.

 long long gammalib::tolonglong ( const std::string & arg )

Convert string into long long value.

Parameters
 [in] arg String to be converted.
Returns
Long long value.

Definition at line 771 of file GTools.cpp.

 std::string gammalib::tolower ( const std::string & arg )

Convert string to lower case.

Parameters
 [in] arg String to be converted to upper case.
Returns
String converted to lower case.

Definition at line 845 of file GTools.cpp.

 short gammalib::toshort ( const std::string & arg )

Convert string into short value.

Parameters
 [in] arg String to be converted.
Returns
Short value.

Definition at line 681 of file GTools.cpp.

 unsigned int gammalib::touint ( const std::string & arg )

Convert string into unsigned integer value.

Parameters
 [in] arg String to be converted.
Returns
Unsigned integer value.

Definition at line 726 of file GTools.cpp.

 unsigned long gammalib::toulong ( const std::string & arg )

Convert string into unsigned long value.

Parameters
 [in] arg String to be converted.
Returns
Unsigned long value.

Definition at line 756 of file GTools.cpp.

 unsigned long long gammalib::toulonglong ( const std::string & arg )

Convert string into unsigned long long value.

Parameters
 [in] arg String to be converted.
Returns
Unsigned long long value.

Definition at line 786 of file GTools.cpp.

 std::string gammalib::toupper ( const std::string & arg )

Convert string to upper case.

Parameters
 [in] arg String to be converted to upper case.
Returns
String converted to upper case.

Definition at line 831 of file GTools.cpp.

 unsigned short gammalib::toushort ( const std::string & arg )

Convert string into unsigned short value.

Parameters
 [in] arg String to be converted.
Returns
Unsigned short value.

Definition at line 696 of file GTools.cpp.

 void gammalib::warning ( const std::string & origin, const std::string & message )

Emits warning.

Parameters
 [in] origin Name of method that emits warning. [in] message Warning message.

Writes a warning to the console.

Definition at line 1276 of file GTools.cpp.

 std::string gammalib::xml2str ( const std::string & arg )

Convert XML character references in string to characters.

Parameters
 [in] arg String containing XML character references.
Returns
String with character reference replaced by respective characters.

Definition at line 1306 of file GTools.cpp.

References G_XML2STRING, number(), and toint().

Referenced by GXmlAttribute::GXmlAttribute(), and GXmlText::GXmlText().

 void gammalib::xml_check_par ( const std::string & origin, const std::string & name, const int & number )

Checks whether a parameter has occured once.

Parameters
 [in] origin Method performing the check. [in] name Parameter name. [in] number Number of occurences of parameter.
Exceptions
 GException::invalid_value Invalid XML format encountered.

Throws an exception if a given parameter has not exactly occured once. The exception text is adapted to the case that none or multiple parameters have been found.

Definition at line 1669 of file GTools.cpp.

References str().

Referenced by GCTAObservation::read(), xml_get_par(), and xml_need_par().

 GFilename gammalib::xml_file_expand ( const GXmlElement & xml, const std::string & filename )

Parameters
 [in] xml XML element. [in] filename File name.
Returns
Expanded file name.

Expands file name provided as XML attribute for loading. If the file name is not empty and has no path it is assumed that the file is located in the same directory as the XML file, and the XML file access path is prepended to the file name.

Definition at line 1703 of file GTools.cpp.

References GXmlNode::filename(), GFilename::is_empty(), and GFilename::path().

 GFilename gammalib::xml_file_reduce ( const GXmlElement & xml, const std::string & filename )

Reduce file name provided for writing as XML attribute.

Parameters
 [in] xml XML element. [in] filename File name.
Returns
Reduced file name.

Reduces file name provided for writing as XML attribute. If the file name is not empty and has the same access path as the XML file it is assumed that both files are located in the same directory, and the access path is stripped from the file name.

Definition at line 1733 of file GTools.cpp.

 std::string gammalib::xml_get_attr ( const std::string & origin, const GXmlElement & xml, const std::string & name, const std::string & attribute )

Return attribute value for a given parameter in XML element.

Parameters
 [in] origin Method requesting parameter. [in] xml XML element. [in] name Parameter name. [in] attribute Attribute name.
Returns
Value of attribute.
Exceptions

Returns the value of attribute of parameter name in XML element. The function checks whether the parameter has been found and throws an exception if no parameter or multiple occurences of a parameter with given name are found. The function furthermore checks whether the attribute exists.

Definition at line 1628 of file GTools.cpp.

References GXmlElement::attribute(), GXmlElement::has_attribute(), and xml_get_par().

 void gammalib::xml_get_name_value_pair ( const GXmlNode * node, std::string & name, std::string & value )

Extract name / value pair from XML node.

Parameters
 [in] node Pointer to XML node. [out] name Name string. [out] value Value string.

Extracts a name / value pair from a XML node. If the XML node pointer is NULL, the name and value strings will be empty.

Definition at line 1761 of file GTools.cpp.

References GXmlNode::element(), and GXmlText::text().

Referenced by GVOClient::get_response_value(), and GVOHub::get_response_value().

 const GXmlElement * gammalib::xml_get_par ( const std::string & origin, const GXmlElement & xml, const std::string & name )

Return pointer to parameter with given name in XML element.

Parameters
 [in] origin Method requesting parameter. [in] xml XML element. [in] name Parameter name.
Returns
Pointer to parameter XML element.
Exceptions
 GException::invalid_value Invalid XML format encountered.

Returns pointer to parameter with given name in XML element. The function checks whether the parameter has been found and throws an exception if no parameter or multiple occurences of a parameter with given name are found.

Definition at line 1579 of file GTools.cpp.

 bool gammalib::xml_has_par ( const GXmlElement & xml, const std::string & name )

Checks if parameter with given name in XML element exists.

Parameters
 [in] xml XML element. [in] name Parameter name.
Returns
True if parameter exists, false otherwise.

Checks whether a parameter with given name exists in XML element.

Definition at line 1486 of file GTools.cpp.

References GXmlElement::attribute(), GXmlNode::element(), and GXmlNode::elements().

 GXmlElement * gammalib::xml_need_par ( const std::string & origin, GXmlElement & xml, const std::string & name )

Return pointer to parameter with given name in XML element.

Parameters
 [in] origin Method requesting parameter. [in] xml XML element. [in] name Parameter name.
Returns
Pointer to parameter XML element.
Exceptions
 GException::invalid_value Invalid XML format encountered.

Returns pointer to parameter with given name in XML element. If the name is not found, a parameter with the given name is added. In that respect the function differs from xml_get_par which does not add a parameter element.

The function checks for multiple occurences of a parameter and throws an exception in case that more than one parameter with a given name is found.

Definition at line 1527 of file GTools.cpp.

Variable Documentation

 const double gammalib::erg2MeV = 624150.96

Definition at line 46 of file GTools.hpp.

 const std::string gammalib::extname_arf = "SPECRESP"

Definition at line 45 of file GArf.hpp.

 const std::string gammalib::extname_cta_aeff2d = "EFFECTIVE AREA"

Definition at line 43 of file GCTAAeff2D.hpp.

 const std::string gammalib::extname_cta_background3d = "BACKGROUND"

Definition at line 44 of file GCTABackground3D.hpp.

 const std::string gammalib::extname_cta_counts = "COUNTS"

Definition at line 50 of file GCTAEventCube.hpp.

 const std::string gammalib::extname_cta_edisp2d = "ENERGY DISPERSION"
 const std::string gammalib::extname_cta_events = "EVENTS"

Definition at line 49 of file GCTAEventList.hpp.

 const std::string gammalib::extname_cta_migras = "MIGRAS"

Definition at line 48 of file GCTACubeEdisp.hpp.

 const std::string gammalib::extname_cta_psf2d = "POINT SPREAD FUNCTION"

Definition at line 42 of file GCTAPsf2D.hpp.

 const std::string gammalib::extname_cta_psfking = "POINT SPREAD FUNCTION"

Definition at line 42 of file GCTAPsfKing.hpp.

 const std::string gammalib::extname_cta_psftable = "PSF_2D_TABLE"

Definition at line 42 of file GCTAPsfTable.hpp.

 const std::string gammalib::extname_cta_spatial_lookup = "RADIAL BACKGROUND LOOKUP"

Definition at line 49 of file GCTAModelSpatialLookup.hpp.

Referenced by GCTAModelSpatialLookup::save().

 const std::string gammalib::extname_cta_weights = "WEIGHTS"

Definition at line 51 of file GCTAEventCube.hpp.

 const std::string gammalib::extname_deltas = "DELTAS"

Definition at line 47 of file GCTACubePsf.hpp.

 const std::string gammalib::extname_dri = "DRI"

Definition at line 51 of file GCOMDri.hpp.

Referenced by GCOMDri::save().

 const std::string gammalib::extname_ebounds = "EBOUNDS"

Definition at line 44 of file GEbounds.hpp.

 const std::string gammalib::extname_energies = "ENERGIES"

Definition at line 44 of file GEnergies.hpp.

 const std::string gammalib::extname_gti = "GTI"

Definition at line 44 of file GGti.hpp.

 const std::string gammalib::extname_lat_aeff = "EFFECTIVE AREA"

Definition at line 45 of file GLATAeff.hpp.

 const std::string gammalib::extname_lat_cthetabounds = "CTHETABOUNDS"

Definition at line 47 of file GLATLtCube.hpp.

 const std::string gammalib::extname_lat_edisp = "ENERGY DISPERSION"

Definition at line 43 of file GLATEdisp.hpp.

 const std::string gammalib::extname_lat_edisp_scale = "EDISP_SCALING_PARAMS"

Definition at line 44 of file GLATEdisp.hpp.

 const std::string gammalib::extname_lat_efficiency = "EFFICIENCY_PARAMS"

Definition at line 46 of file GLATAeff.hpp.

 const std::string gammalib::extname_lat_events = "EVENTS"

Definition at line 45 of file GLATEventList.hpp.

 const std::string gammalib::extname_lat_exposure = "EXPOSURE"

Definition at line 45 of file GLATLtCube.hpp.

 const std::string gammalib::extname_lat_ltcubemap = "EXPOSURE"

Definition at line 44 of file GLATLtCubeMap.hpp.

 const std::string gammalib::extname_lat_wgtexposure = "WEIGHTED_EXPOSURE"

Definition at line 46 of file GLATLtCube.hpp.

 const std::string gammalib::extname_pha = "SPECTRUM"

Definition at line 45 of file GPha.hpp.

 const std::string gammalib::extname_rmf = "MATRIX"

Definition at line 44 of file GRmf.hpp.

 const double gammalib::fourpi = 12.56637061435917295385057353311801153679

Definition at line 37 of file GMath.hpp.

 const double gammalib::fourthird = 4.0/3.0

Definition at line 52 of file GMath.hpp.

 const double gammalib::gkw10[5]
Initial value:
= {
0.066671344308688137593568809893332,
0.149451349150580593145776339657697,
0.219086362515982043995534934228163,
0.269266719309996355091226921569469,
0.295524224714752870173892994651338
}

Definition at line 60 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw21a[5]
Initial value:
= {
0.032558162307964727478818972459390,
0.075039674810919952767043140916190,
0.109387158802297641899210590325805,
0.134709217311473325928054001771707,
0.147739104901338491374841515972068
}

Definition at line 78 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw21b[6]
Initial value:
= {
0.011694638867371874278064396062192,
0.054755896574351996031381300244580,
0.093125454583697605535065465083366,
0.123491976262065851077958109831074,
0.142775938577060080797094273138717,
0.149445554002916905664936468389821
}

Definition at line 87 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw43a[10]
Initial value:
= {
0.016296734289666564924281974617663,
0.037522876120869501461613795898115,
0.054694902058255442147212685465005,
0.067355414609478086075553166302174,
0.073870199632393953432140695251367,
0.005768556059769796184184327908655,
0.027371890593248842081276069289151,
0.046560826910428830743339154433824,
0.061744995201442564496240336030883,
0.071387267268693397768559114425516
}

Definition at line 112 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw43b[12]
Initial value:
= {
0.001844477640212414100389106552965,
0.010798689585891651740465406741293,
0.021895363867795428102523123075149,
0.032597463975345689443882222526137,
0.042163137935191811847627924327955,
0.050741939600184577780189020092084,
0.058379395542619248375475369330206,
0.064746404951445885544689259517511,
0.069566197912356484528633315038405,
0.072824441471833208150939535192842,
0.074507751014175118273571813842889,
0.074722147517403005594425168280423
}

Definition at line 126 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw87a[21]
Initial value:
= {
0.008148377384149172900002878448190,
0.018761438201562822243935059003794,
0.027347451050052286161582829741283,
0.033677707311637930046581056957588,
0.036935099820427907614589586742499,
0.002884872430211530501334156248695,
0.013685946022712701888950035273128,
0.023280413502888311123409291030404,
0.030872497611713358675466394126442,
0.035693633639418770719351355457044,
0.000915283345202241360843392549948,
0.005399280219300471367738743391053,
0.010947679601118931134327826856808,
0.016298731696787335262665703223280,
0.021081568889203835112433060188190,
0.025370969769253827243467999831710,
0.029189697756475752501446154084920,
0.032373202467202789685788194889595,
0.034783098950365142750781997949596,
0.036412220731351787562801163687577,
0.037253875503047708539592001191226
}

Definition at line 168 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkw87b[23]
Initial value:
= {
0.000274145563762072350016527092881,
0.001807124155057942948341311753254,
0.004096869282759164864458070683480,
0.006758290051847378699816577897424,
0.009549957672201646536053581325377,
0.012329447652244853694626639963780,
0.015010447346388952376697286041943,
0.017548967986243191099665352925900,
0.019938037786440888202278192730714,
0.022194935961012286796332102959499,
0.024339147126000805470360647041454,
0.026374505414839207241503786552615,
0.028286910788771200659968002987960,
0.030052581128092695322521110347341,
0.031646751371439929404586051078883,
0.033050413419978503290785944862689,
0.034255099704226061787082821046821,
0.035262412660156681033782717998428,
0.036076989622888701185500318003895,
0.036698604498456094498018047441094,
0.037120549269832576114119958413599,
0.037334228751935040321235449094698,
0.037361073762679023410321241766599
}

Definition at line 193 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkx1[5]
Initial value:
= {
0.973906528517171720077964012084452,
0.865063366688984510732096688423493,
0.679409568299024406234327365114874,
0.433395394129247190799265943165784,
0.148874338981631210884826001129720
}

Definition at line 51 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkx2[5]
Initial value:
= {
0.995657163025808080735527280689003,
0.930157491355708226001207180059508,
0.780817726586416897063717578345042,
0.562757134668604683339000099272694,
0.294392862701460198131126603103866
}

Definition at line 69 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkx3[11]
Initial value:
= {
0.999333360901932081394099323919911,
0.987433402908088869795961478381209,
0.954807934814266299257919200290473,
0.900148695748328293625099494069092,
0.825198314983114150847066732588520,
0.732148388989304982612354848755461,
0.622847970537725238641159120344323,
0.499479574071056499952214885499755,
0.364901661346580768043989548502644,
0.222254919776601296498260928066212,
0.074650617461383322043914435796506
}

Definition at line 97 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::gkx4[22]
Initial value:
= {
0.999902977262729234490529830591582,
0.997989895986678745427496322365960,
0.992175497860687222808523352251425,
0.981358163572712773571916941623894,
0.965057623858384619128284110607926,
0.943167613133670596816416634507426,
0.915806414685507209591826430720050,
0.883221657771316501372117548744163,
0.845710748462415666605902011504855,
0.803557658035230982788739474980964,
0.757005730685495558328942793432020,
0.706273209787321819824094274740840,
0.651589466501177922534422205016736,
0.593223374057961088875273770349144,
0.531493605970831932285268948562671,
0.466763623042022844871966781659270,
0.399424847859218804732101665817923,
0.329874877106188288265053371824597,
0.258503559202161551802280975429025,
0.185695396568346652015917141167606,
0.111842213179907468172398359241362,
0.037352123394619870814998165437704
}

Definition at line 142 of file GIntegral.cpp.

Referenced by GIntegral::gauss_kronrod().

 const double gammalib::inv_ln10 = 1.0/ln10

Definition at line 48 of file GMath.hpp.

 const double gammalib::inv_ln2 = 1.4426950408889634073599246810018921

Definition at line 47 of file GMath.hpp.

Referenced by iter_phi(), and iter_rho().

 const double gammalib::inv_loge = 1.0/std::log10(std::exp(1.0))

Definition at line 49 of file GMath.hpp.

 const double gammalib::inv_pihalf = 0.6366197723675813430755350534900574

Definition at line 39 of file GMath.hpp.

Referenced by GHealpix::ang2pix_z_phi_nest(), and GHealpix::ang2pix_z_phi_ring().

 const double gammalib::inv_sqrt2pi = 0.3989422804014327028632180827116826549172

Definition at line 41 of file GMath.hpp.

 const double gammalib::inv_sqrt4pi = 0.2820947917738781434740397257803862929220

Definition at line 40 of file GMath.hpp.

 const double gammalib::ln10 = 2.3025850929940456840179914546843642

Definition at line 46 of file GMath.hpp.

 const double gammalib::ln2 = 0.6931471805599453094172321214581766

Definition at line 45 of file GMath.hpp.

 const double gammalib::mec2 = 0.5109989461

Definition at line 52 of file GTools.hpp.

 const double gammalib::MeV2Angstrom = 1.239841875e-2

Definition at line 47 of file GTools.hpp.

Referenced by GEnergy::Angstrom().

 const double gammalib::onethird = 1.0/3.0

Definition at line 50 of file GMath.hpp.

Referenced by GSkyMap::flux().

 const double gammalib::pc2cm = 3.08568025e18

Definition at line 48 of file GTools.hpp.

 const double gammalib::pi2 = pi*pi

Definition at line 42 of file GMath.hpp.

 const double gammalib::pihalf = 1.570796326794896619231321691639751442099
 const double gammalib::sec2day = 1.0 / sec_in_day

Definition at line 50 of file GTools.hpp.

Referenced by GTime::convert(), GTime::days(), GTime::jd(), GTime::mjd(), GTime::secs(), and GTime::utc().

 const double gammalib::sec_in_day = 86400.0

Definition at line 49 of file GTools.hpp.

 const double gammalib::sqrt_onehalf = std::sqrt(1.0/2.0)

Definition at line 53 of file GMath.hpp.

 const double gammalib::sqrt_pihalf = std::sqrt(pihalf)

Definition at line 55 of file GMath.hpp.

 const double gammalib::sqrt_two = std::sqrt(2.0)

Definition at line 54 of file GMath.hpp.

 const double gammalib::sqrt_twopi = std::sqrt(twopi)

Definition at line 56 of file GMath.hpp.

Referenced by GCOMD1Response::update_cache().

 const double gammalib::tai2tt = 32.184

Definition at line 51 of file GTools.hpp.

Referenced by GTime::convert(), GTime::secs(), GTime::set(), and GTime::utc().

 const double gammalib::twothird = 2.0/3.0

Definition at line 51 of file GMath.hpp.