CMS 3D CMS Logo

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(
14  std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1Barrel", GeometricDet::PixelPhase1Barrel));
15 
16  _map.insert(
17  std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2Barrel", GeometricDet::PixelPhase2Barrel));
18 
19  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrel", GeometricDet::OTPhase2Barrel));
20  _map.insert(
21  std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelLayer", GeometricDet::OTPhase2Layer));
22  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelPanel", GeometricDet::panel));
23  _map.insert(
24  std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelStack", GeometricDet::OTPhase2Stack));
25 
26  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapSubDet", GeometricDet::PixelEndCap));
27  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDisk", GeometricDet::disk));
28  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapPanel", GeometricDet::panel));
29  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDet", GeometricDet::DetUnit));
30 
31  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapSubDet",
33  _map.insert(
34  std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapDisk", GeometricDet::PixelPhase1Disk));
35 
36  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapSubDet",
38  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapFullDisk",
40  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapReducedDisk",
42  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapTDRDisk",
44  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapDoubleDisk",
46  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapSubDisk",
48 
49  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcap", GeometricDet::OTPhase2EndCap));
50  _map.insert(
51  std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcapDisk", GeometricDet::OTPhase2Wheel));
52  _map.insert(
53  std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcapStack", GeometricDet::OTPhase2Stack));
54 
55  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIB", GeometricDet::TIB));
56  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBLayer", GeometricDet::layer));
57  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBString", GeometricDet::strng));
58  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBGluedDet", GeometricDet::mergedDet));
59  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBDet", GeometricDet::DetUnit));
60 
61  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TID", GeometricDet::TID));
62  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDWheel", GeometricDet::wheel));
63  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDRing", GeometricDet::ring));
64  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDGluedDet", GeometricDet::mergedDet));
65  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDDet", GeometricDet::DetUnit));
66 
67  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOB", GeometricDet::TOB));
68  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBLayer", GeometricDet::layer));
69  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBRod", GeometricDet::rod));
70  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBGluedDet", GeometricDet::mergedDet));
71  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBDet", GeometricDet::DetUnit));
72 
73  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TEC", GeometricDet::TEC));
74  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECWheel", GeometricDet::wheel));
75  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECPetal", GeometricDet::petal));
76  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECRing", GeometricDet::ring));
77  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECGluedDet", GeometricDet::mergedDet));
78  _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECDet", GeometricDet::DetUnit));
79 
80  //
81  // build reverse map
82  //
83 
84  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::Tracker, "Tracker"));
85  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelBarrel, "PixelBarrel"));
86  _reverseMap.insert(
87  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Barrel, "PixelBarrel"));
88  _reverseMap.insert(
89  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2Barrel, "PixelBarrel"));
90  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelEndCap, "PixelEndCap"));
91  _reverseMap.insert(
92  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1EndCap, "PixelEndCap"));
93  _reverseMap.insert(
94  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2EndCap, "PixelEndCap"));
95  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TIB, "TIB"));
96  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TID, "TID"));
97  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TOB, "TOB"));
98  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TEC, "TEC"));
99  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::layer, "layer"));
100  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Barrel, "TOB"));
101  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Layer, "layer"));
102  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::wheel, "Wheel"));
103  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2EndCap, "TID"));
104  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Wheel, "Wheel"));
105  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Stack, "Stack"));
106  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::strng, "String"));
107  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::rod, "Rod"));
108  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::petal, "Petal"));
109  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ring, "Ring"));
110  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ladder, "Ladder"));
111  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::mergedDet, "GluedDet"));
112  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::DetUnit, "DetUnit"));
113  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::disk, "Disk"));
114  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Disk, "Disk"));
115  _reverseMap.insert(
116  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2FullDisk, "Disk"));
117  _reverseMap.insert(
118  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2ReducedDisk, "Disk"));
119  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2TDRDisk, "Disk"));
120  _reverseMap.insert(
121  std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2DoubleDisk, "Disk"));
122  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2SubDisk, "Disk"));
123  _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::panel, "Panel"));
124  //
125  // done
126  //
127 }
128 
130  MapEnumType::const_iterator p = map().find(s);
131  if (p != map().end())
132  return p->second;
133  return GeometricDet::unknown;
134 }
135 
137  static std::string const u("Unknown");
138  ReverseMapEnumType::const_iterator p = reverseMap().find(t);
139  if (p != reverseMap().end())
140  return p->second;
141  return u;
142 }
enum GeometricDet::GDEnumType GeometricEnumType
static MapEnumType const & map()
static ReverseMapEnumType const & reverseMap()
std::string const & name(GeometricDet::GeometricEnumType) const
GeometricDet::GeometricEnumType type(std::string const &) const