CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Geometry/TrackerNumberingBuilder/src/CmsTrackerStringToEnum.cc

Go to the documentation of this file.
00001 #include "Geometry/TrackerNumberingBuilder/interface/CmsTrackerStringToEnum.h"
00002 
00003 CmsTrackerStringToEnum::Impl CmsTrackerStringToEnum::m_impl;
00004 
00005 CmsTrackerStringToEnum::Impl::Impl(){
00006   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("FullTracker",GeometricDet::Tracker));
00007 
00008   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrel",GeometricDet::PixelBarrel));
00009   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLayer",GeometricDet::layer));
00010   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelLadder",GeometricDet::ladder));
00011   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelBarrelDet",GeometricDet::DetUnit));
00012 
00013   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapSubDet",GeometricDet::PixelEndCap));
00014   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDisk",GeometricDet::disk));  
00015   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapPanel",GeometricDet::panel));  
00016   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("PixelEndcapDet",GeometricDet::DetUnit)); 
00017 
00018   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIB",GeometricDet::TIB));
00019   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBLayer",GeometricDet::layer));
00020   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBString",GeometricDet::strng));
00021   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBGluedDet",GeometricDet::mergedDet));
00022   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIBDet",GeometricDet::DetUnit));
00023 
00024   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TID",GeometricDet::TID));
00025   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDWheel",GeometricDet::wheel));
00026   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDRing",GeometricDet::ring));
00027   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDGluedDet",GeometricDet::mergedDet));
00028   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TIDDet",GeometricDet::DetUnit));
00029 
00030   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOB",GeometricDet::TOB));
00031   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBLayer",GeometricDet::layer));
00032   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBRod",GeometricDet::rod));
00033   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBGluedDet",GeometricDet::mergedDet));
00034   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TOBDet",GeometricDet::DetUnit));
00035 
00036   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TEC",GeometricDet::TEC));
00037   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECWheel",GeometricDet::wheel));
00038   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECPetal",GeometricDet::petal));
00039   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECRing",GeometricDet::ring));
00040   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECGluedDet",GeometricDet::mergedDet));
00041   _map.insert(std::pair<std::string, GeometricDet::GeometricEnumType>("TECDet",GeometricDet::DetUnit));
00042 
00043 
00044   //
00045   // build reverse map
00046   //
00047 
00048   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::Tracker,"Tracker"));
00049   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelBarrel,"PixelBarrel"));
00050   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::PixelEndCap,"PixelEndCap"));
00051   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TIB,"TIB"));
00052   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TID,"TID"));
00053   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TOB,"TOB"));
00054   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::TEC,"TEC"));
00055   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::layer,"layer"));
00056   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::wheel,"Wheel"));
00057   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::strng,"String"));
00058   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::rod,"Rod"));
00059   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::petal,"Petal"));
00060   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ring,"Ring"));
00061   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::ladder,"Ladder"));
00062   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::mergedDet,"GluedDet"));
00063   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::DetUnit,"DetUnit"));
00064   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::disk,"Disk")); 
00065   _reverseMap.insert(std::pair<GeometricDet::GeometricEnumType, std::string>(GeometricDet::panel,"Panel")); 
00066 
00067   //
00068   // done
00069   //
00070 }
00071 
00072 GeometricDet::GeometricEnumType CmsTrackerStringToEnum::type(std::string const & s) const{
00073   MapEnumType::const_iterator p=map().find(s);
00074   if (p!= map().end()) return p->second;
00075   return GeometricDet::unknown;
00076 }
00077 
00078 std::string const & CmsTrackerStringToEnum::name(GeometricDet::GeometricEnumType t) const {
00079   static std::string const u("Unknown");
00080   ReverseMapEnumType::const_iterator p=reverseMap().find(t); 
00081   if (p!= reverseMap().end())
00082     return p->second;
00083   return u;
00084 }
00085