diff --git a/Detectors/PHOS/calib/include/PHOSCalibWorkflow/TurnOnHistos.h b/Detectors/PHOS/calib/include/PHOSCalibWorkflow/TurnOnHistos.h index 4457da2e100ad..0814fe0da4547 100644 --- a/Detectors/PHOS/calib/include/PHOSCalibWorkflow/TurnOnHistos.h +++ b/Detectors/PHOS/calib/include/PHOSCalibWorkflow/TurnOnHistos.h @@ -76,7 +76,7 @@ class TurnOnHistos /// \param bitset with channels fired in event void fillFiredMap(const std::bitset& bs) { - for (short i = NCHANNELS; --i;) { + for (size_t i = 0; i < NCHANNELS; ++i) { if (bs[i]) { mGoodMap[i]++; } @@ -87,7 +87,7 @@ class TurnOnHistos /// \param bitset with channels fired in event void fillNoisyMap(const std::bitset& bs) { - for (short i = NCHANNELS; --i;) { + for (size_t i = 0; i < NCHANNELS; ++i) { if (bs[i]) { mNoisyMap[i]++; } diff --git a/Detectors/PHOS/calib/src/PHOSRunbyrunCalibrator.cxx b/Detectors/PHOS/calib/src/PHOSRunbyrunCalibrator.cxx index baa20307b0fbd..63e51f06c0e64 100644 --- a/Detectors/PHOS/calib/src/PHOSRunbyrunCalibrator.cxx +++ b/Detectors/PHOS/calib/src/PHOSRunbyrunCalibrator.cxx @@ -127,11 +127,11 @@ bool PHOSRunbyrunSlot::checkCluster(const Cluster& clu) return false; } // First check BadMap - float posX, posZ; + float posX{0}, posZ{0}; clu.getLocalPosition(posX, posZ); - short absId; + short absId{0}; Geometry::relPosToAbsId(clu.module(), posX, posZ, absId); - if (!mBadMap->isChannelGood(absId)) { + if (mBadMap && absId >= 0 && !mBadMap->isChannelGood(absId)) { return false; } return (clu.getEnergy() > 0.3 && clu.getMultiplicity() > 1); diff --git a/Detectors/PHOS/calib/src/PHOSTurnonCalibrator.cxx b/Detectors/PHOS/calib/src/PHOSTurnonCalibrator.cxx index 5413b20f491b8..432090c280ff8 100644 --- a/Detectors/PHOS/calib/src/PHOSTurnonCalibrator.cxx +++ b/Detectors/PHOS/calib/src/PHOSTurnonCalibrator.cxx @@ -36,7 +36,7 @@ PHOSTurnonSlot::PHOSTurnonSlot(bool useCCDB) : mUseCCDB(useCCDB) PHOSTurnonSlot::PHOSTurnonSlot(const PHOSTurnonSlot& other) { mUseCCDB = other.mUseCCDB; - mRunStartTime = other.mUseCCDB; + mRunStartTime = other.mRunStartTime; mFiredTiles.reset(); mNoisyTiles.reset(); mTurnOnHistos = std::make_unique(); @@ -91,15 +91,17 @@ void PHOSTurnonSlot::scanClusters(const gsl::span& cells, const Trig for (int i = firstCellInEvent; i < lastCellInEvent; i++) { const Cell& c = cells[i]; if (c.getTRU()) { - mNoisyTiles.set(c.getTRUId() - Geometry::getTotalNCells() - 1); + auto channel = c.getTRUId() - Geometry::getTotalNCells() - 1; + if (channel >= 0) { + mNoisyTiles.set(channel); + } } } // Copy to have good and noisy map mFiredTiles.reset(); - char mod; - float x, z; - short ddl; + float x{0}, z{0}; + short ddl{0}; int firstCluInEvent = clutr.getFirstEntry(); int lastCluInEvent = firstCluInEvent + clutr.getNumberOfObjects(); for (int i = firstCluInEvent; i < lastCluInEvent; i++) { @@ -107,7 +109,7 @@ void PHOSTurnonSlot::scanClusters(const gsl::span& cells, const Trig if (clu.getEnergy() < 1.e-4) { continue; } - mod = clu.module(); + char mod = clu.module(); clu.getLocalPosition(x, z); // TODO: do we need separate 2x2 and 4x4 spectra? Switch? // short truId2x2 = Geometry::relPosToTruId(mod, x, z, 0); @@ -123,7 +125,7 @@ void PHOSTurnonSlot::scanClusters(const gsl::span& cells, const Trig // Fill final good and noisy maps mTurnOnHistos->fillFiredMap(mFiredTiles); mNoisyTiles ^= mFiredTiles; - mTurnOnHistos->fillNoisyMap(mFiredTiles); + mTurnOnHistos->fillNoisyMap(mNoisyTiles); } //==============================================