Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:39

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