CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Geometry/CSCGeometry/src/CSCChamber.cc

Go to the documentation of this file.
00001 
00007 #include <Geometry/CSCGeometry/interface/CSCChamber.h>
00008 #include <Geometry/CSCGeometry/interface/CSCLayer.h>
00009 
00010 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00011 
00012 
00013 CSCChamber::~CSCChamber(){
00014   // Delete all layers
00015   for (std::vector<const CSCLayer*>::const_iterator i=theComponents.begin();
00016        i!=theComponents.end(); ++i){
00017     delete (*i);
00018   }
00019 }
00020 
00021 
00022 std::vector<const GeomDet*> 
00023 CSCChamber::components() const {
00024   return std::vector <const GeomDet*>(theComponents.begin(),theComponents.end());
00025 }
00026 
00027 
00028 const GeomDet* CSCChamber::component(DetId id) const {
00029   return layer(CSCDetId(id.rawId()));
00030 }
00031 
00032 
00033 void CSCChamber::addComponent( int n, const CSCLayer* gd ) { 
00034         
00035   if ((n>0) && (n<7)) 
00036     theComponents[n-1] = gd; 
00037   else 
00038     edm::LogError("CSC") << "Each chamber has only SIX layers.";
00039 }
00040 
00041 const CSCLayer* CSCChamber::layer(CSCDetId iid) const {
00042   if (iid.chamberId()!=id()) return 0; // not in this chamber
00043   return layer(iid.layer());
00044 }
00045   
00046 const CSCLayer* CSCChamber::layer(int ilay) const{
00047         
00048   if ((ilay>0) && (ilay<7)) 
00049     return theComponents[ilay-1];
00050   else {
00051     return 0;
00052   }
00053 }