Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:10

0001 #include <utility>
0002 
0003 #include "Geometry/GEMGeometry/interface/GEMStation.h"
0004 #include "Geometry/GEMGeometry/interface/GEMRing.h"
0005 #include "Geometry/GEMGeometry/interface/GEMSuperChamber.h"
0006 
0007 GEMStation::GEMStation(int region, int station) : region_(region), station_(station) {}
0008 
0009 GEMStation::~GEMStation() {}
0010 
0011 std::vector<GEMDetId> GEMStation::ids() const {
0012   std::vector<GEMDetId> result;
0013   for (auto& ri : rings_) {
0014     std::vector<GEMDetId> newIds(ri->ids());
0015     result.insert(result.end(), newIds.begin(), newIds.end());
0016   }
0017   return result;
0018 }
0019 
0020 bool GEMStation::operator==(const GEMStation& st) const { return (region_ == st.region() && station_ == st.station()); }
0021 
0022 void GEMStation::add(GEMRing* ring) { rings_.emplace_back(ring); }
0023 
0024 std::vector<const GeomDet*> GEMStation::components() const {
0025   std::vector<const GeomDet*> result;
0026   for (auto ri : rings_) {
0027     auto newSch(ri->components());
0028     result.insert(result.end(), newSch.begin(), newSch.end());
0029   }
0030   return result;
0031 }
0032 
0033 const GeomDet* GEMStation::component(DetId id) const {
0034   auto detId(GEMDetId(id.rawId()));
0035   return ring(detId.ring())->component(id);
0036 }
0037 
0038 const GEMSuperChamber* GEMStation::superChamber(GEMDetId id) const {
0039   if (id.region() != region_ || id.station() != station_)
0040     return nullptr;  // not in this station
0041   return ring(id.ring())->superChamber(id.chamber());
0042 }
0043 
0044 std::vector<const GEMSuperChamber*> GEMStation::superChambers() const {
0045   std::vector<const GEMSuperChamber*> result;
0046   for (auto ri : rings_) {
0047     std::vector<const GEMSuperChamber*> newSch(ri->superChambers());
0048     result.insert(result.end(), newSch.begin(), newSch.end());
0049   }
0050   return result;
0051 }
0052 
0053 const GEMRing* GEMStation::ring(int ring) const {
0054   for (auto ri : rings_) {
0055     if (ring == ri->ring()) {
0056       return ri;
0057     }
0058   }
0059   return nullptr;
0060 }
0061 
0062 const std::vector<const GEMRing*>& GEMStation::rings() const { return rings_; }
0063 
0064 int GEMStation::nRings() const { return rings_.size(); }
0065 
0066 void GEMStation::setName(std::string name) { name_ = std::move(name); }
0067 
0068 const std::string GEMStation::getName() const { return name_; }
0069 
0070 int GEMStation::region() const { return region_; }
0071 
0072 int GEMStation::station() const { return station_; }