CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Alignment/TrackerAlignment/src/TrackerAlignableId.cc

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00008 
00009 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00010 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00011 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
00012 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00013 
00014 #include "Alignment/TrackerAlignment/interface/TrackerAlignableId.h"
00015 
00016 
00017 //__________________________________________________________________________________________________
00018 // Returns alignable object id and layer (or wheel, or disk) number from a DetId
00019 std::pair<int,int> TrackerAlignableId::typeAndLayerFromDetId( const DetId& detId , const TrackerTopology* tTopo) const
00020 {
00021 
00022   int layerNumber = 0;
00023 
00024   unsigned int subdetId = static_cast<unsigned int>(detId.subdetId());
00025 
00026   if ( subdetId == StripSubdetector::TIB) 
00027         { 
00028            
00029           layerNumber = tTopo->tibLayer(detId.rawId());
00030         }
00031   else if ( subdetId ==  StripSubdetector::TOB )
00032         { 
00033            
00034           layerNumber = tTopo->tobLayer(detId.rawId());
00035         }
00036   else if ( subdetId ==  StripSubdetector::TID) 
00037         { 
00038           
00039           layerNumber = tTopo->tidWheel(detId.rawId());
00040         }
00041   else if ( subdetId ==  StripSubdetector::TEC )
00042         { 
00043            
00044           layerNumber = tTopo->tecWheel(detId.rawId()); 
00045         }
00046   else if ( subdetId ==  PixelSubdetector::PixelBarrel ) 
00047         { 
00048            
00049           layerNumber = tTopo->pxbLayer(detId.rawId());  
00050         }
00051   else if ( subdetId ==  PixelSubdetector::PixelEndcap ) 
00052         { 
00053            
00054           layerNumber = tTopo->pxfDisk(detId.rawId());  
00055         }
00056   else
00057         edm::LogWarning("LogicError") << "Unknown subdetid: " <<  subdetId;
00058 
00059 
00060   return std::make_pair( subdetId, layerNumber );
00061 
00062 }