GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEbounds Class Reference

Energy boundaries container class. More...

#include <GEbounds.hpp>

Inheritance diagram for GEbounds:
GContainer GBase

Public Member Functions

 GEbounds (void)
 Constructor. More...
 
 GEbounds (const GFilename &filename)
 FITS file constructor. More...
 
 GEbounds (const GXmlElement &xml)
 XML element constructor. More...
 
 GEbounds (const GEnergies &energies)
 Energy container constructor. More...
 
 GEbounds (const GEbounds &ebds)
 Copy constructor. More...
 
 GEbounds (const GEnergy &emin, const GEnergy &emax)
 Single energy band constructor. More...
 
 GEbounds (const int &num, const GEnergy &emin, const GEnergy &emax, const bool &log=true)
 Interval constructor. More...
 
virtual ~GEbounds (void)
 Destructor. More...
 
GEboundsoperator= (const GEbounds &ebds)
 Assignment operator. More...
 
void clear (void)
 Clear energy boundaries. More...
 
GEboundsclone (void) const
 Clone energy boundaries. More...
 
std::string classname (void) const
 Return class name. More...
 
int size (void) const
 Return number of energy boundaries. More...
 
bool is_empty (void) const
 Signal if there are no energy boundaries. More...
 
void append (const GEnergy &emin, const GEnergy &emax)
 Append energy interval. More...
 
void insert (const GEnergy &emin, const GEnergy &emax)
 Insert energy interval. More...
 
void merge (void)
 Merge all overlapping or connecting successive energy intervals. More...
 
void merge (const GEnergy &emin, const GEnergy &emax)
 Merge energy interval into energy boundaries. More...
 
void remove (const int &index)
 Remove energy interval. More...
 
void reserve (const int &num)
 Reserve space for energy intervals. More...
 
void extend (const GEbounds &ebds)
 Append energy boundaries. More...
 
void set (const GEnergies &energies)
 Set energy boundaries from energy container. More...
 
void set_lin (const int &num, const GEnergy &emin, const GEnergy &emax)
 Set linearly spaced energy intervals. More...
 
void set_log (const int &num, const GEnergy &emin, const GEnergy &emax)
 Set logarithmically spaced energy intervals. More...
 
void load (const GFilename &filename)
 Load energy boundaries from FITS file. More...
 
void save (const GFilename &filename, const bool &clobber=false, const std::string &unit="keV") const
 Save energy boundaries into FITS file. More...
 
void read (const GFitsTable &table)
 Read energy boundaries from FITS table. More...
 
void write (GFits &file, const std::string &extname=gammalib::extname_ebounds, const std::string &unit="keV") const
 Write energy boundaries into FITS object. More...
 
void read (const GXmlElement &xml)
 Read energy boundaries from XML element. More...
 
void write (GXmlElement &xml) const
 Write energy boundaries into XML element. More...
 
int index (const GEnergy &eng) const
 Returns energy bin index for a given energy. More...
 
const GEnergyemin (void) const
 Return minimum energy of all intervals. More...
 
const GEnergyemax (void) const
 Return maximum energy of all intervals. More...
 
void emin (const int &index, const GEnergy &energy)
 Set minimum energy for a given energy interval. More...
 
void emax (const int &index, const GEnergy &energy)
 Set maximum energy for a given energy interval. More...
 
GEnergy emin (const int &index) const
 Returns minimum energy for a given energy interval. More...
 
GEnergy emax (const int &index) const
 Returns maximum energy for a given energy interval. More...
 
GEnergy emean (const int &index) const
 Returns mean energy for a given energy interval. More...
 
GEnergy elogmean (const int &index) const
 Returns logarithmic mean energy for a given energy interval. More...
 
GEnergy ewidth (const int &index) const
 Returns energy interval width. More...
 
bool contains (const GEnergy &eng) const
 Checks whether energy boundaries contain energy. More...
 
bool contains (const GEnergy &emin, const GEnergy &emax) const
 Checks whether energy boundaries contain and energy bin. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print energy boundaries. More...
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GEbounds &ebds)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void set_attributes (void)
 Set class attributes. More...
 
void insert_eng (const int &index, const GEnergy &emin, const GEnergy &emax)
 Insert energy interval. More...
 

Protected Attributes

int m_num
 Number of energy boundaries. More...
 
GEnergy m_emin
 Minimum energy of all intervals. More...
 
GEnergy m_emax
 Maximum energy of all intervals. More...
 
GEnergym_min
 Array of interval minimum energies. More...
 
