00001 #ifndef DTGeometry_DTGeometry_h 00002 #define DTGeometry_DTGeometry_h 00003 00016 #include <DataFormats/DetId/interface/DetId.h> 00017 #include <Geometry/CommonDetUnit/interface/TrackingGeometry.h> 00018 #include "Geometry/DTGeometry/interface/DTChamber.h" 00019 #include "Geometry/DTGeometry/interface/DTSuperLayer.h" 00020 #include "Geometry/DTGeometry/interface/DTLayer.h" 00021 #include <vector> 00022 #include <map> 00023 00024 class GeomDetType; 00025 class GeomDetUnit; 00026 00027 class DTGeometry : public TrackingGeometry { 00028 00029 typedef std::map<DetId, GeomDet*> DTDetMap; 00030 00031 public: 00033 DTGeometry(); 00034 00036 virtual ~DTGeometry(); 00037 00038 //---- Base class' interface 00039 00040 // Return a vector of all det types 00041 virtual const DetTypeContainer& detTypes() const; 00042 00043 // Returm a vector of all GeomDetUnit 00044 virtual const DetUnitContainer& detUnits() const; 00045 00046 // Returm a vector of all GeomDet (including all GeomDetUnits) 00047 virtual const DetContainer& dets() const; 00048 00049 // Returm a vector of all GeomDetUnit DetIds 00050 virtual const DetIdContainer& detUnitIds() const; 00051 00052 // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits) 00053 virtual const DetIdContainer& detIds() const; 00054 00055 // Return the pointer to the GeomDetUnit corresponding to a given DetId 00056 virtual const GeomDetUnit* idToDetUnit(DetId) const; 00057 00058 // Return the pointer to the GeomDet corresponding to a given DetId 00059 virtual const GeomDet* idToDet(DetId) const; 00060 00061 00062 //---- Extension of the interface 00063 00065 const std::vector<DTChamber*>& chambers() const; 00066 00068 const std::vector<DTSuperLayer*>& superLayers() const; 00069 00071 const std::vector<DTLayer*>& layers() const; 00072 00073 00075 const DTChamber* chamber(DTChamberId id) const; 00076 00078 const DTSuperLayer* superLayer(DTSuperLayerId id) const; 00079 00081 const DTLayer* layer(DTLayerId id) const; 00082 00083 00084 private: 00085 00086 friend class DTGeometryBuilderFromDDD; 00087 friend class DTGeometryBuilderFromCondDB; 00088 00089 friend class GeometryAligner; 00090 00091 00093 void add(DTChamber* ch); 00094 00096 void add(DTSuperLayer* sl); 00097 00099 void add(DTLayer* l); 00100 00101 00102 // The chambers are owned by the geometry (and in turn own superlayers 00103 // and layers) 00104 std::vector<DTChamber*> theChambers; 00105 00106 // All following pointers are redundant; they are used only for an 00107 // efficient implementation of the interface, and are NOT owned. 00108 00109 std::vector<DTSuperLayer*> theSuperLayers; 00110 std::vector<DTLayer*> theLayers; 00111 00112 // Map for efficient lookup by DetId 00113 DTDetMap theMap; 00114 00115 // These are used rarely; they could be computed at runtime 00116 // to save memory. 00117 DetUnitContainer theDetUnits; // all layers 00118 DetContainer theDets; // all chambers, SL, layers 00119 00120 // Replace local static with mutable members 00121 // to allow lazy evaluation if (ever) needed. 00122 mutable DetTypeContainer theDetTypes; 00123 mutable DetIdContainer theDetUnitIds; 00124 mutable DetIdContainer theDetIds; 00125 }; 00126 00127 #endif