File indexing completed on 2024-04-06 12:29:25
0001 #ifndef SimCalorimetry_EcalSimAlgos_ComponentShapeCollection_h
0002 #define SimCalorimetry_EcalSimAlgos_ComponentShapeCollection_h
0003
0004 #include "FWCore/Framework/interface/ConsumesCollector.h"
0005 #include "SimCalorimetry/EcalSimAlgos/interface/EcalShapeBase.h"
0006 #include "SimCalorimetry/EcalSimAlgos/interface/ComponentShape.h"
0007
0008 class ComponentShapeCollection {
0009 public:
0010 ComponentShapeCollection(bool useDBShape, edm::ConsumesCollector iC)
0011 : m_useDBShape(useDBShape), m_thresh(0.0), espsToken_(iC.esConsumes()) {
0012 fillCollection(iC);
0013 }
0014 ComponentShapeCollection(edm::ConsumesCollector iC) : ComponentShapeCollection(true, iC) {}
0015 ComponentShapeCollection(bool useDBShape) : m_useDBShape(useDBShape), m_thresh(0.0) { fillCollection(useDBShape); }
0016
0017 ~ComponentShapeCollection() {}
0018
0019 void setEventSetup(const edm::EventSetup& evtSetup);
0020
0021 const std::shared_ptr<ComponentShape> at(int depthIndex) const;
0022 static int toDepthBin(int index);
0023 static int maxDepthBin();
0024
0025 protected:
0026 void buildMe(const edm::EventSetup* es = nullptr);
0027 void fillCollection(bool useDBShape);
0028 void fillCollection(edm::ConsumesCollector iC);
0029
0030 bool m_useDBShape;
0031 double m_thresh;
0032
0033 private:
0034 const static int m_nDepthBins = 23;
0035 edm::ESGetToken<EcalSimComponentShape, EcalSimComponentShapeRcd> espsToken_;
0036 std::shared_ptr<ComponentShape> m_shapeArr[m_nDepthBins];
0037 };
0038
0039 #endif