CMS 3D CMS Logo

RPCChamber.cc
Go to the documentation of this file.
1 
7 /* This Class Header */
9 
10 /* Collaborating Class Header */
12 
13 /* C++ Headers */
14 #include <iostream>
15 
16 /* ====================================================================== */
17 
18 /* Constructor */
20  setDetId(id);
21 }
22 
23 /* Destructor */
25 
26 RPCDetId RPCChamber::id() const { return theId; }
27 
28 /* Operations */
29 
30 bool RPCChamber::operator==(const RPCChamber& ch) const { return this->id() == ch.id(); }
31 
32 void RPCChamber::add(RPCRoll* rl) { theRolls.emplace_back(rl); }
33 
34 std::vector<const GeomDet*> RPCChamber::components() const {
35  return std::vector<const GeomDet*>(theRolls.begin(), theRolls.end());
36 }
37 
38 const GeomDet* RPCChamber::component(DetId id) const { return roll(RPCDetId(id.rawId())); }
39 
40 const std::vector<const RPCRoll*>& RPCChamber::rolls() const { return theRolls; }
41 
42 int RPCChamber::nrolls() const { return theRolls.size(); }
43 
44 const RPCRoll* RPCChamber::roll(RPCDetId id) const {
45  if (id.chamberId() != theId)
46  return nullptr; // not in this Roll!
47  return roll(id.roll());
48 }
49 
50 const RPCRoll* RPCChamber::roll(int isl) const {
51  for (auto theRoll : theRolls) {
52  if (theRoll->id().roll() == isl)
53  return theRoll;
54  }
55  return nullptr;
56 }
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
Definition: RPCChamber.cc:32
const RPCRoll * roll(RPCDetId id) const
Return the Roll corresponding to the given id.
Definition: RPCChamber.cc:44
void setDetId(DetId id)
Definition: GeomDet.h:99
int nrolls() const
Retunr numbers of rolls.
Definition: RPCChamber.cc:42
RPCDetId id() const
Return the RPCChamberId of this chamber.
Definition: RPCChamber.cc:26
const GeomDet * component(DetId id) const override
Return the sub-component (roll) with a given id in this chamber.
Definition: RPCChamber.cc:38
~RPCChamber() override
Destructor.
Definition: RPCChamber.cc:24
Definition: DetId.h:17
std::vector< const RPCRoll * > theRolls
Definition: RPCChamber.h:59
std::vector< const GeomDet * > components() const override
Return the rolls in the chamber.
Definition: RPCChamber.cc:34
RPCDetId theId
Definition: RPCChamber.h:56
RPCChamber(RPCDetId id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: RPCChamber.cc:19
bool operator==(const RPCChamber &ch) const
equal if the id is the same
Definition: RPCChamber.cc:30
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:40