ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCellPackerUtils::Floatfield2 Class Reference

Helper for packing a float into/out of a bit field, with a minimum of 0. More...

#include <CaloCellPackerUtils.h>

Inheritance diagram for CaloCellPackerUtils::Floatfield2:
Collaboration diagram for CaloCellPackerUtils::Floatfield2:

Public Member Functions

 Floatfield2 (unsigned int mask=1, double xmax=1)
 Constructor.
unsigned int in (double x) const
 Shift and mask a value into the bitfield.
double out (unsigned int x) const
 Extract a value from the bitfield.
unsigned int in (unsigned int x) const
 Shift and mask a value into the bitfield.

Protected Attributes

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

Private Attributes

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, with a minimum of 0.

This is just like Floatfield, specialized for the case where xmin==0.

Definition at line 130 of file CaloCellPackerUtils.h.

Constructor & Destructor Documentation

◆ Floatfield2()

CaloCellPackerUtils::Floatfield2::Floatfield2 ( unsigned int mask = 1,
double xmax = 1 )

Constructor.

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

Definition at line 61 of file CaloCellPackerUtils.cxx.

63 : Bitfield (mask),
64 m_xmax (xmax),
65 m_fact (xmax / (m_mask + 1)),
66 m_ifact (1/m_fact)
67{
68}
unsigned int m_mask
Bitmask. Lower bit should be 1.
Bitfield(unsigned int mask=1)
Constructor.
double m_xmax
Largest representable value.
double m_ifact
Cached factor for float->int conversions.
double m_fact
Cached factor for int->float conversions.
double xmax
Definition listroot.cxx:61

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::Floatfield2::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()

double CaloCellPackerUtils::Floatfield2::out ( unsigned int x) const

Extract a value from the bitfield.

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

Member Data Documentation

◆ m_fact

double CaloCellPackerUtils::Floatfield2::m_fact
private

Cached factor for int->float conversions.

Definition at line 163 of file CaloCellPackerUtils.h.

◆ m_ifact

double CaloCellPackerUtils::Floatfield2::m_ifact
private

Cached factor for float->int conversions.

Definition at line 166 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::Floatfield2::m_xmax
private

Largest representable value.

Definition at line 160 of file CaloCellPackerUtils.h.


The documentation for this class was generated from the following files: