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  void clear();
37 
38  //---- Base class' interface
39 
40  // Return a vector of all det types
41  const DetTypeContainer& detTypes() const override;
42 
43  // Returm a vector of all GeomDetUnit
44  const DetContainer& detUnits() const override;
45 
46  // Returm a vector of all GeomDet (including all GeomDetUnits)
47  const DetContainer& dets() const override;
48 
49  // Returm a vector of all GeomDetUnit DetIds
50  const DetIdContainer& detUnitIds() const override;
51 
52  // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
53  const DetIdContainer& detIds() const override;
54 
55  // Return the pointer to the GeomDetUnit corresponding to a given DetId
56  const GeomDet* idToDetUnit(DetId) const override;
57 
58  // Return the pointer to the GeomDet corresponding to a given DetId
59  const GeomDet* idToDet(DetId) const override;
60 
61 
62  //---- Extension of the interface
63 
65  const std::vector<const DTChamber*>& chambers() const;
66 
68  const std::vector<const DTSuperLayer*>& superLayers() const;
69 
71  const std::vector<const DTLayer*>& layers() const;
72 
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 
84  private:
85 
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 
103  // The chambers are owned by the geometry (and in turn own superlayers
104  // and layers)
105  std::vector<const DTChamber*> theChambers;
106 
107  // All following pointers are redundant; they are used only for an
108  // efficient implementation of the interface, and are NOT owned.
109 
110  std::vector<const DTSuperLayer*> theSuperLayers;
111  std::vector<const DTLayer*> theLayers;
112 
113  // Map for efficient lookup by DetId
114  DTDetMap theMap;
115 
116  // These are used rarely; they could be computed at runtime
117  // to save memory.
118  DetContainer theDetUnits; // all layers
119  DetContainer theDets; // all chambers, SL, layers
120 
121  // Replace local static with mutable members
122  // to allow lazy evaluation if (ever) needed.
126 };
127 
128 #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:102
void deallocate()
Definition: DTGeometry.cc:18
~DTGeometry() override
Destructor.
Definition: DTGeometry.cc:14
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:117
Class to update a given geometry with a set of alignments.
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DTDetMap theMap
Definition: DTGeometry.h:114
DetTypeContainer theDetTypes
Definition: DTGeometry.h:123
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: DTGeometry.cc:82
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:110
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:76
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:111
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: DTGeometry.cc:88
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:124
void clear()
Definition: DTGeometry.cc:24
DetIdContainer theDetIds
Definition: DTGeometry.h:125
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:105
DetContainer theDetUnits
Definition: DTGeometry.h:118
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:66
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:71
Definition: DetId.h:18
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:112
std::vector< DetId > DetIdContainer
DetContainer theDets
Definition: DTGeometry.h:119
std::vector< const GeomDet * > DetContainer
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:93
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:127
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:44
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:38
std::vector< const GeomDetType * > DetTypeContainer
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:107
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:122