CMS 3D CMS Logo

DTChamber.cc
Go to the documentation of this file.
1 
6 /* This Class Header */
8 
9 /* Collaborating Class Header */
12 
13 /* C++ Headers */
14 #include <iostream>
15 
16 /* ====================================================================== */
17 
18 /* Constructor */
20  GeomDet(plane),
21  theId(id) {
22  setDetId(id);
23 }
24 
25 /* Destructor */
27  for (std::vector<const DTSuperLayer*>::const_iterator isl=theSLs.begin();
28  isl!=theSLs.end(); ++isl) delete (*isl);
29 }
30 
31 /* Operations */
32 
34  return theId;
35 }
36 
37 bool DTChamber::operator==(const DTChamber& ch) const {
38  return id()==ch.id();
39 }
40 
42  theSLs.emplace_back(sl);
43 }
44 
45 std::vector<const GeomDet*> DTChamber::components() const {
46  return std::vector<const GeomDet*>(theSLs.begin(), theSLs.end());
47 }
48 
49 
51  DTLayerId lId(id.rawId());
52  if (lId.layer()==0) { // is a SL id
53  return superLayer(lId);
54  } else { // is a layer id
55  return layer(lId);
56  }
57 }
58 
59 
60 const std::vector<const DTSuperLayer*>& DTChamber::superLayers() const {
61  return theSLs;
62 }
63 
64 
66  if (id.chamberId()!=theId) return nullptr; // not in this SL!
67  return superLayer(id.superLayer());
68 }
69 
70 
71 const DTSuperLayer* DTChamber::superLayer(int isl) const {
72  for (auto theSL : theSLs) {
73  if (theSL->id().superLayer()==isl) return theSL;
74  }
75  return nullptr;
76 }
77 
78 
79 const DTLayer* DTChamber::layer(const DTLayerId& id) const {
80  return (superLayer(id.superlayer()))->layer(id.layer());
81 }
82 
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:65
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
Definition: DTChamber.cc:79
void setDetId(DetId id)
Definition: GeomDet.h:120
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
const GeomDet * component(DetId id) const override
Return the sub-component (SL or layer) with a given id in this chamber.
Definition: DTChamber.cc:50
bool operator==(const DTChamber &ch) const
equal if the id is the same
Definition: DTChamber.cc:37
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
Definition: DTChamber.cc:60
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:33
std::vector< const GeomDet * > components() const override
Return the superlayers in the chamber.
Definition: DTChamber.cc:45
Definition: DetId.h:18
DTChamberId theId
Definition: DTChamber.h:66
std::vector< const DTSuperLayer * > theSLs
Definition: DTChamber.h:69
~DTChamber() override
Destructor.
Definition: DTChamber.cc:26
void add(DTSuperLayer *sl)
Add SL to the chamber which takes ownership.
Definition: DTChamber.cc:41
DTChamber(const DTChamberId &id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: DTChamber.cc:19