CMS 3D CMS Logo

ComponentShapeCollection.cc
Go to the documentation of this file.
3 
4 // #define component_shape_debug 1
6 #ifdef component_shape_debug
7  std::cout << "ComponentShapeCollection::setEventSetup called " << std::endl;
8 #endif
9  buildMe(&evtSetup);
10  for (int i = 0; i < m_nDepthBins; ++i) {
11  m_shapeArr[i]->setEventSetup(evtSetup, false);
12  }
13 }
14 
16 #ifdef component_shape_debug
17  std::cout << "ComponentShapeCollection::buildMe called " << std::endl;
18 #endif
20 };
21 
23 #ifdef component_shape_debug
24  std::cout << "ComponentShapeCollection::fillCollection(edm::ConsumesCollector iC) called " << std::endl;
25 #endif
26  //m_shapeArr->clear();
27  for (int i = 0; i < m_nDepthBins; ++i) {
28  m_shapeArr[i] = std::make_shared<ComponentShape>(i, espsToken_);
29  }
30 }
31 
32 void ComponentShapeCollection::fillCollection(bool useDBShape = false) {
33 #ifdef component_shape_debug
34  std::cout << "ComponentShapeCollection::fillCollection(bool useDBShape) called " << std::endl;
35 #endif
36  //m_shapeArr->clear();
37  if (useDBShape) {
38  for (int i = 0; i < m_nDepthBins; ++i) {
39  m_shapeArr[i] = std::make_shared<ComponentShape>(i, espsToken_);
40  }
41  } else {
42  for (int i = 0; i < m_nDepthBins; ++i) {
43  m_shapeArr[i] = std::make_shared<ComponentShape>(i);
44  }
45  }
46 }
47 
48 const std::shared_ptr<ComponentShape> ComponentShapeCollection::at(int depthIndex) const {
49  if (0 > toDepthBin(depthIndex) || toDepthBin(depthIndex) > m_nDepthBins - 1)
50  throw cms::Exception("ComponentShape:: invalid depth requested");
51  return m_shapeArr[toDepthBin(depthIndex)];
52 }
53 
55 
void fillCollection(bool useDBShape)
void buildMe(const edm::EventSetup *es=nullptr)
void setEventSetup(const edm::EventSetup &evtSetup)
static int toDepthBin(int index)
edm::ESGetToken< EcalSimComponentShape, EcalSimComponentShapeRcd > espsToken_
const std::shared_ptr< ComponentShape > at(int depthIndex) const
std::shared_ptr< ComponentShape > m_shapeArr[m_nDepthBins]