CMS 3D CMS Logo

MTDBaseNumber.cc
Go to the documentation of this file.
2 
3 MTDBaseNumber::MTDBaseNumber() : _theLevels(0) {}
4 
6  : _sortedName(aBaseNumber._sortedName),
7  _sortedCopyNumber(aBaseNumber._sortedCopyNumber),
8  _theLevels(aBaseNumber._theLevels) {}
9 
10 void MTDBaseNumber::setSize(const int& size) {
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 }
20 
21 void MTDBaseNumber::addLevel(const std::string& name, const int& copyNumber) {
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 }
29 
30 int MTDBaseNumber::getLevels() const { return _theLevels; }
31 
33 
35  for (int iLevel = 0; iLevel < _theLevels; iLevel++) {
36  if (_sortedName[iLevel] == levelName) {
37  return _sortedCopyNumber[iLevel];
38  }
39  }
40  return 0;
41 }
42 
44 
45 int MTDBaseNumber::getCapacity() { return _sortedName.capacity(); }
46 
personalPlayback.level
level
Definition: personalPlayback.py:22
MTDBaseNumber::getCapacity
int getCapacity()
Definition: MTDBaseNumber.cc:45
MTDBaseNumber
Definition: MTDBaseNumber.h:15
MTDBaseNumber::_sortedName
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:35
MTDBaseNumber::getCopyNumber
int getCopyNumber(int level) const
Definition: MTDBaseNumber.cc:32
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
MTDBaseNumber::getLevels
int getLevels() const
Definition: MTDBaseNumber.cc:30
MTDBaseNumber::getLevelName
std::string const & getLevelName(int level) const
Definition: MTDBaseNumber.cc:43
MTDBaseNumber::_sortedCopyNumber
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:36
MTDBaseNumber::addLevel
void addLevel(const std::string &name, const int &copyNumber)
Definition: MTDBaseNumber.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDBaseNumber::_theLevels
int _theLevels
Definition: MTDBaseNumber.h:37
MTDBaseNumber::setSize
void setSize(const int &size)
Definition: MTDBaseNumber.cc:10
fwlog::levelName
const char * levelName(LogLevel)
Definition: fwLog.cc:32
MTDBaseNumber.h
Exception
Definition: hltDiff.cc:245
MTDBaseNumber::reset
void reset()
Definition: MTDBaseNumber.cc:47
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MTDBaseNumber::MAXLEVEL
static constexpr int MAXLEVEL
Definition: MTDBaseNumber.h:33
MTDBaseNumber::MTDBaseNumber
MTDBaseNumber()
Definition: MTDBaseNumber.cc:3
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443