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