Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:29

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