#include <L1MuScale.h>
Public Member Functions | |
virtual float | getCenter (unsigned packed) const |
get the center of bin represented by packed | |
virtual float | getHighEdge (unsigned packed) const |
get the upper edge of bin represented by packed | |
virtual float | getLowEdge (unsigned packed) const |
get the low edge of bin represented by packed | |
virtual unsigned | getNBins () const |
get number of bins | |
virtual unsigned | getPacked (float value) const |
pack a value | |
virtual float | getScaleMax () const |
get the upper edge of the last bin | |
virtual float | getScaleMin () const |
get the lower edge of the first bin | |
virtual float | getValue (unsigned i) const |
get value of the underlying vector for bin i | |
L1MuBinnedScale (unsigned int nbits, bool signedPacking, int NBins, const std::vector< double > Scale, int idx_offset=0) | |
L1MuBinnedScale () | |
L1MuBinnedScale (unsigned int nbits, bool signedPacking, int NBins, float xmin, float xmax, int idx_offset=0) | |
virtual std::string | print () const |
virtual | ~L1MuBinnedScale () |
destructor | |
Protected Member Functions | |
int | get_idx (unsigned packed) const |
Protected Attributes | |
int | m_idxoffset |
int | m_NBins |
unsigned int | m_nbits |
std::vector< float > | m_Scale |
bool | m_signedPacking |
implements a continuous scale of NBins bins.
the index into the binned scale runs from 0 to NBins-1.
It is packed into a data word (unsigned) using a Packing (template parameter)
If the packing accepts negative values, an offset can be specified which will be subtracted from the index before packing. ( The offset is in turn added to the packed value before using it as an index into the scale.)
Definition at line 91 of file L1MuScale.h.
L1MuBinnedScale::L1MuBinnedScale | ( | ) | [inline] |
constructor
packing is a pointer to a packing object. The L1MuBinnedScale takes ownership of the packing object and deletes it in its destructor
Definition at line 101 of file L1MuScale.h.
: m_nbits( 0 ), m_signedPacking( false ), m_NBins( 0 ), m_idxoffset( 0 ) {}
L1MuBinnedScale::L1MuBinnedScale | ( | unsigned int | nbits, |
bool | signedPacking, | ||
int | NBins, | ||
const std::vector< double > | Scale, | ||
int | idx_offset = 0 |
||
) | [inline] |
NBins=number of bins, Scale[NBins+1]=bin edges, idx_offset=offeset to index (if stored as signed)
Definition at line 111 of file L1MuScale.h.
References i, m_idxoffset, m_NBins, m_Scale, and EnsembleCalibrationLA_cfg::NBins.
L1MuBinnedScale::L1MuBinnedScale | ( | unsigned int | nbits, |
bool | signedPacking, | ||
int | NBins, | ||
float | xmin, | ||
float | xmax, | ||
int | idx_offset = 0 |
||
) | [inline] |
constructor
packing is a pointer to a packing object. The L1MuBinnedScale takes ownership of the packing object and deletes it in its destructor
NBins=number of bins, xmin = low edge of first bin, xmax=high edge of last bin, idx_offset=offeset to index (if stored as signed)
Definition at line 134 of file L1MuScale.h.
References i, m_idxoffset, m_NBins, m_Scale, and EnsembleCalibrationLA_cfg::NBins.
virtual L1MuBinnedScale::~L1MuBinnedScale | ( | ) | [inline, virtual] |
int L1MuBinnedScale::get_idx | ( | unsigned | packed | ) | const [inline, protected] |
Definition at line 217 of file L1MuScale.h.
References customizeTrackingMonitorSeedNumber::idx, L1MuSignedPackingGeneric::idxFromPacked(), L1MuUnsignedPackingGeneric::idxFromPacked(), m_idxoffset, m_NBins, m_nbits, and m_signedPacking.
Referenced by getCenter(), getHighEdge(), and getLowEdge().
{ int idxFromPacked = m_signedPacking ? L1MuSignedPackingGeneric::idxFromPacked( packed, m_nbits ) : L1MuUnsignedPackingGeneric::idxFromPacked( packed, m_nbits ) ; int idx = idxFromPacked + m_idxoffset; if (idx<0) idx=0; if (idx>=m_NBins) idx=m_NBins-1; return idx; }
virtual float L1MuBinnedScale::getCenter | ( | unsigned | packed | ) | const [inline, virtual] |
virtual float L1MuBinnedScale::getHighEdge | ( | unsigned | packed | ) | const [inline, virtual] |
virtual float L1MuBinnedScale::getLowEdge | ( | unsigned | packed | ) | const [inline, virtual] |
virtual unsigned L1MuBinnedScale::getNBins | ( | ) | const [inline, virtual] |
get number of bins
Implements L1MuScale.
Definition at line 194 of file L1MuScale.h.
References m_NBins.
{ return m_NBins; }
virtual unsigned L1MuBinnedScale::getPacked | ( | float | value | ) | const [inline, virtual] |
pack a value
Implements L1MuScale.
Definition at line 171 of file L1MuScale.h.
References customizeTrackingMonitorSeedNumber::idx, m_idxoffset, m_NBins, m_nbits, m_Scale, m_signedPacking, L1MuUnsignedPackingGeneric::packedFromIdx(), and L1MuSignedPackingGeneric::packedFromIdx().
Referenced by print().
{ if (value < m_Scale[0] || value > m_Scale[m_NBins]) edm::LogWarning("ScaleRangeViolation") << "L1MuBinnedScale::getPacked: value out of scale range: " << value << std::endl; int idx = 0; if (value < m_Scale[0]) idx=0; else if (value >= m_Scale[m_NBins]) idx = m_NBins-1; else { for (; idx<m_NBins; idx++) if (value >= m_Scale[idx] && value < m_Scale[idx+1]) break; } return ( m_signedPacking ? L1MuSignedPackingGeneric::packedFromIdx(idx-m_idxoffset, m_nbits) : L1MuUnsignedPackingGeneric::packedFromIdx(idx-m_idxoffset, m_nbits) ) ; };
virtual float L1MuBinnedScale::getScaleMax | ( | ) | const [inline, virtual] |
virtual float L1MuBinnedScale::getScaleMin | ( | ) | const [inline, virtual] |
get the lower edge of the first bin
Implements L1MuScale.
Definition at line 191 of file L1MuScale.h.
References m_Scale.
{ return m_Scale[0]; }
virtual float L1MuBinnedScale::getValue | ( | unsigned | i | ) | const [inline, virtual] |
virtual std::string L1MuBinnedScale::print | ( | void | ) | const [inline, virtual] |
Implements L1MuScale.
Definition at line 199 of file L1MuScale.h.
References getCenter(), getHighEdge(), getLowEdge(), getPacked(), i, m_NBins, and m_Scale.
{ std::ostringstream str; str << " ind | low edge | center | high edge" << std::endl; str << "-------------------------------------------" << std::endl; for(int i=0; i<m_NBins; i++){ unsigned int ipack = getPacked(m_Scale[i]); str << std::setw(4) << ipack << " | " << std::setw(10) << getLowEdge(ipack) << " | " << std::setw(10) << getCenter(ipack) << " | " << std::setw(10) << getHighEdge(ipack) << std::endl; } return str.str(); }
int L1MuBinnedScale::m_idxoffset [protected] |
Definition at line 230 of file L1MuScale.h.
Referenced by get_idx(), getPacked(), and L1MuBinnedScale().
int L1MuBinnedScale::m_NBins [protected] |
Definition at line 229 of file L1MuScale.h.
Referenced by get_idx(), getNBins(), getPacked(), getScaleMax(), L1MuBinnedScale(), and print().
unsigned int L1MuBinnedScale::m_nbits [protected] |
Definition at line 227 of file L1MuScale.h.
Referenced by get_idx(), and getPacked().
std::vector<float> L1MuBinnedScale::m_Scale [protected] |
Definition at line 231 of file L1MuScale.h.
Referenced by getCenter(), getHighEdge(), getLowEdge(), getPacked(), getScaleMax(), getScaleMin(), getValue(), L1MuBinnedScale(), and print().
bool L1MuBinnedScale::m_signedPacking [protected] |
Definition at line 228 of file L1MuScale.h.
Referenced by get_idx(), and getPacked().