#include <ALIUnitsTable.h>
Public Member Functions | |
ALIUnitDefinition (ALIstring name, ALIstring symbol, ALIstring category, ALIdouble value) | |
ALIstring | GetName () const |
ALIstring | GetSymbol () const |
ALIdouble | GetValue () const |
ALIint | operator!= (const ALIUnitDefinition &) const |
ALIint | operator== (const ALIUnitDefinition &) const |
void | PrintDefinition () |
~ALIUnitDefinition () | |
Static Public Member Functions | |
static void | BuildUnitsTable () |
static ALIstring | GetCategory (ALIstring) |
static ALIUnitsTable & | GetUnitsTable () |
static ALIdouble | GetValueOf (ALIstring) |
static void | PrintUnitsTable () |
Private Member Functions | |
ALIUnitDefinition (ALIUnitDefinition &) | |
ALIUnitDefinition & | operator= (const ALIUnitDefinition &) |
Private Attributes | |
size_t | CategoryIndex |
ALIstring | Name |
ALIstring | SymbolName |
ALIdouble | Value |
Static Private Attributes | |
static ALIUnitsTable | theUnitsTable |
Definition at line 52 of file ALIUnitsTable.h.
ALIUnitDefinition::ALIUnitDefinition | ( | ALIstring | name, |
ALIstring | symbol, | ||
ALIstring | category, | ||
ALIdouble | value | ||
) |
Definition at line 12 of file ALIUnitsTable.cc.
References CategoryIndex, GetName(), i, and theUnitsTable.
Referenced by BuildUnitsTable().
: Name(name),SymbolName(symbol),Value(value) { // //does the Category objet already exist ? size_t nbCat = theUnitsTable.size(); size_t i = 0; while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++; if (i == nbCat) theUnitsTable.push_back( new ALIUnitsCategory(category)); CategoryIndex = i; // //insert this Unit in the Unitstable (theUnitsTable[CategoryIndex]->GetUnitsList()).push_back(this); //update ALIstring max length for name and symbol theUnitsTable[i]->UpdateNameMxLen((ALIint)name.length()); theUnitsTable[i]->UpdateSymbMxLen((ALIint)symbol.length()); }
ALIUnitDefinition::~ALIUnitDefinition | ( | ) |
Definition at line 35 of file ALIUnitsTable.cc.
{}
ALIUnitDefinition::ALIUnitDefinition | ( | ALIUnitDefinition & | right | ) | [private] |
Definition at line 40 of file ALIUnitsTable.cc.
{
*this = right;
}
void ALIUnitDefinition::BuildUnitsTable | ( | ) | [static] |
Definition at line 125 of file ALIUnitsTable.cc.
References ALIUnitDefinition(), g, and edm::second().
Referenced by GetCategory(), and GetValueOf().
{ //Length new ALIUnitDefinition( "kilometer","km" ,"Length",kilometer); new ALIUnitDefinition( "meter","m" ,"Length",meter); new ALIUnitDefinition("centimeter","cm" ,"Length",centimeter); new ALIUnitDefinition("millimeter","mm" ,"Length",millimeter); new ALIUnitDefinition("micrometer","mum" ,"Length",micrometer); new ALIUnitDefinition( "nanometer","nm" ,"Length",nanometer); new ALIUnitDefinition( "angstrom","Ang" ,"Length",angstrom); new ALIUnitDefinition( "fermi","fm" ,"Length",fermi); //Surface new ALIUnitDefinition( "kilometer2","km2" ,"Surface",kilometer2); new ALIUnitDefinition( "meter2","m2" ,"Surface",meter2); new ALIUnitDefinition("centimeter2","cm2" ,"Surface",centimeter2); new ALIUnitDefinition("millimeter2","mm2" ,"Surface",millimeter2); new ALIUnitDefinition( "barn","barn" ,"Surface",barn); new ALIUnitDefinition( "millibarn","mbarn" ,"Surface",millibarn); new ALIUnitDefinition( "microbarn","mubarn" ,"Surface",microbarn); new ALIUnitDefinition( "nanobarn","nbarn" ,"Surface",nanobarn); new ALIUnitDefinition( "picobarn","pbarn" ,"Surface",picobarn); //Volume new ALIUnitDefinition( "kilometer3","km3" ,"Volume",kilometer3); new ALIUnitDefinition( "meter3","m3" ,"Volume",meter3); new ALIUnitDefinition("centimeter3","cm3" ,"Volume",centimeter3); new ALIUnitDefinition("millimeter3","mm3" ,"Volume",millimeter3); //Angle new ALIUnitDefinition( "radian","rad" ,"Angle",radian); new ALIUnitDefinition("milliradian","mrad" ,"Angle",milliradian); new ALIUnitDefinition("milliradian","murad" ,"Angle",0.001*milliradian); new ALIUnitDefinition( "steradian","sr" ,"Angle",steradian); new ALIUnitDefinition( "degree","deg" ,"Angle",degree); //Time new ALIUnitDefinition( "second","s" ,"Time",second); new ALIUnitDefinition("millisecond","ms" ,"Time",millisecond); new ALIUnitDefinition("microsecond","mus" ,"Time",microsecond); new ALIUnitDefinition( "nanosecond","ns" ,"Time",nanosecond); new ALIUnitDefinition( "picosecond","ps" ,"Time",picosecond); //Frequency new ALIUnitDefinition( "hertz","Hz" ,"Frequency",hertz); new ALIUnitDefinition("kilohertz","kHz" ,"Frequency",kilohertz); new ALIUnitDefinition("megahertz","MHz" ,"Frequency",megahertz); //Electric charge new ALIUnitDefinition( "eplus","e+" ,"Electric charge",eplus); new ALIUnitDefinition("coulomb","C" ,"Electric charge",coulomb); //Energy new ALIUnitDefinition( "electronvolt","eV" ,"Energy",electronvolt); new ALIUnitDefinition("kiloelectronvolt","keV","Energy",kiloelectronvolt); new ALIUnitDefinition("megaelectronvolt","MeV","Energy",megaelectronvolt); new ALIUnitDefinition("gigaelectronvolt","GeV","Energy",gigaelectronvolt); new ALIUnitDefinition("teraelectronvolt","TeV","Energy",teraelectronvolt); new ALIUnitDefinition("petaelectronvolt","PeV","Energy",petaelectronvolt); new ALIUnitDefinition( "joule","J" ,"Energy",joule); //Mass new ALIUnitDefinition("milligram","mg","Mass",milligram); new ALIUnitDefinition( "gram","g" ,"Mass",gram); new ALIUnitDefinition( "kilogram","kg","Mass",kilogram); //Volumic Mass new ALIUnitDefinition( "g/cm3", "g/cm3","Volumic Mass", g/cm3); new ALIUnitDefinition("mg/cm3","mg/cm3","Volumic Mass",mg/cm3); new ALIUnitDefinition("kg/m3", "kg/m3", "Volumic Mass",kg/m3); //Power new ALIUnitDefinition("watt","W","Power",watt); //Force new ALIUnitDefinition("newton","N","Force",newton); //Pressure new ALIUnitDefinition( "pascal","Pa" ,"Pressure",pascal); new ALIUnitDefinition( "bar","bar","Pressure",bar); new ALIUnitDefinition("atmosphere","atm","Pressure",atmosphere); //Electric current new ALIUnitDefinition( "ampere","A" ,"Electric current",ampere); new ALIUnitDefinition("milliampere","mA" ,"Electric current",milliampere); new ALIUnitDefinition("microampere","muA","Electric current",microampere); new ALIUnitDefinition( "nanoampere","nA" ,"Electric current",nanoampere); //Electric potential new ALIUnitDefinition( "volt","V" ,"Electric potential",volt); new ALIUnitDefinition("kilovolt","kV","Electric potential",kilovolt); new ALIUnitDefinition("megavolt","MV","Electric potential",megavolt); //Magnetic flux new ALIUnitDefinition("weber","Wb","Magnetic flux",weber); //Magnetic flux density new ALIUnitDefinition( "tesla","T" ,"Magnetic flux density",tesla); new ALIUnitDefinition("kilogauss","kG","Magnetic flux density",kilogauss); new ALIUnitDefinition( "gauss","G" ,"Magnetic flux density",gauss); //Temperature new ALIUnitDefinition("kelvin","K","Temperature",kelvin); //Amount of substance new ALIUnitDefinition("mole","mol","Amount of substance",mole); //Activity new ALIUnitDefinition("becquerel","Bq","Activity",becquerel); new ALIUnitDefinition( "curie","Ci","Activity",curie); //Dose new ALIUnitDefinition("gray","Gy","Dose",gray); }
Definition at line 94 of file ALIUnitsTable.cc.
References BuildUnitsTable(), gather_cfg::cout, i, j, mergeVDriftHistosByStation::name, and theUnitsTable.
{ if(theUnitsTable.size()==0) BuildUnitsTable(); ALIstring name,symbol; for (size_t i=0;i<theUnitsTable.size();i++) { ALIUnitsContainer& units = theUnitsTable[i]->GetUnitsList(); for (size_t j=0;j<units.size();j++) { name=units[j]->GetName(); symbol=units[j]->GetSymbol(); if(stri==name||stri==symbol) return theUnitsTable[i]->GetName(); } } std::cout << "Warning from ALIUnitDefinition::GetCategory(" << stri << ")." << " The unit " << stri << " does not exist in UnitsTable." << " Return category = None" << std::endl; name = "None"; return name; }
ALIstring ALIUnitDefinition::GetName | ( | ) | const [inline] |
Definition at line 72 of file ALIUnitsTable.h.
References Name.
Referenced by ALIUnitDefinition().
{return Name;}
ALIstring ALIUnitDefinition::GetSymbol | ( | ) | const [inline] |
static ALIUnitsTable& ALIUnitDefinition::GetUnitsTable | ( | ) | [inline, static] |
Definition at line 81 of file ALIUnitsTable.h.
References theUnitsTable.
Referenced by ALIBestUnit::ALIBestUnit(), and operator<<().
{return theUnitsTable;}
ALIdouble ALIUnitDefinition::GetValue | ( | ) | const [inline] |
Definition at line 74 of file ALIUnitsTable.cc.
References BuildUnitsTable(), gather_cfg::cout, i, j, mergeVDriftHistosByStation::name, and theUnitsTable.
Referenced by ParameterMgr::getVal().
{ if(theUnitsTable.size()==0) BuildUnitsTable(); ALIstring name,symbol; for (size_t i=0;i<theUnitsTable.size();i++) { ALIUnitsContainer& units = theUnitsTable[i]->GetUnitsList(); for (size_t j=0;j<units.size();j++) { name=units[j]->GetName(); symbol=units[j]->GetSymbol(); if(stri==name||stri==symbol) return units[j]->GetValue(); } } std::cout << "Warning from ALIUnitDefinition::GetValueOf(" << stri << ")." << " The unit " << stri << " does not exist in UnitsTable." << " Return Value = 0." << std::endl; return 0.; }
ALIint ALIUnitDefinition::operator!= | ( | const ALIUnitDefinition & | right | ) | const |
Definition at line 68 of file ALIUnitsTable.cc.
{ return (this != &right); }
ALIUnitDefinition & ALIUnitDefinition::operator= | ( | const ALIUnitDefinition & | right | ) | [private] |
Definition at line 47 of file ALIUnitsTable.cc.
References CategoryIndex, Name, SymbolName, and Value.
{ if (this != &right) { Name = right.Name; SymbolName = right.SymbolName; Value = right.Value; CategoryIndex = right.CategoryIndex; } return *this; }
ALIint ALIUnitDefinition::operator== | ( | const ALIUnitDefinition & | right | ) | const |
Definition at line 61 of file ALIUnitsTable.cc.
{ return (this == &right); }
void ALIUnitDefinition::PrintDefinition | ( | ) |
Definition at line 115 of file ALIUnitsTable.cc.
References CategoryIndex, gather_cfg::cout, Name, SymbolName, theUnitsTable, and Value.
{ ALIint nameL = theUnitsTable[CategoryIndex]->GetNameMxLen(); ALIint symbL = theUnitsTable[CategoryIndex]->GetSymbMxLen(); std::cout << std::setw(nameL) << Name << " (" << std::setw(symbL) << SymbolName << ") = " << Value << std::endl; }
void ALIUnitDefinition::PrintUnitsTable | ( | ) | [static] |
Definition at line 242 of file ALIUnitsTable.cc.
References gather_cfg::cout, i, and theUnitsTable.
{ std::cout << "\n ----- The Table of Units ----- \n"; for(size_t i=0;i<theUnitsTable.size();i++) theUnitsTable[i]->PrintCategory(); }
size_t ALIUnitDefinition::CategoryIndex [private] |
Definition at line 96 of file ALIUnitsTable.h.
Referenced by ALIUnitDefinition(), operator=(), and PrintDefinition().
ALIstring ALIUnitDefinition::Name [private] |
Definition at line 88 of file ALIUnitsTable.h.
Referenced by GetName(), operator=(), and PrintDefinition().
ALIstring ALIUnitDefinition::SymbolName [private] |
Definition at line 89 of file ALIUnitsTable.h.
Referenced by GetSymbol(), operator=(), and PrintDefinition().
ALIUnitsTable ALIUnitDefinition::theUnitsTable [static, private] |
Definition at line 93 of file ALIUnitsTable.h.
Referenced by ALIUnitDefinition(), GetCategory(), GetUnitsTable(), GetValueOf(), PrintDefinition(), and PrintUnitsTable().
ALIdouble ALIUnitDefinition::Value [private] |
Definition at line 90 of file ALIUnitsTable.h.
Referenced by GetValue(), operator=(), and PrintDefinition().