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