CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Geometry/RPCGeometry/src/RPCChamber.cc

Go to the documentation of this file.
00001 
00009 /* This Class Header */
00010 #include "Geometry/RPCGeometry/interface/RPCChamber.h"
00011 
00012 /* Collaborating Class Header */
00013 #include "Geometry/RPCGeometry/interface/RPCRoll.h"
00014 
00015 
00016 /* C++ Headers */
00017 #include <iostream>
00018 
00019 /* ====================================================================== */
00020 
00021 /* Constructor */ 
00022 RPCChamber::RPCChamber(RPCDetId id, 
00023                        const ReferenceCountingPointer<BoundPlane> & plane) :
00024   GeomDet(plane), theId(id)
00025 {
00026 setDetId(id);
00027 }
00028 
00029 /* Destructor */ 
00030 RPCChamber::~RPCChamber() {
00031 }
00032 
00033 
00034 RPCDetId
00035 RPCChamber::id() const
00036 {
00037   return theId;
00038 }
00039 
00040 /* Operations */ 
00041 
00042 bool 
00043 RPCChamber::operator==(const RPCChamber& ch) const {
00044   return this->id()==ch.id();
00045 }
00046 
00047 
00048 
00049 void 
00050 RPCChamber::add(RPCRoll* rl) {
00051   theRolls.push_back(rl);
00052 }
00053 
00054 
00055 
00056 std::vector<const GeomDet*> 
00057 RPCChamber::components() const {
00058   return  std::vector<const GeomDet*>(theRolls.begin(), theRolls.end());
00059 }
00060 
00061 
00062 
00063 const GeomDet* 
00064 RPCChamber::component(DetId id) const {
00065   return roll(RPCDetId(id.rawId()));
00066 }
00067 
00068 
00069 const std::vector<const RPCRoll*>& 
00070 RPCChamber::rolls() const 
00071 {
00072   return theRolls;
00073 }
00074 
00075 const int RPCChamber::nrolls() const
00076 {
00077   return theRolls.size();
00078 }
00079 
00080 const RPCRoll* 
00081 RPCChamber::roll(RPCDetId id) const
00082 {
00083   if (id.chamberId()!=theId) return 0; // not in this Roll!
00084   return roll(id.roll());
00085 }
00086 
00087 
00088 const RPCRoll* 
00089 RPCChamber::roll(int isl) const 
00090 {
00091   for (std::vector<const RPCRoll*>::const_iterator i = theRolls.begin();
00092        i!= theRolls.end(); ++i) {
00093     if ((*i)->id().roll()==isl) 
00094       return (*i);
00095   }
00096   return 0;
00097 }
00098