CMS 3D CMS Logo

DTChamber.cc
Go to the documentation of this file.
1 
6 /* This Class Header */
8 
9 /* Collaborating Class Header */
12 
13 /* C++ Headers */
14 #include <iostream>
15 
16 /* ====================================================================== */
17 
18 /* Constructor */
20  GeomDet(plane),
21  theId(id) {
22  setDetId(id);
23 }
24 
25 /* Destructor */
27  for (std::vector<const DTSuperLayer*>::const_iterator isl=theSLs.begin();
28  isl!=theSLs.end(); ++isl) delete (*isl);
29 }
30 
31 /* Operations */
32 
34  return theId;
35 }
36 
37 bool DTChamber::operator==(const DTChamber& ch) const {
38  return id()==ch.id();
39 }
40 
42  theSLs.push_back(sl);
43 }
44 
45 std::vector<const GeomDet*> DTChamber::components() const {
46  return std::vector<const GeomDet*>(theSLs.begin(), theSLs.end());
47 }
48 
49 
51  DTLayerId lId(id.rawId());
52  if (lId.layer()==0) { // is a SL id
53  return superLayer(lId);
54  } else { // is a layer id
55  return layer(lId);
56  }
57 }
58 
59 
60 const std::vector<const DTSuperLayer*>& DTChamber::superLayers() const {
61  return theSLs;
62 }
63 
64 
66  if (id.chamberId()!=theId) return 0; // not in this SL!
67  return superLayer(id.superLayer());
68 }
69 
70 
71 const DTSuperLayer* DTChamber::superLayer(int isl) const {
72  for (std::vector<const DTSuperLayer*>::const_iterator i = theSLs.begin();
73  i!= theSLs.end(); ++i) {
74  if ((*i)->id().superLayer()==isl) return (*i);
75  }
76  return 0;
77 }
78 
79 
81  return (superLayer(id.superlayer()))->layer(id.layer());
82 }
83 
DTChamber(DTChamberId id, const ReferenceCountingPointer< BoundPlane > &plane)
Constructor.
Definition: DTChamber.cc:19
void setDetId(DetId id)
Definition: GeomDet.h:120
virtual std::vector< const GeomDet * > components() const
Return the superlayers in the chamber.
Definition: DTChamber.cc:45
const DTLayer * layer(DTLayerId id) const
Return the layer corresponding to the given id.
Definition: DTChamber.cc:80
virtual ~DTChamber()
Destructor.
Definition: DTChamber.cc:26
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
bool operator==(const DTChamber &ch) const
equal if the id is the same
Definition: DTChamber.cc:37
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
Definition: DTChamber.cc:60
DTChamberId id() const
Return the DTChamberId of this chamber.
Definition: DTChamber.cc:33
Definition: DetId.h:18
DTChamberId theId
Definition: DTChamber.h:66
std::vector< const DTSuperLayer * > theSLs
Definition: DTChamber.h:69
void add(DTSuperLayer *sl)
Add SL to the chamber which takes ownership.
Definition: DTChamber.cc:41
virtual const GeomDet * component(DetId id) const
Return the sub-component (SL or layer) with a given id in this chamber.
Definition: DTChamber.cc:50
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:65