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