File indexing completed on 2024-04-06 12:29:32
0001 #include "SimCalorimetry/HcalSimAlgos/interface/ZDCShape.h"
0002 #include <cmath>
0003
0004 ZDCShape::ZDCShape() : nbin_(256), nt_(nbin_, 0.) { computeShapeZDC(); }
0005
0006 ZDCShape::ZDCShape(const ZDCShape& d) : CaloVShape(d), nbin_(d.nbin_), nt_(d.nt_) {}
0007
0008 double ZDCShape::timeToRise() const { return 0.; }
0009
0010 void ZDCShape::computeShapeZDC() {
0011
0012
0013 const float ts = 3.0;
0014
0015 int j;
0016 float norm;
0017
0018
0019 norm = 0.0;
0020 for (j = 0; j < 3 * ts && j < nbin_; j++) {
0021
0022 nt_[j] = j * exp(-(j * j) / (ts * ts));
0023 norm += nt_[j];
0024 }
0025
0026 for (j = 0; j < 3 * ts && j < nbin_; j++) {
0027 nt_[j] /= norm;
0028 }
0029 }
0030
0031 double ZDCShape::operator()(double time) const {
0032
0033 int jtime;
0034 jtime = static_cast<int>(time + 0.5);
0035
0036 if (jtime >= 0 && jtime < nbin_)
0037 return nt_[jtime];
0038 else
0039 return 0.0;
0040 }