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 
30  typedef std::map<DetId, GeomDet*> DTDetMap;
31 
32  public:
34  DTGeometry();
35 
37  ~DTGeometry() override;
38 
39  void clear();
40 
41  //---- Base class' interface
42 
43  // Return a vector of all det types
44  const DetTypeContainer& detTypes() const override;
45 
46  // Returm a vector of all GeomDetUnit
47  const DetContainer& detUnits() const override;
48 
49  // Returm a vector of all GeomDet (including all GeomDetUnits)
50  const DetContainer& dets() const override;
51 
52  // Returm a vector of all GeomDetUnit DetIds
53  const DetIdContainer& detUnitIds() const override;
54 
55  // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
56  const DetIdContainer& detIds() const override;
57 
58  // Return the pointer to the GeomDetUnit corresponding to a given DetId
59  const GeomDet* idToDetUnit(DetId) const override;
60 
61  // Return the pointer to the GeomDet corresponding to a given DetId
62  const GeomDet* idToDet(DetId) const override;
63 
64 
65  //---- Extension of the interface
66 
68  const std::vector<const DTChamber*>& chambers() const;
69 
71  const std::vector<const DTSuperLayer*>& superLayers() const;
72 
74  const std::vector<const DTLayer*>& layers() const;
75 
76 
78  const DTChamber* chamber(const DTChamberId& id) const;
79 
81  const DTSuperLayer* superLayer(const DTSuperLayerId& id) const;
82 
84  const DTLayer* layer(const DTLayerId& id) const;
85 
86 
87  private:
88 
89  friend class cms::DTGeometryBuilder;
92 
93  friend class GeometryAligner;
94 
95  void deallocate();
96 
98  void add(DTChamber* ch);
99 
101  void add(DTSuperLayer* sl);
102 
104  void add(DTLayer* l);
105 
106 
107  // The chambers are owned by the geometry (and in turn own superlayers
108  // and layers)
109  std::vector<const DTChamber*> theChambers;
110 
111  // All following pointers are redundant; they are used only for an
112  // efficient implementation of the interface, and are NOT owned.
113 
114  std::vector<const DTSuperLayer*> theSuperLayers;
115  std::vector<const DTLayer*> theLayers;
116 
117  // Map for efficient lookup by DetId
118  DTDetMap theMap;
119 
120  // These are used rarely; they could be computed at runtime
121  // to save memory.
122  DetContainer theDetUnits; // all layers
123  DetContainer theDets; // all chambers, SL, layers
124 
125  // Replace local static with mutable members
126  // to allow lazy evaluation if (ever) needed.
128  DetIdContainer theDetUnitIds;
129  DetIdContainer theDetIds;
130 };
131 
132 #endif
std::map< DetId, GeomDet * > DTDetMap
Definition: DTGeometry.h:30
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
Class to update a given geometry with a set of alignments.
DTDetMap theMap
Definition: DTGeometry.h:118
DetTypeContainer theDetTypes
Definition: DTGeometry.h:127
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:114
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:115
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:128
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
DetIdContainer theDetIds
Definition: DTGeometry.h:129
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:109
DetContainer theDetUnits
Definition: DTGeometry.h:122
Namespace of DDCMS conversion namespace.
Definition: DetId.h:18
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
DetContainer theDets
Definition: DTGeometry.h:123
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
std::vector< const GeomDetType * > DetTypeContainer