CMS 3D CMS Logo

CSCChamber.cc
Go to the documentation of this file.
1 
7 
9 
11  // Delete all layers
12  for (std::vector<const CSCLayer*>::const_iterator i = theComponents.begin(); i != theComponents.end(); ++i) {
13  delete (*i);
14  }
15 }
16 
17 std::vector<const GeomDet*> CSCChamber::components() const {
18  return std::vector<const GeomDet*>(theComponents.begin(), theComponents.end());
19 }
20 
21 const GeomDet* CSCChamber::component(DetId id) const { return layer(CSCDetId(id.rawId())); }
22 
23 void CSCChamber::addComponent(int n, const CSCLayer* gd) {
24  if ((n > 0) && (n < 7))
25  theComponents[n - 1] = gd;
26  else
27  edm::LogError("CSC") << "Each chamber has only SIX layers.";
28 }
29 
30 const CSCLayer* CSCChamber::layer(CSCDetId iid) const {
31  if (iid.chamberId() != id())
32  return nullptr; // not in this chamber
33  return layer(iid.layer());
34 }
35 
36 const CSCLayer* CSCChamber::layer(int ilay) const {
37  if ((ilay > 0) && (ilay < 7))
38  return theComponents[ilay - 1];
39  else {
40  return nullptr;
41  }
42 }
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
~CSCChamber() override
Definition: CSCChamber.cc:10
void addComponent(int n, const CSCLayer *gd)
Add a layer.
Definition: CSCChamber.cc:23
std::vector< const GeomDet * > components() const override
Return the layers in this chamber.
Definition: CSCChamber.cc:17
int layer() const
Definition: CSCDetId.h:56
Log< level::Error, false > LogError
std::vector< const CSCLayer * > theComponents
Definition: CSCChamber.h:64
Definition: DetId.h:17
CSCDetId chamberId() const
Definition: CSCDetId.h:47
const GeomDet * component(DetId id) const override
Return the layer with a given id in this chamber.
Definition: CSCChamber.cc:21
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:34