Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-25 03:22:16

0001 #include "Geometry/MTDNumberingBuilder/interface/CmsMTDStringToEnum.h"
0002 
0003 const CmsMTDStringToEnum::Impl CmsMTDStringToEnum::m_impl;
0004 
0005 CmsMTDStringToEnum::Impl::Impl() {
0006   map_.emplace("FastTimerRegion", GeometricTimingDet::MTD);
0007   map_.emplace("BarrelTimingLayer", GeometricTimingDet::BTL);
0008   map_.emplace("Layer1", GeometricTimingDet::BTLLayer);
0009   map_.emplace("Layer1Timing", GeometricTimingDet::BTLLayer);
0010   map_.emplace("BModule", GeometricTimingDet::BTLModule);
0011   map_.emplace("BTLModu", GeometricTimingDet::BTLModule);  // truncate name to have the same length as old versions
0012   map_.emplace("EndcapTimingLayer", GeometricTimingDet::ETL);
0013   map_.emplace("Disc1", GeometricTimingDet::ETLDisc);
0014   map_.emplace("Disc1Timing", GeometricTimingDet::ETLDisc);
0015   map_.emplace("Disc2Timing", GeometricTimingDet::ETLDisc);
0016   map_.emplace("EModule", GeometricTimingDet::ETLModule);
0017 }
0018 
0019 GeometricTimingDet::GeometricTimingEnumType CmsMTDStringToEnum::type(std::string const& s) const {
0020   // remove namespace if present
0021   std::string_view v = s;
0022   auto first = v.find_first_of(':');
0023   v.remove_prefix(std::min(first + 1, v.size()));
0024   MapEnumType::const_iterator p = map().find({v.data(), v.size()});
0025   if (p != map().end())
0026     return p->second;
0027   return GeometricTimingDet::unknown;
0028 }