CMS 3D CMS Logo

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