58 virtual void endJob()
override ;
85 m_caloTowerToken = consumes <CaloTowerBxCollection> (m_caloLabel);
87 produces<MuonCaloSumBxCollection>(
"TriggerTowerSums");
88 produces<MuonCaloSumBxCollection>(
"TriggerTower2x2s");
119 std::map<int, MuonCaloSum> sums;
120 std::map<int, MuonCaloSum> regs;
124 int hwEta = twr.
hwEta();
128 int hwPt = twr.
hwPt();
132 int hwPhi = twr.
hwPhi();
135 int ieta2x2 = (hwEta + 27) / 2;
136 int iphi2x2 = hwPhi / 2;
137 int muon_idx = iphi2x2 * 28 + ieta2x2;
138 if (regs.count(muon_idx) == 0) {
139 regs[muon_idx] =
MuonCaloSum(hwPt, iphi2x2, ieta2x2, muon_idx);
141 regs.at(muon_idx).setEtBits(regs.at(muon_idx).etBits() + hwPt);
147 int ietamax = hwEta + detamax + 1;
148 for (
int ieta = hwEta-detamax; ieta < ietamax; ++ieta) {
152 int ietamu = (ieta + 27) / 2;
153 int iphimax = hwPhi + dphimax + 1;
154 for (
int iphi = hwPhi-dphimax; iphi < iphimax; ++iphi) {
155 int iphiwrapped = iphi;
156 if (iphiwrapped < 0) {
158 }
else if (iphiwrapped > 71) {
161 int iphimu = iphiwrapped / 2;
162 int idxmu = iphimu * 28 + ietamu;
163 if (sums.count(idxmu) == 0) {
164 sums[idxmu] =
MuonCaloSum(hwPt, iphimu, ietamu, idxmu);
166 sums.at(idxmu).setEtBits(sums.at(idxmu).etBits() + hwPt);
173 for (
auto it = sums.begin(); it != sums.end(); ++it) {
174 if (it->second.etBits() > 0) {
180 towerSums->push_back(bx, sum);
184 for (
auto it = regs.begin(); it != regs.end(); ++it) {
185 if (it->second.etBits() > 0) {
186 tower2x2s->push_back(bx, it->second);
191 LogWarning(
"GlobalMuon") <<
"CaloTowers not found. Producing empty collections." << std::endl;
194 iEvent.
put(towerSums,
"TriggerTowerSums");
195 iEvent.
put(tower2x2s,
"TriggerTower2x2s");
T getParameter(std::string const &) const
virtual void endRun(const edm::Run &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
BXVector< MuonCaloSum > MuonCaloSumBxCollection
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken
L1TMuonCaloSumProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void endJob() override
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Abs< T >::type abs(const T &t)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void beginRun(const edm::Run &, edm::EventSetup const &) override
virtual void endLuminosityBlock(const edm::LuminosityBlock &, edm::EventSetup const &) override
virtual void beginJob() override
~L1TMuonCaloSumProducer()
edm::InputTag m_caloLabel