![]() |
![]() |
00001 #include <typeinfo> 00002 00003 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" 00004 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h" 00005 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00006 00007 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" 00008 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" 00009 #include "DataFormats/DetId/interface/DetId.h" 00010 00011 #include <algorithm> 00012 #include <iostream> 00013 #include <map> 00014 00015 TrackerGeometry::TrackerGeometry(GeometricDet const* gd) : theTrackerDet(gd){} 00016 00017 GeometricDet const * TrackerGeometry::trackerDet() const { 00018 return theTrackerDet; 00019 } 00020 00021 00022 void TrackerGeometry::addType(GeomDetType* p) { 00023 theDetTypes.push_back(p); // add to vector 00024 } 00025 00026 void TrackerGeometry::addDetUnit(GeomDetUnit* p) { 00027 theDetUnits.push_back(p); // add to vector 00028 theMapUnit.insert(std::make_pair(p->geographicalId().rawId(),p)); 00029 } 00030 00031 void TrackerGeometry::addDetUnitId(DetId p){ 00032 theDetUnitIds.push_back(p); 00033 } 00034 00035 void TrackerGeometry::addDet(GeomDet* p) { 00036 theDets.push_back(p); // add to vector 00037 theMap.insert(std::make_pair(p->geographicalId().rawId(),p)); 00038 DetId id(p->geographicalId()); 00039 switch(id.subdetId()){ 00040 case PixelSubdetector::PixelBarrel: 00041 thePXBDets.push_back(p); 00042 break; 00043 case PixelSubdetector::PixelEndcap: 00044 thePXFDets.push_back(p); 00045 break; 00046 case StripSubdetector::TIB: 00047 theTIBDets.push_back(p); 00048 break; 00049 case StripSubdetector::TID: 00050 theTIDDets.push_back(p); 00051 break; 00052 case StripSubdetector::TOB: 00053 theTOBDets.push_back(p); 00054 break; 00055 case StripSubdetector::TEC: 00056 theTECDets.push_back(p); 00057 break; 00058 default: 00059 edm::LogError("TrackerGeometry")<<"ERROR - I was expecting a Tracker Subdetector, I got a "<<id.subdetId(); 00060 } 00061 00062 00063 } 00064 00065 void TrackerGeometry::addDetId(DetId p){ 00066 theDetIds.push_back(p); 00067 } 00068 00069 const TrackerGeometry::DetUnitContainer& 00070 TrackerGeometry::detUnits() const 00071 { 00072 return theDetUnits; 00073 } 00074 00075 const TrackerGeometry::DetContainer& 00076 TrackerGeometry::dets() const 00077 { 00078 return theDets; 00079 } 00080 00081 const TrackerGeometry::DetContainer& 00082 TrackerGeometry::detsPXB() const 00083 { 00084 return thePXBDets; 00085 } 00086 00087 const TrackerGeometry::DetContainer& 00088 TrackerGeometry::detsPXF() const 00089 { 00090 return thePXFDets; 00091 } 00092 00093 const TrackerGeometry::DetContainer& 00094 TrackerGeometry::detsTIB() const 00095 { 00096 return theTIBDets; 00097 } 00098 00099 const TrackerGeometry::DetContainer& 00100 TrackerGeometry::detsTID() const 00101 { 00102 return theTIDDets; 00103 } 00104 00105 const TrackerGeometry::DetContainer& 00106 TrackerGeometry::detsTOB() const 00107 { 00108 return theTOBDets; 00109 } 00110 00111 const TrackerGeometry::DetContainer& 00112 TrackerGeometry::detsTEC() const 00113 { 00114 return theTECDets; 00115 } 00116 00117 const GeomDetUnit* 00118 TrackerGeometry::idToDetUnit(DetId s)const 00119 { 00120 mapIdToDetUnit::const_iterator p=theMapUnit.find(s.rawId()); 00121 if (p != theMapUnit.end()) 00122 return (p)->second; 00123 edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDetUnit associated"; 00124 GeomDetUnit* geom = 0; 00125 return geom; 00126 } 00127 00128 const GeomDet* 00129 TrackerGeometry::idToDet(DetId s)const 00130 { 00131 mapIdToDet::const_iterator p=theMap.find(s.rawId()); 00132 if (p != theMap.end()) 00133 return (p)->second; 00134 edm::LogError("TrackerGeometry")<<"Invalid DetID: no GeomDet associated"; 00135 GeomDet* geom = 0; 00136 return geom; 00137 } 00138 00139 const TrackerGeometry::DetTypeContainer& 00140 TrackerGeometry::detTypes() const 00141 { 00142 return theDetTypes; 00143 } 00144 00145 00146 const TrackerGeometry::DetIdContainer& 00147 TrackerGeometry::detUnitIds() const 00148 { 00149 return theDetUnitIds; 00150 } 00151 00152 const TrackerGeometry::DetIdContainer& 00153 TrackerGeometry::detIds() const 00154 { 00155 return theDetIds; 00156 } 00157 00158