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