diff --git a/L1Trigger/L1TGlobal/src/EnergySumZdcCondition.cc b/L1Trigger/L1TGlobal/src/EnergySumZdcCondition.cc index a28bf09eba575..52a6bdcc9e392 100644 --- a/L1Trigger/L1TGlobal/src/EnergySumZdcCondition.cc +++ b/L1Trigger/L1TGlobal/src/EnergySumZdcCondition.cc @@ -122,6 +122,22 @@ const bool l1t::EnergySumZdcCondition::evaluateCondition(const int bxEval) const } const EnergySumZdcTemplate::ObjectParameter objPar = (*(m_gtEnergySumZdcTemplate->objectParameter()))[iCondition]; + l1t::EtSum::EtSumType type; + switch ((m_gtEnergySumZdcTemplate->objectType())[0]) { + case gtZDCP: + type = l1t::EtSum::EtSumType::kZDCP; + break; + case gtZDCM: + type = l1t::EtSum::EtSumType::kZDCM; + break; + default: + edm::LogError("L1TGlobal") + << "\n Error: " + << "Unmatched object type from template to EtSumZdcType, (m_gtEnergySumZdcTemplate->objectType())[0] = " + << (m_gtEnergySumZdcTemplate->objectType())[0] << std::endl; + type = l1t::EtSum::EtSumType::kZDCP; + break; + } // Definition in CondFormats/L1TObjects/interface/L1GtCondition.h: // condGEqVal indicates the operator used for the condition (>=, =): true for >= @@ -136,17 +152,15 @@ const bool l1t::EnergySumZdcCondition::evaluateCondition(const int bxEval) const for (int iEtSum = 0; iEtSum < numberObjectsZdc; ++iEtSum) { l1t::EtSum candZdc = *(candVecZdc->at(useBx, iEtSum)); - if (l1t::EtSum::EtSumType::kZDCP == candZdc.getType()) - candZdcPlus = *(candVecZdc->at(useBx, iEtSum)); - else if (l1t::EtSum::EtSumType::kZDCM == candZdc.getType()) - candZdcMinus = *(candVecZdc->at(useBx, iEtSum)); - - LogDebug("L1TGlobal") << "CANDZdc: " << candZdc.hwPt() << ", " << useBx << ", " << candZdc.getType(); + if (candZdc.getType() != type) + continue; if (candZdc.getType() == l1t::EtSum::EtSumType::kZDCP) { + candZdcPlus = *(candVecZdc->at(useBx, iEtSum)); candZDCPEsum = candZdcPlus.hwPt(); myres = checkThreshold(objPar.etLowThreshold, objPar.etHighThreshold, candZDCPEsum, condGEqVal); } else if (candZdc.getType() == l1t::EtSum::EtSumType::kZDCM) { + candZdcMinus = *(candVecZdc->at(useBx, iEtSum)); candZDCMEsum = candZdcMinus.hwPt(); myres = checkThreshold(objPar.etLowThreshold, objPar.etHighThreshold, candZDCMEsum, condGEqVal); } else { @@ -154,6 +168,8 @@ const bool l1t::EnergySumZdcCondition::evaluateCondition(const int bxEval) const return false; } + LogDebug("L1TGlobal") << "CANDZdc: " << candZdc.hwPt() << ", " << useBx << ", " << candZdc.getType(); + LogDebug("L1TGlobal") << "----------------------------------------------> ZDC EtSumType object from EnergySumZdcTemplate" << "\n objPar.etLowThreshold = " << objPar.etLowThreshold