Geant4-11
G4UnitsTable.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4UnitsTable class implementation
27//
28// Author: M.Maire, 17.05.1998 - First version
29// Revisions: G.Cosmo, 06.03.2001 - Migrated to STL vectors
30// --------------------------------------------------------------------
31
32#include <iomanip>
33#include <sstream>
34
35#include "G4SystemOfUnits.hh"
36#include "G4Threading.hh"
37#include "G4UnitsTable.hh"
38
41
42#ifdef G4MULTITHREADED
43G4UnitsTable* G4UnitDefinition::pUnitsTableShadow = nullptr;
44
45// --------------------------------------------------------------------
46
48
49// --------------------------------------------------------------------
50
51G4UnitsTable::~G4UnitsTable()
52{
53 for(auto itr = cbegin(); itr != cend(); ++itr)
54 {
55 delete *itr;
56 }
57 clear();
58}
59
60#endif
61
62// --------------------------------------------------------------------
63
65 const G4String& category, G4double value)
66 : Name(name)
67 , SymbolName(symbol)
68 , Value(value)
69{
70 if(pUnitsTable == nullptr)
71 {
73 {
74 G4Exception("G4UnitDefinition::G4UnitDefinition", "UnitsTable0000",
75 FatalException, "G4UnitsTable had already deleted.");
76 }
78#ifdef G4MULTITHREADED
80 {
81 pUnitsTableShadow = pUnitsTable;
82 }
83#endif
84 }
85
86 // Does the Category objet already exist ?
87 //
88 std::size_t nbCat = pUnitsTable->size();
89 std::size_t i = 0;
90 while((i < nbCat) && ((*pUnitsTable)[i]->GetName() != category))
91 {
92 ++i;
93 }
94 if(i == nbCat)
95 {
96 pUnitsTable->push_back(new G4UnitsCategory(category));
97 }
98 CategoryIndex = i;
99
100 // Insert this Unit in the Units table
101 //
102 ((*pUnitsTable)[CategoryIndex]->GetUnitsList()).push_back(this);
103
104 // Update string max length for name and symbol
105 //
106 (*pUnitsTable)[i]->UpdateNameMxLen((G4int) name.length());
107 (*pUnitsTable)[i]->UpdateSymbMxLen((G4int) symbol.length());
108}
109
110// --------------------------------------------------------------------
111
113
114// --------------------------------------------------------------------
115
117{
118 *this = right;
119}
120
121// --------------------------------------------------------------------
122
124{
125 if(this != &right)
126 {
127 Name = right.Name;
128 SymbolName = right.SymbolName;
129 Value = right.Value;
131 }
132 return *this;
133}
134
135// --------------------------------------------------------------------
136
138{
139 return (this == (G4UnitDefinition*) &right);
140}
141
142// --------------------------------------------------------------------
143
145{
146 return (this != (G4UnitDefinition*) &right);
147}
148
149// --------------------------------------------------------------------
150
152{
153 if(pUnitsTable == nullptr)
154 {
156 }
157 if(pUnitsTable->size() == 0)
158 {
160 }
161#ifdef G4MULTITHREADED
162 if(G4Threading::IsMasterThread() && pUnitsTableShadow == nullptr)
163 {
164 pUnitsTableShadow = pUnitsTable;
165 }
166#endif
167 return *pUnitsTable;
168}
169
170// --------------------------------------------------------------------
171
173{
174 G4String name, symbol;
175 for(std::size_t i = 0; i < (GetUnitsTable()).size(); ++i)
176 {
177 G4UnitsContainer& units = (*pUnitsTable)[i]->GetUnitsList();
178 for(std::size_t j = 0; j < units.size(); ++j)
179 {
180 name = units[j]->GetName();
181 symbol = units[j]->GetSymbol();
182 if(str == name || str == symbol)
183 {
184 return true;
185 }
186 }
187 }
188 return false;
189}
190
191// --------------------------------------------------------------------
192
194{
195 G4String name, symbol;
196 for(std::size_t i = 0; i < (GetUnitsTable()).size(); ++i)
197 {
198 G4UnitsContainer& units = (*pUnitsTable)[i]->GetUnitsList();
199 for(std::size_t j = 0; j < units.size(); ++j)
200 {
201 name = units[j]->GetName();
202 symbol = units[j]->GetSymbol();
203 if(str == name || str == symbol)
204 {
205 return units[j]->GetValue();
206 }
207 }
208 }
209 std::ostringstream message;
210 message << "The unit '" << str << "' does not exist in the Units Table!";
211 G4Exception("G4UnitDefinition::GetValueOf()", "InvalidUnit", FatalException,
212 message);
213 return 0.;
214}
215
216// --------------------------------------------------------------------
217
219{
220 G4String name, symbol;
221 for(std::size_t i = 0; i < (GetUnitsTable()).size(); ++i)
222 {
223 G4UnitsContainer& units = (*pUnitsTable)[i]->GetUnitsList();
224 for(std::size_t j = 0; j < units.size(); ++j)
225 {
226 name = units[j]->GetName();
227 symbol = units[j]->GetSymbol();
228 if(str == name || str == symbol)
229 {
230 return (*pUnitsTable)[i]->GetName();
231 }
232 }
233 }
234 std::ostringstream message;
235 message << "The unit '" << str << "' does not exist in the Units Table!";
236 G4Exception("G4UnitDefinition::GetCategory()", "InvalidUnit", FatalException,
237 message);
238 name = "None";
239 return name;
240}
241
242// --------------------------------------------------------------------
243
245{
246 G4int nameL = (*pUnitsTable)[CategoryIndex]->GetNameMxLen();
247 G4int symbL = (*pUnitsTable)[CategoryIndex]->GetSymbMxLen();
248 G4cout << std::setw(nameL) << Name << " (" << std::setw(symbL) << SymbolName
249 << ") = " << Value << G4endl;
250}
251
252// --------------------------------------------------------------------
253
255{
256 // Length
257 new G4UnitDefinition("parsec", "pc", "Length", parsec);
258 new G4UnitDefinition("kilometer", "km", "Length", kilometer);
259 new G4UnitDefinition("meter", "m", "Length", meter);
260 new G4UnitDefinition("centimeter", "cm", "Length", centimeter);
261 new G4UnitDefinition("millimeter", "mm", "Length", millimeter);
262 new G4UnitDefinition("micrometer", "um", "Length", micrometer);
263 new G4UnitDefinition("nanometer", "nm", "Length", nanometer);
264 new G4UnitDefinition("angstrom", "Ang", "Length", angstrom);
265 new G4UnitDefinition("fermi", "fm", "Length", fermi);
266
267 // Surface
268 new G4UnitDefinition("kilometer2", "km2", "Surface", kilometer2);
269 new G4UnitDefinition("meter2", "m2", "Surface", meter2);
270 new G4UnitDefinition("centimeter2", "cm2", "Surface", centimeter2);
271 new G4UnitDefinition("millimeter2", "mm2", "Surface", millimeter2);
272 new G4UnitDefinition("barn", "barn", "Surface", barn);
273 new G4UnitDefinition("millibarn", "mbarn", "Surface", millibarn);
274 new G4UnitDefinition("microbarn", "mubarn", "Surface", microbarn);
275 new G4UnitDefinition("nanobarn", "nbarn", "Surface", nanobarn);
276 new G4UnitDefinition("picobarn", "pbarn", "Surface", picobarn);
277
278 // Volume
279 new G4UnitDefinition("kilometer3", "km3", "Volume", kilometer3);
280 new G4UnitDefinition("meter3", "m3", "Volume", meter3);
281 new G4UnitDefinition("centimeter3", "cm3", "Volume", centimeter3);
282 new G4UnitDefinition("millimeter3", "mm3", "Volume", millimeter3);
283
284 new G4UnitDefinition("liter", "L", "Volume", liter);
285 new G4UnitDefinition("dL", "dL", "Volume", dL);
286 new G4UnitDefinition("cL", "cL", "Volume", cL);
287 new G4UnitDefinition("mL", "mL", "Volume", mL);
288
289 // Angle
290 new G4UnitDefinition("radian", "rad", "Angle", radian);
291 new G4UnitDefinition("milliradian", "mrad", "Angle", milliradian);
292 new G4UnitDefinition("degree", "deg", "Angle", degree);
293
294 // Solid angle
295 new G4UnitDefinition("steradian", "sr", "Solid angle", steradian);
296 new G4UnitDefinition("millisteradian", "msr", "Solid angle",
297 steradian * 0.001);
298
299 // Time
300 new G4UnitDefinition("second", "s", "Time", second);
301 new G4UnitDefinition("millisecond", "ms", "Time", millisecond);
302 new G4UnitDefinition("microsecond", "us", "Time", microsecond);
303 new G4UnitDefinition("nanosecond", "ns", "Time", nanosecond);
304 new G4UnitDefinition("picosecond", "ps", "Time", picosecond);
305 new G4UnitDefinition("minute", "min", "Time", minute);
306 new G4UnitDefinition("hour", "h", "Time", hour);
307 new G4UnitDefinition("day", "d", "Time", day);
308 new G4UnitDefinition("year", "y", "Time", year);
309
310 // Frequency
311 new G4UnitDefinition("hertz", "Hz", "Frequency", hertz);
312 new G4UnitDefinition("kilohertz", "kHz", "Frequency", kilohertz);
313 new G4UnitDefinition("megahertz", "MHz", "Frequency", megahertz);
314
315 // Velocity
316 new G4UnitDefinition("cm/ns", "cm/ns", "Velocity", cm/ns);
317 new G4UnitDefinition("mm/ns", "mm/ns", "Velocity", mm/ns);
318 new G4UnitDefinition("cm/us", "cm/us", "Velocity", cm/us);
319 new G4UnitDefinition("km/s" , "km/s" , "Velocity", km/s);
320 new G4UnitDefinition("cm/ms", "cm/ms", "Velocity", cm/ms);
321 new G4UnitDefinition( "m/s" , "m/s" , "Velocity", m/s);
322 new G4UnitDefinition("cm/s" , "cm/s" , "Velocity", cm/s);
323 new G4UnitDefinition("mm/s" , "mm/s" , "Velocity", mm/s);
324
325 // Electric charge
326 new G4UnitDefinition("eplus", "e+", "Electric charge", eplus);
327 new G4UnitDefinition("coulomb", "C", "Electric charge", coulomb);
328
329 // Energy
330 new G4UnitDefinition("electronvolt", "eV", "Energy", electronvolt);
331 new G4UnitDefinition("kiloelectronvolt", "keV", "Energy", kiloelectronvolt);
332 new G4UnitDefinition("megaelectronvolt", "MeV", "Energy", megaelectronvolt);
333 new G4UnitDefinition("gigaelectronvolt", "GeV", "Energy", gigaelectronvolt);
334 new G4UnitDefinition("teraelectronvolt", "TeV", "Energy", teraelectronvolt);
335 new G4UnitDefinition("petaelectronvolt", "PeV", "Energy", petaelectronvolt);
336 new G4UnitDefinition("millielectronVolt", "meV", "Energy", millielectronvolt);
337 new G4UnitDefinition("joule", "J", "Energy", joule);
338
339 //Momentum
340 new G4UnitDefinition( "eV/c", "eV/c", "Momentum", eV);
341 new G4UnitDefinition("keV/c", "keV/c", "Momentum", keV);
342 new G4UnitDefinition("MeV/c", "MeV/c", "Momentum", MeV);
343 new G4UnitDefinition("GeV/c", "GeV/c", "Momentum", GeV);
344 new G4UnitDefinition("TeV/c", "TeV/c", "Momentum", TeV);
345
346 // Energy/Length
347 new G4UnitDefinition("GeV/cm", "GeV/cm", "Energy/Length", GeV / cm);
348 new G4UnitDefinition("MeV/cm", "MeV/cm", "Energy/Length", MeV / cm);
349 new G4UnitDefinition("keV/cm", "keV/cm", "Energy/Length", keV / cm);
350 new G4UnitDefinition("eV/cm", "eV/cm", "Energy/Length", eV / cm);
351
352 // Mass
353 new G4UnitDefinition("milligram", "mg", "Mass", milligram);
354 new G4UnitDefinition("gram", "g", "Mass", gram);
355 new G4UnitDefinition("kilogram", "kg", "Mass", kilogram);
356
357 // Volumic Mass
358 new G4UnitDefinition("g/cm3", "g/cm3", "Volumic Mass", g / cm3);
359 new G4UnitDefinition("mg/cm3", "mg/cm3", "Volumic Mass", mg / cm3);
360 new G4UnitDefinition("kg/m3", "kg/m3", "Volumic Mass", kg / m3);
361
362 // Mass/Surface
363 new G4UnitDefinition("g/cm2", "g/cm2", "Mass/Surface", g / cm2);
364 new G4UnitDefinition("mg/cm2", "mg/cm2", "Mass/Surface", mg / cm2);
365 new G4UnitDefinition("kg/cm2", "kg/cm2", "Mass/Surface", kg / cm2);
366
367 // Surface/Mass
368 new G4UnitDefinition("cm2/g", "cm2/g", "Surface/Mass", cm2 / g);
369
370 // Energy.Surface/Mass
371 new G4UnitDefinition("eV*cm2/g", " eV*cm2/g", "Energy*Surface/Mass",
372 eV * cm2 / g);
373 new G4UnitDefinition("keV*cm2/g", "keV*cm2/g", "Energy*Surface/Mass",
374 keV * cm2 / g);
375 new G4UnitDefinition("MeV*cm2/g", "MeV*cm2/g", "Energy*Surface/Mass",
376 MeV * cm2 / g);
377 new G4UnitDefinition("GeV*cm2/g", "GeV*cm2/g", "Energy*Surface/Mass",
378 GeV * cm2 / g);
379
380 // Power
381 new G4UnitDefinition("watt", "W", "Power", watt);
382
383 // Force
384 new G4UnitDefinition("newton", "N", "Force", newton);
385
386 // Pressure
387 new G4UnitDefinition("pascal", "Pa", "Pressure", hep_pascal);
388 new G4UnitDefinition("bar", "bar", "Pressure", bar);
389 new G4UnitDefinition("atmosphere", "atm", "Pressure", atmosphere);
390
391 // Electric current
392 new G4UnitDefinition("ampere", "A", "Electric current", ampere);
393 new G4UnitDefinition("milliampere", "mA", "Electric current", milliampere);
394 new G4UnitDefinition("microampere", "muA", "Electric current", microampere);
395 new G4UnitDefinition("nanoampere", "nA", "Electric current", nanoampere);
396
397 // Electric potential
398 new G4UnitDefinition("volt", "V", "Electric potential", volt);
399 new G4UnitDefinition("kilovolt", "kV", "Electric potential", kilovolt);
400 new G4UnitDefinition("megavolt", "MV", "Electric potential", megavolt);
401
402 // Electric field
403 new G4UnitDefinition("volt/m", "V/m", "Electric field", volt / m);
404 new G4UnitDefinition("kilovolt/m", "kV/m", "Electric field", kilovolt / m);
405 new G4UnitDefinition("megavolt/m", "MV/m", "Electric field", megavolt / m);
406
407 // Magnetic flux
408 new G4UnitDefinition("weber", "Wb", "Magnetic flux", weber);
409
410 // Magnetic flux density
411 new G4UnitDefinition("tesla", "T", "Magnetic flux density", tesla);
412 new G4UnitDefinition("kilogauss", "kG", "Magnetic flux density", kilogauss);
413 new G4UnitDefinition("gauss", "G", "Magnetic flux density", gauss);
414
415 // Temperature
416 new G4UnitDefinition("kelvin", "K", "Temperature", kelvin);
417
418 // Amount of substance
419 new G4UnitDefinition("mole", "mol", "Amount of substance", mole);
420 new G4UnitDefinition("g/mole", "g/mol", "Molar mass", g / mole);
421
422 // Activity
423 new G4UnitDefinition("becquerel", "Bq", "Activity", becquerel);
424 new G4UnitDefinition("curie", "Ci", "Activity", curie);
425
426 // Dose
427 new G4UnitDefinition("gray", "Gy", "Dose", gray);
428}
429
430// --------------------------------------------------------------------
431
433{
434 G4cout << "\n ----- The Table of Units ----- \n";
435 if(pUnitsTable == nullptr)
436 {
438 }
439 for(std::size_t i = 0; i < pUnitsTable->size(); ++i)
440 {
441 (*pUnitsTable)[i]->PrintCategory();
442 }
443}
444
445// --------------------------------------------------------------------
446
448{
449#ifdef G4MULTITHREADED
450 delete pUnitsTable;
451 pUnitsTable = nullptr;
453 {
454 pUnitsTableShadow = nullptr;
455 }
456#else
457 for(std::size_t i = 0; i < pUnitsTable->size(); ++i)
458 {
459 delete(*pUnitsTable)[i];
460 }
461 pUnitsTable->clear();
462#endif
463 unitsTableDestroyed = true;
464}
465
466// --------------------------------------------------------------------
467
469 : Name(name)
470 , UnitsList()
471{}
472
473// --------------------------------------------------------------------
474
476{
477 for(std::size_t i = 0; i < UnitsList.size(); ++i)
478 {
479 delete UnitsList[i];
480 }
481 UnitsList.clear();
482}
483
484// --------------------------------------------------------------------
485
487{
488 *this = right;
489}
490
491// --------------------------------------------------------------------
492
494{
495 if(this != &right)
496 {
497 Name = right.Name;
498 UnitsList = right.UnitsList;
499 NameMxLen = right.NameMxLen;
500 SymbMxLen = right.SymbMxLen;
501 }
502 return *this;
503}
504
505// --------------------------------------------------------------------
506
508{
509 return (this == (G4UnitsCategory*) &right);
510}
511
512// --------------------------------------------------------------------
513
515{
516 return (this != (G4UnitsCategory*) &right);
517}
518
519// --------------------------------------------------------------------
520
522{
523 G4cout << "\n category: " << Name << G4endl;
524 for(std::size_t i = 0; i < UnitsList.size(); ++i)
525 {
526 UnitsList[i]->PrintDefinition();
527 }
528}
529
530// --------------------------------------------------------------------
531
533 : nbOfVals(1)
534{
535 // find the category
537 std::size_t nbCat = theUnitsTable.size();
538 std::size_t i = 0;
539 while((i < nbCat) && (theUnitsTable[i]->GetName() != category))
540 {
541 ++i;
542 }
543 if(i == nbCat)
544 {
545 G4cout << " G4BestUnit: the category " << category << " does not exist !!"
546 << G4endl;
547 G4Exception("G4BestUnit::G4BestUnit()", "InvalidCall", FatalException,
548 "Missing unit category !");
549 }
550
551 Value[0] = value;
552 Value[1] = 0.;
553 Value[2] = 0.;
554 Category = category;
555 IndexOfCategory = i;
556}
557
558// --------------------------------------------------------------------
559
560G4BestUnit::G4BestUnit(const G4ThreeVector& value, const G4String& category)
561 : nbOfVals(3)
562{
563 // find the category
565 std::size_t nbCat = theUnitsTable.size();
566 std::size_t i = 0;
567 while((i < nbCat) && (theUnitsTable[i]->GetName() != category))
568 {
569 ++i;
570 }
571 if(i == nbCat)
572 {
573 G4cerr << " G4BestUnit: the category " << category << " does not exist."
574 << G4endl;
575 G4Exception("G4BestUnit::G4BestUnit()", "InvalidCall", FatalException,
576 "Missing unit category !");
577 }
578
579 Value[0] = value.x();
580 Value[1] = value.y();
581 Value[2] = value.z();
582 Category = category;
583 IndexOfCategory = i;
584}
585
586// --------------------------------------------------------------------
587
589
590// --------------------------------------------------------------------
591
592G4BestUnit::operator G4String() const
593{
594 std::ostringstream oss;
595 oss << *this;
596 return oss.str();
597}
598
599// --------------------------------------------------------------------
600
601std::ostream& operator<<(std::ostream& flux, G4BestUnit a)
602{
604 G4UnitsContainer& List = theUnitsTable[a.IndexOfCategory]->GetUnitsList();
605 G4int len = theUnitsTable[a.IndexOfCategory]->GetSymbMxLen();
606
607 G4int ksup(-1), kinf(-1);
608 G4double umax(0.), umin(DBL_MAX);
609 G4double rsup(DBL_MAX), rinf(0.);
610
611 // for a ThreeVector, choose the best unit for the biggest value
612 G4double value =
613 std::max(std::max(std::fabs(a.Value[0]), std::fabs(a.Value[1])),
614 std::fabs(a.Value[2]));
615
616 //special treatement for Energy.
617 if ((a.Category == "Energy") && (value == 0.)) {
618 for (G4int j = 0; j < a.nbOfVals; ++j) {
619 flux << a.Value[j] << " ";
620 }
621 std::ios::fmtflags oldform = flux.flags();
622 flux.setf(std::ios::left, std::ios::adjustfield);
623 flux << std::setw(len) << "eV";
624 flux.flags(oldform);
625 return flux;
626 }
627
628 //here, value != 0.
629 for(std::size_t k = 0; k < List.size(); ++k)
630 {
631 G4double unit = List[k]->GetValue();
632 if(!(value != DBL_MAX))
633 {
634 if(unit > umax)
635 {
636 umax = unit;
637 ksup = k;
638 }
639 }
640 else if(value <= DBL_MIN)
641 {
642 if(unit < umin)
643 {
644 umin = unit;
645 kinf = k;
646 }
647 }
648 else
649 {
650 G4double ratio = value / unit;
651 if((ratio >= 1.) && (ratio < rsup))
652 {
653 rsup = ratio;
654 ksup = k;
655 }
656 if((ratio < 1.) && (ratio > rinf))
657 {
658 rinf = ratio;
659 kinf = k;
660 }
661 }
662 }
663
664 G4int index = ksup;
665 if(index == -1)
666 {
667 index = kinf;
668 }
669 if(index == -1)
670 {
671 index = 0;
672 }
673
674 for(G4int j = 0; j < a.nbOfVals; ++j)
675 {
676 flux << a.Value[j] / (List[index]->GetValue()) << " ";
677 }
678
679 std::ios::fmtflags oldform = flux.flags();
680
681 flux.setf(std::ios::left, std::ios::adjustfield);
682 flux << std::setw(len) << List[index]->GetSymbol();
683 flux.flags(oldform);
684
685 return flux;
686}
687
688// --------------------------------------------------------------------
689
690#ifdef G4MULTITHREADED
691
692void G4UnitsTable::Synchronize()
693{
694 G4UnitsTable* orig = &(G4UnitDefinition::GetUnitsTableShadow());
695 if(this == orig)
696 return;
697
698 for(auto utItr = orig->cbegin(); utItr != orig->cend(); ++utItr)
699 {
700 G4UnitsCategory* category = *utItr;
701 G4String catName = category->GetName();
702 G4UnitsContainer* units = &(category->GetUnitsList());
703 for(auto ucItr = units->cbegin(); ucItr != units->cend(); ++ucItr)
704 {
705 G4UnitDefinition* unit = *ucItr;
706 if(!Contains(unit, catName))
707 {
708 new G4UnitDefinition(unit->GetName(), unit->GetSymbol(), catName,
709 unit->GetValue());
710 }
711 }
712 }
713}
714
715// --------------------------------------------------------------------
716
717G4bool G4UnitsTable::Contains(const G4UnitDefinition* unit,
718 const G4String& categoryName)
719{
720 for(auto utItr = cbegin(); utItr != cend(); ++utItr)
721 {
722 G4UnitsCategory* category = *utItr;
723 G4String catName = category->GetName();
724 if(catName != categoryName)
725 continue;
726 G4UnitsContainer* units = &(category->GetUnitsList());
727 for(auto ucItr = units->cbegin(); ucItr != units->cend(); ++ucItr)
728 {
729 if((*ucItr)->GetName() == unit->GetName() &&
730 (*ucItr)->GetSymbol() == unit->GetSymbol())
731 {
732 return true;
733 }
734 }
735 }
736 return false;
737}
738
739#endif
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double centimeter
Definition: G4SIunits.hh:70
static constexpr double kilogauss
Definition: G4SIunits.hh:263
static constexpr double centimeter3
Definition: G4SIunits.hh:72
static constexpr double newton
Definition: G4SIunits.hh:215
static constexpr double steradian
Definition: G4SIunits.hh:126
static constexpr double petaelectronvolt
Definition: G4SIunits.hh:196
static constexpr double nanoampere
Definition: G4SIunits.hh:177
static constexpr double picobarn
Definition: G4SIunits.hh:89
static constexpr double megaelectronvolt
Definition: G4SIunits.hh:193
static constexpr double kelvin
Definition: G4SIunits.hh:274
static constexpr double millisecond
Definition: G4SIunits.hh:139
static constexpr double micrometer
Definition: G4SIunits.hh:80
static constexpr double volt
Definition: G4SIunits.hh:233
static constexpr double mL
Definition: G4SIunits.hh:107
static constexpr double kg
Definition: G4SIunits.hh:167
static constexpr double gauss
Definition: G4SIunits.hh:262
static constexpr double ampere
Definition: G4SIunits.hh:174
static constexpr double milliradian
Definition: G4SIunits.hh:123
static constexpr double megahertz
Definition: G4SIunits.hh:150
static constexpr double electronvolt
Definition: G4SIunits.hh:191
static constexpr double us
Definition: G4SIunits.hh:156
static constexpr double ms
Definition: G4SIunits.hh:155
static constexpr double millimeter3
Definition: G4SIunits.hh:68
static constexpr double gray
Definition: G4SIunits.hh:302
static constexpr double gram
Definition: G4SIunits.hh:163
static constexpr double kilogram
Definition: G4SIunits.hh:162
static constexpr double mole
Definition: G4SIunits.hh:279
static constexpr double cm3
Definition: G4SIunits.hh:101
static constexpr double milliampere
Definition: G4SIunits.hh:175
static constexpr double minute
Definition: G4SIunits.hh:143
static constexpr double meter3
Definition: G4SIunits.hh:64
static constexpr double kilometer
Definition: G4SIunits.hh:74
static constexpr double m
Definition: G4SIunits.hh:109
static constexpr double gigaelectronvolt
Definition: G4SIunits.hh:194
static constexpr double coulomb
Definition: G4SIunits.hh:182
static constexpr double joule
Definition: G4SIunits.hh:189
static constexpr double hertz
Definition: G4SIunits.hh:148
static constexpr double teraelectronvolt
Definition: G4SIunits.hh:195
static constexpr double tesla
Definition: G4SIunits.hh:259
static constexpr double kilohertz
Definition: G4SIunits.hh:149
static constexpr double hep_pascal
Definition: G4SIunits.hh:222
static constexpr double watt
Definition: G4SIunits.hh:210
static constexpr double nanobarn
Definition: G4SIunits.hh:88
static constexpr double kilovolt
Definition: G4SIunits.hh:232
static constexpr double liter
Definition: G4SIunits.hh:103
static constexpr double barn
Definition: G4SIunits.hh:85
static constexpr double day
Definition: G4SIunits.hh:145
static constexpr double millimeter
Definition: G4SIunits.hh:66
static constexpr double meter
Definition: G4SIunits.hh:62
static constexpr double curie
Definition: G4SIunits.hh:285
static constexpr double microsecond
Definition: G4SIunits.hh:140
static constexpr double cm2
Definition: G4SIunits.hh:100
static constexpr double megavolt
Definition: G4SIunits.hh:231
static constexpr double parsec
Definition: G4SIunits.hh:78
static constexpr double angstrom
Definition: G4SIunits.hh:82
static constexpr double microbarn
Definition: G4SIunits.hh:87
static constexpr double s
Definition: G4SIunits.hh:154
static constexpr double millibarn
Definition: G4SIunits.hh:86
static constexpr double mm
Definition: G4SIunits.hh:95
static constexpr double eplus
Definition: G4SIunits.hh:184
static constexpr double second
Definition: G4SIunits.hh:137
static constexpr double keV
Definition: G4SIunits.hh:202
static constexpr double fermi
Definition: G4SIunits.hh:83
static constexpr double m3
Definition: G4SIunits.hh:111
static constexpr double picosecond
Definition: G4SIunits.hh:141
static constexpr double atmosphere
Definition: G4SIunits.hh:225
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double nanosecond
Definition: G4SIunits.hh:138
static constexpr double centimeter2
Definition: G4SIunits.hh:71
static constexpr double km
Definition: G4SIunits.hh:113
static constexpr double g
Definition: G4SIunits.hh:168
static constexpr double milligram
Definition: G4SIunits.hh:164
static constexpr double cL
Definition: G4SIunits.hh:106
static constexpr double kiloelectronvolt
Definition: G4SIunits.hh:192
static constexpr double nanometer
Definition: G4SIunits.hh:81
static constexpr double mg
Definition: G4SIunits.hh:169
static constexpr double GeV
Definition: G4SIunits.hh:203
static constexpr double microampere
Definition: G4SIunits.hh:176
static constexpr double millielectronvolt
Definition: G4SIunits.hh:197
static constexpr double MeV
Definition: G4SIunits.hh:200
static constexpr double degree
Definition: G4SIunits.hh:124
static constexpr double dL
Definition: G4SIunits.hh:105
static constexpr double year
Definition: G4SIunits.hh:146
static constexpr double bar
Definition: G4SIunits.hh:224
static constexpr double weber
Definition: G4SIunits.hh:254
static constexpr double becquerel
Definition: G4SIunits.hh:284
static constexpr double cm
Definition: G4SIunits.hh:99
static constexpr double hour
Definition: G4SIunits.hh:144
static constexpr double TeV
Definition: G4SIunits.hh:204
static constexpr double radian
Definition: G4SIunits.hh:122
static constexpr double millimeter2
Definition: G4SIunits.hh:67
static constexpr double kilometer2
Definition: G4SIunits.hh:75
static constexpr double meter2
Definition: G4SIunits.hh:63
static constexpr double kilometer3
Definition: G4SIunits.hh:76
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
std::vector< G4UnitDefinition * > G4UnitsContainer
std::vector< G4UnitsCategory * > G4UnitsTable
Definition: G4UnitsTable.hh:68
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double y() const
G4String Category
std::size_t IndexOfCategory
G4double Value[3]
G4int nbOfVals
G4BestUnit(G4double internalValue, const G4String &category)
G4UnitDefinition & operator=(const G4UnitDefinition &)
static G4bool IsUnitDefined(const G4String &)
static void ClearUnitsTable()
std::size_t CategoryIndex
static G4ThreadLocal G4bool unitsTableDestroyed
G4UnitDefinition(const G4String &name, const G4String &symbol, const G4String &category, G4double value)
Definition: G4UnitsTable.cc:64
G4bool operator!=(const G4UnitDefinition &) const
G4bool operator==(const G4UnitDefinition &) const
static G4ThreadLocal G4UnitsTable * pUnitsTable
static void BuildUnitsTable()
G4double GetValue() const
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)
static void PrintUnitsTable()
const G4String & GetName() const
static G4UnitsTable & GetUnitsTable()
const G4String & GetSymbol() const
const G4String & GetName() const
G4UnitsCategory & operator=(const G4UnitsCategory &)
G4UnitsContainer UnitsList
G4UnitsContainer & GetUnitsList()
G4UnitsCategory(const G4String &name)
G4bool operator!=(const G4UnitsCategory &) const
G4bool operator==(const G4UnitsCategory &) const
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const char * name(G4int ptype)
G4bool IsMasterThread()
Definition: G4Threading.cc:124
#define DBL_MIN
Definition: templates.hh:54
#define DBL_MAX
Definition: templates.hh:62
#define G4ThreadLocal
Definition: tls.hh:77
#define ns
Definition: xmlparse.cc:614