ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TRTCond::LinearPacker< UnpackedType, PackedType > Class Template Reference

#include <LinearPacker.h>

Collaboration diagram for TRTCond::LinearPacker< UnpackedType, PackedType >:

Public Member Functions

 LinearPacker ()
 default constructor More...
 
 LinearPacker (UnpackedType xmin, UnpackedType xmax)
 normal constructor More...
 
UnpackedType unpack (PackedType val) const
 Unpack method. More...
 
PackedType pack (UnpackedType x) const
 Pack method. More...
 

Private Member Functions

PackedType valmax () const
 returns numeric upper limit of packed type More...
 
PackedType valmin () const
 returns numeric lower limit of packed type More...
 
UnpackedType dx () const
 returns precision of the packed data More...
 

Private Attributes

UnpackedType m_xmin
 minimum data value More...
 
UnpackedType m_xmax
 maximum data value More...
 

Detailed Description

template<class UnpackedType, class PackedType>
class TRTCond::LinearPacker< UnpackedType, PackedType >

Template class for packing data

Definition at line 16 of file LinearPacker.h.

Constructor & Destructor Documentation

◆ LinearPacker() [1/2]

template<class UnpackedType , class PackedType >
TRTCond::LinearPacker< UnpackedType, PackedType >::LinearPacker ( )
inline

default constructor

Definition at line 21 of file LinearPacker.h.

21 : m_xmin(1),m_xmax(0) {}

◆ LinearPacker() [2/2]

template<class UnpackedType , class PackedType >
TRTCond::LinearPacker< UnpackedType, PackedType >::LinearPacker ( UnpackedType  xmin,
UnpackedType  xmax 
)
inline

normal constructor

Definition at line 24 of file LinearPacker.h.

24 : m_xmin(xmin), m_xmax(xmax) {}

Member Function Documentation

◆ dx()

template<class UnpackedType , class PackedType >
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::dx ( ) const
inlineprivate

returns precision of the packed data

Definition at line 43 of file LinearPacker.h.

43 { return (m_xmax - m_xmin)/(UnpackedType(valmax()-valmin())+1) ; }

◆ pack()

template<class UnpackedType , class PackedType >
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::pack ( UnpackedType  x) const
inline

Pack method.

Definition at line 30 of file LinearPacker.h.

30  {
31  return x>=m_xmax ? valmax() : (x<=m_xmin ? valmin() : valmin() + PackedType((x - m_xmin) /dx() + 0.5) ) ;
32  }

◆ unpack()

template<class UnpackedType , class PackedType >
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::unpack ( PackedType  val) const
inline

Unpack method.

Definition at line 27 of file LinearPacker.h.

27 { return m_xmin + (val-valmin()) * dx() ; }

◆ valmax()

template<class UnpackedType , class PackedType >
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::valmax ( ) const
inlineprivate

returns numeric upper limit of packed type

Definition at line 37 of file LinearPacker.h.

◆ valmin()

template<class UnpackedType , class PackedType >
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::valmin ( ) const
inlineprivate

returns numeric lower limit of packed type

Definition at line 40 of file LinearPacker.h.

Member Data Documentation

◆ m_xmax

template<class UnpackedType , class PackedType >
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::m_xmax
private

maximum data value

Definition at line 46 of file LinearPacker.h.

◆ m_xmin

template<class UnpackedType , class PackedType >
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::m_xmin
private

minimum data value

Definition at line 45 of file LinearPacker.h.


The documentation for this class was generated from the following file:
max
#define max(a, b)
Definition: cfImp.cxx:41
x
#define x
TRTCond::LinearPacker::m_xmax
UnpackedType m_xmax
maximum data value
Definition: LinearPacker.h:46
TRTCond::LinearPacker::m_xmin
UnpackedType m_xmin
minimum data value
Definition: LinearPacker.h:45
TRTCond::LinearPacker::valmax
PackedType valmax() const
returns numeric upper limit of packed type
Definition: LinearPacker.h:37
xmin
double xmin
Definition: listroot.cxx:60
TRTCond::LinearPacker::valmin
PackedType valmin() const
returns numeric lower limit of packed type
Definition: LinearPacker.h:40
min
#define min(a, b)
Definition: cfImp.cxx:40
TRTCond::LinearPacker::dx
UnpackedType dx() const
returns precision of the packed data
Definition: LinearPacker.h:43
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
xmax
double xmax
Definition: listroot.cxx:61