CMS 3D CMS Logo

DTGeometry.cc
Go to the documentation of this file.
1 
8 
9 #include <algorithm>
10 #include <iostream>
11 
13 
15  deallocate();
16 }
17 
19  // delete all the chambers (which will delete the SL which will delete the
20  // layers)
21  for (auto & theChamber : theChambers) delete theChamber;
22 }
23 
25  deallocate();
26 
27  theChambers.clear();
28  theSuperLayers.clear();
29  theLayers.clear();
30  theMap.clear();
31  theDetUnits.clear();
32  theDets.clear();
33  theDetTypes.clear();
34  theDetUnitIds.clear();
35  theDetIds.clear();
36 }
37 
39  // FIXME - fill it at runtime
40  return theDetTypes;
41 }
42 
43 
45  theDets.emplace_back(ch);
46  theChambers.emplace_back(ch);
47  theMap.insert(DTDetMap::value_type(ch->geographicalId(),ch));
48 }
49 
50 
52  theDets.emplace_back(sl);
53  theSuperLayers.emplace_back(sl);
54  theMap.insert(DTDetMap::value_type(sl->geographicalId(),sl));
55 }
56 
57 
59  theDetUnits.emplace_back(l);
60  theDets.emplace_back(l);
61  theLayers.emplace_back(l);
63 }
64 
65 
67  return theDetUnits;
68 }
69 
70 
72  return theDets;
73 }
74 
75 
77  // FIXME - fill it at runtime
78  return theDetUnitIds;
79 }
80 
81 
83  // FIXME - fill it at runtime
84  return theDetIds;
85 }
86 
87 
89  return dynamic_cast<const GeomDet*>(idToDet(id));
90 }
91 
92 
94  // Strip away wire#, if any!
95  DTLayerId lId(id.rawId());
96  DTDetMap::const_iterator i = theMap.find(lId);
97  return (i != theMap.end()) ?
98  i->second : nullptr ;
99 }
100 
101 
102 const std::vector<const DTChamber*>& DTGeometry::chambers() const{
103  return theChambers;
104 }
105 
106 
107 const std::vector<const DTSuperLayer*>& DTGeometry::superLayers() const{
108  return theSuperLayers;
109 }
110 
111 
112 const std::vector<const DTLayer*>& DTGeometry::layers() const{
113  return theLayers;
114 }
115 
116 
117 const DTChamber* DTGeometry::chamber(const DTChamberId& id) const {
118  return (const DTChamber*)(idToDet(id));
119 }
120 
121 
123  return (const DTSuperLayer*)(idToDet(id));
124 }
125 
126 
127 const DTLayer* DTGeometry::layer(const DTLayerId& id) const {
128  return (const DTLayer*)(idToDet(id));
129 }
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
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DTDetMap theMap
Definition: DTGeometry.h:118
DetTypeContainer theDetTypes
Definition: DTGeometry.h:127
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:114
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:76
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:115
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:128
void clear()
Definition: DTGeometry.cc:24
DetIdContainer theDetIds
Definition: DTGeometry.h:129
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:109
DetContainer theDetUnits
Definition: DTGeometry.h:122
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:123
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