ATLAS Offline Software
Control
AthenaKernel
AthenaKernel
Units.h
Go to the documentation of this file.
1
// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3
/*
4
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5
*/
6
36
#ifndef ATHENAKERNEL_UNITS_H
37
#define ATHENAKERNEL_UNITS_H
38
39
40
#include "GaudiKernel/SystemOfUnits.h"
41
#include "GaudiKernel/PhysicalConstants.h"
42
43
44
namespace
Athena
{
45
namespace
Units
{
46
47
58
template
<
int
TAG>
class
Unit
{};
59
template
<
int
TAG>
60
constexpr
double
operator/
(
double
x
,
const
Unit<TAG>
u
)
61
{
62
constexpr
double
recip = 1. /
static_cast<
double
>
(
u
);
63
return
x
* recip;
64
}
65
template
<
int
TAG>
66
constexpr
float
operator/
(
float
x
,
const
Unit<TAG>
u
)
67
{
68
constexpr
float
recip = 1. /
static_cast<
float
>
(
u
);
69
return
x
* recip;
70
}
71
72
73
// Include a selection of units from SystemOfUnits.h
74
#define UNIT(NAME) \
75
template <> class Unit<__LINE__> \
76
{ \
77
public: \
78
constexpr operator double() const { return Gaudi::Units::NAME; } \
79
}; \
80
constexpr static const Unit<__LINE__> NAME
81
82
UNIT
(
millimeter
);
83
UNIT
(
millimeter2
);
84
UNIT
(
millimeter3
);
85
UNIT
(
centimeter
);
86
UNIT
(
centimeter2
);
87
UNIT
(
centimeter3
);
88
UNIT
(
meter
);
89
UNIT
(
meter2
);
90
UNIT
(
meter3
);
91
UNIT
(
micrometer
);
92
UNIT
(um);
93
UNIT
(
mm
);
94
UNIT
(
mm2
);
95
UNIT
(
mm3
);
96
UNIT
(
cm
);
97
UNIT
(
cm2
);
98
UNIT
(
cm3
);
99
UNIT
(
radian
);
100
UNIT
(
degree
);
101
UNIT
(
rad
);
102
UNIT
(
deg
);
103
UNIT
(
picosecond
);
104
UNIT
(
nanosecond
);
105
UNIT
(
microsecond
);
106
UNIT
(
millisecond
);
107
UNIT
(
second
);
108
UNIT
(
ns
);
109
UNIT
(
s
);
110
UNIT
(
ms
);
111
UNIT
(
keV
);
112
UNIT
(
MeV
);
113
UNIT
(
GeV
);
114
UNIT
(
TeV
);
115
UNIT
(
gram
);
116
UNIT
(
g
);
117
UNIT
(
mole
);
118
UNIT
(
c_light
);
119
#undef UNIT
120
121
122
}
// namespace Units
123
}
// namespace Athena
124
125
126
#endif // not ATHENAKERNEL_ATLASUNITS_H
python.SystemOfUnits.centimeter3
float centimeter3
Definition:
SystemOfUnits.py:68
GeV
#define GeV
Definition:
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:18
python.SystemOfUnits.mm
float mm
Definition:
SystemOfUnits.py:98
python.SystemOfUnits.millisecond
float millisecond
Definition:
SystemOfUnits.py:136
python.SystemOfUnits.mm3
float mm3
Definition:
SystemOfUnits.py:100
python.SystemOfUnits.centimeter2
float centimeter2
Definition:
SystemOfUnits.py:67
python.SystemOfUnits.second
float second
Definition:
SystemOfUnits.py:135
cm3
#define cm3
deg
#define deg
Definition:
SbPolyhedron.cxx:17
python.SystemOfUnits.centimeter
float centimeter
Definition:
SystemOfUnits.py:66
python.SystemOfUnits.nanosecond
float nanosecond
Definition:
SystemOfUnits.py:134
python.SystemOfUnits.meter3
float meter3
Definition:
SystemOfUnits.py:72
python.SystemOfUnits.meter2
float meter2
Definition:
SystemOfUnits.py:71
python.SystemOfUnits.picosecond
float picosecond
Definition:
SystemOfUnits.py:138
Athena::Units::Unit
Wrapper to avoid constant divisions when using units.
Definition:
Units.h:58
x
#define x
python.SystemOfUnits.TeV
float TeV
Definition:
SystemOfUnits.py:176
python.SystemOfUnits.millimeter
float millimeter
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration # This software is distribute...
Definition:
SystemOfUnits.py:62
Trk::u
@ u
Enums for curvilinear frames.
Definition:
ParamDefs.h:77
python.SystemOfUnits.MeV
float MeV
Definition:
SystemOfUnits.py:172
cm
const double cm
Definition:
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
Athena
Some weak symbol referencing magic...
Definition:
AthLegacySequence.h:21
python.CaloCondTools.g
g
Definition:
CaloCondTools.py:15
python.SystemOfUnits.micrometer
float micrometer
Definition:
SystemOfUnits.py:80
Athena::Units::operator/
constexpr double operator/(double x, const Unit< TAG > u)
Definition:
Units.h:60
python.SystemOfUnits.mm2
float mm2
Definition:
SystemOfUnits.py:99
python.SystemOfUnits.rad
float rad
Definition:
SystemOfUnits.py:126
Athena::Units
Definition:
Units.h:45
python.PhysicalConstants.c_light
float c_light
Definition:
PhysicalConstants.py:73
Athena::Units::UNIT
UNIT(millimeter)
python.SystemOfUnits.keV
float keV
Definition:
SystemOfUnits.py:174
python.SystemOfUnits.millimeter3
float millimeter3
Definition:
SystemOfUnits.py:64
mole
#define mole
python.SystemOfUnits.s
float s
Definition:
SystemOfUnits.py:147
python.SystemOfUnits.microsecond
float microsecond
Definition:
SystemOfUnits.py:137
python.SystemOfUnits.cm2
float cm2
Definition:
SystemOfUnits.py:103
python.SystemOfUnits.meter
float meter
Definition:
SystemOfUnits.py:70
python.SystemOfUnits.millimeter2
float millimeter2
Definition:
SystemOfUnits.py:63
python.SystemOfUnits.degree
tuple degree
Definition:
SystemOfUnits.py:121
python.SystemOfUnits.radian
float radian
Definition:
SystemOfUnits.py:119
python.SystemOfUnits.ns
float ns
Definition:
SystemOfUnits.py:146
python.SystemOfUnits.gram
float gram
Definition:
SystemOfUnits.py:183
python.SystemOfUnits.ms
float ms
Definition:
SystemOfUnits.py:148
Generated on Mon Sep 1 2025 21:23:28 for ATLAS Offline Software by
1.8.18