CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TMuonCaloSumProducer Class Reference

#include <L1Trigger/L1TGlobalMuon/plugins/L1TMuonCaloSumProducer.cc>

Inheritance diagram for L1TMuonCaloSumProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1TMuonCaloSumProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag m_caloLabel
 
edm::EDGetTokenT< CaloTowerBxCollectionm_caloTowerToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: takes generated muons and fills them in the expected collections for the MicroGMT

Implementation: [Notes on implementation]

Definition at line 47 of file L1TMuonCaloSumProducer.cc.

Constructor & Destructor Documentation

◆ L1TMuonCaloSumProducer()

L1TMuonCaloSumProducer::L1TMuonCaloSumProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 71 of file L1TMuonCaloSumProducer.cc.

References edm::ParameterSet::getParameter().

71  {
72  //register your inputs:
73  m_caloLabel = iConfig.getParameter<edm::InputTag>("caloStage2Layer2Label");
74  m_caloTowerToken = consumes<CaloTowerBxCollection>(m_caloLabel);
75  //register your products
76  produces<MuonCaloSumBxCollection>("TriggerTowerSums");
77  produces<MuonCaloSumBxCollection>("TriggerTower2x2s");
78 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken

Member Function Documentation

◆ fillDescriptions()

void L1TMuonCaloSumProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 184 of file L1TMuonCaloSumProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

184  {
185  //The following says we do not know what parameters are allowed so do no validation
186  // Please change this to state exactly what you do use, even if it is no parameters
188  desc.setUnknown();
189  descriptions.addDefault(desc);
190 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void L1TMuonCaloSumProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 85 of file L1TMuonCaloSumProducer.cc.

References funct::abs(), nano_mu_digi_cff::bx, eleHcalExtractorBlocks_cff::caloTowers, l1t::MuonCaloSum::etBits(), l1trig_cff::hwEta, l1t::L1Candidate::hwEta(), l1trig_cff::hwPhi, l1t::L1Candidate::hwPhi(), l1trig_cff::hwPt, l1t::L1Candidate::hwPt(), hcalRecHitTable_cff::ieta, iEvent, hcalRecHitTable_cff::iphi, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), and l1t::MuonCaloSum::setEtBits().

85  {
86  using namespace edm;
87  std::unique_ptr<MuonCaloSumBxCollection> towerSums(std::make_unique<MuonCaloSumBxCollection>());
88  std::unique_ptr<MuonCaloSumBxCollection> tower2x2s(std::make_unique<MuonCaloSumBxCollection>());
89 
91 
92  if (iEvent.getByToken(m_caloTowerToken, caloTowers)) {
93  int detamax = 4;
94  int dphimax = 4;
95 
96  const int iFirstBx = caloTowers->getFirstBX();
97  const int iLastBx = caloTowers->getLastBX();
98 
99  // set BX range for sums
100  towerSums->setBXRange(iFirstBx, iLastBx);
101  tower2x2s->setBXRange(iFirstBx, iLastBx);
102 
103  for (int bx = iFirstBx; bx <= iLastBx; ++bx) {
104  std::map<int, MuonCaloSum> sums;
105  std::map<int, MuonCaloSum> regs;
106 
107  for (auto it = caloTowers->begin(bx); it != caloTowers->end(bx); ++it) {
108  const CaloTower& twr = *it;
109  int hwEta = twr.hwEta();
110  if (std::abs(hwEta) > 27) {
111  continue;
112  }
113  int hwPt = twr.hwPt();
114  if (hwPt < 1) {
115  continue;
116  }
117  int hwPhi = twr.hwPhi();
118 
119  // calculating tower2x2s
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) {
124  regs[muon_idx] = MuonCaloSum(hwPt, iphi2x2, ieta2x2, muon_idx);
125  } else {
126  regs.at(muon_idx).setEtBits(regs.at(muon_idx).etBits() + hwPt);
127  }
128 
129  // std::cout << "iphi; phi " << hwPhi << "; " << phi << " .. ieta; eta" << hwEta << "; " << twr.eta() << std::endl;
130 
131  // calculating towerSums
132  int ietamax = hwEta + detamax + 1;
133  for (int ieta = hwEta - detamax; ieta < ietamax; ++ieta) {
134  if (std::abs(ieta) > 27) {
135  continue;
136  }
137  int ietamu = (ieta + 27) / 2;
138  int iphimax = hwPhi + dphimax + 1;
139  for (int iphi = hwPhi - dphimax; iphi < iphimax; ++iphi) {
140  int iphiwrapped = iphi;
141  if (iphiwrapped < 0) {
142  iphiwrapped += 72;
143  } else if (iphiwrapped > 71) {
144  iphiwrapped -= 72;
145  }
146  int iphimu = iphiwrapped / 2;
147  int idxmu = iphimu * 28 + ietamu;
148  if (sums.count(idxmu) == 0) {
149  sums[idxmu] = MuonCaloSum(hwPt, iphimu, ietamu, idxmu);
150  } else {
151  sums.at(idxmu).setEtBits(sums.at(idxmu).etBits() + hwPt);
152  }
153  }
154  }
155  }
156 
157  // fill towerSums output collection for this BX
158  for (auto it = sums.begin(); it != sums.end(); ++it) {
159  if (it->second.etBits() > 0) {
160  MuonCaloSum sum = MuonCaloSum(it->second);
161  // convert Et to correct scale:
162  if (sum.etBits() > 31) {
163  sum.setEtBits(31);
164  }
165  towerSums->push_back(bx, sum);
166  }
167  }
168  // fill tower2x2s output collection for this BX
169  for (auto it = regs.begin(); it != regs.end(); ++it) {
170  if (it->second.etBits() > 0) {
171  tower2x2s->push_back(bx, it->second);
172  }
173  }
174  }
175  } else {
176  LogWarning("GlobalMuon") << "CaloTowers not found. Producing empty collections." << std::endl;
177  }
178 
179  iEvent.put(std::move(towerSums), "TriggerTowerSums");
180  iEvent.put(std::move(tower2x2s), "TriggerTower2x2s");
181 }
edm::EDGetTokenT< CaloTowerBxCollection > m_caloTowerToken
const int etBits() const
Definition: MuonCaloSum.h:20
int hwPhi() const
Definition: L1Candidate.h:37
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int hwEta() const
Definition: L1Candidate.h:36
void setEtBits(int bits)
Definition: MuonCaloSum.h:15
int hwPt() const
Definition: L1Candidate.h:35
HLT enums.
Log< level::Warning, false > LogWarning
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ m_caloLabel

edm::InputTag L1TMuonCaloSumProducer::m_caloLabel
private

Definition at line 57 of file L1TMuonCaloSumProducer.cc.

◆ m_caloTowerToken

edm::EDGetTokenT<CaloTowerBxCollection> L1TMuonCaloSumProducer::m_caloTowerToken
private

Definition at line 56 of file L1TMuonCaloSumProducer.cc.