CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/plugins/ExtractStringFromDDD.h"
00002 #include "DetectorDescription/Core/interface/DDFilteredView.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include <vector>
00005 #include <string>
00006 
00007 using namespace cms;
00008 
00009 std::string ExtractStringFromDDD::getString(std::string const & s,DDFilteredView* fv){ 
00010   DDValue val(s);
00011   std::vector<const DDsvalues_type *> result;
00012   fv->specificsV(result);
00013   std::vector<const DDsvalues_type *>::iterator it = result.begin();
00014   bool foundIt = false;
00015   for (; it != result.end(); ++it)   {
00016     foundIt = DDfetch(*it,val);
00017     if (foundIt) break;
00018   }    
00019   if (foundIt)   { 
00020     std::vector<std::string> const & temp = val.strings();
00021     if (temp.size() != 1) {
00022      throw cms::Exception("Configuration")<< " ERROR: I need 1 "<< s << " tags";
00023     }
00024     return temp[0]; 
00025   }
00026   return "NotFound";
00027 }