GEnergym_max
 Array of interval maximum energies. More...
 

Friends

bool operator== (const GEbounds &a, const GEbounds &b)
 Energy boundaries equality operator friend. More...
 
bool operator!= (const GEbounds &a, const GEbounds &b)
 Energy boundaries inequality operator friend. More...
 

Detailed Description

Energy boundaries container class.

This class holds a list of energy intervals that are defined by a minimum and maximum energy. Energies are implement using the GEnergy class which holds unit independent energy information.

The class has no method for sorting of the energy boundaries; it is expected that the energy boundaries are correctly set by the client.

Definition at line 60 of file GEbounds.hpp.

Constructor & Destructor Documentation

GEbounds::GEbounds ( void  )

Constructor.

Definition at line 74 of file GEbounds.cpp.

References init_members().

Referenced by clone().

GEbounds::GEbounds ( const GFilename filename)
explicit

FITS file constructor.

Parameters
[in]filenameFITS file name.

Constructs energy boundaries from a FITS file.

Definition at line 91 of file GEbounds.cpp.

References init_members(), and load().

GEbounds::GEbounds ( const GXmlElement xml)
explicit

XML element constructor.

Parameters
[in]xmlXML element.

Constructs energy boundaries from an XML element.

Definition at line 111 of file GEbounds.cpp.

References init_members(), and read().

GEbounds::GEbounds ( const GEnergies energies)
explicit

Energy container constructor.

Parameters
[in]energiesEnergy container.

Constructs energy boundaries from an energy container.

Definition at line 131 of file GEbounds.cpp.

References init_members(), and set().

GEbounds::GEbounds ( const GEbounds ebds)

Copy constructor.

Parameters
[in]ebdsEnergy boundaries.

Definition at line 149 of file GEbounds.cpp.

References copy_members(), and init_members().

GEbounds::GEbounds ( const GEnergy emin,
const GEnergy emax 
)

Single energy band constructor.

Parameters
[in]eminMinimum energy of the interval.
[in]emaxMaximum energy of the interval.

Constructs energy boundaries for one (emin, emax) energy band.

Definition at line 170 of file GEbounds.cpp.

References append(), and init_members().

GEbounds::GEbounds ( const int &  num,
const GEnergy emin,
const GEnergy emax,
const bool &  log = true 
)

Interval constructor.

Parameters
[in]numNumber of energy intervals.
[in]eminMinimum energy of first interval.
[in]emaxMaximum energy of last interval.
[in]logUse logarithmic spacing? (defaults to true).

Constructs energy boundaries by defining num successive energy intervals between emin and emax. The log parameter controls whether the energy spacing is logarihmic (default) or linear.

Definition at line 195 of file GEbounds.cpp.

References init_members(), set_lin(), and set_log().

GEbounds::~GEbounds ( void  )
virtual

Destructor.

Definition at line 217 of file GEbounds.cpp.

References free_members().

Member Function Documentation

void GEbounds::append ( const GEnergy emin,
const GEnergy emax 
)

Append energy interval.

Parameters
[in]eminMinimum energy of interval.
[in]emaxMaximum energy of interval.

Appends an energy interval to the end of the energy boundaries container.

Definition at line 302 of file GEbounds.cpp.

References insert_eng(), and m_num.

Referenced by GEbounds(), GCTAAeffArf::read(), GRmf::read(), read(), GArf::read(), gammalib::read_ds_ebounds(), set(), GCTAAeffPerfTable::set_boundaries(), GCTAAeff2D::set_boundaries(), GMWLSpectrum::set_ebounds(), GModelSpatialDiffuseCube::set_energy_boundaries(), set_lin(), and set_log().

std::string GEbounds::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GEbounds").

Implements GBase.

Definition at line 145 of file GEbounds.hpp.

GEbounds * GEbounds::clone ( void  ) const
virtual

Clone energy boundaries.

Returns
Pointer to deep copy of energy boundaries.

Implements GBase.

Definition at line 287 of file GEbounds.cpp.

References GEbounds().

bool GEbounds::contains ( const GEnergy eng) const

Checks whether energy boundaries contain energy.

Parameters
[in]engEnergy to be checked.
Returns
True if energy falls in at least one interval, false otherwise.

Checks if the energy eng falls in at least one of the energy intervals. The method exits when the first matching interval has been found.

Definition at line 1192 of file GEbounds.cpp.

References m_max, m_min, and m_num.

Referenced by GCTAOnOffObservation::apply_ebounds(), and GCTACubeBackground::fill().

