CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
std::map< DetId, GeomDet * > DTDetMap
Definition: DTGeometry.h:29
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
void deallocate()
Definition: DTGeometry.cc:16
~DTGeometry() override
Destructor.
Definition: DTGeometry.cc:14
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:63
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
Class to update a given geometry with a set of alignments.
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: DTGeometry.cc:70
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:61
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DTDetMap theMap
Definition: DTGeometry.h:113
DetTypeContainer theDetTypes
Definition: DTGeometry.h:122
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:109
std::vector< const GeomDet * > DetContainer
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:110
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:37
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:123
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
void clear()
Definition: DTGeometry.cc:23
DetIdContainer theDetIds
Definition: DTGeometry.h:124
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: DTGeometry.cc:75
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:104
DetContainer theDetUnits
Definition: DTGeometry.h:117
Definition: DetId.h:17
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:65
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
std::vector< DetId > DetIdContainer
DetContainer theDets
Definition: DTGeometry.h:118
std::vector< const GeomDetType * > DetTypeContainer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92