ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
CaloCellPackerUtils::Floatfield Class Reference

Helper for packing a float into/out of a bit field. More...

#include <CaloCellPackerUtils.h>

Inheritance diagram for CaloCellPackerUtils::Floatfield:
Collaboration diagram for CaloCellPackerUtils::Floatfield:

Public Member Functions

 Floatfield (unsigned int mask=1, double xmin=1, double xmax=0)
 Constructor. More...
 
unsigned int in (double x) const
 Shift and mask a value into the bitfield. More...
 
double out (unsigned int x, int &underflow) const
 Extract a value from the bitfield. More...
 
unsigned int in (unsigned int x) const
 Shift and mask a value into the bitfield. More...
 
unsigned int out (unsigned int x) const
 Extract a value from the bitfield. More...
 

Protected Attributes

unsigned int m_mask
 Bitmask. Lower bit should be 1. More...
 
unsigned int m_shift
 Shift count. More...
 

Private Attributes

double m_xmin
 Smallest representable value. More...
 
double m_xmax
 Largest representable value. More...
 
double m_fact
 Cached factor for int->float conversions. More...
 
double m_ifact
 Cached factor for float->int conversions. More...
 

Detailed Description

Helper for packing a float into/out of a bit field.

This works like the bitfield class above, except that the in/out methods take floating-point values. The field takes a min/max range of values; the input value is converted to a fraction within the range, and that fraction is stored.

Definition at line 79 of file CaloCellPackerUtils.h.

Constructor & Destructor Documentation

◆ Floatfield()

CaloCellPackerUtils::Floatfield::Floatfield ( unsigned int  mask = 1,
double  xmin = 1,
double  xmax = 0 
)

Constructor.

Parameters
Thebit mask. Should contain a single contiguous string of 1's.
xminThe smallest storable value.
xmaxThe largest storable value.

Definition at line 44 of file CaloCellPackerUtils.cxx.

47  : Bitfield (mask),
48  m_xmin (xmin),
49  m_xmax (xmax),
50  m_fact ((xmax-xmin) / (m_mask + 1)),
51  m_ifact (1/m_fact)
52 {
53 }

Member Function Documentation

◆ in() [1/2]

unsigned int CaloCellPackerUtils::Floatfield::in ( double  x) const

Shift and mask a value into the bitfield.

Parameters
xThe input value.
Returns
The converted value shifted and masked to go into the bitfield.

◆ in() [2/2]

unsigned int CaloCellPackerUtils::Bitfield::in ( unsigned int  x) const
inherited

Shift and mask a value into the bitfield.

Parameters
xThe input value.
Returns
The value shifted and masked to go into the bitfield.

◆ out() [1/2]

unsigned int CaloCellPackerUtils::Bitfield::out ( unsigned int  x) const
inherited

Extract a value from the bitfield.

Parameters
xThe input bitfield.
Returns
The value extracted from the bitfield.

◆ out() [2/2]

double CaloCellPackerUtils::Floatfield::out ( unsigned int  x,
int &  underflow 
) const

Extract a value from the bitfield.

Parameters
xThe input bitfield.
underflag[out]Set to 1 if the value was the lowest possible.
Returns
The value extracted from the bitfield.

Member Data Documentation

◆ m_fact

double CaloCellPackerUtils::Floatfield::m_fact
private

Cached factor for int->float conversions.

Definition at line 117 of file CaloCellPackerUtils.h.

◆ m_ifact

double CaloCellPackerUtils::Floatfield::m_ifact
private

Cached factor for float->int conversions.

Definition at line 120 of file CaloCellPackerUtils.h.

◆ m_mask

unsigned int CaloCellPackerUtils::Bitfield::m_mask
protectedinherited

Bitmask. Lower bit should be 1.

Definition at line 64 of file CaloCellPackerUtils.h.

◆ m_shift

unsigned int CaloCellPackerUtils::Bitfield::m_shift
protectedinherited

Shift count.

Definition at line 67 of file CaloCellPackerUtils.h.

◆ m_xmax

double CaloCellPackerUtils::Floatfield::m_xmax
private

Largest representable value.

Definition at line 114 of file CaloCellPackerUtils.h.

◆ m_xmin

double CaloCellPackerUtils::Floatfield::m_xmin
private

Smallest representable value.

Definition at line 111 of file CaloCellPackerUtils.h.


The documentation for this class was generated from the following files:
CaloCellPackerUtils::Floatfield::m_xmax
double m_xmax
Largest representable value.
Definition: CaloCellPackerUtils.h:114
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CaloCellPackerUtils::Bitfield::Bitfield
Bitfield(unsigned int mask=1)
Constructor.
Definition: CaloCellPackerUtils.cxx:25
xmin
double xmin
Definition: listroot.cxx:60
CaloCellPackerUtils::Bitfield::m_mask
unsigned int m_mask
Bitmask. Lower bit should be 1.
Definition: CaloCellPackerUtils.h:64
CaloCellPackerUtils::Floatfield::m_ifact
double m_ifact
Cached factor for float->int conversions.
Definition: CaloCellPackerUtils.h:120
CaloCellPackerUtils::Floatfield::m_fact
double m_fact
Cached factor for int->float conversions.
Definition: CaloCellPackerUtils.h:117
xmax
double xmax
Definition: listroot.cxx:61
CaloCellPackerUtils::Floatfield::m_xmin
double m_xmin
Smallest representable value.
Definition: CaloCellPackerUtils.h:111