CMS 3D CMS Logo

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