ATLAS Offline Software
CaloCellPackerUtils.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: CaloCellPackerUtils.h,v 1.1 2007-11-08 18:14:20 ssnyder Exp $
8 
17 #ifndef CALOCELLPACKERUTILS_H
18 #define CALOCELLPACKERUTILS_H
19 
20 
21 #include "GaudiKernel/Kernel.h" // For LIKELY
22 
23 
24 namespace CaloCellPackerUtils {
25 
26 
36 class Bitfield
37 {
38 public:
43  Bitfield (unsigned int mask = 1);
44 
45 
51  unsigned int in (unsigned int x) const;
52 
53 
59  unsigned int out (unsigned int x) const;
60 
61 
62 protected:
64  unsigned int m_mask;
65 
67  unsigned int m_shift;
68 };
69 
70 
80  : public Bitfield
81 {
82 public:
89  Floatfield (unsigned int mask=1, double xmin=1, double xmax=0);
90 
91 
97  unsigned int in (double x) const;
98 
99 
106  double out (unsigned int x, int& underflow) const;
107 
108 
109 private:
111  double m_xmin;
112 
114  double m_xmax;
115 
117  double m_fact;
118 
120  double m_ifact;
121 };
122 
123 
131  : public Bitfield
132 {
133 public:
139  Floatfield2 (unsigned int mask=1, double xmax=1);
140 
141 
147  unsigned int in (double x) const;
148 
149 
155  double out (unsigned int x) const;
156 
157 
158 private:
160  double m_xmax;
161 
163  double m_fact;
164 
166  double m_ifact;
167 };
168 
169 
170 } // namespace CaloCellPackerUtils
171 
172 
173 #include "CaloCellPackerUtils.icc"
174 
175 
176 #endif // not CALOCELLPACKERUTILS_H
CaloCellPackerUtils::Floatfield::m_xmax
double m_xmax
Largest representable value.
Definition: CaloCellPackerUtils.h:114
CaloCellPackerUtils::Floatfield
Helper for packing a float into/out of a bit field.
Definition: CaloCellPackerUtils.h:81
CaloCellPackerUtils::Floatfield::Floatfield
Floatfield(unsigned int mask=1, double xmin=1, double xmax=0)
Constructor.
Definition: CaloCellPackerUtils.cxx:44
CaloCellPackerUtils::Floatfield2
Helper for packing a float into/out of a bit field, with a minimum of 0.
Definition: CaloCellPackerUtils.h:132
CaloCellPackerUtils::Floatfield::in
unsigned int in(double x) const
Shift and mask a value into the bitfield.
CaloCellPackerUtils::Floatfield2::out
double out(unsigned int x) const
Extract a value from the bitfield.
CaloCellPackerUtils::Bitfield::m_shift
unsigned int m_shift
Shift count.
Definition: CaloCellPackerUtils.h:67
CaloCellPackerUtils::Bitfield
Helper for packing into/out of a bit field.
Definition: CaloCellPackerUtils.h:37
x
#define x
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CaloCellPackerUtils::Bitfield::in
unsigned int in(unsigned int x) const
Shift and mask a value into the bitfield.
CaloCellPackerUtils::Bitfield::Bitfield
Bitfield(unsigned int mask=1)
Constructor.
Definition: CaloCellPackerUtils.cxx:25
CaloCellPackerUtils::Floatfield2::m_xmax
double m_xmax
Largest representable value.
Definition: CaloCellPackerUtils.h:160
xmin
double xmin
Definition: listroot.cxx:60
CaloCellPackerUtils::Floatfield2::Floatfield2
Floatfield2(unsigned int mask=1, double xmax=1)
Constructor.
Definition: CaloCellPackerUtils.cxx:61
CaloCellPackerUtils::Bitfield::m_mask
unsigned int m_mask
Bitmask. Lower bit should be 1.
Definition: CaloCellPackerUtils.h:64
CaloCellPackerUtils::Floatfield2::m_ifact
double m_ifact
Cached factor for float->int conversions.
Definition: CaloCellPackerUtils.h:166
CaloCellPackerUtils::Floatfield2::m_fact
double m_fact
Cached factor for int->float conversions.
Definition: CaloCellPackerUtils.h:163
CaloCellPackerUtils::Bitfield::out
unsigned int out(unsigned int x) const
Extract a value from the bitfield.
CaloCellPackerUtils::Floatfield2::in
unsigned int in(double x) const
Shift and mask a value into the bitfield.
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.icc
CaloCellPackerUtils::Floatfield::out
double out(unsigned int x, int &underflow) const
Extract a value from the bitfield.
CaloCellPackerUtils
Definition: CaloCellPackerUtils.cxx:18
CaloCellPackerUtils::Floatfield::m_xmin
double m_xmin
Smallest representable value.
Definition: CaloCellPackerUtils.h:111