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), theId(id) {
21  setDetId(id);
22 }
23 
24 /* Destructor */
26  for (std::vector<const DTSuperLayer*>::const_iterator isl = theSLs.begin(); isl != theSLs.end(); ++isl)
27  delete (*isl);
28 }
29 
30 /* Operations */
31 
32 DTChamberId DTChamber::id() const { return theId; }
33 
34 bool DTChamber::operator==(const DTChamber& ch) const { return id() == ch.id(); }
35 
36 void DTChamber::add(DTSuperLayer* sl) { theSLs.emplace_back(sl); }
37 
38 std::vector<const GeomDet*> DTChamber::components() const {
39  return std::vector<const GeomDet*>(theSLs.begin(), theSLs.end());
40 }
41 
43  DTLayerId lId(id.rawId());
44  if (lId.layer() == 0) { // is a SL id
45  return superLayer(lId);
46  } else { // is a layer id
47  return layer(lId);
48  }
49 }
50 
51 const std::vector<const DTSuperLayer*>& DTChamber::superLayers() const { return theSLs; }
52 
54  if (id.chamberId() != theId)
55  return nullptr; // not in this SL!
56  return superLayer(id.superLayer());
57 }
58 
59 const DTSuperLayer* DTChamber::superLayer(int isl) const {
60  for (auto theSL : theSLs) {
61  if (theSL->id().superLayer() == isl)
62  return theSL;
63  }
64  return nullptr;
65 }
66 
67 const DTLayer* DTChamber::layer(const DTLayerId& id) const { return (superLayer(id.superlayer()))->layer(id.layer()); }
DTChamber::id
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:32
GeomDet::setDetId
void setDetId(DetId id)
Definition: GeomDet.h:99
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTChamber::layer
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
Definition: DTChamber.cc:67
DTChamber::~DTChamber
~DTChamber() override
Destructor.
Definition: DTChamber.cc:25
GeomDet
Definition: GeomDet.h:27
DTChamber
Definition: DTChamber.h:24
DTChamber::theId
DTChamberId theId
Definition: DTChamber.h:64
DTChamber::component
const GeomDet * component(DetId id) const override
Return the sub-component (SL or layer) with a given id in this chamber.
Definition: DTChamber.cc:42
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
DTSuperLayer
Definition: DTSuperLayer.h:24
DTChamber::add
void add(DTSuperLayer *sl)
Add SL to the chamber which takes ownership.
Definition: DTChamber.cc:36
DTChamber::DTChamber
DTChamber(const DTChamberId &id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: DTChamber.cc:19
DetId
Definition: DetId.h:17
DTChamber::components
std::vector< const GeomDet * > components() const override
Return the superlayers in the chamber.
Definition: DTChamber.cc:38
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
DTChamber::theSLs
std::vector< const DTSuperLayer * > theSLs
Definition: DTChamber.h:67
DTChamber::superLayers
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
Definition: DTChamber.cc:51
DTLayer
Definition: DTLayer.h:25
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
DTChamber.h
DTChamberId
Definition: DTChamberId.h:14
DTChamber::operator==
bool operator==(const DTChamber &ch) const
equal if the id is the same
Definition: DTChamber.cc:34
DTChamber::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
DTSuperLayer.h