bool GEbounds::contains ( const GEnergy emin,
const GEnergy emax 
) const

Checks whether energy boundaries contain and energy bin.

Parameters
[in]eminMinimum energy of bin to be checked.
[in]emaxMaximum energy of bin to be checked.
Returns
True if energy bin [emin, emax] is fully contained inside energy the boundaries, false otherwiese

Checks if the energy interval [emin, emax ] falls is fully contained by energy boundaries

Todo:
This method is so far only correct for contiguous energy boundaries.

Definition at line 1223 of file GEbounds.cpp.

References m_emax, and m_emin.

void GEbounds::copy_members ( const GEbounds ebds)
protected

Copy class members.

Parameters
[in]ebdsEnergy boundaries.

Definition at line 1312 of file GEbounds.cpp.

References m_emax, m_emin, m_max, m_min, and m_num.

Referenced by GEbounds(), and operator=().

GEnergy GEbounds::elogmean ( const int &  index) const

Returns logarithmic mean energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
Returns
Logarithmic mean energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Computes the logarithmic mean energy \(10^{0.5 * (\log E_{\rm min} + \log E_{\rm max})}\) for the energy interval index.

Definition at line 1140 of file GEbounds.cpp.

References G_ELOGMEAN, m_max, m_min, m_num, GEnergy::MeV(), and sqrt().

Referenced by GCTAOnOffObservation::compute_alpha(), GCTAOnOffObservation::compute_arf(), GCTAOnOffObservation::compute_arf_cut(), GCTAOnOffObservation::compute_bgd(), GCTAEdispRmf::compute_ereco_bounds(), GCTAEdispRmf::compute_etrue_bounds(), GCTAOnOffObservation::compute_rmf(), GCTAModelAeffBackground::mc(), GCTAOnOffObservation::N_bgd(), GCTAOnOffObservation::N_gamma(), GCOMIaq::set(), GCTAEdispRmf::set_cache(), GCOMEventCube::set_energies(), GCTACubeBackground::set_eng_axis(), GArf::set_logetrue(), and GCTAEdispRmf::set_matrix().

void GEbounds::emax ( const int &  index,
const GEnergy energy 
)

Set maximum energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
[in]energyMaximum energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Sets the maximum energy for the energy interval index.

Definition at line 1025 of file GEbounds.cpp.

References G_EMAX_SET, index(), m_max, m_num, and set_attributes().

GEnergy GEbounds::emax ( const int &  index) const

Returns maximum energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
Returns
Maximum energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 1081 of file GEbounds.cpp.

References G_EMAX_GET, m_max, and m_num.

GEnergy GEbounds::emean ( const int &  index) const

Returns mean energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
Returns
Mean energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Computes the mean energy \(0.5 * (E_{\rm min} + E_{\rm max})\) for the energy interval index.

Definition at line 1110 of file GEbounds.cpp.

References G_EMEAN, index(), m_max, m_min, and m_num.

Referenced by GCTAOnOffObservation::model_background(), and GCTAOnOffObservation::model_gamma().

void GEbounds::emin ( const int &  index,
const GEnergy energy 
)

Set minimum energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
[in]energyMinimum energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Sets the minimum energy for the energy interval index.

Definition at line 992 of file GEbounds.cpp.

References G_EMIN_SET, index(), m_min, m_num, and set_attributes().

GEnergy GEbounds::emin ( const int &  index) const

Returns minimum energy for a given energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
Returns
Minimum energy of interval.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 1056 of file GEbounds.cpp.

References G_EMIN_GET, m_min, and m_num.

GEnergy GEbounds::ewidth ( const int &  index) const

Returns energy interval width.

Parameters
[in]indexEnergy interval index (0,...,size()-1).
Returns
Energy interval width.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 1167 of file GEbounds.cpp.

References G_EWIDTH, m_max, m_min, and m_num.

Referenced by GCTAOnOffObservation::N_bgd(), and GCTAOnOffObservation::N_gamma().

void GEbounds::extend ( const GEbounds ebds)

Append energy boundaries.

Parameters
[in]ebdsEnergy boundaries.

Append energy boundaries to the container.

Definition at line 476 of file GEbounds.cpp.

References is_empty(), m_max, m_min, m_num, max(), min(), set_attributes(), and size().

void GEbounds::free_members ( void  )
protected

Delete class members.

Definition at line 1337 of file GEbounds.cpp.

References m_max, and m_min.

Referenced by clear(), operator=(), read(), and ~GEbounds().

