File indexing completed on 2024-04-06 12:29:26
0001 #include <cmath>
0002
0003 #include "SimCalorimetry/EcalSimAlgos/interface/APDShape.h"
0004
0005 #include <cassert>
0006
0007 void APDShape::fillShape(float& time_interval,
0008 double& m_thresh,
0009 EcalShapeBase::DVec& aVec,
0010 const edm::EventSetup* es) const {
0011 if (m_useDBShape) {
0012 if (es == nullptr) {
0013 throw cms::Exception("EcalShapeBase:: DB conditions are not available, const edm::EventSetup* es == nullptr ");
0014 }
0015 auto const& esps = es->getData(espsToken_);
0016
0017 aVec = esps.apd_shape;
0018 time_interval = esps.time_interval;
0019 m_thresh = esps.apd_thresh;
0020 } else {
0021 m_thresh = 0.0;
0022 time_interval = 1.0;
0023 aVec.reserve(500);
0024 const double m_tStart = 74.5;
0025 const double m_tau = 40.5;
0026
0027 for (unsigned int i(0); i != 500; ++i) {
0028 const double ctime((1. * i + 0.5 - m_tStart) / m_tau);
0029 double val = 0 > ctime ? 0 : ctime * exp(1. - ctime);
0030 aVec.push_back(val);
0031 }
0032 }
0033 }