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  virtual ~DTGeometry();
35 
36  //---- Base class' interface
37 
38  // Return a vector of all det types
39  virtual const DetTypeContainer& detTypes() const override;
40 
41  // Returm a vector of all GeomDetUnit
42  virtual const DetUnitContainer& detUnits() const override;
43 
44  // Returm a vector of all GeomDet (including all GeomDetUnits)
45  virtual const DetContainer& dets() const override;
46 
47  // Returm a vector of all GeomDetUnit DetIds
48  virtual const DetIdContainer& detUnitIds() const override;
49 
50  // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
51  virtual const DetIdContainer& detIds() const override;
52 
53  // Return the pointer to the GeomDetUnit corresponding to a given DetId
54  virtual const GeomDetUnit* idToDetUnit(DetId) const override;
55 
56  // Return the pointer to the GeomDet corresponding to a given DetId
57  virtual 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(DTChamberId id) const;
74 
76  const DTSuperLayer* superLayer(DTSuperLayerId id) const;
77 
79  const DTLayer* layer(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.
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
std::vector< GeomDetType const * > DetTypeContainer
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:85
Class to update a given geometry with a set of alignments.
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DetUnitContainer theDetUnits
Definition: DTGeometry.h:115
DTDetMap theMap
Definition: DTGeometry.h:111
DetTypeContainer theDetTypes
Definition: DTGeometry.h:120
virtual const GeomDetUnit * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: DTGeometry.cc:71
virtual const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: DTGeometry.cc:65
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:107
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
virtual const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:59
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:108
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:121
DetIdContainer theDetIds
Definition: DTGeometry.h:122
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:102
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:105
virtual const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:54
Definition: DetId.h:18
virtual ~DTGeometry()
Destructor.
Definition: DTGeometry.cc:14
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:95
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:100
DetContainer theDets
Definition: DTGeometry.h:116
virtual const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:76
virtual const DetUnitContainer & detUnits() const override
Returm a vector of all GeomDetUnit.
Definition: DTGeometry.cc:49
std::vector< GeomDet const * > DetContainer
std::vector< GeomDetUnit const * > DetUnitContainer
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:27
virtual const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:21
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:90
std::vector< DetId > DetIdContainer