int GEbounds::index ( const GEnergy eng) const

Returns energy bin index for a given energy.

Parameters
[in]engEnergy.
Returns
Bin index.

Returns the energy boundary bin index for a given energy. By convention, the limits for an energy bin are defined as

 min <= energy < max

i.e. and energy equals to max falls above the largest energy.

If the energy falls outside all boundaries, -1 is returned.

Definition at line 963 of file GEbounds.cpp.

References m_max, m_min, and m_num.

Referenced by emax(), emean(), GRmf::emeasured(), emin(), GRmf::etrue(), GPha::fill(), and insert_eng().

void GEbounds::init_members ( void  )
protected

Initialise class members.

Definition at line 1293 of file GEbounds.cpp.

References GEnergy::clear(), m_emax, m_emin, m_max, m_min, and m_num.

Referenced by clear(), GEbounds(), operator=(), and read().

void GEbounds::insert ( const GEnergy emin,
const GEnergy emax 
)

Insert energy interval.

Parameters
[in]eminMinimum energy of interval.
[in]emaxMaximum energy of interval.

Inserts an energy interval into the energy boundaries after the first boundary that has a minimum energy smaller than emin. The method implicitely assumes that the intervals are ordered by increasing minimum energy.

Definition at line 323 of file GEbounds.cpp.

References insert_eng(), m_min, and m_num.

void GEbounds::insert_eng ( const int &  index,
const GEnergy emin,
const GEnergy emax 
)
protected

Insert energy interval.

Parameters
[in]indexIndex after with interval is inserted.
[in]eminMinimum energy of interval.
[in]emaxMaximum energy of interval.
Exceptions
GException::invalid_argumentMinimum energy larger than maximum energy

Inserts an energy interval after the specified index in the energy boundaries. The method does not reorder the intervals by energy, instead the client needs to determine the approriate index.

Invalid parameters do not produce any exception, but are handled transparently. If the interval is invalid (i.e. emin > emax) an exception is thrown. If the index is out of the valid range, the index will be adjusted to either the first or the last element.

Definition at line 1401 of file GEbounds.cpp.

References emax(), emin(), G_INSERT_ENG, index(), m_max, m_min, m_num, max(), min(), NORMAL, GEnergy::print(), and set_attributes().

Referenced by append(), insert(), and merge().

bool GEbounds::is_empty ( void  ) const
inlinevirtual

Signal if there are no energy boundaries.

Returns
True if there are no energy boundaries.

Implements GContainer.

Definition at line 169 of file GEbounds.hpp.

References m_num.

Referenced by extend(), and write().

void GEbounds::load ( const GFilename filename)

Load energy boundaries from FITS file.

Parameters
[in]filenameFITS file name.

Loads the energy boundaries from a FITS file.

If no extension name is provided, the energy boundaries are loaded from the EBOUNDS extension.

Definition at line 704 of file GEbounds.cpp.

References GFits::close(), GFilename::extname(), gammalib::extname_ebounds, read(), and GFits::table().

Referenced by GEbounds().

void GEbounds::merge ( void  )

Merge all overlapping or connecting successive energy intervals.

Merges all overlapping or connecting successive energy intervals. The method implicitely assumes that the intervals are ordered by increasing minimum energy.

Note that the method does not actually reduce the memory size but just updates the information on the number of elements in the array.

Definition at line 350 of file GEbounds.cpp.

References m_max, m_min, and m_num.

Referenced by merge().

void GEbounds::merge ( const GEnergy emin,
const GEnergy emax 
)

Merge energy interval into energy boundaries.

Parameters
[in]eminMinimum energy of interval.
[in]emaxMaximum energy of interval.

Inserts an energy interval into the energy boundaries after the first boundary that has a minimum energy smaller than emin and then merges any overlapping or connecting energy boundaries. The method implicitely assumes that the intervals are ordered by increasing minimum energy.

Definition at line 396 of file GEbounds.cpp.

References insert_eng(), m_min, m_num, and merge().

GEbounds & GEbounds::operator= ( const GEbounds ebds)

Assignment operator.

Parameters
[in]ebdsEnergy boundaries to be assigned.
Returns
Energy boundaries.

Definition at line 239 of file GEbounds.cpp.

References copy_members(), free_members(), and init_members().

std::string GEbounds::print ( const GChatter chatter = NORMAL) const
virtual

Print energy boundaries.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing energy boundary information.

Implements GBase.

Definition at line 1244 of file GEbounds.cpp.

