CMS 3D CMS Logo

AlignableObjectId.cc

Go to the documentation of this file.
00001 #include "FWCore/Utilities/interface/Exception.h"
00002 
00003 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
00004 
00005 using namespace align;
00006 
00007 //__________________________________________________________________________________________________
00008 AlignableObjectId::AlignableObjectId()
00009 {
00010 
00011   // Names are defined here!
00012 
00013   theMap.clear();
00014   theReverseMap.clear();
00015 
00016   theMap.insert( PairEnumType( AlignableDetUnit, "DetUnit" ) );
00017   theMap.insert( PairEnumType( AlignableDet    , "Det"     ) );
00018 
00019   theMap.insert( PairEnumType(TPBModule      , "TPBModule"      ) );
00020   theMap.insert( PairEnumType(TPBLadder      , "TPBLadder"      ) );
00021   theMap.insert( PairEnumType(TPBLayer       , "TPBLayer"       ) );
00022   theMap.insert( PairEnumType(TPBHalfBarrel  , "TPBHalfBarrel"  ) );
00023   theMap.insert( PairEnumType(TPBBarrel      , "TPBBarrel"      ) );
00024 
00025   theMap.insert( PairEnumType(TPEModule      , "TPEModule"      ) );
00026   theMap.insert( PairEnumType(TPEPanel       , "TPEPanel"       ) );
00027   theMap.insert( PairEnumType(TPEBlade       , "TPEBlade"       ) );
00028   theMap.insert( PairEnumType(TPEHalfDisk    , "TPEHalfDisk"    ) );
00029   theMap.insert( PairEnumType(TPEHalfCylinder, "TPEHalfCylinder") );
00030   theMap.insert( PairEnumType(TPEEndcap      , "TPEEndcap"      ) );
00031 
00032   theMap.insert( PairEnumType(TIBModule      , "TIBModule"      ) );
00033   theMap.insert( PairEnumType(TIBString      , "TIBString"      ) );
00034   theMap.insert( PairEnumType(TIBSurface     , "TIBSurface"     ) );
00035   theMap.insert( PairEnumType(TIBHalfShell   , "TIBHalfShell"   ) );
00036   theMap.insert( PairEnumType(TIBLayer       , "TIBLayer"       ) );
00037   theMap.insert( PairEnumType(TIBHalfBarrel  , "TIBHalfBarrel"  ) );
00038   theMap.insert( PairEnumType(TIBBarrel      , "TIBBarrel"      ) );
00039 
00040   theMap.insert( PairEnumType(TIDModule      , "TIDModule"      ) );
00041   theMap.insert( PairEnumType(TIDSide        , "TIDSide"        ) );
00042   theMap.insert( PairEnumType(TIDRing        , "TIDRing"        ) );
00043   theMap.insert( PairEnumType(TIDDisk        , "TIDDisk"        ) );
00044   theMap.insert( PairEnumType(TIDEndcap      , "TIDEndcap"      ) );
00045 
00046   theMap.insert( PairEnumType(TOBModule      , "TOBModule"      ) );
00047   theMap.insert( PairEnumType(TOBRod         , "TOBRod"         ) );
00048   theMap.insert( PairEnumType(TOBLayer       , "TOBLayer"       ) );
00049   theMap.insert( PairEnumType(TOBHalfBarrel  , "TOBHalfBarrel"  ) );
00050   theMap.insert( PairEnumType(TOBBarrel      , "TOBBarrel"      ) );
00051 
00052   theMap.insert( PairEnumType(TECModule      , "TECModule"      ) );
00053   theMap.insert( PairEnumType(TECRing        , "TECRing"        ) );
00054   theMap.insert( PairEnumType(TECPetal       , "TECPetal"       ) );
00055   theMap.insert( PairEnumType(TECSide        , "TECSide"        ) );
00056   theMap.insert( PairEnumType(TECDisk        , "TECDisk"        ) );
00057   theMap.insert( PairEnumType(TECEndcap      , "TECEndcap"      ) );
00058 
00059   theMap.insert( PairEnumType(Pixel          , "Pixel"          ) );
00060   theMap.insert( PairEnumType(Strip          , "Strip"          ) );
00061   theMap.insert( PairEnumType(Tracker        , "Tracker"        ) );
00062 
00063   theMap.insert( PairEnumType( AlignableDTBarrel    ,  "DTBarrel"     ) );
00064   theMap.insert( PairEnumType( AlignableDTWheel     ,  "DTWheel"      ) );
00065   theMap.insert( PairEnumType( AlignableDTStation   ,  "DTStation"    ) );
00066   theMap.insert( PairEnumType( AlignableDTChamber   ,  "DTChamber"    ) );
00067   theMap.insert( PairEnumType( AlignableDTSuperLayer,  "DTSuperLayer" ) );
00068   theMap.insert( PairEnumType( AlignableDTLayer     ,  "DTLayer"      ) );
00069   theMap.insert( PairEnumType( AlignableCSCEndcap   ,  "CSCEndcap"    ) );
00070   theMap.insert( PairEnumType( AlignableCSCStation  ,  "CSCStation"   ) );
00071   theMap.insert( PairEnumType( AlignableCSCRing     ,  "CSCRing"      ) );
00072   theMap.insert( PairEnumType( AlignableCSCChamber  ,  "CSCChamber"   ) );
00073   theMap.insert( PairEnumType( AlignableCSCLayer    ,  "CSCLayer"     ) );
00074   theMap.insert( PairEnumType( AlignableMuon        ,  "Muon"         ) );
00075 
00076   // Create the reverse map
00077   std::transform( theMap.begin(), theMap.end(),
00078                   std::inserter( theReverseMap, theReverseMap.begin() ),
00079                   reverse_pair() );
00080 
00081 }
00082 
00083 
00084 //__________________________________________________________________________________________________
00085 const StructureType
00086 AlignableObjectId::nameToType( const std::string& name ) const
00087 {
00088   ReverseMapEnumType::const_iterator n = theReverseMap.find(name);
00089 
00090   if (theReverseMap.end() == n)
00091   {
00092     throw cms::Exception("AlignableObjectIdError")
00093       << "Unknown alignableObjectId " << name;
00094   }
00095 
00096   return n->second;
00097 }
00098 
00099 
00100 //__________________________________________________________________________________________________
00101 const std::string& AlignableObjectId::typeToName( StructureType type ) const
00102 {
00103   MapEnumType::const_iterator t = theMap.find(type);
00104 
00105   if (theMap.end() == t)
00106   {
00107     throw cms::Exception("AlignableObjectIdError")
00108       << "Unknown alignableObjectId " << type;
00109   }
00110 
00111   return t->second;
00112 }

Generated on Tue Jun 9 17:23:45 2009 for CMSSW by  doxygen 1.5.4