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 (int level) const
 
int getCopyNumber (const std::string &levelName) 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 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.

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

Member Function Documentation

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

Definition at line 22 of file MTDBaseNumber.cc.

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

Referenced by MtdSD::getBaseNumber(), and ~MTDBaseNumber().

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 }
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 MTDBaseNumber::getCapacity ( )

Definition at line 55 of file MTDBaseNumber.cc.

References _sortedName.

Referenced by MtdSD::getBaseNumber(), and ~MTDBaseNumber().

56 {
57  return _sortedName.capacity();
58 }
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:36
int MTDBaseNumber::getCopyNumber ( int  level) const

Definition at line 37 of file MTDBaseNumber.cc.

References _sortedCopyNumber, and hcalDigis_cfi::level.

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

38 {
39  return _sortedCopyNumber[level];
40 }
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:37
int MTDBaseNumber::getCopyNumber ( const std::string &  levelName) const

Definition at line 42 of file MTDBaseNumber.cc.

References _sortedCopyNumber, _sortedName, and _theLevels.

43 {
44  for ( int iLevel = 0; iLevel < _theLevels; iLevel++ ) {
45  if ( _sortedName[iLevel] == levelName ) { return _sortedCopyNumber[iLevel]; }
46  }
47  return 0;
48 }
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:36
std::vector< int > _sortedCopyNumber
Definition: MTDBaseNumber.h:37
const char * levelName(LogLevel)
Definition: fwLog.cc:34
std::string const & MTDBaseNumber::getLevelName ( int  level) const

Definition at line 50 of file MTDBaseNumber.cc.

References _sortedName, and hcalDigis_cfi::level.

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

51 {
52  return _sortedName[level];
53 }
std::vector< std::string > _sortedName
Definition: MTDBaseNumber.h:36
int MTDBaseNumber::getLevels ( ) const

Definition at line 32 of file MTDBaseNumber.cc.

References _theLevels.

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

33 {
34  return _theLevels;
35 }
void MTDBaseNumber::reset ( void  )

Definition at line 60 of file MTDBaseNumber.cc.

References _theLevels.

Referenced by MtdSD::getBaseNumber(), and ~MTDBaseNumber().

61 {
62  _theLevels = 0;
63 }
void MTDBaseNumber::setSize ( const int &  size)

Definition at line 10 of file MTDBaseNumber.cc.

References _sortedCopyNumber, _sortedName, and MAXLEVEL.

Referenced by MtdSD::getBaseNumber(), and ~MTDBaseNumber().

10  {
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 }
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

Member Data Documentation

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

Definition at line 37 of file MTDBaseNumber.h.

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

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

Definition at line 36 of file MTDBaseNumber.h.

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

int MTDBaseNumber::_theLevels
protected

Definition at line 38 of file MTDBaseNumber.h.

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

int MTDBaseNumber::MAXLEVEL =20
staticprotected

Definition at line 34 of file MTDBaseNumber.h.

Referenced by addLevel(), and setSize().