Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:12

0001 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
0002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0003 #include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include <vector>
0006 #include <string>
0007 
0008 template <>
0009 std::string ExtractStringFromDDD<DDFilteredView>::getString(const std::string &s, DDFilteredView *fv) {
0010   DDValue val(s);
0011   std::vector<const DDsvalues_type *> result;
0012   fv->specificsV(result);
0013   std::vector<const DDsvalues_type *>::iterator it = result.begin();
0014   bool foundIt = false;
0015   for (; it != result.end(); ++it) {
0016     foundIt = DDfetch(*it, val);
0017     if (foundIt)
0018       break;
0019   }
0020   if (foundIt) {
0021     std::vector<std::string> const &temp = val.strings();
0022     if (temp.size() != 1) {
0023       throw cms::Exception("Configuration") << " ERROR: I need 1 " << s << " tags";
0024     }
0025     return temp[0];
0026   }
0027   return "NotFound";
0028 }
0029 
0030 template <>
0031 std::string ExtractStringFromDDD<cms::DDFilteredView>::getString(const std::string &s, cms::DDFilteredView *fv) {
0032   auto result = fv->getString(s);
0033   return {result.data(), result.size()};
0034 }