#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 (posivie half) | |
virtual float | getScaleMin () const |
get the lower edge of the first bin (positive half) | |
virtual float | getValue (unsigned i) const |
get value of the underlying vector for bin i | |
L1MuSymmetricBinnedScale (int nbits, int NBins, const std::vector< double > Scale) | |
L1MuSymmetricBinnedScale () | |
L1MuSymmetricBinnedScale (int nbits, int NBins, float xmin, float xmax) | |
virtual std::string | print () const |
virtual | ~L1MuSymmetricBinnedScale () |
destructor | |
Protected Attributes | |
int | m_NBins |
L1MuPseudoSignedPacking | m_packing |
std::vector< float > | m_Scale |
In the GMT the concept of a symmetric scale exists The internal representation of scale values is "pseudo-signed", i.e. the highest bit stores the sign and the lower bits contain the absolute value
Attention: for reasons of symmetry, the low edge in this scale is the edge closer to zero. the high edge is the edge further away from zero
Definition at line 245 of file L1MuScale.h.
L1MuSymmetricBinnedScale::L1MuSymmetricBinnedScale | ( | ) | [inline] |
constructor
packing is a pointer to a packing object. The L1MuSymmetricBinnedScale takes ownership of the packing object and deletes it in its destructor
Definition at line 256 of file L1MuScale.h.
: m_NBins( 0 ) {}
L1MuSymmetricBinnedScale::L1MuSymmetricBinnedScale | ( | int | nbits, |
int | NBins, | ||
const std::vector< double > | Scale | ||
) | [inline] |
NBins=number of bins (in one half of the scale), Scale[NBins+1]=bin edges
Definition at line 263 of file L1MuScale.h.
References i, m_NBins, m_Scale, and EnsembleCalibrationLA_cfg::NBins.
L1MuSymmetricBinnedScale::L1MuSymmetricBinnedScale | ( | int | nbits, |
int | NBins, | ||
float | xmin, | ||
float | xmax | ||
) | [inline] |
constructor
packing is a pointer to a packing object. The L1MuSymmetricBinnedScale takes ownership of the packing object and deletes it in its destructor
NBins=number of bins, xmin = low edge of first bin (in positive half) xmax=high edge of last bin (in positive half)
Definition at line 282 of file L1MuScale.h.
References i, m_NBins, m_Scale, and EnsembleCalibrationLA_cfg::NBins.
virtual L1MuSymmetricBinnedScale::~L1MuSymmetricBinnedScale | ( | ) | [inline, virtual] |
virtual float L1MuSymmetricBinnedScale::getCenter | ( | unsigned | packed | ) | const [inline, virtual] |
get the center of bin represented by packed
Implements L1MuScale.
Definition at line 297 of file L1MuScale.h.
References abs, L1MuPseudoSignedPacking::idxFromPacked(), m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::signFromPacked().
Referenced by print().
{ int absidx = abs ( m_packing.idxFromPacked( packed ) ); if (absidx>=m_NBins) absidx=m_NBins-1; float center = (m_Scale[absidx] + m_Scale[absidx+1] )/ 2.; float fsign = m_packing.signFromPacked( packed ) == 0 ? 1. : -1.; return center * fsign; };
virtual float L1MuSymmetricBinnedScale::getHighEdge | ( | unsigned | packed | ) | const [inline, virtual] |
get the upper edge of bin represented by packed
Implements L1MuScale.
Definition at line 315 of file L1MuScale.h.
{ edm::LogWarning("NotImplemented") << "L1MuSymmetricBinnedScale::getHighEdge not implemented" << std::endl; return 0; };
virtual float L1MuSymmetricBinnedScale::getLowEdge | ( | unsigned | packed | ) | const [inline, virtual] |
get the low edge of bin represented by packed
Implements L1MuScale.
Definition at line 306 of file L1MuScale.h.
References abs, L1MuPseudoSignedPacking::idxFromPacked(), m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::signFromPacked().
Referenced by print().
{ // === edge towards 0 int absidx = abs ( m_packing.idxFromPacked( packed ) ); if (absidx>=m_NBins) absidx=m_NBins-1; float low = m_Scale[absidx]; float fsign = m_packing.signFromPacked( packed ) == 0 ? 1. : -1.; return low * fsign; };
virtual unsigned L1MuSymmetricBinnedScale::getNBins | ( | ) | const [inline, virtual] |
get number of bins
Implements L1MuScale.
Definition at line 339 of file L1MuScale.h.
References m_NBins.
{ return m_NBins; }
virtual unsigned L1MuSymmetricBinnedScale::getPacked | ( | float | value | ) | const [inline, virtual] |
pack a value
Implements L1MuScale.
Definition at line 321 of file L1MuScale.h.
References UserOptions_cff::idx, m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::packedFromIdx().
Referenced by print().
{ float absval = fabs ( value ); if (absval < m_Scale[0] || absval > m_Scale[m_NBins]) edm::LogWarning("ScaleRangeViolation") << "L1MuSymmetricBinnedScale::getPacked: value out of scale range!!! abs(val) = " << absval << " min= " << m_Scale[0] << " max = " << m_Scale[m_NBins] << std::endl; int idx = 0; for (; idx<m_NBins; idx++) if (absval >= m_Scale[idx] && absval < m_Scale[idx+1]) break; if (idx >= m_NBins) idx = m_NBins-1; return m_packing.packedFromIdx(idx, (value>=0) ? 0 : 1); };
virtual float L1MuSymmetricBinnedScale::getScaleMax | ( | ) | const [inline, virtual] |
virtual float L1MuSymmetricBinnedScale::getScaleMin | ( | ) | const [inline, virtual] |
get the lower edge of the first bin (positive half)
Implements L1MuScale.
Definition at line 336 of file L1MuScale.h.
References m_Scale.
{ return m_Scale[0]; }
virtual float L1MuSymmetricBinnedScale::getValue | ( | unsigned | i | ) | const [inline, virtual] |
virtual std::string L1MuSymmetricBinnedScale::print | ( | void | ) | const [inline, virtual] |
Implements L1MuScale.
Definition at line 344 of file L1MuScale.h.
References getCenter(), getLowEdge(), getPacked(), i, m_NBins, and m_Scale.
{ std::ostringstream str; str << " ind | low edge | center" << 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::endl; } return str.str(); }
int L1MuSymmetricBinnedScale::m_NBins [protected] |
Definition at line 361 of file L1MuScale.h.
Referenced by getCenter(), getLowEdge(), getNBins(), getPacked(), getScaleMax(), L1MuSymmetricBinnedScale(), and print().
Definition at line 360 of file L1MuScale.h.
Referenced by getCenter(), getLowEdge(), and getPacked().
std::vector<float> L1MuSymmetricBinnedScale::m_Scale [protected] |
Definition at line 362 of file L1MuScale.h.
Referenced by getCenter(), getLowEdge(), getPacked(), getScaleMax(), getScaleMin(), getValue(), L1MuSymmetricBinnedScale(), and print().