ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
Public Member Functions | Protected Member Functions | Protected Attributes
MassObject Class Reference

A MassObject corresponds to a line in the mass.mas03 file. More...

#include <MassObject.h>

List of all members.

Public Member Functions

 MassObject ()
 Constructor, constructs an empty MassObject.
 MassObject (string massString)
 Creates the MassObject from a line in the mass.mas03 file.
Nukleid getNukleid () const
 Get the Nukleid corresponding to this object.
ExperimentalValue getMassExcess () const
 Get the mass excess.
ExperimentalValue getBindingEnergy () const
 Get the Binding energy.
ExperimentalValue getBetaDecayEnergy () const
 Get the Beta decay energy.
ExperimentalValue getAtomicMass () const
 Get the atomic mass.

Protected Member Functions

ExperimentalValue stringsToExperimentalValue (string value, string deltaValue)
 Returns the ExperimentalValue corresponding to a value and a diffrence in this value.
double stringToDouble (string myString)
 Convert a string to a double.
string trimString (string toTrim)
 Trims a string.

Protected Attributes

Nukleid myNukleid
 contains N, Z, A and the designation of this MassObject.
ExperimentalValue massExcess
 In keV.
ExperimentalValue bindingEnergy
 In keV.
ExperimentalValue betaDecayEnergy
 In keV.
ExperimentalValue atomicMass
 The atomic mass in µu.

Detailed Description

A MassObject corresponds to a line in the mass.mas03 file.

Author:
Rikard Lundmark
Note:
Only real nucleids (that is, not for example neutrons and protons) can be mass objects).

Definition at line 42 of file MassObject.h.


Constructor & Destructor Documentation

MassObject::MassObject ( string  massString)

Creates the MassObject from a line in the mass.mas03 file.

Parameters:
massStringThe string to construct the MassObject from. This string must be a valid line >40 in the mass.mas03 file (not neutron or proton or such either).

Definition at line 9 of file MassObject.cpp.

References atomicMass, betaDecayEnergy, bindingEnergy, massExcess, myNukleid, stringsToExperimentalValue(), and trimString().

{
  string elementName = massString.substr(20,3);
  elementName = trimString(elementName);
  while(elementName.size()<2)
    elementName = elementName + " ";
  string elementMass = massString.substr(16,3);
  elementMass = trimString(elementMass);
  while(elementMass.size()<3)
    elementMass = elementMass + " ";

  string nukleidString = elementMass + elementName;

  myNukleid = Nukleid(nukleidString);
  massExcess = stringsToExperimentalValue(massString.substr(29,13),massString.substr(42,10));
  bindingEnergy = stringsToExperimentalValue(massString.substr(54,8),massString.substr(65,7));
  betaDecayEnergy = stringsToExperimentalValue(massString.substr(76,10),massString.substr(88,8));
  string massStr = massString.substr(96,16);
  massStr[3]='.';
  atomicMass = stringsToExperimentalValue(massStr,massString.substr(113,10));                                    
}

Member Function Documentation

ExperimentalValue MassObject::getAtomicMass ( ) const

Get the atomic mass.

Returns:
the Atomic mass of this mass object.

Definition at line 91 of file MassObject.cpp.

References atomicMass.

{
  return atomicMass;
}
ExperimentalValue MassObject::getBetaDecayEnergy ( ) const

Get the Beta decay energy.

Returns:
the Beta decay energy of this mass object.

Definition at line 86 of file MassObject.cpp.

References betaDecayEnergy.

{
  return betaDecayEnergy;
}
ExperimentalValue MassObject::getBindingEnergy ( ) const

Get the Binding energy.

Returns:
The binding energy of this Mass object.

Definition at line 81 of file MassObject.cpp.

References bindingEnergy.

{
  return bindingEnergy;
}
ExperimentalValue MassObject::getMassExcess ( ) const

Get the mass excess.

Returns:
The mass excess of this Mass object.

Definition at line 76 of file MassObject.cpp.

References massExcess.

Referenced by main(), and InterestingDecayBetaGamma::toString().

{
  return massExcess;
}
Nukleid MassObject::getNukleid ( ) const

Get the Nukleid corresponding to this object.

Returns:
The Nukleid object of this Mass object.

Definition at line 71 of file MassObject.cpp.

References myNukleid.

{
  return myNukleid;
}
ExperimentalValue MassObject::stringsToExperimentalValue ( string  value,
string  deltaValue 
) [protected]

Returns the ExperimentalValue corresponding to a value and a diffrence in this value.

Note:
The value and deltavalue must follow mass.mas03 format.
Parameters:
valueThe value to make an ExperimentalValue from.
deltaValueThe error in in value.

Definition at line 31 of file MassObject.cpp.

References ExperimentalValue::deltaValue, ExperimentalValue::isTheoretical, ExperimentalValue::nonCalculable, stringToDouble(), and ExperimentalValue::value.

Referenced by MassObject().

{
  ExperimentalValue toReturn;
  if(find(value.begin(), value.end(), '*')!=value.end())
    {
      toReturn.isTheoretical=true;
    }
  else
    {
      toReturn.isTheoretical=false;
      if(find(value.begin(), value.end(), '#')!=value.end())
        {
          toReturn.nonCalculable=true;
        }
      else
        {
          toReturn.nonCalculable=false;
        }
      remove(value.begin(), value.end(), '#');
      remove(deltaValue.begin(), deltaValue.end(), '#');
      toReturn.value=stringToDouble(value);
      toReturn.deltaValue=stringToDouble(deltaValue);
    }
  return toReturn;
}
double MassObject::stringToDouble ( string  myString) [protected]

Convert a string to a double.

Parameters:
myStringThe string to convert to a double.

Definition at line 57 of file MassObject.cpp.

Referenced by stringsToExperimentalValue().

{
  return atof(myString.c_str());
}
string MassObject::trimString ( string  toTrim) [protected]

Trims a string.

Parameters:
toTrimthe string to trim.

Definition at line 62 of file MassObject.cpp.

Referenced by MassObject().

{
  string retur = "";
  for(unsigned int i = 0; i<toTrim.size(); i++)
    if(toTrim[i]!=' ')
      retur = retur + toTrim[i];
  return retur;
}

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Defines

Back to the main page of the Precalibrated Ion Beam Identification Detector project

Created by Rikard Lundmark