Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:05:28

0001 #include "Geometry/TrackerNumberingBuilder/interface/CmsTrackerStringToEnum.h"
0002 
0003 const CmsTrackerStringToEnum::Impl CmsTrackerStringToEnum::m_impl;
0004 
0005 CmsTrackerStringToEnum::Impl::Impl() {
0006   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("FullTracker", GeometricDet::Tracker));
0007 
0008   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrel", GeometricDet::PixelBarrel));
0009   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLayer", GeometricDet::layer));
0010   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLadder", GeometricDet::ladder));
0011   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelDet", GeometricDet::DetUnit));
0012 
0013   _map.insert(
0014       std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1Barrel", GeometricDet::PixelPhase1Barrel));
0015 
0016   _map.insert(
0017       std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2Barrel", GeometricDet::PixelPhase2Barrel));
0018 
0019   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrel", GeometricDet::OTPhase2Barrel));
0020   _map.insert(
0021       std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelLayer", GeometricDet::OTPhase2Layer));
0022   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelPanel", GeometricDet::panel));
0023   _map.insert(
0024       std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTBarrelStack", GeometricDet::OTPhase2Stack));
0025 
0026   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapSubDet", GeometricDet::PixelEndCap));
0027   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDisk", GeometricDet::disk));
0028   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapPanel", GeometricDet::panel));
0029   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDet", GeometricDet::DetUnit));
0030 
0031   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapSubDet",
0032                                                                       GeometricDet::PixelPhase1EndCap));
0033   _map.insert(
0034       std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase1EndcapDisk", GeometricDet::PixelPhase1Disk));
0035 
0036   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapSubDet",
0037                                                                       GeometricDet::PixelPhase2EndCap));
0038   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapFullDisk",
0039                                                                       GeometricDet::PixelPhase2FullDisk));
0040   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapReducedDisk",
0041                                                                       GeometricDet::PixelPhase2ReducedDisk));
0042   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapTDRDisk",
0043                                                                       GeometricDet::PixelPhase2TDRDisk));
0044   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapDoubleDisk",
0045                                                                       GeometricDet::PixelPhase2DoubleDisk));
0046   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelPhase2EndcapSubDisk",
0047                                                                       GeometricDet::PixelPhase2SubDisk));
0048 
0049   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcap", GeometricDet::OTPhase2EndCap));
0050   _map.insert(
0051       std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcapDisk", GeometricDet::OTPhase2Wheel));
0052   _map.insert(
0053       std::pair<std::string, GeometricDet::GeometricEnumType>("Phase2OTEndcapStack", GeometricDet::OTPhase2Stack));
0054 
0055   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIB", GeometricDet::TIB));
0056   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBLayer", GeometricDet::layer));
0057   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBString", GeometricDet::strng));
0058   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBGluedDet", GeometricDet::mergedDet));
0059   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBDet", GeometricDet::DetUnit));
0060 
0061   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TID", GeometricDet::TID));
0062   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDWheel", GeometricDet::wheel));
0063   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDRing", GeometricDet::ring));
0064   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDGluedDet", GeometricDet::mergedDet));
0065   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDDet", GeometricDet::DetUnit));
0066 
0067   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOB", GeometricDet::TOB));
0068   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBLayer", GeometricDet::layer));
0069   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBRod", GeometricDet::rod));
0070   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBGluedDet", GeometricDet::mergedDet));
0071   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBDet", GeometricDet::DetUnit));
0072 
0073   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TEC", GeometricDet::TEC));
0074   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECWheel", GeometricDet::wheel));
0075   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECPetal", GeometricDet::petal));
0076   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECRing", GeometricDet::ring));
0077   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECGluedDet", GeometricDet::mergedDet));
0078   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECDet", GeometricDet::DetUnit));
0079 
0080   //
0081   // build reverse map
0082   //
0083 
0084   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::Tracker, "Tracker"));
0085   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelBarrel, "PixelBarrel"));
0086   _reverseMap.insert(
0087       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Barrel, "PixelBarrel"));
0088   _reverseMap.insert(
0089       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2Barrel, "PixelBarrel"));
0090   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelEndCap, "PixelEndCap"));
0091   _reverseMap.insert(
0092       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1EndCap, "PixelEndCap"));
0093   _reverseMap.insert(
0094       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2EndCap, "PixelEndCap"));
0095   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TIB, "TIB"));
0096   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TID, "TID"));
0097   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TOB, "TOB"));
0098   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TEC, "TEC"));
0099   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::layer, "layer"));
0100   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Barrel, "TOB"));
0101   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Layer, "layer"));
0102   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::wheel, "Wheel"));
0103   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2EndCap, "TID"));
0104   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Wheel, "Wheel"));
0105   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::OTPhase2Stack, "Stack"));
0106   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::strng, "String"));
0107   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::rod, "Rod"));
0108   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::petal, "Petal"));
0109   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ring, "Ring"));
0110   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ladder, "Ladder"));
0111   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::mergedDet, "GluedDet"));
0112   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::DetUnit, "DetUnit"));
0113   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::disk, "Disk"));
0114   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase1Disk, "Disk"));
0115   _reverseMap.insert(
0116       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2FullDisk, "Disk"));
0117   _reverseMap.insert(
0118       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2ReducedDisk, "Disk"));
0119   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2TDRDisk, "Disk"));
0120   _reverseMap.insert(
0121       std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2DoubleDisk, "Disk"));
0122   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelPhase2SubDisk, "Disk"));
0123   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::panel, "Panel"));
0124   //
0125   // done
0126   //
0127 }
0128 
0129 GeometricDet::GeometricEnumType CmsTrackerStringToEnum::type(std::string const& s) const {
0130   MapEnumType::const_iterator p = map().find(s);
0131   if (p != map().end())
0132     return p->second;
0133   return GeometricDet::unknown;
0134 }
0135 
0136 std::string const& CmsTrackerStringToEnum::name(GeometricDet::GeometricEnumType t) const {
0137   static std::string const u("Unknown");
0138   ReverseMapEnumType::const_iterator p = reverseMap().find(t);
0139   if (p != reverseMap().end())
0140     return p->second;
0141   return u;
0142 }