#include <Alignment/CocoaModel/interface/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 11 of file ALIUnitsTable.cc.
References CategoryIndex, GetName(), i, and theUnitsTable.
Referenced by BuildUnitsTable().
00013 : Name(name),SymbolName(symbol),Value(value) 00014 { 00015 // 00016 //does the Category objet already exist ? 00017 size_t nbCat = theUnitsTable.size(); 00018 size_t i = 0; 00019 while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++; 00020 if (i == nbCat) theUnitsTable.push_back( new ALIUnitsCategory(category)); 00021 CategoryIndex = i; 00022 // 00023 //insert this Unit in the Unitstable 00024 (theUnitsTable[CategoryIndex]->GetUnitsList()).push_back(this); 00025 00026 //update ALIstring max length for name and symbol 00027 theUnitsTable[i]->UpdateNameMxLen((ALIint)name.length()); 00028 theUnitsTable[i]->UpdateSymbMxLen((ALIint)symbol.length()); 00029 00030 }
ALIUnitDefinition::~ALIUnitDefinition | ( | ) |
ALIUnitDefinition::ALIUnitDefinition | ( | ALIUnitDefinition & | right | ) | [private] |
void ALIUnitDefinition::BuildUnitsTable | ( | ) | [static] |
Definition at line 124 of file ALIUnitsTable.cc.
References ALIUnitDefinition(), g, and edm::second().
Referenced by GetCategory(), and GetValueOf().
00125 { 00126 //Length 00127 new ALIUnitDefinition( "kilometer","km" ,"Length",kilometer); 00128 new ALIUnitDefinition( "meter","m" ,"Length",meter); 00129 new ALIUnitDefinition("centimeter","cm" ,"Length",centimeter); 00130 new ALIUnitDefinition("millimeter","mm" ,"Length",millimeter); 00131 new ALIUnitDefinition("micrometer","mum" ,"Length",micrometer); 00132 new ALIUnitDefinition( "nanometer","nm" ,"Length",nanometer); 00133 new ALIUnitDefinition( "angstrom","Ang" ,"Length",angstrom); 00134 new ALIUnitDefinition( "fermi","fm" ,"Length",fermi); 00135 00136 //Surface 00137 new ALIUnitDefinition( "kilometer2","km2" ,"Surface",kilometer2); 00138 new ALIUnitDefinition( "meter2","m2" ,"Surface",meter2); 00139 new ALIUnitDefinition("centimeter2","cm2" ,"Surface",centimeter2); 00140 new ALIUnitDefinition("millimeter2","mm2" ,"Surface",millimeter2); 00141 new ALIUnitDefinition( "barn","barn" ,"Surface",barn); 00142 new ALIUnitDefinition( "millibarn","mbarn" ,"Surface",millibarn); 00143 new ALIUnitDefinition( "microbarn","mubarn" ,"Surface",microbarn); 00144 new ALIUnitDefinition( "nanobarn","nbarn" ,"Surface",nanobarn); 00145 new ALIUnitDefinition( "picobarn","pbarn" ,"Surface",picobarn); 00146 00147 //Volume 00148 new ALIUnitDefinition( "kilometer3","km3" ,"Volume",kilometer3); 00149 new ALIUnitDefinition( "meter3","m3" ,"Volume",meter3); 00150 new ALIUnitDefinition("centimeter3","cm3" ,"Volume",centimeter3); 00151 new ALIUnitDefinition("millimeter3","mm3" ,"Volume",millimeter3); 00152 00153 //Angle 00154 new ALIUnitDefinition( "radian","rad" ,"Angle",radian); 00155 new ALIUnitDefinition("milliradian","mrad" ,"Angle",milliradian); 00156 new ALIUnitDefinition("milliradian","murad" ,"Angle",0.001*milliradian); 00157 new ALIUnitDefinition( "steradian","sr" ,"Angle",steradian); 00158 new ALIUnitDefinition( "degree","deg" ,"Angle",degree); 00159 00160 //Time 00161 new ALIUnitDefinition( "second","s" ,"Time",second); 00162 new ALIUnitDefinition("millisecond","ms" ,"Time",millisecond); 00163 new ALIUnitDefinition("microsecond","mus" ,"Time",microsecond); 00164 new ALIUnitDefinition( "nanosecond","ns" ,"Time",nanosecond); 00165 new ALIUnitDefinition( "picosecond","ps" ,"Time",picosecond); 00166 00167 //Frequency 00168 new ALIUnitDefinition( "hertz","Hz" ,"Frequency",hertz); 00169 new ALIUnitDefinition("kilohertz","kHz" ,"Frequency",kilohertz); 00170 new ALIUnitDefinition("megahertz","MHz" ,"Frequency",megahertz); 00171 00172 //Electric charge 00173 new ALIUnitDefinition( "eplus","e+" ,"Electric charge",eplus); 00174 new ALIUnitDefinition("coulomb","C" ,"Electric charge",coulomb); 00175 00176 //Energy 00177 new ALIUnitDefinition( "electronvolt","eV" ,"Energy",electronvolt); 00178 new ALIUnitDefinition("kiloelectronvolt","keV","Energy",kiloelectronvolt); 00179 new ALIUnitDefinition("megaelectronvolt","MeV","Energy",megaelectronvolt); 00180 new ALIUnitDefinition("gigaelectronvolt","GeV","Energy",gigaelectronvolt); 00181 new ALIUnitDefinition("teraelectronvolt","TeV","Energy",teraelectronvolt); 00182 new ALIUnitDefinition("petaelectronvolt","PeV","Energy",petaelectronvolt); 00183 new ALIUnitDefinition( "joule","J" ,"Energy",joule); 00184 00185 //Mass 00186 new ALIUnitDefinition("milligram","mg","Mass",milligram); 00187 new ALIUnitDefinition( "gram","g" ,"Mass",gram); 00188 new ALIUnitDefinition( "kilogram","kg","Mass",kilogram); 00189 00190 //Volumic Mass 00191 new ALIUnitDefinition( "g/cm3", "g/cm3","Volumic Mass", g/cm3); 00192 new ALIUnitDefinition("mg/cm3","mg/cm3","Volumic Mass",mg/cm3); 00193 new ALIUnitDefinition("kg/m3", "kg/m3", "Volumic Mass",kg/m3); 00194 00195 //Power 00196 new ALIUnitDefinition("watt","W","Power",watt); 00197 00198 //Force 00199 new ALIUnitDefinition("newton","N","Force",newton); 00200 00201 //Pressure 00202 new ALIUnitDefinition( "pascal","Pa" ,"Pressure",pascal); 00203 new ALIUnitDefinition( "bar","bar","Pressure",bar); 00204 new ALIUnitDefinition("atmosphere","atm","Pressure",atmosphere); 00205 00206 //Electric current 00207 new ALIUnitDefinition( "ampere","A" ,"Electric current",ampere); 00208 new ALIUnitDefinition("milliampere","mA" ,"Electric current",milliampere); 00209 new ALIUnitDefinition("microampere","muA","Electric current",microampere); 00210 new ALIUnitDefinition( "nanoampere","nA" ,"Electric current",nanoampere); 00211 00212 //Electric potential 00213 new ALIUnitDefinition( "volt","V" ,"Electric potential",volt); 00214 new ALIUnitDefinition("kilovolt","kV","Electric potential",kilovolt); 00215 new ALIUnitDefinition("megavolt","MV","Electric potential",megavolt); 00216 00217 //Magnetic flux 00218 new ALIUnitDefinition("weber","Wb","Magnetic flux",weber); 00219 00220 //Magnetic flux density 00221 new ALIUnitDefinition( "tesla","T" ,"Magnetic flux density",tesla); 00222 new ALIUnitDefinition("kilogauss","kG","Magnetic flux density",kilogauss); 00223 new ALIUnitDefinition( "gauss","G" ,"Magnetic flux density",gauss); 00224 00225 //Temperature 00226 new ALIUnitDefinition("kelvin","K","Temperature",kelvin); 00227 00228 //Amount of substance 00229 new ALIUnitDefinition("mole","mol","Amount of substance",mole); 00230 00231 //Activity 00232 new ALIUnitDefinition("becquerel","Bq","Activity",becquerel); 00233 new ALIUnitDefinition( "curie","Ci","Activity",curie); 00234 00235 //Dose 00236 new ALIUnitDefinition("gray","Gy","Dose",gray); 00237 }
Definition at line 93 of file ALIUnitsTable.cc.
References BuildUnitsTable(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, j, name, and theUnitsTable.
00094 { 00095 if(theUnitsTable.size()==0) BuildUnitsTable(); 00096 ALIstring name,symbol; 00097 for (size_t i=0;i<theUnitsTable.size();i++) 00098 { ALIUnitsContainer& units = theUnitsTable[i]->GetUnitsList(); 00099 for (size_t j=0;j<units.size();j++) 00100 { name=units[j]->GetName(); symbol=units[j]->GetSymbol(); 00101 if(stri==name||stri==symbol) 00102 return theUnitsTable[i]->GetName(); 00103 } 00104 } 00105 std::cout << "Warning from ALIUnitDefinition::GetCategory(" << stri << ")." 00106 << " The unit " << stri << " does not exist in UnitsTable." 00107 << " Return category = None" << std::endl; 00108 name = "None"; 00109 return name; 00110 }
ALIstring ALIUnitDefinition::GetName | ( | ) | const [inline] |
Definition at line 72 of file ALIUnitsTable.h.
References Name.
Referenced by ALIUnitDefinition().
00072 {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<<().
00081 {return theUnitsTable;}
ALIdouble ALIUnitDefinition::GetValue | ( | ) | const [inline] |
Definition at line 73 of file ALIUnitsTable.cc.
References BuildUnitsTable(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, j, name, and theUnitsTable.
Referenced by ParameterMgr::getVal().
00074 { 00075 if(theUnitsTable.size()==0) BuildUnitsTable(); 00076 ALIstring name,symbol; 00077 for (size_t i=0;i<theUnitsTable.size();i++) 00078 { ALIUnitsContainer& units = theUnitsTable[i]->GetUnitsList(); 00079 for (size_t j=0;j<units.size();j++) 00080 { name=units[j]->GetName(); symbol=units[j]->GetSymbol(); 00081 if(stri==name||stri==symbol) 00082 return units[j]->GetValue(); 00083 } 00084 } 00085 std::cout << "Warning from ALIUnitDefinition::GetValueOf(" << stri << ")." 00086 << " The unit " << stri << " does not exist in UnitsTable." 00087 << " Return Value = 0." << std::endl; 00088 return 0.; 00089 }
ALIint ALIUnitDefinition::operator!= | ( | const ALIUnitDefinition & | right | ) | const |
Definition at line 67 of file ALIUnitsTable.cc.
00068 { 00069 return (this != (ALIUnitDefinition *) &right); 00070 }
ALIUnitDefinition & ALIUnitDefinition::operator= | ( | const ALIUnitDefinition & | right | ) | [private] |
Definition at line 46 of file ALIUnitsTable.cc.
References CategoryIndex, Name, SymbolName, and Value.
00047 { 00048 if (this != &right) 00049 { 00050 Name = right.Name; 00051 SymbolName = right.SymbolName; 00052 Value = right.Value; 00053 CategoryIndex = right.CategoryIndex; 00054 } 00055 return *this; 00056 }
ALIint ALIUnitDefinition::operator== | ( | const ALIUnitDefinition & | right | ) | const |
Definition at line 60 of file ALIUnitsTable.cc.
00061 { 00062 return (this == (ALIUnitDefinition *) &right); 00063 }
void ALIUnitDefinition::PrintDefinition | ( | ) |
Definition at line 114 of file ALIUnitsTable.cc.
References CategoryIndex, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Name, SymbolName, theUnitsTable, and Value.
00115 { 00116 ALIint nameL = theUnitsTable[CategoryIndex]->GetNameMxLen(); 00117 ALIint symbL = theUnitsTable[CategoryIndex]->GetSymbMxLen(); 00118 std::cout << std::setw(nameL) << Name << " (" 00119 << std::setw(symbL) << SymbolName << ") = " << Value << std::endl; 00120 }
void ALIUnitDefinition::PrintUnitsTable | ( | ) | [static] |
Definition at line 241 of file ALIUnitsTable.cc.
References GenMuonPlsPt100GeV_cfg::cout, i, and theUnitsTable.
00242 { 00243 std::cout << "\n ----- The Table of Units ----- \n"; 00244 for(size_t i=0;i<theUnitsTable.size();i++) 00245 theUnitsTable[i]->PrintCategory(); 00246 }
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().