Skip to content

Commit

Permalink
ZDC Reconstruction Bug Fixes
Browse files Browse the repository at this point in the history
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.
setSaturationFlags to true
  • Loading branch information
matt2275 committed Oct 17, 2024
1 parent 5d7641b commit 599b331
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 6 additions & 5 deletions RecoLocalCalo/HcalRecAlgos/src/ZdcSimpleRecAlgo_Run3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,23 @@ ZDCRecHit ZdcSimpleRecAlgo_Run3::reco0(const QIE10DataFrame& digi,
ta *= calibs.respcorrgain(capid); // fC --> GeV
if (ta > 0) {
tmp_energy += ta;
tmp_TSWeightedEnergy += (ts + 1) * ta;
tmp_TSWeightedEnergy += (ts)*ta;
}
}

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

if (maxI >= 0 && maxI < tool.size()) {
float tmp_tdctime = 0;
int le_tdc = digi[maxI].le_tdc();
// TDC error codes will be 60=-1, 61 = -2, 62 = -3, 63 = -4
if (digi[maxI].le_tdc() >= 60)
tmp_tdctime = -1 * (digi[maxI].le_tdc() - 59);
if (le_tdc >= 60)
tmp_tdctime = -1 * (le_tdc - 59);
else
tmp_tdctime = maxI * 25. + (digi[maxI].le_tdc() / 2);
tmp_tdctime = maxI * 25. + (le_tdc / 2.0);
rh.setTDCtime(tmp_tdctime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

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

} // namespace zdchelper

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

: reco_(conf.getParameter<int>("recoMethod")),
Expand Down Expand Up @@ -227,7 +225,7 @@ void ZdcHitReconstructor_Run3::fillDescriptions(edm::ConfigurationDescriptions&
{
1,
});
desc.add<bool>("setSaturationFlags", false);
desc.add<bool>("setSaturationFlags", true);
{
edm::ParameterSetDescription psd0;
psd0.add<int>("maxADCvalue", 255);
Expand Down

0 comments on commit 599b331

Please sign in to comment.