00001 00002 00003 00004 00005 00006 00007 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00008 00009 #include "DataFormats/SiStripDetId/interface/TOBDetId.h" 00010 #include "DataFormats/SiStripDetId/interface/TIBDetId.h" 00011 #include "DataFormats/SiStripDetId/interface/TIDDetId.h" 00012 #include "DataFormats/SiStripDetId/interface/TECDetId.h" 00013 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h" 00014 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h" 00015 00016 #include "Alignment/TrackerAlignment/interface/TrackerAlignableId.h" 00017 00018 00019 //__________________________________________________________________________________________________ 00020 // Returns alignable object id and layer (or wheel, or disk) number from a DetId 00021 std::pair<int,int> TrackerAlignableId::typeAndLayerFromDetId( const DetId& detId ) const 00022 { 00023 00024 int layerNumber = 0; 00025 00026 unsigned int subdetId = static_cast<unsigned int>(detId.subdetId()); 00027 00028 if ( subdetId == StripSubdetector::TIB) 00029 { 00030 TIBDetId tibid(detId.rawId()); 00031 layerNumber = tibid.layer(); 00032 } 00033 else if ( subdetId == StripSubdetector::TOB ) 00034 { 00035 TOBDetId tobid(detId.rawId()); 00036 layerNumber = tobid.layer(); 00037 } 00038 else if ( subdetId == StripSubdetector::TID) 00039 { 00040 TIDDetId tidid(detId.rawId()); 00041 layerNumber = tidid.wheel(); 00042 } 00043 else if ( subdetId == StripSubdetector::TEC ) 00044 { 00045 TECDetId tecid(detId.rawId()); 00046 layerNumber = tecid.wheel(); 00047 } 00048 else if ( subdetId == PixelSubdetector::PixelBarrel ) 00049 { 00050 PXBDetId pxbid(detId.rawId()); 00051 layerNumber = pxbid.layer(); 00052 } 00053 else if ( subdetId == PixelSubdetector::PixelEndcap ) 00054 { 00055 PXFDetId pxfid(detId.rawId()); 00056 layerNumber = pxfid.disk(); 00057 } 00058 else 00059 edm::LogWarning("LogicError") << "Unknown subdetid: " << subdetId; 00060 00061 00062 return std::make_pair( subdetId, layerNumber ); 00063 00064 }