Skip to content

Commit a7e8fef

Browse files
committed
ZDC Reconstruction Bug Fixes
Bug Fixes: ZdcSimpleRecAlgo_Run3.cc: Simplified the formula for ChargeWeightedTime. Fixed issue with integer division with TdcTime and updated code only call digi.le_tcd() once. ZdcHitReconstruction_Run3.cc: fixed issue with setZdcSaturation where the saturation was always 1 due to incorrect method to iterate over QIE10 digis. updated default value of skipRPD to false and setSaturationFlags to true
1 parent fe85c4c commit a7e8fef

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -231,22 +231,23 @@ ZDCRecHit ZdcSimpleRecAlgo_Run3::reco0(const QIE10DataFrame& digi,
231231
ta *= calibs.respcorrgain(capid); // fC --> GeV
232232
if (ta > 0) {
233233
tmp_energy += ta;
234-
tmp_TSWeightedEnergy += (ts + 1) * ta;
234+
tmp_TSWeightedEnergy += (ts)*ta;
235235
}
236236
}
237237

238238
if (tmp_energy > 0)
239-
chargeWeightedTime = (tmp_TSWeightedEnergy / tmp_energy - 1) * 25.0;
239+
chargeWeightedTime = (tmp_TSWeightedEnergy / tmp_energy) * 25.0;
240240
auto rh = ZDCRecHit(digi.id(), ampl, time, -99);
241241
rh.setEnergySOIp1(energySOIp1);
242242

243243
if (maxI >= 0 && maxI < tool.size()) {
244244
float tmp_tdctime = 0;
245+
int le_tdc = digi[maxI].le_tdc();
245246
// TDC error codes will be 60=-1, 61 = -2, 62 = -3, 63 = -4
246-
if (digi[maxI].le_tdc() >= 60)
247-
tmp_tdctime = -1 * (digi[maxI].le_tdc() - 59);
247+
if (le_tdc >= 60)
248+
tmp_tdctime = -1 * (le_tdc - 59);
248249
else
249-
tmp_tdctime = maxI * 25. + (digi[maxI].le_tdc() / 2);
250+
tmp_tdctime = maxI * 25. + (le_tdc / 2.0);
250251
rh.setTDCtime(tmp_tdctime);
251252
}
252253

RecoLocalCalo/HcalRecProducers/plugins/ZdcHitReconstructor_Run3.cc

+4-6
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818

1919
#include <vector>
2020
namespace zdchelper {
21-
void setZDCSaturation(ZDCRecHit rh, QIE10DataFrame& digi, int maxValue) {
22-
for (auto it = digi.begin(); it != digi.end(); it++) {
23-
QIE10DataFrame::Sample sample = QIE10DataFrame::Sample(*it);
24-
if (sample.adc() >= maxValue) {
21+
void setZDCSaturation(ZDCRecHit& rh, QIE10DataFrame& digi, int maxValue) {
22+
for (int i = 0; i < digi.samples(); i++) {
23+
if (digi[i].adc() >= maxValue) {
2524
rh.setFlagField(1, HcalCaloFlagLabels::ADCSaturationBit);
2625
break;
2726
}
@@ -30,7 +29,6 @@ namespace zdchelper {
3029

3130
} // namespace zdchelper
3231

33-
/* Zdc Hit reconstructor allows for CaloRecHits with status words */
3432
ZdcHitReconstructor_Run3::ZdcHitReconstructor_Run3(edm::ParameterSet const& conf)
3533

3634
: reco_(conf.getParameter<int>("recoMethod")),
@@ -227,7 +225,7 @@ void ZdcHitReconstructor_Run3::fillDescriptions(edm::ConfigurationDescriptions&
227225
{
228226
1,
229227
});
230-
desc.add<bool>("setSaturationFlags", false);
228+
desc.add<bool>("setSaturationFlags", true);
231229
{
232230
edm::ParameterSetDescription psd0;
233231
psd0.add<int>("maxADCvalue", 255);

0 commit comments

Comments
 (0)