CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Friends
L1MuSymmetricBinnedScale Class Reference

#include <L1MuScale.h>

Inheritance diagram for L1MuSymmetricBinnedScale:
L1MuScale

Public Member Functions

float getCenter (unsigned packed) const override
 get the center of bin represented by packed More...
 
float getHighEdge (unsigned packed) const override
 get the upper edge of bin represented by packed More...
 
float getLowEdge (unsigned packed) const override
 get the low edge of bin represented by packed More...
 
unsigned getNBins () const override
 get number of bins More...
 
unsigned getPacked (float value) const override
 pack a value More...
 
float getScaleMax () const override
 get the upper edge of the last bin (posivie half) More...
 
float getScaleMin () const override
 get the lower edge of the first bin (positive half) More...
 
float getValue (unsigned i) const override
 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)
 
std::string print () const override
 
 ~L1MuSymmetricBinnedScale () override
 destructor More...
 
- Public Member Functions inherited from L1MuScale
 L1MuScale ()
 
virtual ~L1MuScale ()
 

Protected Attributes

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

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

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 236 of file L1MuScale.h.

Constructor & Destructor Documentation

◆ L1MuSymmetricBinnedScale() [1/3]

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 246 of file L1MuScale.h.

246 : m_NBins(0) {}

◆ L1MuSymmetricBinnedScale() [2/3]

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 251 of file L1MuScale.h.

253  m_NBins = NBins;
254  m_Scale.reserve(m_NBins + 1);
255  for (int i = 0; i < m_NBins + 1; i++)
256  // m_Scale[i] = Scale[i];
257  m_Scale.push_back(Scale[i]);
258  };

References mps_fire::i, m_NBins, m_Scale, and SiStripSourceConfigP5_cff::NBins.

◆ L1MuSymmetricBinnedScale() [3/3]

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 270 of file L1MuScale.h.

271  m_NBins = NBins;
272  m_Scale.reserve(m_NBins + 1);
273  for (int i = 0; i < m_NBins + 1; i++)
274  // m_Scale[i] = xmin + i * (xmax-xmin) / m_NBins;
275  m_Scale.push_back(xmin + i * (xmax - xmin) / m_NBins);
276  };

References mps_fire::i, m_NBins, m_Scale, SiStripSourceConfigP5_cff::NBins, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

◆ ~L1MuSymmetricBinnedScale()

L1MuSymmetricBinnedScale::~L1MuSymmetricBinnedScale ( )
inlineoverride

destructor

Definition at line 279 of file L1MuScale.h.

279  {
280  // delete m_packing;
281  };

Member Function Documentation

◆ getCenter()

float L1MuSymmetricBinnedScale::getCenter ( unsigned  packed) const
inlineoverridevirtual

get the center of bin represented by packed

Implements L1MuScale.

Definition at line 284 of file L1MuScale.h.

284  {
285  int absidx = abs(m_packing.idxFromPacked(packed));
286  if (absidx >= m_NBins)
287  absidx = m_NBins - 1;
288  float center = (m_Scale[absidx] + m_Scale[absidx + 1]) / 2.;
289  float fsign = m_packing.signFromPacked(packed) == 0 ? 1. : -1.;
290  return center * fsign;
291  };

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

Referenced by print().

◆ getHighEdge()

float L1MuSymmetricBinnedScale::getHighEdge ( unsigned  packed) const
inlineoverridevirtual

get the upper edge of bin represented by packed

Implements L1MuScale.

Definition at line 304 of file L1MuScale.h.

304  {
305  edm::LogWarning("NotImplemented") << "L1MuSymmetricBinnedScale::getHighEdge not implemented" << std::endl;
306  return 0;
307  };

◆ getLowEdge()

float L1MuSymmetricBinnedScale::getLowEdge ( unsigned  packed) const
inlineoverridevirtual

get the low edge of bin represented by packed

Implements L1MuScale.

Definition at line 294 of file L1MuScale.h.

294  { // === edge towards 0
295  int absidx = abs(m_packing.idxFromPacked(packed));
296  if (absidx >= m_NBins)
297  absidx = m_NBins - 1;
298  float low = m_Scale[absidx];
299  float fsign = m_packing.signFromPacked(packed) == 0 ? 1. : -1.;
300  return low * fsign;
301  };

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

Referenced by print().

◆ getNBins()

unsigned L1MuSymmetricBinnedScale::getNBins ( ) const
inlineoverridevirtual

get number of bins

Implements L1MuScale.

Definition at line 331 of file L1MuScale.h.

331 { return m_NBins; }

References m_NBins.

◆ getPacked()

