Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:54

0001 /** \file 
0002  *  
0003  *  \author Stefano Lacaprara - INFN Padova <stefano.lacaprara@pd.infn.it>
0004  *
0005  */
0006 
0007 /* This Class Header */
0008 
0009 /* Base Class Headers */
0010 #include "Geometry/DTGeometry/interface/DTSuperLayer.h"
0011 
0012 /* Collaborating Class Header */
0013 #include "Geometry/DTGeometry/interface/DTLayer.h"
0014 
0015 /* C++ Headers */
0016 #include <iostream>
0017 
0018 /* ====================================================================== */
0019 
0020 /* Constructor */
0021 DTSuperLayer::DTSuperLayer(const DTSuperLayerId& id, ReferenceCountingPointer<BoundPlane>& plane, const DTChamber* ch)
0022     : GeomDet(plane), theId(id), theLayers(4, (const DTLayer*)nullptr), theCh(ch) {
0023   setDetId(id);
0024 }
0025 
0026 /* Destructor */
0027 DTSuperLayer::~DTSuperLayer() {
0028   for (std::vector<const DTLayer*>::const_iterator il = theLayers.begin(); il != theLayers.end(); ++il)
0029     delete (*il);
0030 }
0031 
0032 /* Operations */
0033 
0034 DTSuperLayerId DTSuperLayer::id() const { return theId; }
0035 
0036 bool DTSuperLayer::operator==(const DTSuperLayer& sl) const { return id() == sl.id(); }
0037 
0038 /// Return the layers in the SL
0039 std::vector<const GeomDet*> DTSuperLayer::components() const {
0040   return std::vector<const GeomDet*>(theLayers.begin(), theLayers.end());
0041 }
0042 
0043 const GeomDet* DTSuperLayer::component(DetId id) const { return layer(DTLayerId(id.rawId())); }
0044 
0045 const std::vector<const DTLayer*>& DTSuperLayer::layers() const { return theLayers; }
0046 
0047 void DTSuperLayer::add(DTLayer* l) {
0048   // theLayers size is preallocated.
0049   theLayers[l->id().layer() - 1] = l;
0050 }
0051 
0052 const DTChamber* DTSuperLayer::chamber() const { return theCh; }
0053 
0054 const DTLayer* DTSuperLayer::layer(const DTLayerId& id) const {
0055   if (id.superlayerId() != theId)
0056     return nullptr;  // not in this SL!
0057   return layer(id.layer());
0058 }
0059 
0060 const DTLayer* DTSuperLayer::layer(int ilay) const {
0061   if ((ilay >= 1) && (ilay <= 4)) {
0062     return theLayers[ilay - 1];
0063   } else {
0064     return nullptr;
0065   }
0066 }