File indexing completed on 2024-04-06 12:20:42
0001 #include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorTrigSumImpl.h"
0002
0003 HGCalConcentratorTrigSumImpl::HGCalConcentratorTrigSumImpl(const edm::ParameterSet& conf) {}
0004
0005 void HGCalConcentratorTrigSumImpl::doSum(uint32_t module_id,
0006 const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
0007 std::vector<l1t::HGCalTriggerSums>& trigSumsVecOutput) const {
0008 double ptsum = 0;
0009 double mipptsum = 0;
0010 double hwptsum = 0;
0011
0012 for (const auto& trigCell : trigCellVecInput) {
0013
0014
0015 ptsum += trigCell.pt();
0016 mipptsum += trigCell.mipPt();
0017 hwptsum += trigCell.hwPt();
0018 }
0019 if (!trigCellVecInput.empty()) {
0020 GlobalPoint module_pos = triggerTools_.getTriggerGeometry()->getModulePosition(module_id);
0021
0022 math::PtEtaPhiMLorentzVector p4(ptsum, module_pos.eta(), module_pos.phi(), 0);
0023 l1t::HGCalTriggerSums ts;
0024 ts.setP4(p4);
0025 ts.setDetId(module_id);
0026 ts.setPosition(module_pos);
0027 ts.setMipPt(mipptsum);
0028 ts.setHwPt(hwptsum);
0029 trigSumsVecOutput.push_back(ts);
0030 }
0031 }