Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#include <utility>

#include "Geometry/GEMGeometry/interface/GEMStation.h"
#include "Geometry/GEMGeometry/interface/GEMRing.h"
#include "Geometry/GEMGeometry/interface/GEMSuperChamber.h"

GEMStation::GEMStation(int region, int station) : region_(region), station_(station) {}

GEMStation::~GEMStation() {}

std::vector<GEMDetId> GEMStation::ids() const {
  std::vector<GEMDetId> result;
  for (auto& ri : rings_) {
    std::vector<GEMDetId> newIds(ri->ids());
    result.insert(result.end(), newIds.begin(), newIds.end());
  }
  return result;
}

bool GEMStation::operator==(const GEMStation& st) const { return (region_ == st.region() && station_ == st.station()); }

void GEMStation::add(GEMRing* ring) { rings_.emplace_back(ring); }

std::vector<const GeomDet*> GEMStation::components() const {
  std::vector<const GeomDet*> result;
  for (auto ri : rings_) {
    auto newSch(ri->components());
    result.insert(result.end(), newSch.begin(), newSch.end());
  }
  return result;
}

const GeomDet* GEMStation::component(DetId id) const {
  auto detId(GEMDetId(id.rawId()));
  return ring(detId.ring())->component(id);
}

const GEMSuperChamber* GEMStation::superChamber(GEMDetId id) const {
  if (id.region() != region_ || id.station() != station_)
    return nullptr;  // not in this station
  return ring(id.ring())->superChamber(id.chamber());
}

std::vector<const GEMSuperChamber*> GEMStation::superChambers() const {
  std::vector<const GEMSuperChamber*> result;
  for (auto ri : rings_) {
    std::vector<const GEMSuperChamber*> newSch(ri->superChambers());
    result.insert(result.end(), newSch.begin(), newSch.end());
  }
  return result;
}

const GEMRing* GEMStation::ring(int ring) const {
  for (auto ri : rings_) {
    if (ring == ri->ring()) {
      return ri;
    }
  }
  return nullptr;
}

const std::vector<const GEMRing*>& GEMStation::rings() const { return rings_; }

int GEMStation::nRings() const { return rings_.size(); }

void GEMStation::setName(std::string name) { name_ = std::move(name); }

const std::string GEMStation::getName() const { return name_; }

int GEMStation::region() const { return region_; }

int GEMStation::station() const { return station_; }