CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsTrackerStringToEnum.cc
Go to the documentation of this file.
2 
4 
6  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("FullTracker",GeometricDet::Tracker));
7 
8  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrel",GeometricDet::PixelBarrel));
9  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLayer",GeometricDet::layer));
10  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLadder",GeometricDet::ladder));
11  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelDet",GeometricDet::DetUnit));
12 
13  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1Barrel",GeometricDet::PixelPhase1Barrel));
14 
15  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrel",GeometricDet::OTPhase2Barrel));
16  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelLayer",GeometricDet::OTPhase2Layer));
17 
18  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapSubDet",GeometricDet::PixelEndCap));
19  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDisk",GeometricDet::disk));
20  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapPanel",GeometricDet::panel));
21  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDet",GeometricDet::DetUnit));
22 
23  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapSubDet",GeometricDet::PixelPhase1EndCap));
24  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapDisk",GeometricDet::PixelPhase1Disk));
25 
26  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapSubDet",GeometricDet::PixelPhase2EndCap));
27  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapFullDisk",GeometricDet::PixelPhase2FullDisk));
28  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapReducedDisk",GeometricDet::PixelPhase2ReducedDisk));
29 
30  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcap",GeometricDet::OTPhase2EndCap));
31  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcapDisk",GeometricDet::OTPhase2Wheel));
32 
33  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIB",GeometricDet::TIB));
34  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBLayer",GeometricDet::layer));
35  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBString",GeometricDet::strng));
36  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBGluedDet",GeometricDet::mergedDet));
37  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBDet",GeometricDet::DetUnit));
38 
39  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TID",GeometricDet::TID));
40  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDWheel",GeometricDet::wheel));
41  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDRing",GeometricDet::ring));
42  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDGluedDet",GeometricDet::mergedDet));
43  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDDet",GeometricDet::DetUnit));
44 
45  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOB",GeometricDet::TOB));
46  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBLayer",GeometricDet::layer));
47  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBRod",GeometricDet::rod));
48  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBGluedDet",GeometricDet::mergedDet));
49  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBDet",GeometricDet::DetUnit));
50 
51  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TEC",GeometricDet::TEC));
52  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECWheel",GeometricDet::wheel));
53  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECPetal",GeometricDet::petal));
54  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECRing",GeometricDet::ring));
55  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECGluedDet",GeometricDet::mergedDet));
56  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECDet",GeometricDet::DetUnit));
57 
58 
59  //
60  // build reverse map
61  //
62 
63  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::Tracker,"Tracker"));
64  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelBarrel,"PixelBarrel"));
65  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Barrel,"PixelBarrel"));
66  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelEndCap,"PixelEndCap"));
67  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1EndCap,"PixelEndCap"));
68  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2EndCap,"PixelEndCap"));
69  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TIB,"TIB"));
70  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TID,"TID"));
71  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TOB,"TOB"));
72  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TEC,"TEC"));
73  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::layer,"layer"));
74  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Barrel,"TOB"));
75  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Layer,"layer"));
76  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::wheel,"Wheel"));
77  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2EndCap,"TID"));
78  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Wheel,"Wheel"));
79  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::strng,"String"));
80  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::rod,"Rod"));
81  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::petal,"Petal"));
82  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ring,"Ring"));
83  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ladder,"Ladder"));
84  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::mergedDet,"GluedDet"));
85  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::DetUnit,"DetUnit"));
86  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::disk,"Disk"));
87  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Disk,"Disk"));
88  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2FullDisk,"Disk"));
89  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2ReducedDisk,"Disk"));
90  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::panel,"Panel"));
91 
92  //
93  // done
94  //
95 }
96 
98  MapEnumType::const_iterator p=map().find(s);
99  if (p!= map().end()) return p->second;
100  return GeometricDet::unknown;
101 }
102 
104  static std::string const u("Unknown");
105  ReverseMapEnumType::const_iterator p=reverseMap().find(t);
106  if (p!= reverseMap().end())
107  return p->second;
108  return u;
109 }
110 
enum GeometricDet::GDEnumType GeometricEnumType
static MapEnumType const & map()
static ReverseMapEnumType const & reverseMap()
#define end
Definition: vmac.h:37
std::string const & name(GeometricDet::GeometricEnumType) const
GeometricDet::GeometricEnumType type(std::string const &) const