CMS 3D CMS Logo

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 &name, const int &copyNumber)
 
int getCapacity ()
 
int getCopyNumber (const std::string &levelName) const
 
int getCopyNumber (int level) const
 
std::string 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 > _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() [1/2]

MTDBaseNumber::MTDBaseNumber ( )

Definition at line 3 of file MTDBaseNumber.cc.

3 : _theLevels(0) {}

◆ MTDBaseNumber() [2/2]

MTDBaseNumber::MTDBaseNumber ( const MTDBaseNumber aBaseNumber)

Definition at line 5 of file MTDBaseNumber.cc.

6  : _sortedName(aBaseNumber._sortedName),
8  _theLevels(aBaseNumber._theLevels) {}

◆ ~MTDBaseNumber()

MTDBaseNumber::~MTDBaseNumber ( )
inline

Definition at line 19 of file MTDBaseNumber.h.

19 {}

Member Function Documentation

◆ addLevel()

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

Definition at line 21 of file MTDBaseNumber.cc.

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 }

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

Referenced by MtdSD::getBaseNumber().

◆ getCapacity()

int MTDBaseNumber::getCapacity ( )

Definition at line 45 of file MTDBaseNumber.cc.

45 { return _sortedName.capacity(); }

References _sortedName.

Referenced by MtdSD::getBaseNumber().

◆ getCopyNumber() [1/2]

int MTDBaseNumber::getCopyNumber ( const std::string &  levelName) const

Definition at line 34 of file MTDBaseNumber.cc.

34  {
35  for (int iLevel = 0; iLevel < _theLevels; iLevel++) {
36  if (_sortedName[iLevel] == levelName) {
37  return _sortedCopyNumber[iLevel];
38  }
39  }
40  return 0;
41 }

References _sortedCopyNumber, _sortedName, _theLevels, and fwlog::levelName().

◆ getCopyNumber() [2/2]

int MTDBaseNumber::getCopyNumber ( int  level) const

◆ getLevelName()

std::string const & MTDBaseNumber::getLevelName ( int  level) const

Definition at line 43 of file MTDBaseNumber.cc.

43 { return _sortedName[level]; }

References _sortedName, and personalPlayback::level.

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

◆ getLevels()

int MTDBaseNumber::getLevels ( ) const

Definition at line 30 of file MTDBaseNumber.cc.

30 { return _theLevels; }

References _theLevels.

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

◆ reset()

void MTDBaseNumber::reset ( void  )

Definition at line 47 of file MTDBaseNumber.cc.

47 { _theLevels = 0; }

References _theLevels.

Referenced by MtdSD::getBaseNumber().

◆ setSize()

void MTDBaseNumber::setSize ( const int &  size)

Definition at line 10 of file MTDBaseNumber.cc.

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 }

References _sortedCopyNumber, _sortedName, MAXLEVEL, and findQualityFiles::size.

Referenced by MtdSD::getBaseNumber().

Member Data Documentation

◆ _sortedCopyNumber

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

Definition at line 36 of file MTDBaseNumber.h.

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

◆ _sortedName

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

Definition at line 35 of file MTDBaseNumber.h.

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

◆ _theLevels

int MTDBaseNumber::_theLevels
protected

Definition at line 37 of file MTDBaseNumber.h.

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

◆ MAXLEVEL

constexpr int MTDBaseNumber::MAXLEVEL = 20
staticconstexprprotected

Definition at line 33 of file MTDBaseNumber.h.

Referenced by addLevel(), and setSize().

personalPlayback.level
level
Definition: personalPlayback.py:22
MTDBaseNumber::_sortedName
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:35
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MTDBaseNumber::_sortedCopyNumber
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
MTDBaseNumber::_theLevels
int _theLevels
Definition: MTDBaseNumber.h:37
fwlog::levelName
const char * levelName(LogLevel)
Definition: fwLog.cc:32
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MTDBaseNumber::MAXLEVEL
static constexpr int MAXLEVEL
Definition: MTDBaseNumber.h:33
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443