File indexing completed on 2023-03-17 13:03:00
0001 #include "Geometry/GEMGeometry/interface/GEMRing.h"
0002 #include "Geometry/GEMGeometry/interface/GEMSuperChamber.h"
0003
0004 GEMRing::GEMRing(int region, int station, int ring) : region_(region), station_(station), ring_(ring) {}
0005
0006 GEMRing::~GEMRing() {}
0007
0008 std::vector<GEMDetId> GEMRing::ids() const { return detIds_; }
0009
0010 bool GEMRing::operator==(const GEMRing& ri) const {
0011 return (region_ == ri.region() && station_ == ri.station() && ring_ == ri.ring());
0012 }
0013
0014 void GEMRing::add(GEMSuperChamber* sch) { superChambers_.emplace_back(sch); }
0015
0016 std::vector<const GeomDet*> GEMRing::components() const {
0017 std::vector<const GeomDet*> result;
0018 for (auto sch : superChambers_) {
0019 auto newSch(sch->components());
0020 result.insert(result.end(), newSch.begin(), newSch.end());
0021 }
0022 return result;
0023 }
0024
0025 const GeomDet* GEMRing::component(DetId id) const { return superChamber(GEMDetId(id.rawId())); }
0026
0027 const GEMSuperChamber* GEMRing::superChamber(GEMDetId id) const {
0028 if (id.region() != region_ || id.station() != station_ || id.ring() != ring_)
0029 return nullptr;
0030 return superChamber(id.chamber());
0031 }
0032
0033 const GEMSuperChamber* GEMRing::superChamber(int isch) const {
0034 for (auto sch : superChambers_) {
0035 if (sch->id().chamber() == isch) {
0036 return sch;
0037 }
0038 }
0039 return nullptr;
0040 }
0041
0042 const std::vector<const GEMSuperChamber*>& GEMRing::superChambers() const { return superChambers_; }
0043
0044 int GEMRing::nSuperChambers() const { return superChambers_.size(); }
0045
0046 int GEMRing::region() const { return region_; }
0047
0048 int GEMRing::station() const { return station_; }
0049
0050 int GEMRing::ring() const { return ring_; }