Logo ROOT  
Reference Guide
TGeoUnit.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Markus Frank 25/06/19
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TGeoUnit
13\ingroup Geometry_classes
14
15Base class describing materials.
16
17*/
18#include "TError.h"
19#include "TGeoSystemOfUnits.h"
21
22namespace {
23 static bool s_type_changed = false;
24 union _unit_type {
28 } s_unit_type(TGeoUnit::kTGeoUnits);
29}
30
32 return s_unit_type.tgeo_unit_type;
33}
34
36 UnitType tmp = s_unit_type.tgeo_unit_type;
37 if ( !s_type_changed || new_type == s_unit_type.tgeo_unit_type ) {
38 s_unit_type.tgeo_unit_type = new_type;
39 s_type_changed = true;
40 return tmp;
41 }
42 Fatal("TGeoUnit","The system of units may only be changed once at the beginning of the program!");
43 return tmp;
44}
45
47 return s_unit_type.tgeant4_unit_type;
48}
49
51 UnitType tmp = s_unit_type.tgeant4_unit_type;
52 if ( !s_type_changed || new_type == s_unit_type.tgeant4_unit_type ) {
53 s_unit_type.tgeant4_unit_type = new_type;
54 s_type_changed = true;
55 return tmp;
56 }
57 Fatal("TGeoUnit","The system of units may only be changed once at the beginning of the program!");
58 return tmp;
59}
void Fatal(const char *location, const char *msgfmt,...)
_unit_type(TGeoUnit::UnitType t)
Definition: TGeoUnit.cxx:2
TGeant4Unit::UnitType tgeant4_unit_type
Definition: TGeoUnit.cxx:1
TGeoUnit::UnitType tgeo_unit_type
Definition: TGeoUnit.cxx:0
UnitType unitType()
Access the currently set units type.
Definition: TGeoUnit.cxx:46
UnitType
System of units flavor. Must be kept in sync with TGeoUnits::UnitType.
UnitType setUnitType(UnitType new_type)
Set the currently used unit type (Only ONCE possible)
Definition: TGeoUnit.cxx:50
UnitType setUnitType(UnitType new_type)
Set the currently used unit type (Only ONCE possible)
UnitType unitType()
Access the currently set units type.