GammaLib
2.1.0.dev
|
Class that handles energies in a unit independent way. More...
#include <GEnergy.hpp>
Public Member Functions | |
GEnergy (void) | |
Void constructor. More... | |
GEnergy (const GEnergy &eng) | |
Copy constructor. More... | |
GEnergy (const double &eng, const std::string &unit) | |
Energy constructor. More... | |
virtual | ~GEnergy (void) |
Destructor. More... | |
GEnergy & | operator= (const GEnergy &eng) |
Assignment operator. More... | |
GEnergy & | operator+= (const GEnergy &eng) |
Energy unary addition operator. More... | |
GEnergy & | operator-= (const GEnergy &eng) |
Energy unary differnce operator. More... | |
GEnergy & | operator*= (const double &scale) |
Energy unary multiplication operator. More... | |
GEnergy & | operator/= (const double &scale) |
Energy unary division operator. More... | |
void | operator() (const double &eng, const std::string &unit) |
Unit set operator. More... | |
double | operator() (const std::string &unit) const |
Unit access operator. More... | |
void | clear (void) |
Clear instance. More... | |
GEnergy * | clone (void) const |
Clone object. More... | |
std::string | classname (void) const |
Return class name. More... | |
double | erg (void) const |
Return energy in erg. More... | |
double | keV (void) const |
Return energy in keV. More... | |
double | MeV (void) const |
Return energy in MeV. More... | |
double | GeV (void) const |
Return energy in GeV. More... | |
double | TeV (void) const |
Return energy in TeV. More... | |
double | Angstrom (void) const |
Return energy as wavelength in Angstrom. More... | |
double | log10erg (void) const |
Return log10 of energy in erg. More... | |
double | log10keV (void) const |
Return log10 of energy in keV. More... | |
double | log10MeV (void) const |
Return log10 of energy in MeV. More... | |
double | log10GeV (void) const |
Return log10 of energy in GeV. More... | |
double | log10TeV (void) const |
Return log10 of energy in TeV. More... | |
double | log10 (const std::string &unit) const |
Set log10 of energy with unit specification. More... | |
void | erg (const double &eng) |
Set energy in erg. More... | |
void | keV (const double &eng) |
Set energy in keV. More... | |
void | MeV (const double &eng) |
Set energy in MeV. More... | |
void | GeV (const double &eng) |
Set energy in GeV. More... | |
void | TeV (const double &eng) |
Set energy in TeV. More... | |
void | Angstrom (const double &wavelength) |
Set energy from wavelength in Angstrom. More... | |
void | log10erg (const double &eng) |
Set log10 of energy in erg. More... | |
void | log10keV (const double &eng) |
Set log10 of energy in keV. More... | |
void | log10MeV (const double &eng) |
Set log10 of energy in MeV. More... | |
void | log10GeV (const double &eng) |
Set log10 of energy in GeV. More... | |
void | log10TeV (const double &eng) |
Set log10 of energy in TeV. More... | |
void | log10 (const double &eng, const std::string &unit) |
Set log10 of energy with unit specification. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print energy. 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 GEnergy &eng) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
double | m_energy |
Energy in MeV. More... | |
double | m_elog10 |
log10 of energy in MeV More... | |
bool | m_has_log10 |
log10 of energy is valid More... | |
Friends | |
GEnergy | operator+ (const GEnergy &a, const GEnergy &b) |
Energy addition operator friend. More... | |
GEnergy | operator- (const GEnergy &a, const GEnergy &b) |
Energy subtraction operator friend. More... | |
GEnergy | operator* (const double &a, const GEnergy &b) |
Energy multiplication operator friend. More... | |
GEnergy | operator* (const GEnergy &a, const double &b) |
Energy multiplication operator friend. More... | |
GEnergy | operator/ (const GEnergy &a, const double &b) |
Energy division operator friend. More... | |
double | operator/ (const GEnergy &a, const GEnergy &b) |
Energy division operator friend. More... | |
bool | operator== (const GEnergy &a, const GEnergy &b) |
Energy equality operator friend. More... | |
bool | operator!= (const GEnergy &a, const GEnergy &b) |
Energy non-equality operator friend. More... | |
bool | operator< (const GEnergy &a, const GEnergy &b) |
Energy smaller than operator friend. More... | |
bool | operator<= (const GEnergy &a, const GEnergy &b) |
Energy smaller than or equal to operator friend. More... | |
bool | operator> (const GEnergy &a, const GEnergy &b) |
Energy larger than operator friend. More... | |
bool | operator>= (const GEnergy &a, const GEnergy &b) |
Energy larger than or equal to operator friend. More... | |
Class that handles energies in a unit independent way.
The GEnergy class stores an energy value in units of MeV and implements methods that provide automatic conversion of the energy values in other units. This makes instrument specific implementations more robust and reduces the risk of unit errors. The method also holds on request the log10 of the energy in MeV, which is only recomputed when the energy value is changed. This considerably reduces the number of log10 operations in many applications and speeds up the performance.
Definition at line 48 of file GEnergy.hpp.
GEnergy::GEnergy | ( | void | ) |
Void constructor.
Definition at line 64 of file GEnergy.cpp.
References init_members().
Referenced by clone().
GEnergy::GEnergy | ( | const GEnergy & | eng | ) |
Copy constructor.
[in] | eng | Energy. |
Definition at line 79 of file GEnergy.cpp.
References copy_members(), and init_members().
GEnergy::GEnergy | ( | const double & | eng, |
const std::string & | unit | ||
) |
Energy constructor.
[in] | eng | Energy. |
[in] | unit | Energy unit (one of erg(s), keV, MeV, GeV, TeV). |
Construct energy from an energy value and unit. The constructor interprets the unit string and performs automatic conversion of the energy value.
Definition at line 101 of file GEnergy.cpp.
References init_members(), and operator()().
|
virtual |
double GEnergy::Angstrom | ( | void | ) | const |
Return energy as wavelength in Angstrom.
GException::invalid_value | Cannot convert zero energy into a wavelength. |
Definition at line 366 of file GEnergy.cpp.
References G_ANGSTROM_GET, m_energy, and gammalib::MeV2Angstrom.
Referenced by operator()().
void GEnergy::Angstrom | ( | const double & | wavelength | ) |
Set energy from wavelength in Angstrom.
[in] | wavelength | Wavelength in Angstrom. |
GException::invalid_argument | Cannot set energy from zero wavelength. |
Definition at line 604 of file GEnergy.cpp.
References G_ANGSTROM_SET, m_energy, m_has_log10, and gammalib::MeV2Angstrom.
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 129 of file GEnergy.hpp.
|
virtual |
Clear instance.
Implements GBase.
Definition at line 261 of file GEnergy.cpp.
References free_members(), and init_members().
Referenced by GSPIEventCube::alloc_data(), GCTACubeEdisp::compute_ebounds(), GCTAEdisp2D::compute_etrue_bounds(), GLATEventAtom::init_members(), GPhoton::init_members(), GSource::init_members(), GMWLDatum::init_members(), GCTAEventAtom::init_members(), GCOMEventCube::init_members(), GCOMEventBin::init_members(), GModelSpectralExponential::init_members(), GModelSpectralMultiplicative::init_members(), GModelSpectralComposite::init_members(), GCOMEventAtom::init_members(), GCTAEventBin::init_members(), GSPIEventBin::init_members(), GModelSpectralTable::init_members(), GModelSpectralPlaw::init_members(), GCTAEdispRmf::init_members(), GModelSpectralBins::init_members(), GModelSpectralFunc::init_members(), GModelSpectralExpPlaw::init_members(), GModelSpectralLogParabola::init_members(), GModelSpectralBrokenPlaw::init_members(), GModelSpectralSuperExpPlaw::init_members(), GModelSpectralExpInvPlaw::init_members(), GEbounds::init_members(), GModelSpectralNodes::init_members(), GModelSpectralSmoothBrokenPlaw::init_members(), GPha::init_members(), and GEbounds::set_attributes().
|
virtual |
Clone object.
Implements GBase.
Definition at line 279 of file GEnergy.cpp.
References GEnergy().
|
protected |
Copy class members.
[in] | eng | Energy. |
Definition at line 817 of file GEnergy.cpp.
References m_elog10, m_energy, and m_has_log10.
Referenced by GEnergy(), and operator=().
double GEnergy::erg | ( | void | ) | const |
Return energy in erg.
Definition at line 291 of file GEnergy.cpp.
References m_energy, and gammalib::MeV2erg.
Referenced by operator()().
void GEnergy::erg | ( | const double & | eng | ) |
Set energy in erg.
[in] | eng | Energy in erg. |
Definition at line 511 of file GEnergy.cpp.
References gammalib::erg2MeV, m_energy, and m_has_log10.
|
protected |
Delete class members.
Definition at line 832 of file GEnergy.cpp.
Referenced by clear(), operator=(), and ~GEnergy().
double GEnergy::GeV | ( | void | ) | const |
Return energy in GeV.
Definition at line 333 of file GEnergy.cpp.
References m_energy.
Referenced by operator()(), and print().
void GEnergy::GeV | ( | const double & | eng | ) |
Set energy in GeV.
[in] | eng | Energy in GeV. |
Definition at line 565 of file GEnergy.cpp.
References m_energy, and m_has_log10.
|
protected |
Initialise class members.
Definition at line 800 of file GEnergy.cpp.
References m_elog10, m_energy, and m_has_log10.
Referenced by clear(), GEnergy(), and operator=().
double GEnergy::keV | ( | void | ) | const |
Return energy in keV.
Definition at line 306 of file GEnergy.cpp.
References m_energy.
Referenced by GModelSpectralTable::create_eng_table(), operator()(), print(), GSPIResponse::read_energies(), GCOMEventList::read_events(), GSPIResponse::set(), and GArf::write().
void GEnergy::keV | ( | const double & | eng | ) |
Set energy in keV.
[in] | eng | Energy in keV. |
Definition at line 529 of file GEnergy.cpp.
References m_energy, and m_has_log10.
double GEnergy::log10 | ( | const std::string & | unit | ) | const |
Set log10 of energy with unit specification.
[in] | unit | Unit of log10 of energy. |
GException::invalid_argument | Unit argument is not valid. |
Definition at line 473 of file GEnergy.cpp.
References G_LOG10_GET, log10erg(), log10GeV(), log10keV(), log10MeV(), log10TeV(), and gammalib::tolower().
void GEnergy::log10 | ( | const double & | eng, |
const std::string & | unit | ||
) |
Set log10 of energy with unit specification.
[in] | eng | log10 of energy. |
[in] | unit | Unit of log10 of energy. |
GException::invalid_argument | Unit argument is not valid. |
Definition at line 712 of file GEnergy.cpp.
References G_LOG10_SET, log10erg(), log10GeV(), log10keV(), log10MeV(), log10TeV(), and gammalib::tolower().
double GEnergy::log10erg | ( | void | ) | const |
Return log10 of energy in erg.
Returns the log10 of the energy in erg.
Definition at line 389 of file GEnergy.cpp.
References log10(), log10MeV(), and gammalib::MeV2erg.
Referenced by log10().
void GEnergy::log10erg | ( | const double & | eng | ) |
Set log10 of energy in erg.
[in] | eng | log10 of energy in erg. |
Definition at line 628 of file GEnergy.cpp.
References log10(), log10MeV(), and gammalib::MeV2erg.
double GEnergy::log10GeV | ( | void | ) | const |
Return log10 of energy in GeV.
Returns the log10 of the energy in GeV.
Definition at line 443 of file GEnergy.cpp.
References log10MeV().
Referenced by log10().
void GEnergy::log10GeV | ( | const double & | eng | ) |
Set log10 of energy in GeV.
[in] | eng | log10 of energy in GeV. |
Definition at line 678 of file GEnergy.cpp.
References log10MeV().
double GEnergy::log10keV | ( | void | ) | const |
Return log10 of energy in keV.
Returns the log10 of the energy in keV.
Definition at line 406 of file GEnergy.cpp.
References log10MeV().
Referenced by log10().
void GEnergy::log10keV | ( | const double & | eng | ) |
Set log10 of energy in keV.
[in] | eng | log10 of energy in keV. |
Definition at line 646 of file GEnergy.cpp.
References log10MeV().
double GEnergy::log10MeV | ( | void | ) | const |
Return log10 of energy in MeV.
Returns the log10 of the energy in MeV. The result is stored internally and not recomputed when the method is called again with the same energy value. This speeds up computation. In case that the energy is not positive the method returns DBL_MIN.
Definition at line 423 of file GEnergy.cpp.
References log10(), m_elog10, m_energy, and m_has_log10.
Referenced by GModelSpectralFunc::append(), GModelSpatialDiffuseCube::cube_intensity(), GLATAeff::efficiency_factor1(), GLATAeff::efficiency_factor2(), gammalib::elogmean(), GModelSpatialDiffuseCube::energies(), GModelSpectralFunc::energy(), GModelSpectralTable::eval(), GModelSpectralFunc::eval(), GModelSpectralPlawEnergyFlux::eval(), GModelSpectralPlawPhotonFlux::eval(), GModelSpectralNodes::eval(), GCTAEdisp2D::edisp_ereco_kern::eval(), GModelSpatialDiffuseCube::flux(), GModelSpectralFunc::insert(), GLATResponse::irf(), GLATResponse::irf_spatial_bin(), log10(), log10erg(), log10GeV(), log10keV(), log10TeV(), GModelSpatialDiffuseCube::mc(), GModelSpatialDiffuseCube::mc_cone(), GCTAEdisp2D::normalize_table(), GLATLtCubeMap::operator()(), GLATMeanPsf::print(), GLATMeanPsf::set(), GModelSpatialDiffuseCube::set_energy_boundaries(), GModelSpectralExponential::update_mc_cache(), and GModelSpectralMultiplicative::update_mc_cache().
void GEnergy::log10MeV | ( | const double & | eng | ) |
Set log10 of energy in MeV.
[in] | eng | log10 of energy in MeV. |
Definition at line 661 of file GEnergy.cpp.
References m_elog10, m_energy, m_has_log10, and pow().
double GEnergy::log10TeV | ( | void | ) | const |
Return log10 of energy in TeV.
Returns the log10 of the energy in TeV.
Definition at line 457 of file GEnergy.cpp.
References log10MeV().
Referenced by GCTAOnOffObservation::compute_arf_cut(), GCTAEdisp2D::compute_ereco_bounds(), GCTAOnOffObservation::compute_rmf(), GCTAEdispPerfTable::ereco_bounds(), GCTAEdispPerfTable::etrue_bounds(), GCTAModelSkyCube::eval(), GCTAModelSpatialLookup::eval(), cta_irf_radial_kern_omega::eval(), cta_irf_elliptical_kern_omega::eval(), GCTAEdisp2D::get_max_edisp(), GCTAResponseIrf::irf(), GCTAResponseIrf::irf_diffuse(), GCTAResponseIrf::irf_elliptical(), GCTAResponseIrf::irf_radial(), GCTABackgroundPerfTable::load(), GCTAModelSkyCube::load(), log10(), GCTAModelAeffBackground::mc(), GCTABackground3D::mc(), GCTABackground2D::mc(), GCTAEdispPerfTable::mc(), GCTAResponseIrf::mc(), GCTAResponseIrf::nirf(), GCTAModelIrfBackground::npred(), GCTAModelAeffBackground::npred(), GCTAModelCubeBackground::npred(), GCTAModelSkyCube::npred(), GCTAResponseIrf::nroi_diffuse(), GCTAResponseIrf::nroi_elliptical(), GCTAResponseIrf::nroi_radial(), GCTACubeBackground::operator()(), GCTACubeExposure::operator()(), GCTAEdispPerfTable::operator()(), GArf::operator()(), GCTACubePsf::operator()(), GCTAEdisp2D::operator()(), GCTAEdispRmf::prob_erecobin(), GCTAEdispPerfTable::prob_erecobin(), GCTAEdisp2D::prob_erecobin(), GCTABackgroundPerfTable::rate_ebin(), GCTABackground3D::rate_ebin(), GCTABackground2D::rate_ebin(), GCTAAeffPerfTable::set_boundaries(), GCTAEdispRmf::set_cache(), GCTACubeBackground::set_eng_axis(), GArf::set_logetrue(), GCTAEdispRmf::update(), and GCTACubeEdisp::update().
void GEnergy::log10TeV | ( | const double & | eng | ) |
Set log10 of energy in TeV.
[in] | eng | log10 of energy in TeV. |
Definition at line 693 of file GEnergy.cpp.
References log10MeV().
double GEnergy::MeV | ( | void | ) | const |
Return energy in MeV.
Definition at line 321 of file GEnergy.cpp.
References m_energy.
Referenced by GModelSpectralBins::append(), GModelSpectralFunc::append(), GModelSpectralNodes::append(), GModelSpectralBins::bin_index(), GModelSpectralBrokenPlaw::breakenergy(), GModelSpectralSmoothBrokenPlaw::breakenergy(), GCOMIaq::compute_iaq_bin(), GCOMDri::compute_tof_correction(), GMWLSpectrum::conv_flux(), GResponse::convolve(), GModelSpectralExpPlaw::cutoff(), GModelSpectralSuperExpPlaw::cutoff(), GModelSpectralExpInvPlaw::cutoff(), GResponse::ebounds_model(), GModelSpectralMultiplicative::eflux(), GModelSpectralExponential::eflux(), GModelSpectralBins::eflux(), GModelSpectralConst::eflux(), GModelSpectralTable::eflux(), GModelSpectralFunc::eflux(), GModelSpectralGauss::eflux(), GModelSpectralPlaw::eflux(), GModelSpectralExpPlaw::eflux(), GModelSpectralLogParabola::eflux(), GModelSpectralBrokenPlaw::eflux(), GModelSpectralSuperExpPlaw::eflux(), GModelSpectralExpInvPlaw::eflux(), GModelSpectralPlawPhotonFlux::eflux(), GModelSpectralPlawEnergyFlux::eflux(), GModelSpectralNodes::eflux(), GModelSpectralSmoothBrokenPlaw::eflux(), GModelSky::eflux(), gammalib::elogmean(), GEbounds::elogmean(), GModelSpectralBins::emax(), GModelSpectralPlawEnergyFlux::emax(), GModelSpectralPlawPhotonFlux::emax(), GCTAEventBin::emin(), GModelSpectralBins::emin(), GModelSpectralPlawEnergyFlux::emin(), GModelSpectralPlawPhotonFlux::emin(), GModelSpectralFunc::energy(), GModelSpectralNodes::energy(), GCTAModelIrfBackground::eval(), GModelSpectralBins::eval(), GModelSpectralGauss::eval(), GModelSpectralBrokenPlaw::eval(), GModelSpectralExpInvPlaw::eval(), GModelSpectralLogParabola::flux_kern::eval(), cta_nroi_kern::eval(), GModelSpectralSmoothBrokenPlaw::flux_kern::eval(), GResponse::edisp_kerns::eval(), GObservation::npred_spec_kern::eval(), GCTAEdisp2D::edisp_ereco_kern::eval(), GModelSky::flux_kern::eval(), GModelSky::eflux_kern::eval(), GModelSpectralMultiplicative::flux(), GModelSpectralExponential::flux(), GModelSpectralBins::flux(), GModelSpectralConst::flux(), GModelSpectralTable::flux(), GModelSpectralFunc::flux(), GModelSpectralGauss::flux(), GModelSpectralPlaw::flux(), GModelSpectralExpPlaw::flux(), GModelSpectralLogParabola::flux(), GModelSpectralBrokenPlaw::flux(), GModelSpectralSuperExpPlaw::flux(), GModelSpectralExpInvPlaw::flux(), GModelSpectralPlawPhotonFlux::flux(), GModelSpectralPlawEnergyFlux::flux(), GModelSpectralNodes::flux(), GModelSpectralSmoothBrokenPlaw::flux(), GModelSky::flux(), GCOMObservation::GCOMObservation(), GModelSpectralBrokenPlaw::GModelSpectralBrokenPlaw(), GModelSpectralExpInvPlaw::GModelSpectralExpInvPlaw(), GModelSpectralExpPlaw::GModelSpectralExpPlaw(), GModelSpectralGauss::GModelSpectralGauss(), GModelSpectralLogParabola::GModelSpectralLogParabola(), GModelSpectralPlaw::GModelSpectralPlaw(), GModelSpectralPlawEnergyFlux::GModelSpectralPlawEnergyFlux(), GModelSpectralPlawPhotonFlux::GModelSpectralPlawPhotonFlux(), GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw(), GModelSpectralSuperExpPlaw::GModelSpectralSuperExpPlaw(), GResponseCache::hash(), GModelSpectralPlawPhotonFlux::init_members(), GModelSpectralPlawEnergyFlux::init_members(), GModelSpectralBins::insert(), GModelSpectralFunc::insert(), GModelSpectralNodes::insert(), GLATResponse::irf_spatial_bin(), GCOMObservation::load_dre(), GModelSpectralBins::mc(), GModelSpectralTable::mc(), GModelSpectralConst::mc(), GModelSpectralFunc::mc(), GModelSpectralGauss::mc(), GModelSpectralPlaw::mc(), GModelSpectralExpPlaw::mc(), GModelSpectralLogParabola::mc(), GModelSpectralBrokenPlaw::mc(), GModelSpectralSuperExpPlaw::mc(), GModelSpectralExpInvPlaw::mc(), GModelSpectralPlawPhotonFlux::mc(), GModelSpectralPlawEnergyFlux::mc(), GModelSpectralNodes::mc(), GModelSpectralBins::mc_update(), GModelSpectralFunc::mc_update(), GModelSpectralNodes::mc_update(), GModelSpectralGauss::mean(), GCTAOnOffObservation::N_bgd(), GCTAOnOffObservation::N_gamma(), GObservation::npred_spec(), GCTAResponseIrf::nroi(), operator()(), GCTAEdispPerfTable::operator()(), GCTAEdisp2D::operator()(), GModelSpectralPlaw::pivot(), GModelSpectralExpPlaw::pivot(), GModelSpectralLogParabola::pivot(), GModelSpectralExpInvPlaw::pivot(), GModelSpectralSuperExpPlaw::pivot(), GModelSpectralSmoothBrokenPlaw::pivot(), GMWLDatum::print(), print(), GCTAEdispRmf::prob_erecobin(), GCTABackgroundPerfTable::rate_ebin(), GCTABackground3D::rate_ebin(), GCTABackground2D::rate_ebin(), GPha::read(), GSPIEventCube::read_dsp(), GCOMIaq::save(), GCOMIaq::set(), GModelSpectralTable::set_energy_nodes(), GEnergies::set_log(), GCTAEdispRmf::set_matrix(), GCTAEdisp2D::set_max_edisp(), GEnergies::set_pow(), GModelSpectralGauss::sigma(), GCOMEventBin::size(), GLATEventBin::size(), GCTAEventBin::size(), GModelSpectralPlawPhotonFlux::update(), GModelSpectralPlawEnergyFlux::update(), GModelSpectralPlaw::update_eval_cache(), GModelSpectralExpPlaw::update_eval_cache(), GModelSpectralLogParabola::update_eval_cache(), GModelSpectralBrokenPlaw::update_eval_cache(), GModelSpectralExpInvPlaw::update_eval_cache(), GModelSpectralSuperExpPlaw::update_eval_cache(), GModelSpectralSmoothBrokenPlaw::update_eval_cache(), GModelSpectralTable::update_mc(), GModelSpectralPlaw::update_mc_cache(), GModelSpectralExpPlaw::update_mc_cache(), GModelSpectralLogParabola::update_mc_cache(), GModelSpectralBrokenPlaw::update_mc_cache(), GModelSpectralExpInvPlaw::update_mc_cache(), GModelSpectralSuperExpPlaw::update_mc_cache(), GModelSpectralSmoothBrokenPlaw::update_mc_cache(), GPha::write(), and GCOMDri::write_attributes().
void GEnergy::MeV | ( | const double & | eng | ) |
Set energy in MeV.
[in] | eng | Energy in MeV. |
Definition at line 547 of file GEnergy.cpp.
References m_energy, and m_has_log10.
void GEnergy::operator() | ( | const double & | eng, |
const std::string & | unit | ||
) |
Unit set operator.
[in] | eng | Energy. |
[in] | unit | Energy unit (one of erg(s), keV, MeV, GeV, TeV, Angstrom). |
GException::invalid_argument | Invalid energy unit specified. |
Construct energy from an energy value and unit. The constructor interprets the unit string and performs automatic conversion of the energy value.
Definition at line 172 of file GEnergy.cpp.
References Angstrom(), erg(), G_OPERATOR1, GeV(), keV(), MeV(), gammalib::strip_whitespace(), TeV(), and gammalib::tolower().
Referenced by GEnergy().
double GEnergy::operator() | ( | const std::string & | unit | ) | const |
Unit access operator.
[in] | unit | Energy unit (one of erg(s), keV, MeV, GeV, TeV, Angstrom). |
GException::invalid_argument | Invalid energy unit specified. |
Returns the energy in the requested units.
Definition at line 216 of file GEnergy.cpp.
References Angstrom(), erg(), G_OPERATOR2, GeV(), keV(), MeV(), TeV(), and gammalib::tolower().
|
inline |
Energy unary multiplication operator.
[in] | scale | Scale. |
Definition at line 172 of file GEnergy.hpp.
References m_energy, and m_has_log10.
Energy unary addition operator.
[in] | eng | Energy. |
Definition at line 142 of file GEnergy.hpp.
References m_energy, and m_has_log10.
Energy unary differnce operator.
[in] | eng | Energy. |
Definition at line 157 of file GEnergy.hpp.
References m_energy, and m_has_log10.
|
inline |
Energy unary division operator.
[in] | scale | Scale. |
Definition at line 187 of file GEnergy.hpp.
References m_energy, and m_has_log10.
Assignment operator.
[in] | eng | Energy. |
Definition at line 139 of file GEnergy.cpp.
References copy_members(), free_members(), and init_members().
Print energy.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GBase.
Definition at line 748 of file GEnergy.cpp.
References GeV(), keV(), m_elog10, m_energy, m_has_log10, MeV(), SILENT, gammalib::str(), TeV(), and VERBOSE.
Referenced by GModelSpectralBins::append(), GModelSpectralFunc::append(), GModelSpectralNodes::append(), gammalib::check_energy_interval(), GModelSpectralFunc::energy(), GModelSpectralNodes::energy(), GModelSpatialRadialGauss::eval(), GModelSpatialRadialGeneralGauss::eval(), GModelSpectralPlaw::eval(), GModelSpectralBins::insert(), GModelSpectralFunc::insert(), GModelSpectralNodes::insert(), GEbounds::insert_eng(), GCTABackground2D::mc(), GCTABackground3D::mc(), GModelSpectralBins::mc(), GModelSpatialDiffuseCube::mc(), GModelSpectralExpPlaw::mc(), GModelSpectralSuperExpPlaw::mc(), GModelSpectralExpInvPlaw::mc(), GModelSpectralNodes::mc(), GCTAEdisp2D::mc(), GCOMEventAtom::print(), GLATEventAtom::print(), GCTAEventAtom::print(), GCOMIaq::print(), GMWLDatum::print(), GPhoton::print(), GCTAAeffPerfTable::print(), GSource::print(), GCTAAeffArf::print(), GLATMeanPsf::print(), GCOMEventCube::print(), GModelSpectralTable::print(), GModelSpatialDiffuseCube::print(), GCTAEdispRmf::print(), GRmf::print(), GArf::print(), GPha::print(), GEbounds::remove(), GEnergies::set(), GEnergies::set_log(), GEnergies::set_pow(), and GModelSpectralComposite::update_mc_cache().
double GEnergy::TeV | ( | void | ) | const |
Return energy in TeV.
Definition at line 348 of file GEnergy.cpp.
References m_energy.
Referenced by GCTAEdisp2D::compute_ereco_bounds(), GCTAEdispRmf::ereco_bounds(), GCTAEdisp2D::ereco_bounds(), GCTAEdisp2D::etrue(), GCTAEdispRmf::etrue_bounds(), GCTAEdisp2D::etrue_bounds(), GCTAModelSpatialLookup::GCTAModelSpatialLookup(), GCTAEdisp2D::init_members(), GCTAEdispRmf::mc(), GCTAResponseIrf::mc(), GCTAEdisp2D::mc(), operator()(), print(), GCTAEdispRmf::prob_erecobin(), GCTAEdispRmf::set_cache(), GCTAEdispRmf::update(), and GCTAEventList::write_ds_keys().
void GEnergy::TeV | ( | const double & | eng | ) |
Set energy in TeV.
[in] | eng | Energy in TeV. |
Definition at line 583 of file GEnergy.cpp.
References m_energy, and m_has_log10.
Energy non-equality operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 311 of file GEnergy.hpp.
Energy multiplication operator friend.
[in] | a | Scale. |
[in] | b | Energy. |
Definition at line 235 of file GEnergy.hpp.
Energy multiplication operator friend.
[in] | a | Energy. |
[in] | b | Scale. |
Definition at line 251 of file GEnergy.hpp.
Energy addition operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 203 of file GEnergy.hpp.
Energy subtraction operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 219 of file GEnergy.hpp.
Energy division operator friend.
[in] | a | Energy. |
[in] | b | Scale. |
Definition at line 267 of file GEnergy.hpp.
Energy division operator friend.
[in] | a | Energy. |
[in] | b | Energy. |
Definition at line 283 of file GEnergy.hpp.
Energy smaller than operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 325 of file GEnergy.hpp.
Energy smaller than or equal to operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 339 of file GEnergy.hpp.
Energy equality operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 297 of file GEnergy.hpp.
Energy larger than operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 353 of file GEnergy.hpp.
Energy larger than or equal to operator friend.
[in] | a | First energy. |
[in] | b | Second energy. |
Definition at line 367 of file GEnergy.hpp.
|
mutableprotected |
log10 of energy in MeV
Definition at line 118 of file GEnergy.hpp.
Referenced by copy_members(), init_members(), log10MeV(), and print().
|
protected |
Energy in MeV.
Definition at line 117 of file GEnergy.hpp.
Referenced by Angstrom(), copy_members(), erg(), GeV(), init_members(), keV(), log10MeV(), MeV(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), print(), and TeV().
|
mutableprotected |
log10 of energy is valid
Definition at line 119 of file GEnergy.hpp.
Referenced by Angstrom(), copy_members(), erg(), GeV(), init_members(), keV(), log10MeV(), MeV(), operator*=(), operator+=(), operator-=(), operator/=(), print(), and TeV().