Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:18

0001 /// \file TrackerAlignableId.cc
0002 ///
0003 ///  $Revision: 1.12 $
0004 ///  $Date: 2007/10/08 13:49:07 $
0005 ///  (last update by $Author: cklae $)
0006 
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 
0009 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0010 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0011 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0012 
0013 #include "Alignment/TrackerAlignment/interface/TrackerAlignableId.h"
0014 
0015 //__________________________________________________________________________________________________
0016 // Returns alignable object id and layer (or wheel, or disk) number from a DetId
0017 std::pair<int, int> TrackerAlignableId::typeAndLayerFromDetId(const DetId& detId, const TrackerTopology* tTopo) const {
0018   int layerNumber = 0;
0019 
0020   unsigned int subdetId = static_cast<unsigned int>(detId.subdetId());
0021 
0022   if (subdetId == StripSubdetector::TIB) {
0023     layerNumber = tTopo->tibLayer(detId.rawId());
0024   } else if (subdetId == StripSubdetector::TOB) {
0025     layerNumber = tTopo->tobLayer(detId.rawId());
0026   } else if (subdetId == StripSubdetector::TID) {
0027     layerNumber = tTopo->tidWheel(detId.rawId());
0028   } else if (subdetId == StripSubdetector::TEC) {
0029     layerNumber = tTopo->tecWheel(detId.rawId());
0030   } else if (subdetId == PixelSubdetector::PixelBarrel) {
0031     layerNumber = tTopo->pxbLayer(detId.rawId());
0032   } else if (subdetId == PixelSubdetector::PixelEndcap) {
0033     layerNumber = tTopo->pxfDisk(detId.rawId());
0034   } else
0035     edm::LogWarning("LogicError") << "Unknown subdetid: " << subdetId;
0036 
0037   return std::make_pair(subdetId, layerNumber);
0038 }