ATLAS Offline Software
Loading...
Searching...
No Matches
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.
unsigned int in (double x) const
 Shift and mask a value into the bitfield.
double out (unsigned int x, int &underflow) const
 Extract a value from the bitfield.
unsigned int in (unsigned int x) const
 Shift and mask a value into the bitfield.
unsigned int out (unsigned int x) const
 Extract a value from the bitfield.

Protected Attributes

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

Private Attributes

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

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}
unsigned int m_mask
Bitmask. Lower bit should be 1.
Bitfield(unsigned int mask=1)
Constructor.
double m_xmin
Smallest representable value.
double m_ifact
Cached factor for float->int conversions.
double m_fact
Cached factor for int->float conversions.
double m_xmax
Largest representable value.
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60

Member Function Documentation

◆ in() [1/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.

◆ in() [2/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.

◆ 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: