File indexing completed on 2023-03-17 13:02:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "Geometry/DTGeometry/interface/DTSuperLayer.h"
0011
0012
0013 #include "Geometry/DTGeometry/interface/DTLayer.h"
0014
0015
0016 #include <iostream>
0017
0018
0019
0020
0021 DTSuperLayer::DTSuperLayer(const DTSuperLayerId& id, ReferenceCountingPointer<BoundPlane>& plane, const DTChamber* ch)
0022 : GeomDet(plane), theId(id), theLayers(4, (const DTLayer*)nullptr), theCh(ch) {
0023 setDetId(id);
0024 }
0025
0026
0027 DTSuperLayer::~DTSuperLayer() {
0028 for (std::vector<const DTLayer*>::const_iterator il = theLayers.begin(); il != theLayers.end(); ++il)
0029 delete (*il);
0030 }
0031
0032
0033
0034 DTSuperLayerId DTSuperLayer::id() const { return theId; }
0035
0036 bool DTSuperLayer::operator==(const DTSuperLayer& sl) const { return id() == sl.id(); }
0037
0038
0039 std::vector<const GeomDet*> DTSuperLayer::components() const {
0040 return std::vector<const GeomDet*>(theLayers.begin(), theLayers.end());
0041 }
0042
0043 const GeomDet* DTSuperLayer::component(DetId id) const { return layer(DTLayerId(id.rawId())); }
0044
0045 const std::vector<const DTLayer*>& DTSuperLayer::layers() const { return theLayers; }
0046
0047 void DTSuperLayer::add(DTLayer* l) {
0048
0049 theLayers[l->id().layer() - 1] = l;
0050 }
0051
0052 const DTChamber* DTSuperLayer::chamber() const { return theCh; }
0053
0054 const DTLayer* DTSuperLayer::layer(const DTLayerId& id) const {
0055 if (id.superlayerId() != theId)
0056 return nullptr;
0057 return layer(id.layer());
0058 }
0059
0060 const DTLayer* DTSuperLayer::layer(int ilay) const {
0061 if ((ilay >= 1) && (ilay <= 4)) {
0062 return theLayers[ilay - 1];
0063 } else {
0064 return nullptr;
0065 }
0066 }