3 #include "CLHEP/Units/GlobalSystemOfUnits.h" 15 :
Name(name),SymbolName(symbol),
Value(value)
64 return (
this == &right);
71 return (
this != &right);
81 for (
size_t j=0;j<units.size();j++)
82 { name=units[j]->GetName(); symbol=units[j]->GetSymbol();
83 if(stri==name||stri==symbol)
84 return units[j]->GetValue();
87 std::cout <<
"Warning from ALIUnitDefinition::GetValueOf(" << stri <<
")." 88 <<
" The unit " << stri <<
" does not exist in UnitsTable." 89 <<
" Return Value = 0." << std::endl;
101 for (
size_t j=0;j<units.size();j++)
102 { name=units[j]->GetName(); symbol=units[j]->GetSymbol();
103 if(stri==name||stri==symbol)
107 std::cout <<
"Warning from ALIUnitDefinition::GetCategory(" << stri <<
")." 108 <<
" The unit " << stri <<
" does not exist in UnitsTable." 109 <<
" Return category = None" << std::endl;
129 std::make_shared<ALIUnitDefinition>(
"kilometer",
"km" ,
"Length",kilometer);
130 std::make_shared<ALIUnitDefinition>(
"meter",
"m" ,
"Length",meter);
131 std::make_shared<ALIUnitDefinition>(
"centimeter",
"cm" ,
"Length",centimeter);
132 std::make_shared<ALIUnitDefinition>(
"millimeter",
"mm" ,
"Length",millimeter);
133 std::make_shared<ALIUnitDefinition>(
"micrometer",
"mum" ,
"Length",micrometer);
134 std::make_shared<ALIUnitDefinition>(
"nanometer",
"nm" ,
"Length",nanometer);
135 std::make_shared<ALIUnitDefinition>(
"angstrom",
"Ang" ,
"Length",angstrom);
136 std::make_shared<ALIUnitDefinition>(
"fermi",
"fm" ,
"Length",
fermi);
139 std::make_shared<ALIUnitDefinition>(
"kilometer2",
"km2" ,
"Surface",kilometer2);
140 std::make_shared<ALIUnitDefinition>(
"meter2",
"m2" ,
"Surface",meter2);
141 std::make_shared<ALIUnitDefinition>(
"centimeter2",
"cm2" ,
"Surface",centimeter2);
142 std::make_shared<ALIUnitDefinition>(
"millimeter2",
"mm2" ,
"Surface",millimeter2);
143 std::make_shared<ALIUnitDefinition>(
"barn",
"barn" ,
"Surface",barn);
144 std::make_shared<ALIUnitDefinition>(
"millibarn",
"mbarn" ,
"Surface",millibarn);
145 std::make_shared<ALIUnitDefinition>(
"microbarn",
"mubarn" ,
"Surface",microbarn);
146 std::make_shared<ALIUnitDefinition>(
"nanobarn",
"nbarn" ,
"Surface",nanobarn);
147 std::make_shared<ALIUnitDefinition>(
"picobarn",
"pbarn" ,
"Surface",picobarn);
150 std::make_shared<ALIUnitDefinition>(
"kilometer3",
"km3" ,
"Volume",kilometer3);
151 std::make_shared<ALIUnitDefinition>(
"meter3",
"m3" ,
"Volume",meter3);
152 std::make_shared<ALIUnitDefinition>(
"centimeter3",
"cm3" ,
"Volume",centimeter3);
153 std::make_shared<ALIUnitDefinition>(
"millimeter3",
"mm3" ,
"Volume",millimeter3);
156 std::make_shared<ALIUnitDefinition>(
"radian",
"rad" ,
"Angle",radian);
157 std::make_shared<ALIUnitDefinition>(
"milliradian",
"mrad" ,
"Angle",milliradian);
158 std::make_shared<ALIUnitDefinition>(
"milliradian",
"murad" ,
"Angle",0.001*milliradian);
159 std::make_shared<ALIUnitDefinition>(
"steradian",
"sr" ,
"Angle",steradian);
160 std::make_shared<ALIUnitDefinition>(
"degree",
"deg" ,
"Angle",degree);
163 std::make_shared<ALIUnitDefinition>(
"second",
"s" ,
"Time",
second);
164 std::make_shared<ALIUnitDefinition>(
"millisecond",
"ms" ,
"Time",millisecond);
165 std::make_shared<ALIUnitDefinition>(
"microsecond",
"mus" ,
"Time",microsecond);
166 std::make_shared<ALIUnitDefinition>(
"nanosecond",
"ns" ,
"Time",nanosecond);
167 std::make_shared<ALIUnitDefinition>(
"picosecond",
"ps" ,
"Time",picosecond);
170 std::make_shared<ALIUnitDefinition>(
"hertz",
"Hz" ,
"Frequency",hertz);
171 std::make_shared<ALIUnitDefinition>(
"kilohertz",
"kHz" ,
"Frequency",kilohertz);
172 std::make_shared<ALIUnitDefinition>(
"megahertz",
"MHz" ,
"Frequency",megahertz);
175 std::make_shared<ALIUnitDefinition>(
"eplus",
"e+" ,
"Electric charge",eplus);
176 std::make_shared<ALIUnitDefinition>(
"coulomb",
"C" ,
"Electric charge",coulomb);
179 std::make_shared<ALIUnitDefinition>(
"electronvolt",
"eV" ,
"Energy",electronvolt);
180 std::make_shared<ALIUnitDefinition>(
"kiloelectronvolt",
"keV",
"Energy",kiloelectronvolt);
181 std::make_shared<ALIUnitDefinition>(
"megaelectronvolt",
"MeV",
"Energy",megaelectronvolt);
182 std::make_shared<ALIUnitDefinition>(
"gigaelectronvolt",
"GeV",
"Energy",gigaelectronvolt);
183 std::make_shared<ALIUnitDefinition>(
"teraelectronvolt",
"TeV",
"Energy",teraelectronvolt);
184 std::make_shared<ALIUnitDefinition>(
"petaelectronvolt",
"PeV",
"Energy",petaelectronvolt);
185 std::make_shared<ALIUnitDefinition>(
"joule",
"J" ,
"Energy",joule);
188 std::make_shared<ALIUnitDefinition>(
"milligram",
"mg",
"Mass",milligram);
189 std::make_shared<ALIUnitDefinition>(
"gram",
"g" ,
"Mass",gram);
190 std::make_shared<ALIUnitDefinition>(
"kilogram",
"kg",
"Mass",kilogram);
193 std::make_shared<ALIUnitDefinition>(
"g/cm3",
"g/cm3",
"Volumic Mass",
g/cm3);
194 std::make_shared<ALIUnitDefinition>(
"mg/cm3",
"mg/cm3",
"Volumic Mass",mg/cm3);
195 std::make_shared<ALIUnitDefinition>(
"kg/m3",
"kg/m3",
"Volumic Mass",kg/m3);
198 std::make_shared<ALIUnitDefinition>(
"watt",
"W",
"Power",watt);
201 std::make_shared<ALIUnitDefinition>(
"newton",
"N",
"Force",newton);
204 std::make_shared<ALIUnitDefinition>(
"pascal",
"Pa" ,
"Pressure",pascal);
205 std::make_shared<ALIUnitDefinition>(
"bar",
"bar",
"Pressure",bar);
206 std::make_shared<ALIUnitDefinition>(
"atmosphere",
"atm",
"Pressure",atmosphere);
209 std::make_shared<ALIUnitDefinition>(
"ampere",
"A" ,
"Electric current",ampere);
210 std::make_shared<ALIUnitDefinition>(
"milliampere",
"mA" ,
"Electric current",milliampere);
211 std::make_shared<ALIUnitDefinition>(
"microampere",
"muA",
"Electric current",microampere);
212 std::make_shared<ALIUnitDefinition>(
"nanoampere",
"nA" ,
"Electric current",nanoampere);
215 std::make_shared<ALIUnitDefinition>(
"volt",
"V" ,
"Electric potential",volt);
216 std::make_shared<ALIUnitDefinition>(
"kilovolt",
"kV",
"Electric potential",kilovolt);
217 std::make_shared<ALIUnitDefinition>(
"megavolt",
"MV",
"Electric potential",megavolt);
220 std::make_shared<ALIUnitDefinition>(
"weber",
"Wb",
"Magnetic flux",weber);
223 std::make_shared<ALIUnitDefinition>(
"tesla",
"T" ,
"Magnetic flux density",tesla);
224 std::make_shared<ALIUnitDefinition>(
"kilogauss",
"kG",
"Magnetic flux density",kilogauss);
225 std::make_shared<ALIUnitDefinition>(
"gauss",
"G" ,
"Magnetic flux density",gauss);
228 std::make_shared<ALIUnitDefinition>(
"kelvin",
"K",
"Temperature",kelvin);
231 std::make_shared<ALIUnitDefinition>(
"mole",
"mol",
"Amount of substance",mole);
234 std::make_shared<ALIUnitDefinition>(
"becquerel",
"Bq",
"Activity",becquerel);
235 std::make_shared<ALIUnitDefinition>(
"curie",
"Ci",
"Activity",curie);
238 std::make_shared<ALIUnitDefinition>(
"gray",
"Gy",
"Dose",gray);
245 std::cout <<
"\n ----- The Table of Units ----- \n";
253 :
Name(name),NameMxLen(0),SymbMxLen(0)
288 return (
this == &right);
295 return (
this != &right);
313 size_t nbCat = theUnitsTable.size();
316 ((i<nbCat)&&(theUnitsTable[i]->
GetName()!=category)) i++;
318 {
std::cout <<
" ALIBestUnit: the category " << category
319 <<
" does not exist !!" << std::endl;
320 std::cerr <<
"Missing unit category !" << std::endl;
335 size_t nbCat = theUnitsTable.size();
338 ((i<nbCat)&&(theUnitsTable[i]->
GetName()!=category)) i++;
340 {
std::cerr <<
" ALIBestUnit: the category " << category
341 <<
" does not exist." << std::endl;
342 std::cerr <<
"Unit category not existing !" << std::endl;
348 Value[0] = value.x();
349 Value[1] = value.y();
350 Value[2] = value.z();
366 ALIint ksup(-1), kinf(-1);
374 for (
size_t k=0;
k<List.size();
k++)
377 if (value==1.E12) {
if(unit>umax) {umax=
unit; ksup=
k;}}
378 else if (value<=-1.E12) {
if(unit<umin) {umin=
unit; kinf=
k;}}
381 if ((ratio>=1.)&&(ratio<rsup)) {rsup=
ratio; ksup=
k;}
382 if ((ratio< 1.)&&(ratio>rinf)) {rinf=
ratio; kinf=
k;}
386 ALIint index=ksup;
if(index==-1) index=kinf;
if(index==-1) index=0;
389 {flux << a.
Value[j]/(List[
index]->GetValue()) <<
" ";}
391 #ifdef ALIUSE_STD_NAMESPACE 392 std::ios::fmtflags oldform =
std::cout.flags();
397 flux.setf(std::ios::left,std::ios::adjustfield);
398 flux << std::setw(len) << List[
index]->GetSymbol();
ALIstring GetName() const
ALIint operator==(const ALIUnitDefinition &) const
std::ostream & operator<<(std::ostream &flux, ALIBestUnit a)
std::vector< ALIUnitsCategory * > ALIUnitsTable
ALIUnitDefinition & operator=(const ALIUnitDefinition &)
ALIint operator!=(const ALIUnitDefinition &) const
ALIBestUnit(ALIdouble internalValue, ALIstring category)
ALIUnitDefinition(ALIstring name, ALIstring symbol, ALIstring category, ALIdouble value)
static ALIstring GetCategory(ALIstring)
ALIUnitsContainer UnitsList
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
U second(std::pair< T, U > const &p)
ALIint operator==(const ALIUnitsCategory &) const
ALIUnitsCategory & operator=(const ALIUnitsCategory &)
static void PrintUnitsTable()
Abs< T >::type abs(const T &t)
ALIUnitsCategory(ALIstring name)
reco::JetExtendedAssociation::JetExtendedData Value
static void BuildUnitsTable()
ALIint operator!=(const ALIUnitsCategory &) const
std::vector< std::shared_ptr< ALIUnitDefinition >> ALIUnitsContainer
ALIstring GetName() const
static ALIdouble GetValueOf(ALIstring)
TString units(TString variable, Char_t axis)
static ALIUnitsTable theUnitsTable
static ALIUnitsTable & GetUnitsTable()