40#define G_CONSTRUCT "GEnergy::GEnergy(double&, std::string&)"
41#define G_OPERATOR1 "GEnergy::operator()(double&, std::string&)"
42#define G_OPERATOR2 "GEnergy::operator()(std::string&)"
43#define G_ANGSTROM_GET "GEnergy::Angstrom()"
44#define G_ANGSTROM_SET "GEnergy::Angstrom(double&)"
45#define G_LOG10_GET "GEnergy::log10(std::string&)"
46#define G_LOG10_SET "GEnergy::log10(double&, std::string&)"
176 if (eunit ==
"erg" || eunit ==
"ergs") {
179 else if (eunit ==
"kev") {
182 else if (eunit ==
"mev") {
185 else if (eunit ==
"gev") {
188 else if (eunit ==
"tev") {
191 else if (eunit ==
"angstrom") {
196 "Valid energy units are \"erg(s)\", \"keV\", \"MeV\","
197 " \"GeV\", \"TeV\", or \"Angstrom\" (case insensitive).");
223 if (eunit ==
"erg" || eunit ==
"ergs") {
224 energy = this->
erg();
226 else if (eunit ==
"kev") {
227 energy = this->
keV();
229 else if (eunit ==
"mev") {
230 energy = this->
MeV();
232 else if (eunit ==
"gev") {
233 energy = this->
GeV();
235 else if (eunit ==
"tev") {
236 energy = this->
TeV();
238 else if (eunit ==
"angstrom") {
243 "Valid energy units are \"erg(s)\", \"keV\", \"MeV\","
244 " \"GeV\", \"TeV\", or \"Angstrom\" (case insensitive).");
371 "Cannot convert energy of 0 MeV into Angstrom.");
480 if (eunit ==
"erg" || eunit ==
"ergs") {
483 else if (eunit ==
"kev") {
486 else if (eunit ==
"mev") {
489 else if (eunit ==
"gev") {
492 else if (eunit ==
"tev") {
497 "Valid energy units are \"erg(s)\", \"keV\", \"MeV\","
498 " \"GeV\", or \"TeV\" (case insensitive).");
607 if (wavelength == 0) {
609 "Cannot set energy from a wavelength that is zero.");
716 if (eunit ==
"erg" || eunit ==
"ergs") {
719 else if (eunit ==
"kev") {
722 else if (eunit ==
"mev") {
725 else if (eunit ==
"gev") {
728 else if (eunit ==
"tev") {
733 "Valid energy units are \"erg(s)\", \"keV\", \"MeV\","
734 " \"GeV\", or \"TeV\" (case insensitive).");
757 if (
TeV() >= 1000.0) {
760 else if (
GeV() >= 1000.0) {
763 else if (
MeV() >= 1000.0) {
766 else if (
keV() >= 1000.0) {
780 result.append(
", no log10(E) value)");
Energy value class definition.
Exception handler interface definition.
Class that handles energies in a unit independent way.
double log10(const std::string &unit) const
Set log10 of energy with unit specification.
double GeV(void) const
Return energy in GeV.
double Angstrom(void) const
Return energy as wavelength in Angstrom.
double m_energy
Energy in MeV.
double keV(void) const
Return energy in keV.
void operator()(const double &eng, const std::string &unit)
Unit set operator.
double log10TeV(void) const
Return log10 of energy in TeV.
double log10GeV(void) const
Return log10 of energy in GeV.
double MeV(void) const
Return energy in MeV.
double log10MeV(void) const
Return log10 of energy in MeV.
void free_members(void)
Delete class members.
GEnergy(void)
Void constructor.
void copy_members(const GEnergy &eng)
Copy class members.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
double log10keV(void) const
Return log10 of energy in keV.
GEnergy & operator=(const GEnergy &eng)
Assignment operator.
void clear(void)
Clear instance.
double TeV(void) const
Return energy in TeV.
double erg(void) const
Return energy in erg.
double log10erg(void) const
Return log10 of energy in erg.
void init_members(void)
Initialise class members.
virtual ~GEnergy(void)
Destructor.
bool m_has_log10
log10 of energy is valid
GEnergy * clone(void) const
Clone object.
double m_elog10
log10 of energy in MeV
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
std::string tolower(const std::string &s)
Convert string to lower case.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
const double MeV2Angstrom