CMS 3D CMS Logo

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