References emax(), emin(), EXPLICIT, gammalib::parformat(), SILENT, size(), and gammalib::str().

Referenced by GCOMDri::print(), and GCTACubeBackground::print().

void GEbounds::read ( const GFitsTable table)

Read energy boundaries from FITS table.

Parameters
[in]tableFITS table.

Reads the energy boundaries from a FITS table. The method interprets the energy units provide in the FITS header. If no energy units are found it is assumed that the energies are stored in units of keV.

Definition at line 776 of file GEbounds.cpp.

References free_members(), init_members(), GFitsHDU::integer(), m_max, m_min, m_num, GFitsHDU::real(), and set_attributes().

Referenced by GEbounds(), load(), GCTACubeBackground::read(), GCTAObservation::read(), GRmf::read(), GPha::read(), GLATEventCube::read_ebds(), and GCTAEventCube::read_ebds().

void GEbounds::read ( const GXmlElement xml)

Read energy boundaries from XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::invalid_valueInvalid XML format encountered.

Read energy boundaries from an XML element. The format of the energy boundaries is

<parameter name="EnergyBoundaries" emin="0.1" emax="10.0"/>

The units of the emin and emax parameters are MeV.

Definition at line 884 of file GEbounds.cpp.

References append(), GXmlElement::attribute(), clear(), emax(), emin(), G_READ_XML, GXmlElement::has_attribute(), set_attributes(), gammalib::todouble(), and gammalib::xml_get_par().

void GEbounds::remove ( const int &  index)
virtual

Remove energy interval.

Parameters
[in]indexEnergy interval index (0,...,size()-1).

Removes energy interval at index from the energy boundaries container. All intervals after the specified index are moved forward by one position.

Note that the method does not actually reduce the memory size but just updates the information on the number of elements in the array.

Implements GContainer.

Definition at line 428 of file GEbounds.cpp.

References G_REMOVE, m_max, m_min, m_num, and set_attributes().

void GEbounds::reserve ( const int &  num)
virtual

Reserve space for energy intervals.

Parameters
[in]numNumber of elements.

This method does nothing (it is needed to satisfy the GContainer interface).

Implements GContainer.

Definition at line 462 of file GEbounds.cpp.

void GEbounds::save ( const GFilename filename,
const bool &  clobber = false,
const std::string &  unit = "keV" 
) const

Save energy boundaries into FITS file.

Parameters
[in]filenameFITS file name.
[in]clobberOverwrite an existing energy boundaries extension?
[in]unitEnergy unit

Saves energy boundaries into a FITS file. If a file with the given filename does not yet exist it will be created, otherwise the method opens the existing file. Energy boundaries can only be appended to an existing file if the clobber flag is set to "true" (otherwise an exception is thrown).

The method will append a binary FITS table containing the energy boundaries to the FITS file. The extension name can be specified as part of the filename. For example the filename

 myfile.fits[ENERGY BOUNDARIES]

will save the energy boundaries in the ENERGY BOUNDARIES extension of the "myfile.fits" file. If the extension exists already in the file it will be replaced, otherwise a new extension will be created. If no extension name is provided, the method will use EBOUNDS as the default extension name for energy boundaries.

Definition at line 748 of file GEbounds.cpp.

References GFilename::extname(), gammalib::extname_ebounds, GFilename::url(), and write().

void GEbounds::set ( const GEnergies energies)

Set energy boundaries from energy container.

Parameters
[in]energiesEnergy container.

Sets the energy boundaries from an energy container. Each two subsequent energies in the energy container will form an energy boundary. This means that n energies will lead to n-1 energy boundaries with the following mapping:

 [energies[0], energies[1]]
 [energies[1], energies[2]]
 ...
 [energies[n-2], energies[n-1]]

If there is only one energy in the container the following empty energy boundary will be appended:

 [energies[0], energies[0]]

Definition at line 542 of file GEbounds.cpp.

References append(), clear(), and GEnergies::size().

Referenced by GEbounds().

void GEbounds::set_attributes ( void  )
protected

Set class attributes.

Determines the minimum and maximum energy from all intervals. If no interval is present the minimum and maximum energies are cleared.

Definition at line 1358 of file GEbounds.cpp.

References GEnergy::clear(), m_emax, m_emin, m_max, m_min, and m_num.

Referenced by emax(), emin(), extend(), insert_eng(), read(), remove(), set_lin(), and set_log().

void GEbounds::set_lin ( const int &  num,
const GEnergy emin,
const GEnergy emax 
)

Set linearly spaced energy intervals.

