CMS 3D CMS Logo

DTGeometry.cc
Go to the documentation of this file.
1 
8 
9 #include <algorithm>
10 #include <iostream>
11 
13 
15 
17  // delete all the chambers (which will delete the SL which will delete the
18  // layers)
19  for (auto& theChamber : theChambers)
20  delete theChamber;
21 }
22 
24  deallocate();
25 
26  theChambers.clear();
27  theSuperLayers.clear();
28  theLayers.clear();
29  theMap.clear();
30  theDetUnits.clear();
31  theDets.clear();
32  theDetTypes.clear();
33  theDetUnitIds.clear();
34  theDetIds.clear();
35 }
36 
38  // FIXME - fill it at runtime
39  return theDetTypes;
40 }
41 
43  theDets.emplace_back(ch);
44  theChambers.emplace_back(ch);
45  theMap.insert(DTDetMap::value_type(ch->geographicalId(), ch));
46 }
47 
49  theDets.emplace_back(sl);
50  theSuperLayers.emplace_back(sl);
51  theMap.insert(DTDetMap::value_type(sl->geographicalId(), sl));
52 }
53 
55  theDetUnits.emplace_back(l);
56  theDets.emplace_back(l);
57  theLayers.emplace_back(l);
59 }
60 
62 
64 
66  // FIXME - fill it at runtime
67  return theDetUnitIds;
68 }
69 
71  // FIXME - fill it at runtime
72  return theDetIds;
73 }
74 
75 const GeomDet* DTGeometry::idToDetUnit(DetId id) const { return dynamic_cast<const GeomDet*>(idToDet(id)); }
76 
77 const GeomDet* DTGeometry::idToDet(DetId id) const {
78  // Strip away wire#, if any!
79  DTLayerId lId(id.rawId());
80  DTDetMap::const_iterator i = theMap.find(lId);
81  return (i != theMap.end()) ? i->second : nullptr;
82 }
83 
84 const std::vector<const DTChamber*>& DTGeometry::chambers() const { return theChambers; }
85 
86 const std::vector<const DTSuperLayer*>& DTGeometry::superLayers() const { return theSuperLayers; }
87 
88 const std::vector<const DTLayer*>& DTGeometry::layers() const { return theLayers; }
89 
90 const DTChamber* DTGeometry::chamber(const DTChamberId& id) const { return (const DTChamber*)(idToDet(id)); }
91 
93  return (const DTSuperLayer*)(idToDet(id));
94 }
95 
96 const DTLayer* DTGeometry::layer(const DTLayerId& id) const { return (const DTLayer*)(idToDet(id)); }
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
void deallocate()
Definition: DTGeometry.cc:16
~DTGeometry() override
Destructor.
Definition: DTGeometry.cc:14
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
DTGeometry()
Default constructor.
Definition: DTGeometry.cc:12
DTDetMap theMap
Definition: DTGeometry.h:112
DetTypeContainer theDetTypes
Definition: DTGeometry.h:121
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: DTGeometry.cc:70
std::vector< const DTSuperLayer * > theSuperLayers
Definition: DTGeometry.h:108
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: DTGeometry.cc:65
std::vector< const GeomDet * > DetContainer
std::vector< const DTLayer * > theLayers
Definition: DTGeometry.h:109
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: DTGeometry.cc:75
DetIdContainer theDetUnitIds
Definition: DTGeometry.h:122
void clear()
Definition: DTGeometry.cc:23
DetIdContainer theDetIds
Definition: DTGeometry.h:123
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::vector< const DTChamber * > theChambers
Definition: DTGeometry.h:103
DetContainer theDetUnits
Definition: DTGeometry.h:116
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: DTGeometry.cc:61
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DTGeometry.cc:63
Definition: DetId.h:17
const std::vector< const DTLayer * > & layers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:88
std::vector< DetId > DetIdContainer
DetContainer theDets
Definition: DTGeometry.h:117
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
std::vector< const GeomDetType * > DetTypeContainer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: DTGeometry.cc:37
const std::vector< const DTSuperLayer * > & superLayers() const
Return a vector of all SuperLayer.
Definition: DTGeometry.cc:86
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92