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)");
const double MeV2Angstrom
double log10erg(void) const
Return log10 of energy in erg.
Energy value class definition.
void operator()(const double &eng, const std::string &unit)
Unit set operator.
void init_members(void)
Initialise class members.
double m_energy
Energy in MeV.
GEnergy & operator=(const GEnergy &eng)
Assignment operator.
double TeV(void) const
Return energy in TeV.
double log10TeV(void) const
Return log10 of energy in TeV.
double MeV(void) const
Return energy in MeV.
void copy_members(const GEnergy &eng)
Copy class members.
GEnergy * clone(void) const
Clone object.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
double log10MeV(void) const
Return log10 of energy in MeV.
double Angstrom(void) const
Return energy as wavelength in Angstrom.
void free_members(void)
Delete class members.
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
bool m_has_log10
log10 of energy is valid
double log10GeV(void) const
Return log10 of energy in GeV.
double m_elog10
log10 of energy in MeV
double erg(void) const
Return energy in erg.
double log10keV(void) const
Return log10 of energy in keV.
double GeV(void) const
Return energy in GeV.
double log10(const std::string &unit) const
Set log10 of energy with unit specification.
double keV(void) const
Return energy in keV.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
virtual ~GEnergy(void)
Destructor.
Exception handler interface definition.
std::string tolower(const std::string &s)
Convert string to lower case.
GEnergy(void)
Void constructor.
void clear(void)
Clear instance.
GVector log10(const GVector &vector)
Computes base10 logarithm of vector elements.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.