Skip to content

Commit e43317c

Browse files
committed
name 170, add const to vector size
1 parent 84faa67 commit e43317c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

SimCalorimetry/HcalSimAlgos/src/HcalSiPM.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const HcalSiPM::cdfpair& HcalSiPM::BorelCDF(unsigned int k) {
8181
// EPSILON determines the min and max # of xtalk cells that can be
8282
// simulated.
8383
constexpr double EPSILON = 1e-6;
84+
constexpr uint32_t maxCDFsize = 170; // safe max to avoid factorial to be infinite
8485
auto it = borelcdfs.find(k);
8586
if (it == borelcdfs.end()) {
8687
vector<double> cdf;
@@ -90,7 +91,7 @@ const HcalSiPM::cdfpair& HcalSiPM::BorelCDF(unsigned int k) {
9091
unsigned int i;
9192
double sumb = 0.;
9293
double iFact = 1.;
93-
for (i = 0; i < 170; i++) {
94+
for (i = 0; i < maxCDFsize; i++) {
9495
if (i > 0)
9596
iFact *= double(i);
9697
sumb += Borel(i, theCrossTalk, k, iFact);
@@ -102,7 +103,7 @@ const HcalSiPM::cdfpair& HcalSiPM::BorelCDF(unsigned int k) {
102103
unsigned int borelstartn = i;
103104

104105
// calculate cdf[i] limit to 170 to avoid iFact to become infinite
105-
for (++i; i < 170; ++i) {
106+
for (++i; i < maxCDFsize; ++i) {
106107
iFact *= double(i);
107108
sumb += Borel(i, theCrossTalk, k, iFact);
108109
cdf.push_back(sumb);

SimCalorimetry/HcalSimAlgos/src/HcalSiPMHitResponse.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ CaloSamples HcalSiPMHitResponse::makeSiPMSignal(DetId const& id,
209209

210210
LogDebug("HcalSiPMHitResponse") << "makeSiPMSignal for " << HcalDetId(id);
211211

212-
int nptb = photonTimeBins.size();
212+
const int nptb = photonTimeBins.size();
213213
double sum[nptb];
214214
for (auto i = 0; i < nptb; ++i)
215215
sum[i] = 0;

0 commit comments

Comments
 (0)