CMS 3D CMS Logo

DTSuperLayer.cc
Go to the documentation of this file.
1 
7 /* This Class Header */
8 
9 /* Base Class Headers */
11 
12 /* Collaborating Class Header */
14 
15 /* C++ Headers */
16 #include <iostream>
17 
18 /* ====================================================================== */
19 
20 /* Constructor */
22  : GeomDet(plane), theId(id), theLayers(4, (const DTLayer*)nullptr), theCh(ch) {
23  setDetId(id);
24 }
25 
26 /* Destructor */
28  for (std::vector<const DTLayer*>::const_iterator il = theLayers.begin(); il != theLayers.end(); ++il)
29  delete (*il);
30 }
31 
32 /* Operations */
33 
35 
36 bool DTSuperLayer::operator==(const DTSuperLayer& sl) const { return id() == sl.id(); }
37 
39 std::vector<const GeomDet*> DTSuperLayer::components() const {
40  return std::vector<const GeomDet*>(theLayers.begin(), theLayers.end());
41 }
42 
43 const GeomDet* DTSuperLayer::component(DetId id) const { return layer(DTLayerId(id.rawId())); }
44 
45 const std::vector<const DTLayer*>& DTSuperLayer::layers() const { return theLayers; }
46 
48  // theLayers size is preallocated.
49  theLayers[l->id().layer() - 1] = l;
50 }
51 
52 const DTChamber* DTSuperLayer::chamber() const { return theCh; }
53 
54 const DTLayer* DTSuperLayer::layer(const DTLayerId& id) const {
55  if (id.superlayerId() != theId)
56  return nullptr; // not in this SL!
57  return layer(id.layer());
58 }
59 
60 const DTLayer* DTSuperLayer::layer(int ilay) const {
61  if ((ilay >= 1) && (ilay <= 4)) {
62  return theLayers[ilay - 1];
63  } else {
64  return nullptr;
65  }
66 }
GeomDet::setDetId
void setDetId(DetId id)
Definition: GeomDet.h:99
DTSuperLayerId
Definition: DTSuperLayerId.h:12
GeomDet
Definition: GeomDet.h:27
DTChamber
Definition: DTChamber.h:24
DTSuperLayer::id
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:34
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
DTSuperLayer
Definition: DTSuperLayer.h:24
watchdog.const
const
Definition: watchdog.py:83
DetId
Definition: DetId.h:17
DTSuperLayer::layers
const std::vector< const DTLayer * > & layers() const
Return the layers in the SL.
Definition: DTSuperLayer.cc:45
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
DTSuperLayer::add
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
DTSuperLayer::theId
DTSuperLayerId theId
Definition: DTSuperLayer.h:66
DTSuperLayer::~DTSuperLayer
~DTSuperLayer() override
Definition: DTSuperLayer.cc:27
DTSuperLayer::operator==
bool operator==(const DTSuperLayer &sl) const
True if id are the same.
Definition: DTSuperLayer.cc:36
DTLayer
Definition: DTLayer.h:25
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
DTSuperLayer::components
std::vector< const GeomDet * > components() const override
Return the layers in the SL.
Definition: DTSuperLayer.cc:39
DTSuperLayer::theCh
const DTChamber * theCh
Definition: DTSuperLayer.h:69
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
DTSuperLayer::layer
const DTLayer * layer(const DTLayerId &id) const
Return the layer corresponding to the given id.
Definition: DTSuperLayer.cc:54
DTSuperLayer::component
const GeomDet * component(DetId id) const override
Return the layer with a given id in this SL.
Definition: DTSuperLayer.cc:43
DTSuperLayer::chamber
const DTChamber * chamber() const
Definition: DTSuperLayer.cc:52
DTSuperLayer::DTSuperLayer
DTSuperLayer(const DTSuperLayerId &id, ReferenceCountingPointer< BoundPlane > &plane, const DTChamber *ch=nullptr)
Definition: DTSuperLayer.cc:21
DTSuperLayer.h
DTSuperLayer::theLayers
std::vector< const DTLayer * > theLayers
Definition: DTSuperLayer.h:68