CMS 3D CMS Logo

GEMRing.cc
Go to the documentation of this file.
3 
4 GEMRing::GEMRing(int region, int station, int ring) :
5  region_(region),
6  station_(station),
7  ring_(ring)
8 {}
9 
11 
12 std::vector<GEMDetId> GEMRing::ids() const {
13  return detIds_;
14 }
15 
16 bool GEMRing::operator==(const GEMRing& ri) const {
17  return ( region_ == ri.region() &&
18  station_ == ri.station() &&
19  ring_ == ri.ring() );
20 }
21 
23  superChambers_.emplace_back(sch);
24 }
25 
26 std::vector<const GeomDet*> GEMRing::components() const {
27  std::vector<const GeomDet*> result;
28  for (auto sch : superChambers_) {
29  auto newSch(sch->components());
30  result.insert(result.end(), newSch.begin(), newSch.end());
31  }
32  return result;
33 }
34 
35 const GeomDet* GEMRing::component(DetId id) const {
36  return superChamber(GEMDetId(id.rawId()));
37 }
38 
40  if (id.region()!=region_ || id.station()!=station_ || id.ring()!=ring_) return nullptr; // not in this station
41  return superChamber(id.chamber());
42 }
43 
44 const GEMSuperChamber* GEMRing::superChamber(int isch) const {
45  for (auto sch : superChambers_) {
46  if (sch->id().chamber() == isch) {
47  return sch;
48  }
49  }
50  return nullptr;
51 }
52 
53 const std::vector<const GEMSuperChamber*>& GEMRing::superChambers() const {
54  return superChambers_;
55 }
56 
58  return superChambers_.size();
59 }
60 
61 int GEMRing::region() const {
62  return region_;
63 }
64 
65 int GEMRing::station() const {
66  return station_;
67 }
68 
69 int GEMRing::ring() const {
70  return ring_;
71 }
int region() const
Return the region number.
Definition: GEMRing.cc:61
int station() const
Return the station number.
Definition: GEMRing.cc:65
int nSuperChambers() const
Return numbers of chambers.
Definition: GEMRing.cc:57
GEMRing(int region, int station, int ring)
constructor
Definition: GEMRing.cc:4
std::vector< const GeomDet * > components() const
Return the super chambers in the ring.
Definition: GEMRing.cc:26
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
Definition: GEMRing.cc:22
~GEMRing()
destructor
Definition: GEMRing.cc:10
int ring() const
Return the ring number.
Definition: GEMRing.cc:69
std::vector< const GEMSuperChamber * > superChambers_
Definition: GEMRing.h:72
std::vector< GEMDetId > detIds_
Definition: GEMRing.h:69
static const char ring_[]
std::vector< GEMDetId > ids() const
Return the vector of GEMDetIds in this ring.
Definition: GEMRing.cc:12
const GeomDet * component(DetId id) const
Return the sub-component (super chamber) with a given id in this ring.
Definition: GEMRing.cc:35
const GEMSuperChamber * superChamber(GEMDetId id) const
Return the chamber corresponding to the given id.
Definition: GEMRing.cc:39
bool operator==(const GEMRing &sch) const
equal if the id is the same
Definition: GEMRing.cc:16
int ring_
Definition: GEMRing.h:67
Definition: DetId.h:18
int region_
Definition: GEMRing.h:65
int station_
Definition: GEMRing.h:66
const std::vector< const GEMSuperChamber * > & superChambers() const
Return the chambers in the ring.
Definition: GEMRing.cc:53