CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
L1MuSymmetricBinnedScale Class Reference

#include <L1MuScale.h>

Inheritance diagram for L1MuSymmetricBinnedScale:
L1MuScale

Public Member Functions

virtual float getCenter (unsigned packed) const
 get the center of bin represented by packed More...
 
virtual float getHighEdge (unsigned packed) const
 get the upper edge of bin represented by packed More...
 
virtual float getLowEdge (unsigned packed) const
 get the low edge of bin represented by packed More...
 
virtual unsigned getNBins () const
 get number of bins More...
 
virtual unsigned getPacked (float value) const
 pack a value More...
 
virtual float getScaleMax () const
 get the upper edge of the last bin (posivie half) More...
 
virtual float getScaleMin () const
 get the lower edge of the first bin (positive half) More...
 
virtual float getValue (unsigned i) const
 get value of the underlying vector for bin i More...
 
 L1MuSymmetricBinnedScale ()
 
 L1MuSymmetricBinnedScale (int nbits, int NBins, const std::vector< double > &Scale)
 
 L1MuSymmetricBinnedScale (int nbits, int NBins, float xmin, float xmax)
 
virtual std::string print () const
 
virtual ~L1MuSymmetricBinnedScale ()
 destructor More...
 
- Public Member Functions inherited from L1MuScale
 L1MuScale ()
 
virtual ~L1MuScale ()
 

Protected Attributes

int m_NBins
 
L1MuPseudoSignedPacking m_packing
 
std::vector< float > m_Scale
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

256  :
257  m_NBins( 0 )
258  {}
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.

265  m_NBins = NBins;
266  m_Scale.reserve(m_NBins + 1);
267  for (int i=0; i<m_NBins + 1; i++)
268  // m_Scale[i] = Scale[i];
269  m_Scale.push_back( Scale[i] ) ;
270  };
int i
Definition: DBlmapReader.cc:9
std::vector< float > m_Scale
Definition: L1MuScale.h:362
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:360
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.

284  m_NBins = NBins;
285  m_Scale.reserve(m_NBins + 1);
286  for (int i=0; i<m_NBins + 1; i++)
287  // m_Scale[i] = xmin + i * (xmax-xmin) / m_NBins;
288  m_Scale.push_back( xmin + i * (xmax-xmin) / m_NBins ) ;
289  };
int i
Definition: DBlmapReader.cc:9
std::vector< float > m_Scale
Definition: L1MuScale.h:362
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:360
virtual L1MuSymmetricBinnedScale::~L1MuSymmetricBinnedScale ( )
inlinevirtual

destructor

Definition at line 292 of file L1MuScale.h.

292  {
293 // delete m_packing;
294  };

Member Function Documentation

virtual float L1MuSymmetricBinnedScale::getCenter ( unsigned  packed) const
inlinevirtual

get the center of bin represented by packed

Implements L1MuScale.

Definition at line 297 of file L1MuScale.h.

References funct::abs(), L1MuPseudoSignedPacking::idxFromPacked(), m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::signFromPacked().

Referenced by print().

297  {
298  int absidx = abs ( m_packing.idxFromPacked( packed ) );
299  if (absidx>=m_NBins) absidx=m_NBins-1;
300  float center = (m_Scale[absidx] + m_Scale[absidx+1] )/ 2.;
301  float fsign = m_packing.signFromPacked( packed ) == 0 ? 1. : -1.;
302  return center * fsign;
303  };
std::vector< float > m_Scale
Definition: L1MuScale.h:362
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:360
virtual int idxFromPacked(unsigned packed) const
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:139
virtual int signFromPacked(unsigned packed) const
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
Definition: L1MuPacking.h:136
virtual float L1MuSymmetricBinnedScale::getHighEdge ( unsigned  packed) const
inlinevirtual

get the upper edge of bin represented by packed

Implements L1MuScale.

Definition at line 315 of file L1MuScale.h.

315  {
316  edm::LogWarning("NotImplemented") << "L1MuSymmetricBinnedScale::getHighEdge not implemented" << std::endl;
317  return 0;
318  };
virtual float L1MuSymmetricBinnedScale::getLowEdge ( unsigned  packed) const
inlinevirtual

get the low edge of bin represented by packed

Implements L1MuScale.

Definition at line 306 of file L1MuScale.h.

References funct::abs(), L1MuPseudoSignedPacking::idxFromPacked(), m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::signFromPacked().

Referenced by print().

