CMS 3D CMS Logo

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

#include <MTDBaseNumber.h>

Public Member Functions

void addLevel (const std::string_view name, const int copyNumber)
 
int getCapacity ()
 
int getCopyNumber (int level) const
 
int getCopyNumber (const std::string_view levelName) const
 
std::string_view const & getLevelName (int level) const
 
int getLevels () const
 
 MTDBaseNumber ()
 
 MTDBaseNumber (const MTDBaseNumber &aBaseNumber)
 
void reset ()
 
void setSize (const int size)
 
 ~MTDBaseNumber ()
 

Protected Attributes

std::vector< int > _sortedCopyNumber
 
std::vector< std::string_view > _sortedName
 
int _theLevels
 

Static Protected Attributes

static constexpr int MAXLEVEL = 20
 

Detailed Description

Cloned from the EcalBaseNumber class

Definition at line 15 of file MTDBaseNumber.h.

Constructor & Destructor Documentation

MTDBaseNumber::MTDBaseNumber ( )

Definition at line 3 of file MTDBaseNumber.cc.

3 : _theLevels(0) {}
MTDBaseNumber::MTDBaseNumber ( const MTDBaseNumber aBaseNumber)

Definition at line 5 of file MTDBaseNumber.cc.

6  : _sortedName(aBaseNumber._sortedName),
8  _theLevels(aBaseNumber._theLevels) {}
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35
MTDBaseNumber::~MTDBaseNumber ( )
inline

Definition at line 19 of file MTDBaseNumber.h.

19 {}

Member Function Documentation

void MTDBaseNumber::addLevel ( const std::string_view  name,
const int  copyNumber 
)

Definition at line 21 of file MTDBaseNumber.cc.

References _sortedCopyNumber, _sortedName, _theLevels, Exception, MAXLEVEL, and mergeVDriftHistosByStation::name.

Referenced by MtdSD::getBaseNumber().

21  {
22  if (_theLevels == MAXLEVEL - 1) {
23  throw cms::Exception("WrongMTDGeom") << "MTDBaseNumber required to add more levels than maximum allowed";
24  }
26  _sortedCopyNumber[_theLevels] = copyNumber;
27  _theLevels++;
28 }
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
static constexpr int MAXLEVEL
Definition: MTDBaseNumber.h:33
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35
int MTDBaseNumber::getCapacity ( )

Definition at line 45 of file MTDBaseNumber.cc.

References _sortedName.

Referenced by MtdSD::getBaseNumber().

45 { return _sortedName.capacity(); }
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35
int MTDBaseNumber::getCopyNumber ( int  level) const

Definition at line 32 of file MTDBaseNumber.cc.

References _sortedCopyNumber, and testEve_cfg::level.

Referenced by BTLNumberingScheme::getUnitID(), and ETLNumberingScheme::getUnitID().

32 { return _sortedCopyNumber[level]; }
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
tuple level
Definition: testEve_cfg.py:47
int MTDBaseNumber::getCopyNumber ( const std::string_view  levelName) const

Definition at line 34 of file MTDBaseNumber.cc.

References _sortedCopyNumber, _sortedName, and _theLevels.

34  {
35  for (int iLevel = 0; iLevel < _theLevels; iLevel++) {
36  if (_sortedName[iLevel] == levelName) {
37  return _sortedCopyNumber[iLevel];
38  }
39  }
40  return 0;
41 }
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
const char * levelName(LogLevel)
Definition: fwLog.cc:32
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35
std::string_view const & MTDBaseNumber::getLevelName ( int  level) const

Definition at line 43 of file MTDBaseNumber.cc.

References _sortedName, and testEve_cfg::level.

Referenced by BTLNumberingScheme::getUnitID(), and ETLNumberingScheme::getUnitID().

43 { return _sortedName[level]; }
tuple level
Definition: testEve_cfg.py:47
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35
int MTDBaseNumber::getLevels ( ) const

Definition at line 30 of file MTDBaseNumber.cc.

References _theLevels.

Referenced by BTLNumberingScheme::getUnitID(), and ETLNumberingScheme::getUnitID().

30 { return _theLevels; }
void MTDBaseNumber::reset ( void  )

Definition at line 47 of file MTDBaseNumber.cc.

References _theLevels.

Referenced by MtdSD::getBaseNumber().

47 { _theLevels = 0; }
void MTDBaseNumber::setSize ( const int  size)

Definition at line 10 of file MTDBaseNumber.cc.

References _sortedCopyNumber, _sortedName, and MAXLEVEL.

Referenced by MtdSD::getBaseNumber().

10  {
11  if (size < MAXLEVEL) {
12  _sortedName.resize(size);
13  _sortedCopyNumber.resize(size);
14  } else {
15  _sortedName.resize(MAXLEVEL);
17  edm::LogWarning("MTDGeom") << "Required base number size exceeding maximum";
18  }
19 }
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
static constexpr int MAXLEVEL
Definition: MTDBaseNumber.h:33
Log< level::Warning, false > LogWarning
tuple size
Write out results.
std::vector< std::string_view > _sortedName
Definition: MTDBaseNumber.h:35

Member Data Documentation

std::vector<int> MTDBaseNumber::_sortedCopyNumber
protected

Definition at line 36 of file MTDBaseNumber.h.

Referenced by addLevel(), getCopyNumber(), and setSize().

std::vector<std::string_view> MTDBaseNumber::_sortedName
protected

Definition at line 35 of file MTDBaseNumber.h.

Referenced by addLevel(), getCapacity(), getCopyNumber(), getLevelName(), and setSize().

int MTDBaseNumber::_theLevels
protected

Definition at line 37 of file MTDBaseNumber.h.

Referenced by addLevel(), getCopyNumber(), getLevels(), and reset().

constexpr int MTDBaseNumber::MAXLEVEL = 20
staticprotected

Definition at line 33 of file MTDBaseNumber.h.

Referenced by addLevel(), and setSize().