ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
TRT_ConditionsData
TRT_ConditionsData
LinearPacker.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TRTCONDITIONSDATA_LINEARPACKER_H
6
#define TRTCONDITIONSDATA_LINEARPACKER_H
7
8
#include <limits>
9
10
namespace
TRTCond
11
{
15
template
<
class
UnpackedType,
class
PackedType>
16
class
LinearPacker
17
{
18
public
:
19
21
LinearPacker
() :
m_xmin
(1),
m_xmax
(0) {}
22
24
LinearPacker
(UnpackedType
xmin
, UnpackedType
xmax
) :
m_xmin
(
xmin
),
m_xmax
(
xmax
) {}
25
27
UnpackedType
unpack
(PackedType val )
const
{
return
m_xmin
+ (val-
valmin
()) *
dx
() ; }
28
30
PackedType
pack
(UnpackedType
x
)
const
{
31
return
x
>=
m_xmax
?
valmax
() : (
x
<=
m_xmin
?
valmin
() :
valmin
() + PackedType((
x
-
m_xmin
) /
dx
() + 0.5) ) ;
32
}
33
34
private
:
35
37
PackedType
valmax
()
const
{
return
std::numeric_limits<PackedType>::max() ; }
38
40
PackedType
valmin
()
const
{
return
std::numeric_limits<PackedType>::min() ; }
41
43
UnpackedType
dx
()
const
{
return
(
m_xmax
-
m_xmin
)/(UnpackedType(
valmax
()-
valmin
())+1) ; }
44
private
:
45
UnpackedType
m_xmin
;
46
UnpackedType
m_xmax
;
47
} ;
48
49
}
50
51
#endif
x
#define x
TRTCond::LinearPacker::LinearPacker
LinearPacker()
default constructor
Definition
LinearPacker.h:21
TRTCond::LinearPacker::m_xmin
UnpackedType m_xmin
minimum data value
Definition
LinearPacker.h:45
TRTCond::LinearPacker::m_xmax
UnpackedType m_xmax
maximum data value
Definition
LinearPacker.h:46
TRTCond::LinearPacker::pack
PackedType pack(UnpackedType x) const
Pack method.
Definition
LinearPacker.h:30
TRTCond::LinearPacker::valmin
PackedType valmin() const
returns numeric lower limit of packed type
Definition
LinearPacker.h:40
TRTCond::LinearPacker::unpack
UnpackedType unpack(PackedType val) const
Unpack method.
Definition
LinearPacker.h:27
TRTCond::LinearPacker::valmax
PackedType valmax() const
returns numeric upper limit of packed type
Definition
LinearPacker.h:37
TRTCond::LinearPacker::dx
UnpackedType dx() const
returns precision of the packed data
Definition
LinearPacker.h:43
TRTCond::LinearPacker::LinearPacker
LinearPacker(UnpackedType xmin, UnpackedType xmax)
normal constructor
Definition
LinearPacker.h:24
xmax
double xmax
Definition
listroot.cxx:61
xmin
double xmin
Definition
listroot.cxx:60
TRTCond
Definition
BasicRtRelation.cxx:8
Generated on
for ATLAS Offline Software by
1.17.0