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
/** 
 * Implementation of the Model for a GEM Chamber
 *
 *  \author S.Dildick 
 */

#include "Geometry/GEMGeometry/interface/GEMChamber.h"
#include "Geometry/GEMGeometry/interface/GEMEtaPartition.h"
#include <iostream>

GEMChamber::GEMChamber(GEMDetId id, const ReferenceCountingPointer<BoundPlane>& plane) : GeomDet(plane), detId_(id) {
  setDetId(id);
}

GEMChamber::~GEMChamber() {}

GEMDetId GEMChamber::id() const { return detId_; }

bool GEMChamber::operator==(const GEMChamber& ch) const { return this->id() == ch.id(); }

void GEMChamber::add(const GEMEtaPartition* rl) { etaPartitions_.emplace_back(rl); }

std::vector<const GeomDet*> GEMChamber::components() const {
  return std::vector<const GeomDet*>(etaPartitions_.begin(), etaPartitions_.end());
}

const GeomDet* GEMChamber::component(DetId id) const { return etaPartition(GEMDetId(id.rawId())); }

const std::vector<const GEMEtaPartition*>& GEMChamber::etaPartitions() const { return etaPartitions_; }

int GEMChamber::nEtaPartitions() const { return etaPartitions_.size(); }

const GEMEtaPartition* GEMChamber::etaPartition(GEMDetId id) const {
  if (id.chamberId() != detId_)
    return nullptr;  // not in this eta partition!
  return etaPartition(id.roll());
}

const GEMEtaPartition* GEMChamber::etaPartition(int isl) const {
  for (auto roll : etaPartitions_) {
    if (roll->id().roll() == isl)
      return roll;
  }
  return nullptr;
}