74 m_caloTowerToken = consumes<CaloTowerBxCollection>(m_caloLabel);
76 produces<MuonCaloSumBxCollection>(
"TriggerTowerSums");
77 produces<MuonCaloSumBxCollection>(
"TriggerTower2x2s");
87 std::unique_ptr<MuonCaloSumBxCollection> towerSums(std::make_unique<MuonCaloSumBxCollection>());
88 std::unique_ptr<MuonCaloSumBxCollection> tower2x2s(std::make_unique<MuonCaloSumBxCollection>());
100 towerSums->setBXRange(iFirstBx, iLastBx);
101 tower2x2s->setBXRange(iFirstBx, iLastBx);
103 for (
int bx = iFirstBx;
bx <= iLastBx; ++
bx) {
104 std::map<int, MuonCaloSum> sums;
105 std::map<int, MuonCaloSum> regs;
120 int ieta2x2 = (
hwEta + 27) / 2;
121 int iphi2x2 =
hwPhi / 2;
122 int muon_idx = iphi2x2 * 28 + ieta2x2;
123 if (regs.count(muon_idx) == 0) {
126 regs.at(muon_idx).setEtBits(regs.at(muon_idx).etBits() +
hwPt);
132 int ietamax =
hwEta + detamax + 1;
137 int ietamu = (
ieta + 27) / 2;
138 int iphimax =
hwPhi + dphimax + 1;
140 int iphiwrapped =
iphi;
141 if (iphiwrapped < 0) {
143 }
else if (iphiwrapped > 71) {
146 int iphimu = iphiwrapped / 2;
147 int idxmu = iphimu * 28 + ietamu;
148 if (sums.count(idxmu) == 0) {
151 sums.at(idxmu).setEtBits(sums.at(idxmu).etBits() +
hwPt);
158 for (
auto it = sums.begin();
it != sums.end(); ++
it) {
159 if (
it->second.etBits() > 0) {
165 towerSums->push_back(
bx, sum);
169 for (
auto it = regs.begin();
it != regs.end(); ++
it) {
170 if (
it->second.etBits() > 0) {
171 tower2x2s->push_back(
bx,
it->second);
176 LogWarning(
"GlobalMuon") <<
"CaloTowers not found. Producing empty collections." << std::endl;
T getParameter(std::string const &) const
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken
L1TMuonCaloSumProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Warning, false > LogWarning
edm::InputTag m_caloLabel