Parameters
[in]numNumber of energy intervals.
[in]eminMinimum energy of first interval.
[in]emaxMaximum energy of last interval.
Exceptions
GException::invalid_argumentMinimum energy is larger than the maximum energy.

Creates num linearly spaced energy boundaries running from emin to emax. If num is not a positive integer, no energy boundaries will be set.

Definition at line 583 of file GEbounds.cpp.

References append(), clear(), emin(), G_SET_LIN, max(), min(), GEnergy::print(), and set_attributes().

Referenced by GEbounds().

void GEbounds::set_log ( const int &  num,
const GEnergy emin,
const GEnergy emax 
)

Set logarithmically spaced energy intervals.

Parameters
[in]numNumber of energy intervals.
[in]eminMinimum energy of first interval.
[in]emaxMaximum energy of last interval.
Exceptions
GException::invalid_argumentMinimum or maximum energy are not positive or minimum energy is larger than the maximum energy.

Creates num logarithmically spaced energy boundaries running from emin to emax. If num is not a positive integer, no energy boundaries will be set.

Definition at line 638 of file GEbounds.cpp.

References append(), clear(), G_SET_LOG, log10(), max(), GEnergy::MeV(), min(), pow(), GEnergy::print(), and set_attributes().

Referenced by GEbounds().

void GEbounds::write ( GFits fits,
const std::string &  extname = gammalib::extname_ebounds,
const std::string &  unit = "keV" 
) const

Write energy boundaries into FITS object.

Parameters
[in]fitsFITS file.
[in]extnameEnergy boundary extension name.
[in]unitEnergy units.

Writes the energy boundaries into a FITS object. The unit parameter specifies in which unit the energies are written. By default, the energy units are keV.

Todo:
Write header keywords.

Definition at line 831 of file GEbounds.cpp.

References GFitsTable::append(), GFits::append(), GFits::contains(), GFitsHDU::extname(), m_max, m_min, m_num, GFits::remove(), and GFitsTableCol::unit().

Referenced by save(), GLATEventCube::write(), GCTACubeBackground::write(), GCTAEventCube::write(), GRmf::write(), and GPha::write().

void GEbounds::write ( GXmlElement xml) const

Write energy boundaries into XML element.

Parameters
[in]xmlXML element.

Writes energy boundaries into an XML element. The format of the energy boundaries is

<parameter name="EnergyBoundaries" emin="0.1" emax="10.0"/>

The units of the emin and emax parameters are MeV.

This method does nothing if the energy boundaries are empty.

Definition at line 928 of file GEbounds.cpp.

References GXmlElement::attribute(), emax(), emin(), G_WRITE_XML, is_empty(), gammalib::str(), and gammalib::xml_need_par().

Friends And Related Function Documentation

bool operator!= ( const GEbounds a,
const GEbounds b 
)
friend

Energy boundaries inequality operator friend.

Parameters
[in]aFirst energy boundaries.
[in]bSecond energy boundaries.
Returns
True if both energy boundaries are different.

Definition at line 207 of file GEbounds.hpp.

bool operator== ( const GEbounds a,
const GEbounds b 
)
friend

Energy boundaries equality operator friend.

Parameters
[in]aFirst energy boundaries.
[in]bSecond energy boundaries.
Returns
True if both energy boundaries are identical.

Definition at line 1474 of file GEbounds.cpp.

Member Data Documentation

GEnergy GEbounds::m_emax
protected

Maximum energy of all intervals.

Definition at line 133 of file GEbounds.hpp.

Referenced by contains(), copy_members(), emax(), init_members(), and set_attributes().

GEnergy GEbounds::m_emin
protected

Minimum energy of all intervals.

Definition at line 132 of file GEbounds.hpp.

Referenced by contains(), copy_members(), emin(), init_members(), and set_attributes().

GEnergy* GEbounds::m_max
protected

Array of interval maximum energies.

Definition at line 135 of file GEbounds.hpp.

Referenced by contains(), copy_members(), elogmean(), emax(), emean(), ewidth(), extend(), free_members(), index(), init_members(), insert_eng(), merge(), read(), remove(), set_attributes(), and write().

GEnergy* GEbounds::m_min
protected

Array of interval minimum energies.

Definition at line 134 of file GEbounds.hpp.

Referenced by contains(), copy_members(), elogmean(), emean(), emin(), ewidth(), extend(), free_members(), index(), init_members(), insert(), insert_eng(), merge(), read(), remove(), set_attributes(), and write().

int GEbounds::m_num
protected

The documentation for this class was generated from the following files: