File indexing completed on 2024-04-06 12:14:40
0001 #include "Geometry/GEMGeometry/interface/ME0Layer.h"
0002 #include "Geometry/GEMGeometry/interface/ME0EtaPartition.h"
0003 #include <iostream>
0004
0005 ME0Layer::ME0Layer(ME0DetId id, const ReferenceCountingPointer<BoundPlane>& plane) : GeomDet(plane), detId_(id) {
0006 setDetId(id);
0007 }
0008
0009 ME0Layer::~ME0Layer() {}
0010
0011 ME0DetId ME0Layer::id() const { return detId_; }
0012
0013 bool ME0Layer::operator==(const ME0Layer& ch) const { return this->id() == ch.id(); }
0014
0015 void ME0Layer::add(const ME0EtaPartition* rl) { etaPartitions_.emplace_back(rl); }
0016
0017 std::vector<const GeomDet*> ME0Layer::components() const {
0018 return std::vector<const GeomDet*>(etaPartitions_.begin(), etaPartitions_.end());
0019 }
0020
0021 const GeomDet* ME0Layer::component(DetId id) const { return etaPartition(ME0DetId(id.rawId())); }
0022
0023 const std::vector<const ME0EtaPartition*>& ME0Layer::etaPartitions() const { return etaPartitions_; }
0024
0025 int ME0Layer::nEtaPartitions() const { return etaPartitions_.size(); }
0026
0027 const ME0EtaPartition* ME0Layer::etaPartition(ME0DetId id) const {
0028 if (id.layerId() != detId_)
0029 return nullptr;
0030 return etaPartition(id.roll());
0031 }
0032
0033 const ME0EtaPartition* ME0Layer::etaPartition(int isl) const {
0034 for (auto roll : etaPartitions_) {
0035 if (roll->id().roll() == isl)
0036 return roll;
0037 }
0038 return nullptr;
0039 }