CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTSuperLayer.cc
Go to the documentation of this file.
1 
9 /* This Class Header */
10 
11 /* Base Class Headers */
13 
14 /* Collaborating Class Header */
16 
17 /* C++ Headers */
18 #include <iostream>
19 
20 /* ====================================================================== */
21 
22 /* Constructor */
25  const DTChamber* ch) :
26  GeomDet(plane), theId(id) , theLayers(4,(const DTLayer*)0), theCh(ch) {
27  setDetId(id);
28 }
29 
30 /* Destructor */
32  for (std::vector<const DTLayer*>::const_iterator il=theLayers.begin();
33  il!=theLayers.end(); ++il) delete (*il);
34 }
35 
36 /* Operations */
37 
39  return theId;
40 }
41 
42 bool DTSuperLayer::operator==(const DTSuperLayer& sl) const {
43  return id()==sl.id();
44 }
45 
47 std::vector< const GeomDet*> DTSuperLayer::components() const {
48  return std::vector<const GeomDet*>(theLayers.begin(), theLayers.end());
49 }
50 
51 
53  return layer(DTLayerId(id.rawId()));
54 }
55 
56 
57 const std::vector< const DTLayer*>& DTSuperLayer::layers() const {
58  return theLayers;
59 }
60 
62  // theLayers size is preallocated.
63  theLayers[l->id().layer()-1] = l;
64 }
65 
67  return theCh;
68 }
69 
71  if (id.superlayerId()!=theId) return 0; // not in this SL!
72  return layer(id.layer());
73 }
74 
75 const DTLayer* DTSuperLayer::layer(int ilay) const{
76  if ((ilay>=1) && (ilay<=4)) {
77  return theLayers[ilay-1];
78  } else {
79  return 0;
80  }
81 }
void setDetId(DetId id)
Definition: GeomDet.h:97
DTLayerId id() const
Return the DetId of this SL.
Definition: DTLayer.cc:48
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:61
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
DTSuperLayerId theId
Definition: DTSuperLayer.h:74
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:38
virtual ~DTSuperLayer()
Definition: DTSuperLayer.cc:31
const DTLayer * layer(DTLayerId id) const
Return the layer corresponding to the given id.
Definition: DTSuperLayer.cc:70
const DTChamber * theCh
Definition: DTSuperLayer.h:77
Definition: DetId.h:20
const std::vector< const DTLayer * > & layers() const
Return the layers in the SL.
Definition: DTSuperLayer.cc:57
string const
Definition: compareJSON.py:14
bool operator==(const DTSuperLayer &sl) const
True if id are the same.
Definition: DTSuperLayer.cc:42
const DTChamber * chamber() const
Definition: DTSuperLayer.cc:66
std::vector< const DTLayer * > theLayers
Definition: DTSuperLayer.h:76
virtual const GeomDet * component(DetId id) const
Return the layer with a given id in this SL.
Definition: DTSuperLayer.cc:52
DTSuperLayer(DTSuperLayerId id, ReferenceCountingPointer< BoundPlane > &plane, const DTChamber *ch=0)
Definition: DTSuperLayer.cc:23
virtual std::vector< const GeomDet * > components() const
Return the layers in the SL.
Definition: DTSuperLayer.cc:47