CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeomDetTypeIdToEnum.cc
Go to the documentation of this file.
2 
3 using namespace GeomDetEnumerators;
4 
5 
7  _map.clear();
8  _reverseMap.clear();
9  //
10  // Insert !
11  //
12 
13  _map.insert(std::pair<int, SubDetector>(1,PixelBarrel));
14  _map.insert(std::pair<int, SubDetector>(2,PixelEndcap));
15  _map.insert(std::pair<int, SubDetector>(3,TIB));
16  _map.insert(std::pair<int, SubDetector>(4,TID));
17  _map.insert(std::pair<int, SubDetector>(5,TOB));
18  _map.insert(std::pair<int, SubDetector>(6,TEC));
19 
20  //
21  // build reverse map
22  //
23 
24  _reverseMap.insert(std::pair<SubDetector, int>(PixelBarrel,1));
25  _reverseMap.insert(std::pair<SubDetector, int>(PixelEndcap,2));
26  _reverseMap.insert(std::pair<SubDetector, int>(TIB,3));
27  _reverseMap.insert(std::pair<SubDetector, int>(TID,4));
28  _reverseMap.insert(std::pair<SubDetector, int>(TOB,5));
29  _reverseMap.insert(std::pair<SubDetector, int>(TEC,6));
30  _reverseMap.insert(std::pair<SubDetector, int>(invalidDet,100));// detID(GeomDetTyp::SubDetector t) default was to return 100;
31  //
32  // done
33  //
34 }
35 
37  if (_map.find(s) != _map.end())
38  return (_map.find(s))->second;
39  return invalidDet;
40 }
41 
43  if (_reverseMap.find(t) != _reverseMap.end())
44  return (_reverseMap.find(t))->second;
45  return _reverseMap.find(invalidDet)->second;
46 }
47 
48 
U second(std::pair< T, U > const &p)
int detId(GeomDetType::SubDetector) const
GeomDetType::SubDetector type(int) const