GammaLib  2.1.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 std::string &method="LOG", const double &gamma=1.0)
 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 remove (const GEnergy &emin, const GEnergy &emax)
 Remove energy interval from energy boundaries. 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 (const int &num, const GEnergy &emin, const GEnergy &emax, const std::string &method="LOG", const double &gamma=1.0)
 Set 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 73 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 90 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 110 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 130 of file GEbounds.cpp.

References init_members(), and set().

GEbounds::GEbounds ( const GEbounds ebds)

Copy constructor.

Parameters
[in]ebdsEnergy boundaries.

Definition at line 148 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 169 of file GEbounds.cpp.

References append(), and init_members().

GEbounds::GEbounds ( const int &  num,
const GEnergy emin,
const GEnergy emax,
const std::string &  method = "LOG",
const double &  gamma = 1.0 
)

Interval constructor.

Parameters
[in]numNumber of energy intervals.
[in]eminMinimum energy of first interval.
[in]emaxMaximum energy of last interval.
[in]methodEnergy spacing method (one of "LIN", "LOG" or "POW").
[in]gammaPower law index for POW method.

Constructs energy boundaries by defining num successive energy intervals between emin and emax. The method parameter controls the energy spacing of the energy boundaries. See the set() method for more information.

Definition at line 196 of file GEbounds.cpp.

References init_members(), and set().

GEbounds::~GEbounds ( void  )
virtual

Destructor.

Definition at line 216 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 301 of file GEbounds.cpp.

References insert_eng(), and m_num.

Referenced by GResponse::ebounds_model(), GEbounds(), GModelSpectralTable::load_eng(), GCTAAeffArf::read(), GRmf::read(), GArf::read(), read(), gammalib::read_ds_ebounds(), GSPIResponse::set(), set(), GCTAAeffPerfTable::set_boundaries(), GCTAAeff2D::set_boundaries(), GMWLSpectrum::set_ebounds(), and GModelSpatialDiffuseCube::set_energy_boundaries().

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

Return class name.

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

Implements GBase.

Definition at line 151 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 286 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 1180 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 1211 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 1300 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
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 1010 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 1066 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()[.
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 1095 of file GEbounds.cpp.

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

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

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 977 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 1041 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()[.
Returns
Energy interval width.
Exceptions
GException::out_of_rangeSpecified index is out of range.

Definition at line 1154 of file GEbounds.cpp.

References G_EWIDTH, m_max, m_min, and m_num.

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

void GEbounds::extend ( const GEbounds ebds)

Append energy boundaries.

Parameters
[in]ebdsEnergy boundaries.

Append energy boundaries to the container.

Definition at line 552 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 1325 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 948 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 1281 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 322 of file GEbounds.cpp.

References insert_eng(), m_min, and m_num.

Referenced by remove().

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 1389 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 175 of file GEbounds.hpp.

References m_num.

Referenced by extend(), GSPIResponse::is_precomputed(), write(), and GSPIResponse::write_energies().

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 689 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 349 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 395 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 238 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 1232 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 761 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(), GCTAModelSkyCube::load(), load(), GCTACubeBackground::read(), GCTAObservation::read(), GRmf::read(), GPha::read(), GSPIEventCube::read_ebds(), GLATEventCube::read_ebds(), GCTAEventCube::read_ebds(), and GSPIResponse::read_energies().

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 869 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()[.

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 427 of file GEbounds.cpp.

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

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

Remove energy interval from energy boundaries.

Parameters
[in]eminMinimum energy of interval.
[in]emaxMaximum energy of interval.
Exceptions
GException::invalid_argumentMinimum energy larger than maximum energy

Removes an energy interval from the energy boundaries. If the energy interval is fully enclosed in an existing energy boundary, the energy boundary will be split into two, excluding the specified energy interval. If the energy interval corresponds exactly to an existing energy boundary the corresponding energy boundary will be removed. Otherwise the existing energy boundaries will be adjusted to exclude the specified energy interval.

Definition at line 471 of file GEbounds.cpp.

References emax(), emin(), G_REMOVE_ENG, insert(), m_max, m_min, m_num, NORMAL, GEnergy::print(), 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 538 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 733 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 618 of file GEbounds.cpp.

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

Referenced by GEbounds(), and set().

void GEbounds::set ( const int &  num,
const GEnergy emin,
const GEnergy emax,
const std::string &  method = "LOG",
const double &  gamma = 1.0 
)

Set energy intervals.

Parameters
[in]numNumber of energy intervals.
[in]eminMinimum energy of first interval.
[in]emaxMaximum energy of last interval.
[in]methodEnergy spacing method (one of "LIN", "LOG" or "POW").
[in]gammaPower law index for POW method.

Sets energy boundaries by defining num successive energy intervals between emin and emax. The method parameter controls the energy spacing of the energy boundaries. See the GEnergies::set() method for more information.

Definition at line 662 of file GEbounds.cpp.

References set().

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 1346 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(), and set().

int GEbounds::size ( void  ) const
inlinevirtual

Return number of energy boundaries.

Returns
Number of energy boundaries.

Implements GContainer.

Definition at line 163 of file GEbounds.hpp.

References m_num.

Referenced by GCTAOnOffObservation::apply_ebounds(), GCTAOnOffObservation::arf_stacked(), GCTAOnOffObservation::compute_alpha(), GCTAOnOffObservation::compute_arf(), GCTAOnOffObservation::compute_arf_cut(), GCTAOnOffObservation::compute_bgd(), GCTAOnOffObservation::compute_rmf(), GResponse::convolve(), GModelSpectralTable::create_eng_table(), GModelSpectralTable::create_spec_table(), extend(), GCTACubeBackground::fill(), GArf::GArf(), GCTACubeBackground::GCTACubeBackground(), GCTAModelSpatialLookup::GCTAModelSpatialLookup(), GModelSpectralBins::GModelSpectralBins(), GModelSpectralTable::GModelSpectralTable(), GPha::GPha(), GRmf::GRmf(), GCTAModelSkyCube::load(), GCTAModelIrfBackground::mc(), GCTAModelAeffBackground::mc(), GCTAModelBackground::mc(), GModelSpatialDiffuseCube::mc(), GCTAEdisp2D::normalize_table(), GObservation::npred_spec(), GCTAResponseIrf::nroi(), operator==(), GMWLSpectrum::print(), GCTACubeBackground::print(), GModelSpectralTable::print(), GModelSpatialDiffuseCube::print(), GCTAEdispRmf::print(), GRmf::print(), GArf::print(), print(), GPha::print(), GRmf::read(), GPha::read(), GSPIEventCube::read_ebds(), GCTAOnOffObservation::rmf_stacked(), GModelSpectralTable::scale_energy(), GLATMeanPsf::set(), GCOMIaq::set(), GEnergies::set(), GCOMEventCube::set_energies(), GCTAEventCube::set_energies(), GModelSpectralTable::set_energy_nodes(), GCTACubeBackground::set_eng_axis(), GArf::set_logetrue(), GCTAEdispRmf::set_matrix(), GModelSpectralTable::update(), GPha::write(), and GCOMDri::write_attributes().

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 816 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(), GPha::write(), and GSPIResponse::write_energies().

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 913 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 213 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 1462 of file GEbounds.cpp.

Member Data Documentation

GEnergy GEbounds::m_emax
protected

Maximum energy of all intervals.

Definition at line 139 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 138 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 141 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 140 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: