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