unsigned L1MuSymmetricBinnedScale::getPacked ( float  value) const
inlineoverridevirtual

pack a value

Implements L1MuScale.

Definition at line 310 of file L1MuScale.h.

310  {
311  float absval = fabs(value);
312  if (absval < m_Scale[0] || absval > m_Scale[m_NBins])
313  edm::LogWarning("ScaleRangeViolation")
314  << "L1MuSymmetricBinnedScale::getPacked: value out of scale range!!! abs(val) = " << absval
315  << " min= " << m_Scale[0] << " max = " << m_Scale[m_NBins] << std::endl;
316  int idx = 0;
317  for (; idx < m_NBins; idx++)
318  if (absval >= m_Scale[idx] && absval < m_Scale[idx + 1])
319  break;
320  if (idx >= m_NBins)
321  idx = m_NBins - 1;
322  return m_packing.packedFromIdx(idx, (value >= 0) ? 0 : 1);
323  };

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

Referenced by print().

◆ getScaleMax()

float L1MuSymmetricBinnedScale::getScaleMax ( ) const
inlineoverridevirtual

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

Implements L1MuScale.

Definition at line 325 of file L1MuScale.h.

325 { return m_Scale[m_NBins]; }

References m_NBins, and m_Scale.

◆ getScaleMin()

float L1MuSymmetricBinnedScale::getScaleMin ( ) const
inlineoverridevirtual

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

Implements L1MuScale.

Definition at line 328 of file L1MuScale.h.

328 { return m_Scale[0]; }

References m_Scale.

◆ getValue()

float L1MuSymmetricBinnedScale::getValue ( unsigned  i) const
inlineoverridevirtual

get value of the underlying vector for bin i

Implements L1MuScale.

Definition at line 334 of file L1MuScale.h.

334 { return m_Scale[i]; }

References mps_fire::i, and m_Scale.

◆ print()

std::string L1MuSymmetricBinnedScale::print ( void  ) const
inlineoverridevirtual

Implements L1MuScale.

Definition at line 336 of file L1MuScale.h.

336  {
337  std::ostringstream str;
338 
339  str << " ind | low edge | center" << std::endl;
340  str << "-------------------------------------------" << std::endl;
341  for (int i = 0; i < m_NBins; i++) {
342  unsigned int ipack = getPacked(m_Scale[i]);
343  str << std::setw(4) << ipack << " | " << std::setw(10) << getLowEdge(ipack) << " | " << std::setw(10)
344  << getCenter(ipack) << std::endl;
345  }
346 
347  return str.str();
348  }

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

◆ serialize()

template<class Archive >
void L1MuSymmetricBinnedScale::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 355 of file L1MuScale.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 355 of file L1MuScale.h.

Member Data Documentation

◆ m_NBins

int L1MuSymmetricBinnedScale::m_NBins
protected

◆ m_packing

L1MuPseudoSignedPacking L1MuSymmetricBinnedScale::m_packing
protected

Definition at line 351 of file L1MuScale.h.

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

◆ m_Scale

std::vector<float> L1MuSymmetricBinnedScale::m_Scale
protected
L1MuPseudoSignedPacking::packedFromIdx
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
Definition: L1MuPacking.h:157
mps_fire.i
i
Definition: mps_fire.py:428
L1MuSymmetricBinnedScale::m_NBins
int m_NBins
Definition: L1MuScale.h:352
L1MuSymmetricBinnedScale::m_packing
L1MuPseudoSignedPacking m_packing
Definition: L1MuScale.h:351
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
L1MuPseudoSignedPacking
Definition: L1MuPacking.h:140
str
#define str(s)
Definition: TestProcessor.cc:51
L1MuPseudoSignedPacking::idxFromPacked
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:150
L1MuSymmetricBinnedScale::getPacked
unsigned getPacked(float value) const override
pack a value
Definition: L1MuScale.h:310
L1MuPseudoSignedPacking::signFromPacked
int signFromPacked(unsigned packed) const override
get the (pseudo-)sign from the packed notation (0=positive, 1=negative)
Definition: L1MuPacking.h:147
value
Definition: value.py:1
L1MuSymmetricBinnedScale::getLowEdge
float getLowEdge(unsigned packed) const override
get the low edge of bin represented by packed
Definition: L1MuScale.h:294
SiStripSourceConfigP5_cff.NBins
NBins
Definition: SiStripSourceConfigP5_cff.py:4
L1MuSymmetricBinnedScale::getCenter
float getCenter(unsigned packed) const override
get the center of bin represented by packed
Definition: L1MuScale.h:284
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
L1MuSymmetricBinnedScale::m_Scale
std::vector< float > m_Scale
Definition: L1MuScale.h:353