Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:19

0001 /** \file
0002  *
0003  *  Author: Raffaello Trentadue - Universit? Bari 
0004  *  Mail:     <raffaello.trentadue@ba.infn.it>
0005  */
0006 
0007 /* This Class Header */
0008 #include "Geometry/RPCGeometry/interface/RPCChamber.h"
0009 
0010 /* Collaborating Class Header */
0011 #include "Geometry/RPCGeometry/interface/RPCRoll.h"
0012 
0013 /* C++ Headers */
0014 #include <iostream>
0015 
0016 /* ====================================================================== */
0017 
0018 /* Constructor */
0019 RPCChamber::RPCChamber(RPCDetId id, const ReferenceCountingPointer<BoundPlane>& plane) : GeomDet(plane), theId(id) {
0020   setDetId(id);
0021 }
0022 
0023 /* Destructor */
0024 RPCChamber::~RPCChamber() {}
0025 
0026 RPCDetId RPCChamber::id() const { return theId; }
0027 
0028 /* Operations */
0029 
0030 bool RPCChamber::operator==(const RPCChamber& ch) const { return this->id() == ch.id(); }
0031 
0032 void RPCChamber::add(RPCRoll* rl) { theRolls.emplace_back(rl); }
0033 
0034 std::vector<const GeomDet*> RPCChamber::components() const {
0035   return std::vector<const GeomDet*>(theRolls.begin(), theRolls.end());
0036 }
0037 
0038 const GeomDet* RPCChamber::component(DetId id) const { return roll(RPCDetId(id.rawId())); }
0039 
0040 const std::vector<const RPCRoll*>& RPCChamber::rolls() const { return theRolls; }
0041 
0042 int RPCChamber::nrolls() const { return theRolls.size(); }
0043 
0044 const RPCRoll* RPCChamber::roll(RPCDetId id) const {
0045   if (id.chamberId() != theId)
0046     return nullptr;  // not in this Roll!
0047   return roll(id.roll());
0048 }
0049 
0050 const RPCRoll* RPCChamber::roll(int isl) const {
0051   for (auto theRoll : theRolls) {
0052     if (theRoll->id().roll() == isl)
0053       return theRoll;
0054   }
0055   return nullptr;
0056 }