306  { // === edge towards 0
307  int absidx = abs ( m_packing.idxFromPacked( packed ) );
308  if (absidx>=m_NBins) absidx=m_NBins-1;
309  float low = m_Scale[absidx];
310  float fsign = m_packing.signFromPacked( packed ) == 0 ? 1. : -1.;
311  return low * fsign;
312  };
std::vector< float > m_Scale
Definition: L1MuScale.h:362
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:360
virtual int idxFromPacked(unsigned packed) const
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:139
virtual int signFromPacked(unsigned packed) const
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
Definition: L1MuPacking.h:136
virtual unsigned L1MuSymmetricBinnedScale::getNBins ( ) const
inlinevirtual

get number of bins

Implements L1MuScale.

Definition at line 339 of file L1MuScale.h.

References m_NBins.

339 { return m_NBins; }
virtual unsigned L1MuSymmetricBinnedScale::getPacked ( float  value) const
inlinevirtual

pack a value

Implements L1MuScale.

Definition at line 321 of file L1MuScale.h.

References customizeTrackingMonitorSeedNumber::idx, m_NBins, m_packing, m_Scale, and L1MuPseudoSignedPacking::packedFromIdx().

Referenced by print().

321  {
322  float absval = fabs ( value );
323  if (absval < m_Scale[0] || absval > m_Scale[m_NBins]) edm::LogWarning("ScaleRangeViolation")
324  << "L1MuSymmetricBinnedScale::getPacked: value out of scale range!!! abs(val) = "
325  << absval << " min= " << m_Scale[0] << " max = " << m_Scale[m_NBins] << std::endl;
326  int idx = 0;
327  for (; idx<m_NBins; idx++)
328  if (absval >= m_Scale[idx] && absval < m_Scale[idx+1]) break;
329  if (idx >= m_NBins) idx = m_NBins-1;
330  return m_packing.packedFromIdx(idx, (value>=0) ? 0 : 1);
331  };
std::vector< float > m_Scale
Definition: L1MuScale.h:362
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check range
Definition: L1MuPacking.h:146
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:360
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
virtual float L1MuSymmetricBinnedScale::getScaleMax ( ) const
inlinevirtual

get the upper edge of the last bin (posivie half)

Implements L1MuScale.

Definition at line 333 of file L1MuScale.h.

References m_NBins, and m_Scale.

333 { return m_Scale[m_NBins]; }
std::vector< float > m_Scale
Definition: L1MuScale.h:362
virtual float L1MuSymmetricBinnedScale::getScaleMin ( ) const
inlinevirtual

get the lower edge of the first bin (positive half)

Implements L1MuScale.

Definition at line 336 of file L1MuScale.h.

References m_Scale.

336 { return m_Scale[0]; }
std::vector< float > m_Scale
Definition: L1MuScale.h:362
virtual float L1MuSymmetricBinnedScale::getValue ( unsigned  i) const
inlinevirtual

get value of the underlying vector for bin i

Implements L1MuScale.

Definition at line 342 of file L1MuScale.h.

References i, and m_Scale.

342 { return m_Scale[i]; }
int i
Definition: DBlmapReader.cc:9
std::vector< float > m_Scale
Definition: L1MuScale.h:362
virtual std::string L1MuSymmetricBinnedScale::print ( void  ) const
inlinevirtual

Implements L1MuScale.

Definition at line 344 of file L1MuScale.h.

References getCenter(), getLowEdge(), getPacked(), i, m_NBins, and m_Scale.

344  {
345  std::ostringstream str;
346 
347  str << " ind | low edge | center" << std::endl;
348  str << "-------------------------------------------" << std::endl;
349  for(int i=0; i<m_NBins; i++){
350  unsigned int ipack = getPacked(m_Scale[i]);
351  str << std::setw(4) << ipack <<
352  " | " << std::setw(10) << getLowEdge(ipack) <<
353  " | " << std::setw(10) << getCenter(ipack) << std::endl;
354  }
355 
356  return str.str();
357  }
int i
Definition: DBlmapReader.cc:9
std::vector< float > m_Scale
Definition: L1MuScale.h:362
virtual unsigned getPacked(float value) const
pack a value
Definition: L1MuScale.h:321
virtual float getCenter(unsigned packed) const
get the center of bin represented by packed
Definition: L1MuScale.h:297
virtual float getLowEdge(unsigned packed) const
get the low edge of bin represented by packed
Definition: L1MuScale.h:306

Member Data Documentation

int L1MuSymmetricBinnedScale::m_NBins
protected
L1MuPseudoSignedPacking L1MuSymmetricBinnedScale::m_packing
protected

Definition at line 360 of file L1MuScale.h.

Referenced by getCenter(), getLowEdge(), and getPacked().

std::vector<float> L1MuSymmetricBinnedScale::m_Scale
protected