CMS 3D CMS Logo

GEMRegion.cc
Go to the documentation of this file.
4 
5 GEMRegion::GEMRegion(int region) : region_(region) {}
6 
8 
9 std::vector<GEMDetId> GEMRegion::ids() const {
10  std::vector<GEMDetId> result;
11  for (auto st : stations_) {
12  std::vector<GEMDetId> newIds(st->ids());
13  result.insert(result.end(), newIds.begin(), newIds.end());
14  }
15  return result;
16 }
17 
18 bool GEMRegion::operator==(const GEMRegion& re) const { return region_ == re.region(); }
19 
20 void GEMRegion::add(GEMStation* st) { stations_.emplace_back(st); }
21 
22 std::vector<const GeomDet*> GEMRegion::components() const {
23  std::vector<const GeomDet*> result;
24  for (auto st : stations_) {
25  auto newSch(st->components());
26  result.insert(result.end(), newSch.begin(), newSch.end());
27  }
28  return result;
29 }
30 
32  auto detId(GEMDetId(id.rawId()));
33  return station(detId.station())->component(id);
34 }
35 
37  if (id.region() != region_)
38  return nullptr; // not in this region
39  return station(id.station())->ring(id.ring())->superChamber(id);
40 }
41 
42 std::vector<const GEMSuperChamber*> GEMRegion::superChambers() const {
43  std::vector<const GEMSuperChamber*> result;
44  for (auto st : stations_) {
45  std::vector<const GEMSuperChamber*> newSch(st->superChambers());
46  result.insert(result.end(), newSch.begin(), newSch.end());
47  }
48  return result;
49 }
50 
51 const GEMStation* GEMRegion::station(int st) const {
52  for (auto stat : stations_) {
53  if (st == stat->station()) {
54  return stat;
55  }
56  }
57  return nullptr;
58 }
59 
60 const std::vector<const GEMStation*>& GEMRegion::stations() const { return stations_; }
61 
62 int GEMRegion::nStations() const { return stations_.size(); }
63 
64 int GEMRegion::region() const { return region_; }
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the super chamber corresponding to the given id.
Definition: GEMRegion.cc:36
std::vector< const GeomDet * > components() const
Return the super chambers in the region.
Definition: GEMRegion.cc:22
const GEMStation * station(int st) const
Return a station.
Definition: GEMRegion.cc:51
std::vector< const GEMSuperChamber * > superChambers() const
Return the super chambers in the region.
Definition: GEMRegion.cc:42
int region() const
Return the region.
Definition: GEMRegion.cc:64
int region_
Definition: GEMRegion.h:61
const std::vector< const GEMStation * > & stations() const
Return all stations.
Definition: GEMRegion.cc:60
const GEMRing * ring(int ring) const
Get a ring.
Definition: GEMStation.cc:53
std::vector< const GEMStation * > stations_
Definition: GEMRegion.h:63
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the chamber corresponding to the given id.
Definition: GEMRing.cc:27
Definition: DetId.h:17
GEMRegion(int region)
constructor
Definition: GEMRegion.cc:5
bool operator==(const GEMRegion &reg) const
equal if the id is the same
Definition: GEMRegion.cc:18
~GEMRegion()
destructor
Definition: GEMRegion.cc:7
int nStations() const
Return numbers of stations.
Definition: GEMRegion.cc:62
const GeomDet * component(DetId id) const
Return the sub-component (super chamber) with a given id in this region.
Definition: GEMRegion.cc:31
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:20
std::vector< GEMDetId > ids() const
Return the vector of GEMDetIds in this ring.
Definition: GEMRegion.cc:9