CMS 3D CMS Logo

GEMRing.cc
Go to the documentation of this file.
3 
4 GEMRing::GEMRing(int region, int station, int ring) : region_(region), station_(station), ring_(ring) {}
5 
7 
8 std::vector<GEMDetId> GEMRing::ids() const { return detIds_; }
9 
10 bool GEMRing::operator==(const GEMRing& ri) const {
11  return (region_ == ri.region() && station_ == ri.station() && ring_ == ri.ring());
12 }
13 
14 void GEMRing::add(GEMSuperChamber* sch) { superChambers_.emplace_back(sch); }
15 
16 std::vector<const GeomDet*> GEMRing::components() const {
17  std::vector<const GeomDet*> result;
18  for (auto sch : superChambers_) {
19  auto newSch(sch->components());
20  result.insert(result.end(), newSch.begin(), newSch.end());
21  }
22  return result;
23 }
24 
25 const GeomDet* GEMRing::component(DetId id) const { return superChamber(GEMDetId(id.rawId())); }
26 
28  if (id.region() != region_ || id.station() != station_ || id.ring() != ring_)
29  return nullptr; // not in this station
30  return superChamber(id.chamber());
31 }
32 
33 const GEMSuperChamber* GEMRing::superChamber(int isch) const {
34  for (auto sch : superChambers_) {
35  if (sch->id().chamber() == isch) {
36  return sch;
37  }
38  }
39  return nullptr;
40 }
41 
42 const std::vector<const GEMSuperChamber*>& GEMRing::superChambers() const { return superChambers_; }
43 
44 int GEMRing::nSuperChambers() const { return superChambers_.size(); }
45 
46 int GEMRing::region() const { return region_; }
47 
48 int GEMRing::station() const { return station_; }
49 
50 int GEMRing::ring() const { return ring_; }
std::vector< const GeomDet * > components() const
Return the super chambers in the ring.
Definition: GEMRing.cc:16
const std::vector< const GEMSuperChamber * > & superChambers() const
Return the chambers in the ring.
Definition: GEMRing.cc:42
int region() const
Return the region number.
Definition: GEMRing.cc:46
GEMRing(int region, int station, int ring)
constructor
Definition: GEMRing.cc:4
int nSuperChambers() const
Return numbers of chambers.
Definition: GEMRing.cc:44
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
Definition: GEMRing.cc:14
~GEMRing()
destructor
Definition: GEMRing.cc:6
int station() const
Return the station number.
Definition: GEMRing.cc:48
std::vector< const GEMSuperChamber * > superChambers_
Definition: GEMRing.h:70
std::vector< GEMDetId > detIds_
Definition: GEMRing.h:67
static const char ring_[]
int ring_
Definition: GEMRing.h:65
Definition: DetId.h:17
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the chamber corresponding to the given id.
Definition: GEMRing.cc:27
bool operator==(const GEMRing &sch) const
equal if the id is the same
Definition: GEMRing.cc:10
int ring() const
Return the ring number.
Definition: GEMRing.cc:50
std::vector< GEMDetId > ids() const
Return the vector of GEMDetIds in this ring.
Definition: GEMRing.cc:8
const GeomDet * component(DetId id) const
Return the sub-component (super chamber) with a given id in this ring.
Definition: GEMRing.cc:25
int region_
Definition: GEMRing.h:63
int station_
Definition: GEMRing.h:64