CMS 3D CMS Logo

DTGeometry.h
Go to the documentation of this file.
1 #ifndef DTGeometry_DTGeometry_h
2 #define DTGeometry_DTGeometry_h
3 
19 #include <vector>
20 #include <map>
21 
22 class GeomDetType;
23 
24 namespace cms {
25  class DTGeometryBuilder;
26 }
27 
28 class DTGeometry : public TrackingGeometry {
29  typedef std::map<DetId, GeomDet*> DTDetMap;
30 
31 public:
33  DTGeometry();
34 
36  ~DTGeometry() override;
37 
38  void clear();
39 
40  //---- Base class' interface
41 
42  // Return a vector of all det types
43  const DetTypeContainer& detTypes() const override;
44 
45  // Returm a vector of all GeomDetUnit
46  const DetContainer& detUnits() const override;
47 
48  // Returm a vector of all GeomDet (including all GeomDetUnits)
49  const DetContainer& dets() const override;
50 
51  // Returm a vector of all GeomDetUnit DetIds
52  const DetIdContainer& detUnitIds() const override;
53 
54  // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
55  const DetIdContainer& detIds() const override;
56 
57  // Return the pointer to the GeomDetUnit corresponding to a given DetId
58  const GeomDet* idToDetUnit(DetId) const override;
59 
60  // Return the pointer to the GeomDet corresponding to a given DetId
61  const GeomDet* idToDet(DetId) const override;
62 
63  //---- Extension of the interface
64 
66  const std::vector<const DTChamber*>& chambers() const;
67 
69  const std::vector<const DTSuperLayer*>& superLayers() const;
70 
72  const std::vector<const DTLayer*>& layers() const;
73 
75  const DTChamber* chamber(const DTChamberId& id) const;
76 
78  const DTSuperLayer* superLayer(const DTSuperLayerId& id) const;
79 
81  const DTLayer* layer(const DTLayerId& id) const;
82 
83 private:
84  friend class cms::DTGeometryBuilder;
88 
89  friend class GeometryAligner;
90 
91  void deallocate();
92 
94  void add(DTChamber* ch);
95 
97  void add(DTSuperLayer* sl);
98 
100  void add(DTLayer* l);
101 
102  // The chambers are owned by the geometry (and in turn own superlayers
103  // and layers)
104  std::vector<const DTChamber*> theChambers;
105 
106  // All following pointers are redundant; they are used only for an
107  // efficient implementation of the interface, and are NOT owned.
108 
109  std::vector<const DTSuperLayer*> theSuperLayers;
110  std::vector<const DTLayer*> theLayers;
111 
112  // Map for efficient lookup by DetId
114 
115  // These are used rarely; they could be computed at runtime
116  // to save memory.
117  DetContainer theDetUnits; // all layers
118  DetContainer theDets; // all chambers, SL, layers
119 
120  // Replace local static with mutable members
121  // to allow lazy evaluation if (ever) needed.
125 };
126 
127 #endif
DTGeometry
Definition: DTGeometry.h:28
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTGeometry::theChambers
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:104
DTGeometryBuilder
DTGeometry::detUnitIds
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:65
DTGeometry::theDetIds
DetIdContainer theDetIds
Definition: DTGeometry.h:124
TrackingGeometry
Definition: TrackingGeometry.h:26
GeomDet
Definition: GeomDet.h:27
DTGeometry::theDetUnitIds
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:123
DTGeometry::idToDetUnit
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: DTGeometry.cc:75
DTGeometryBuilderFromDDD
Definition: DTGeometryBuilderFromDDD.h:31
DTGeometry::theDetUnits
DetContainer theDetUnits
Definition: DTGeometry.h:117
DTChamber
Definition: DTChamber.h:24
GeomDetType
Definition: GeomDetType.h:9
TrackingGeometry.h
DTSuperLayer
Definition: DTSuperLayer.h:24
DTGeometry::chamber
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
DetId
Definition: DetId.h:17
DTGeometry::theDets
DetContainer theDets
Definition: DTGeometry.h:118
DTGeometry::DTDetMap
std::map< DetId, GeomDet * > DTDetMap
Definition: DTGeometry.h:29
DTGeometry::layers
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
DTGeometry::chambers
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
DTGeometryBuilderFromCondDB
Definition: DTGeometryBuilderFromCondDB.h:40
DTGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:63
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
TrackingGeometry::DetTypeContainer
std::vector< const GeomDetType * > DetTypeContainer
Definition: TrackingGeometry.h:28
TrackingGeometry::DetIdContainer
std::vector< DetId > DetIdContainer
Definition: TrackingGeometry.h:30
cms::DTGeometryBuilder
Definition: DTGeometryBuilder.h:46
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
DTGeometry::add
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
DTGeometry::detIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: DTGeometry.cc:70
TrackingGeometry::DetContainer
std::vector< const GeomDet * > DetContainer
Definition: TrackingGeometry.h:29
DTGeometry::deallocate
void deallocate()
Definition: DTGeometry.cc:16
DTGeometry::superLayers
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
DTLayer
Definition: DTLayer.h:25
DTGeometry::theMap
DTDetMap theMap
Definition: DTGeometry.h:113
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
DTGeometryBuilderFromDD4Hep
Definition: DTGeometryBuilderFromDD4Hep.h:42
DTGeometry::theDetTypes
DetTypeContainer theDetTypes
Definition: DTGeometry.h:122
DTGeometry::~DTGeometry
~DTGeometry() override
Destructor.
Definition: DTGeometry.cc:14
DTGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:61
DTGeometry::theSuperLayers
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:109
DTGeometry::theLayers
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:110
DetId.h
DTGeometry::DTGeometry
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DTChamber.h
DTGeometry::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
DTChamberId
Definition: DTChamberId.h:14
DTGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
DTSuperLayer.h
DTGeometry::clear
void clear()
Definition: DTGeometry.cc:23
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
DTGeometry::detTypes
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:37
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21