CMS 3D CMS Logo

MTDBaseNumber.cc
Go to the documentation of this file.
2 
3 MTDBaseNumber::MTDBaseNumber():_theLevels(0) { }
4 
6  _sortedName(aBaseNumber._sortedName),
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  }
15  else {
16  _sortedName.resize(MAXLEVEL);
18  edm::LogWarning("MTDGeom") << "Required base number size exceeding maximum";
19  }
20 }
21 
22 void MTDBaseNumber::addLevel(const std::string& name, const int & copyNumber)
23 {
24  if ( _theLevels == MAXLEVEL-1 ) {
25  throw cms::Exception("WrongMTDGeom") << "MTDBaseNumber required to add more levels than maximum allowed";
26  }
28  _sortedCopyNumber[_theLevels] = copyNumber;
29  _theLevels++;
30 }
31 
33 {
34  return _theLevels;
35 }
36 
38 {
39  return _sortedCopyNumber[level];
40 }
41 
43 {
44  for ( int iLevel = 0; iLevel < _theLevels; iLevel++ ) {
45  if ( _sortedName[iLevel] == levelName ) { return _sortedCopyNumber[iLevel]; }
46  }
47  return 0;
48 }
49 
51 {
52  return _sortedName[level];
53 }
54 
56 {
57  return _sortedName.capacity();
58 }
59 
61 {
62  _theLevels = 0;
63 }
64 
size
Write out results.
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:36
static int MAXLEVEL
Definition: MTDBaseNumber.h:34
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:37
int getLevels() const
const char * levelName(LogLevel)
Definition: fwLog.cc:34
void setSize(const int &size)
int getCopyNumber(int level) const
void addLevel(const std::string &name, const int &copyNumber)
std::string const & getLevelName(int level) const