CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes
ComponentShapeCollection Class Reference

#include <ComponentShapeCollection.h>

Public Member Functions

const std::shared_ptr< ComponentShapeat (int depthIndex) const
 
 ComponentShapeCollection (bool useDBShape, edm::ConsumesCollector iC)
 
 ComponentShapeCollection (edm::ConsumesCollector iC)
 
 ComponentShapeCollection (bool useDBShape)
 
void setEventSetup (const edm::EventSetup &evtSetup)
 
 ~ComponentShapeCollection ()
 

Static Public Member Functions

static int maxDepthBin ()
 
static int toDepthBin (int index)
 

Protected Member Functions

void buildMe (const edm::EventSetup *es=nullptr)
 
void fillCollection (bool useDBShape)
 
void fillCollection (edm::ConsumesCollector iC)
 

Protected Attributes

double m_thresh
 
bool m_useDBShape
 

Private Attributes

edm::ESGetToken< EcalSimComponentShape, EcalSimComponentShapeRcdespsToken_
 
std::shared_ptr< ComponentShapem_shapeArr [m_nDepthBins]
 

Static Private Attributes

static const int m_nDepthBins = 23
 

Detailed Description

Definition at line 8 of file ComponentShapeCollection.h.

Constructor & Destructor Documentation

◆ ComponentShapeCollection() [1/3]

ComponentShapeCollection::ComponentShapeCollection ( bool  useDBShape,
edm::ConsumesCollector  iC 
)
inline

Definition at line 10 of file ComponentShapeCollection.h.

References fillCollection().

11  : m_useDBShape(useDBShape), m_thresh(0.0), espsToken_(iC.esConsumes()) {
12  fillCollection(iC);
13  }
void fillCollection(bool useDBShape)
edm::ESGetToken< EcalSimComponentShape, EcalSimComponentShapeRcd > espsToken_

◆ ComponentShapeCollection() [2/3]

ComponentShapeCollection::ComponentShapeCollection ( edm::ConsumesCollector  iC)
inline

Definition at line 14 of file ComponentShapeCollection.h.

14 : ComponentShapeCollection(true, iC) {}
ComponentShapeCollection(bool useDBShape, edm::ConsumesCollector iC)

◆ ComponentShapeCollection() [3/3]

ComponentShapeCollection::ComponentShapeCollection ( bool  useDBShape)
inline

Definition at line 15 of file ComponentShapeCollection.h.

References fillCollection().

◆ ~ComponentShapeCollection()

ComponentShapeCollection::~ComponentShapeCollection ( )
inline

Definition at line 17 of file ComponentShapeCollection.h.

17 {}

Member Function Documentation

◆ at()

const std::shared_ptr< ComponentShape > ComponentShapeCollection::at ( int  depthIndex) const

Definition at line 48 of file ComponentShapeCollection.cc.

References Exception, m_nDepthBins, m_shapeArr, and toDepthBin().

Referenced by EcalTimeMapDigitizer::add().

48  {
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 }
static int toDepthBin(int index)
std::shared_ptr< ComponentShape > m_shapeArr[m_nDepthBins]

◆ buildMe()

void ComponentShapeCollection::buildMe ( const edm::EventSetup es = nullptr)
protected

Definition at line 15 of file ComponentShapeCollection.cc.

References gather_cfg::cout, fillCollection(), and m_useDBShape.

Referenced by setEventSetup().

15  {
16 #ifdef component_shape_debug
17  std::cout << "ComponentShapeCollection::buildMe called " << std::endl;
18 #endif
20 };
void fillCollection(bool useDBShape)

◆ fillCollection() [1/2]

void ComponentShapeCollection::fillCollection ( bool  useDBShape = false)
protected

Definition at line 32 of file ComponentShapeCollection.cc.

References gather_cfg::cout, espsToken_, mps_fire::i, m_nDepthBins, and m_shapeArr.

Referenced by buildMe(), and ComponentShapeCollection().

32  {
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 }
edm::ESGetToken< EcalSimComponentShape, EcalSimComponentShapeRcd > espsToken_
std::shared_ptr< ComponentShape > m_shapeArr[m_nDepthBins]

◆ fillCollection() [2/2]

void ComponentShapeCollection::fillCollection ( edm::ConsumesCollector  iC)
protected

Definition at line 22 of file ComponentShapeCollection.cc.

References gather_cfg::cout, espsToken_, mps_fire::i, m_nDepthBins, and m_shapeArr.

22  {
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 }
edm::ESGetToken< EcalSimComponentShape, EcalSimComponentShapeRcd > espsToken_
std::shared_ptr< ComponentShape > m_shapeArr[m_nDepthBins]

◆ maxDepthBin()

int ComponentShapeCollection::maxDepthBin ( )
static

Definition at line 56 of file ComponentShapeCollection.cc.

References m_nDepthBins.

Referenced by EcalTimeMapDigitizer::add().

56 { return m_nDepthBins - 1; }

◆ setEventSetup()

void ComponentShapeCollection::setEventSetup ( const edm::EventSetup evtSetup)

Definition at line 5 of file ComponentShapeCollection.cc.

References buildMe(), gather_cfg::cout, mps_fire::i, m_nDepthBins, and m_shapeArr.

Referenced by EcalDigiProducer_Ph2::accumulate(), EcalDigiProducer::accumulate(), EcalTimeDigiProducer::initializeEvent(), and EcalTimeMapDigitizer::setEventSetup().

5  {
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 }
void buildMe(const edm::EventSetup *es=nullptr)
std::shared_ptr< ComponentShape > m_shapeArr[m_nDepthBins]

◆ toDepthBin()

int ComponentShapeCollection::toDepthBin ( int  index)
static

Definition at line 54 of file ComponentShapeCollection.cc.

Referenced by EcalTimeMapDigitizer::add(), and at().

54 { return index >> 3; }

Member Data Documentation

◆ espsToken_

edm::ESGetToken<EcalSimComponentShape, EcalSimComponentShapeRcd> ComponentShapeCollection::espsToken_
private

Definition at line 35 of file ComponentShapeCollection.h.

Referenced by fillCollection().

◆ m_nDepthBins

const int ComponentShapeCollection::m_nDepthBins = 23
staticprivate

Definition at line 34 of file ComponentShapeCollection.h.

Referenced by at(), fillCollection(), maxDepthBin(), and setEventSetup().

◆ m_shapeArr

std::shared_ptr<ComponentShape> ComponentShapeCollection::m_shapeArr[m_nDepthBins]
private

Definition at line 36 of file ComponentShapeCollection.h.

Referenced by at(), fillCollection(), and setEventSetup().

◆ m_thresh

double ComponentShapeCollection::m_thresh
protected

Definition at line 31 of file ComponentShapeCollection.h.

◆ m_useDBShape

bool ComponentShapeCollection::m_useDBShape
protected

Definition at line 30 of file ComponentShapeCollection.h.

Referenced by buildMe().