ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
34
35
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
cm3
#define cm3
mole
#define mole
TeV
static const double TeV
Definition
HIEventSelectionToolRun3.cxx:74
MeV
static const double MeV
Definition
HIEventSelectionToolRun3.cxx:72
GeV
#define GeV
Definition
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
deg
#define deg
Definition
SbPolyhedron.cxx:18
cm
const double cm
Definition
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
UNIT
#define UNIT(NAME)
Definition
Units.h:74
x
#define x
Athena::Units::Unit
Wrapper to avoid constant divisions when using units.
Definition
Units.h:58
Athena::Units
Definition
Units.h:45
Athena::Units::operator/
constexpr double operator/(double x, const Unit< TAG > u)
Definition
Units.h:60
Athena
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
Definition
AthDsoUtils.h:10
Generated on
for ATLAS Offline Software by
1.17.0