CMS 3D CMS Logo

GEMStation.cc
Go to the documentation of this file.
1 #include <utility>
2 
6 
7 GEMStation::GEMStation(int region, int station) : region_(region), station_(station) {}
8 
10 
11 std::vector<GEMDetId> GEMStation::ids() const {
12  std::vector<GEMDetId> result;
13  for (auto& ri : rings_) {
14  std::vector<GEMDetId> newIds(ri->ids());
15  result.insert(result.end(), newIds.begin(), newIds.end());
16  }
17  return result;
18 }
19 
20 bool GEMStation::operator==(const GEMStation& st) const { return (region_ == st.region() && station_ == st.station()); }
21 
22 void GEMStation::add(GEMRing* ring) { rings_.emplace_back(ring); }
23 
24 std::vector<const GeomDet*> GEMStation::components() const {
25  std::vector<const GeomDet*> result;
26  for (auto ri : rings_) {
27  auto newSch(ri->components());
28  result.insert(result.end(), newSch.begin(), newSch.end());
29  }
30  return result;
31 }
32 
34  auto detId(GEMDetId(id.rawId()));
35  return ring(detId.ring())->component(id);
36 }
37 
39  if (id.region() != region_ || id.station() != station_)
40  return nullptr; // not in this station
41  return ring(id.ring())->superChamber(id.chamber());
42 }
43 
44 std::vector<const GEMSuperChamber*> GEMStation::superChambers() const {
45  std::vector<const GEMSuperChamber*> result;
46  for (auto ri : rings_) {
47  std::vector<const GEMSuperChamber*> newSch(ri->superChambers());
48  result.insert(result.end(), newSch.begin(), newSch.end());
49  }
50  return result;
51 }
52 
53 const GEMRing* GEMStation::ring(int ring) const {
54  for (auto ri : rings_) {
55  if (ring == ri->ring()) {
56  return ri;
57  }
58  }
59  return nullptr;
60 }
61 
62 const std::vector<const GEMRing*>& GEMStation::rings() const { return rings_; }
63 
64 int GEMStation::nRings() const { return rings_.size(); }
65 
67 
68 const std::string GEMStation::getName() const { return name_; }
69 
70 int GEMStation::region() const { return region_; }
71 
72 int GEMStation::station() const { return station_; }
int region_
Definition: GEMStation.h:70
std::vector< const GeomDet * > components() const
Return the super chambers in the station.
Definition: GEMStation.cc:24
const std::string getName() const
Set the station name.
Definition: GEMStation.cc:68
int region() const
Get the region.
Definition: GEMStation.cc:70
void add(GEMRing *ring)
Add ring to the station which takes ownership.
Definition: GEMStation.cc:22
const GEMRing * ring(int ring) const
Get a ring.
Definition: GEMStation.cc:53
std::vector< GEMDetId > ids() const
Return the vector of GEMDetIds in this station.
Definition: GEMStation.cc:11
void setName(std::string name)
Set the station name.
Definition: GEMStation.cc:66
std::vector< const GEMRing * > rings_
Definition: GEMStation.h:74
bool operator==(const GEMStation &st) const
equal if the id is the same
Definition: GEMStation.cc:20
~GEMStation()
destructor
Definition: GEMStation.cc:9
std::string name_
Definition: GEMStation.h:75
Definition: DetId.h:17
GEMStation(int region, int station)
constructor
Definition: GEMStation.cc:7
std::vector< const GEMSuperChamber * > superChambers() const
Return the super chambers in the region.
Definition: GEMStation.cc:44
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the chamber corresponding to the given id.
Definition: GEMRing.cc:27
int nRings() const
Return numbers of rings for this station.
Definition: GEMStation.cc:64
const GeomDet * component(DetId id) const
Return the sub-component (super chamber) with a given id in this station.
Definition: GEMStation.cc:33
int ring() const
Return the ring number.
Definition: GEMRing.cc:50
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the chamber corresponding to the given id.
Definition: GEMStation.cc:38
const std::vector< const GEMRing * > & rings() const
Return the rings in the station.
Definition: GEMStation.cc:62
int station_
Definition: GEMStation.h:71
def move(src, dest)
Definition: eostools.py:511
int station() const
Get the station.
Definition: GEMStation.cc:72