00001 00009 /* This Class Header */ 00010 00011 /* Base Class Headers */ 00012 #include "Geometry/DTGeometry/interface/DTSuperLayer.h" 00013 00014 /* Collaborating Class Header */ 00015 #include "Geometry/DTGeometry/interface/DTLayer.h" 00016 00017 /* C++ Headers */ 00018 #include <iostream> 00019 00020 /* ====================================================================== */ 00021 00022 /* Constructor */ 00023 DTSuperLayer::DTSuperLayer(DTSuperLayerId id, 00024 ReferenceCountingPointer<BoundPlane>& plane, 00025 const DTChamber* ch) : 00026 GeomDet(plane), theId(id) , theLayers(4,(const DTLayer*)0), theCh(ch) { 00027 setDetId(id); 00028 } 00029 00030 /* Destructor */ 00031 DTSuperLayer::~DTSuperLayer() { 00032 for (std::vector<const DTLayer*>::const_iterator il=theLayers.begin(); 00033 il!=theLayers.end(); ++il) delete (*il); 00034 } 00035 00036 /* Operations */ 00037 00038 DTSuperLayerId DTSuperLayer::id() const { 00039 return theId; 00040 } 00041 00042 bool DTSuperLayer::operator==(const DTSuperLayer& sl) const { 00043 return id()==sl.id(); 00044 } 00045 00047 std::vector< const GeomDet*> DTSuperLayer::components() const { 00048 return std::vector<const GeomDet*>(theLayers.begin(), theLayers.end()); 00049 } 00050 00051 00052 const GeomDet* DTSuperLayer::component(DetId id) const { 00053 return layer(DTLayerId(id.rawId())); 00054 } 00055 00056 00057 const std::vector< const DTLayer*>& DTSuperLayer::layers() const { 00058 return theLayers; 00059 } 00060 00061 void DTSuperLayer::add(DTLayer* l) { 00062 // theLayers size is preallocated. 00063 theLayers[l->id().layer()-1] = l; 00064 } 00065 00066 const DTChamber* DTSuperLayer::chamber() const { 00067 return theCh; 00068 } 00069 00070 const DTLayer* DTSuperLayer::layer(DTLayerId id) const { 00071 if (id.superlayerId()!=theId) return 0; // not in this SL! 00072 return layer(id.layer()); 00073 } 00074 00075 const DTLayer* DTSuperLayer::layer(int ilay) const{ 00076 if ((ilay>=1) && (ilay<=4)) { 00077 return theLayers[ilay-1]; 00078 } else { 00079 return 0; 00080 } 00081 }