From f787df2b084dbfc4eaf5e237c7a65890abbeda63 Mon Sep 17 00:00:00 2001 From: matt2275 Date: Mon, 7 Oct 2024 15:55:46 -0500 Subject: [PATCH] Update ZdcSimpleRecAlgo_Run3.cc Update ZdcSimpleRecAlgo_Run3.cc Fixed an issue where if statement checking wrong variable to guard against seg fault. Fixed issue by updating associated for loop condition to be less than digi_size. I also updated the chargedweightedtime to check for potential NAN which will now be set to -99.0 --- RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc b/RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc index 3d1f6fed27155..87ccdbc69b64d 100644 --- a/RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc +++ b/RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc @@ -97,7 +97,7 @@ ZDCRecHit ZdcSimpleRecAlgo_Run3::reco0(const QIE10DataFrame& digi, double ta = 0; double energySOIp1 = 0; double ratioSOIp1 = -1.0; - double chargeWeightedTime = 0; + double chargeWeightedTime = -99.0; double Allnoise = 0; int noiseslices = 0; @@ -223,9 +223,7 @@ ZDCRecHit ZdcSimpleRecAlgo_Run3::reco0(const QIE10DataFrame& digi, double tmp_energy = 0; double tmp_TSWeightedEnergy = 0; - for (int ts = 0; ts < nTs_; ++ts) { - if (CurrentTS >= digi_size) - continue; + for (int ts = 0; ts < digi_size; ++ts) { int capid = digi[ts].capid(); // max sure there are no negative values in time calculation @@ -237,7 +235,8 @@ ZDCRecHit ZdcSimpleRecAlgo_Run3::reco0(const QIE10DataFrame& digi, } } - chargeWeightedTime = (tmp_TSWeightedEnergy / tmp_energy - 1) * 25.0; + if (tmp_energy > 0) + chargeWeightedTime = (tmp_TSWeightedEnergy / tmp_energy - 1) * 25.0; auto rh = ZDCRecHit(digi.id(), ampl, time, -99); rh.setEnergySOIp1(energySOIp1);