CMS 3D CMS Logo

L1TMuonProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TMuonProducer
4 // Class: L1TMuonProducer
5 //
13 //
14 // Original Author: Joschka Philip Lingemann,40 3-B01,+41227671598,
15 // Created: Thu Oct 3 16:31:34 CEST 2013
16 // $Id$
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <fstream>
23 
24 // user include files
29 
32 
35 
42 
46 
52 
53 #include "TMath.h"
54 //
55 // class declaration
56 //
57 using namespace l1t;
58 
60 public:
61  explicit L1TMuonProducer(const edm::ParameterSet&);
62  ~L1TMuonProducer() override;
63 
64  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
65 
66 private:
67  void produce(edm::Event&, const edm::EventSetup&) override;
68 
69  void beginRun(edm::Run const&, edm::EventSetup const&) override;
70  void endRun(edm::Run const&, edm::EventSetup const&) override;
71  void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
72  void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
73 
74  static bool compareMuons(const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu1,
75  const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2);
76 
77  void sortMuons(MicroGMTConfiguration::InterMuonList&, unsigned) const;
78 
79  void calculateRank(MicroGMTConfiguration::InterMuonList& muons) const;
80 
81  void splitAndConvertMuons(edm::Handle<MicroGMTConfiguration::InputCollection> const& in,
84  GMTInternalWedges& wedges_pos,
85  GMTInternalWedges& wedges_neg,
86  int bx) const;
87 
90  GMTInternalWedges& wedges,
91  int bx) const;
92 
93  int computeMuonIdx(const RegionalMuonCand& mu, int currentLink, int muIdxAuto) const;
94 
95  void addMuonsToCollections(MicroGMTConfiguration::InterMuonList& coll,
97  std::unique_ptr<MuonBxCollection>& out,
98  int bx) const;
99 
100  // ----------member data ---------------------------
102  int m_bxMin;
103  int m_bxMax;
105  std::bitset<72> m_inputsToDisable;
106  std::bitset<28> m_caloInputsToDisable;
107  std::bitset<12> m_bmtfInputsToDisable;
108  std::bitset<12> m_omtfInputsToDisable;
109  std::bitset<12> m_emtfInputsToDisable;
110  std::bitset<72> m_maskedInputs;
111  std::bitset<28> m_maskedCaloInputs;
112  std::bitset<12> m_maskedBmtfInputs;
113  std::bitset<12> m_maskedOmtfInputs;
114  std::bitset<12> m_maskedEmtfInputs;
115  std::unique_ptr<L1TMuonGlobalParamsHelper> microGMTParamsHelper;
120  std::shared_ptr<MicroGMTRankPtQualLUT> m_rankPtQualityLUT;
123  std::ofstream m_debugOut;
126 
133 };
134 
135 //
136 // constants, enums and typedefs
137 //
138 
139 //
140 // static data member definitions
141 //
142 
143 //
144 // constructors and destructor
145 //
147  : m_debugOut("test/debug/iso_debug.dat"),
148  m_bmtfCancelMode(cancelmode::tracks),
149  m_emtfCancelMode(cancelmode::coordinate) {
150  // edm::InputTag barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
151  // edm::InputTag overlapTfInputTag = iConfig.getParameter<edm::InputTag>("overlapTFInput");
152  // edm::InputTag forwardTfInputTag = iConfig.getParameter<edm::InputTag>("forwardTFInput");
153 
154  m_barrelTfInputTag = iConfig.getParameter<edm::InputTag>("barrelTFInput");
155  m_overlapTfInputTag = iConfig.getParameter<edm::InputTag>("overlapTFInput");
156  m_endcapTfInputTag = iConfig.getParameter<edm::InputTag>("forwardTFInput");
157  m_trigTowerTag = iConfig.getParameter<edm::InputTag>("triggerTowerInput");
158 
159  m_autoBxRange = iConfig.getParameter<bool>("autoBxRange");
160  m_bxMin = iConfig.getParameter<int>("bxMin");
161  m_bxMax = iConfig.getParameter<int>("bxMax");
162 
163  m_autoCancelMode = iConfig.getParameter<bool>("autoCancelMode");
164  if (!m_autoCancelMode) {
165  if (iConfig.getParameter<std::string>("bmtfCancelMode").find("kftracks") == 0) {
167  }
168  if (iConfig.getParameter<std::string>("emtfCancelMode").find("tracks") == 0) {
170  }
171  }
172 
173  m_barrelTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_barrelTfInputTag);
174  m_overlapTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_overlapTfInputTag);
175  m_endcapTfInputToken = consumes<MicroGMTConfiguration::InputCollection>(m_endcapTfInputTag);
176  m_caloTowerInputToken = consumes<MicroGMTConfiguration::CaloInputCollection>(m_trigTowerTag);
177  m_microGMTParamsToken = esConsumes<L1TMuonGlobalParams, L1TMuonGlobalParamsRcd, edm::Transition::BeginRun>();
178  m_o2oProtoToken = esConsumes<L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd, edm::Transition::BeginRun>();
179 
180  //register your products
181  produces<MuonBxCollection>();
182  produces<MuonBxCollection>("imdMuonsBMTF");
183  produces<MuonBxCollection>("imdMuonsEMTFPos");
184  produces<MuonBxCollection>("imdMuonsEMTFNeg");
185  produces<MuonBxCollection>("imdMuonsOMTFPos");
186  produces<MuonBxCollection>("imdMuonsOMTFNeg");
187 }
188 
190 
191 //
192 // member functions
193 //
194 
195 // ------------ method called to produce the data ------------
197  using namespace edm;
198  std::unique_ptr<MuonBxCollection> outMuons(new MuonBxCollection());
199  std::unique_ptr<MuonBxCollection> imdMuonsBMTF(new MuonBxCollection());
200  std::unique_ptr<MuonBxCollection> imdMuonsEMTFPos(new MuonBxCollection());
201  std::unique_ptr<MuonBxCollection> imdMuonsEMTFNeg(new MuonBxCollection());
202  std::unique_ptr<MuonBxCollection> imdMuonsOMTFPos(new MuonBxCollection());
203  std::unique_ptr<MuonBxCollection> imdMuonsOMTFNeg(new MuonBxCollection());
204 
209 
210  iEvent.getByToken(m_barrelTfInputToken, bmtfMuons);
211  iEvent.getByToken(m_endcapTfInputToken, emtfMuons);
212  iEvent.getByToken(m_overlapTfInputToken, omtfMuons);
213  iEvent.getByToken(m_caloTowerInputToken, trigTowers);
214 
215  // find out the BX range from the inputs
216  // the smallest BX window defines the output BX window
217  if (m_autoBxRange) {
218  int bxMin = -1000;
219  int bxMax = 1000;
220  if (!(m_caloInputsToDisable.all() || m_maskedCaloInputs.all())) {
221  bxMin = std::max(bxMin, trigTowers->getFirstBX());
222  bxMax = std::min(bxMax, trigTowers->getLastBX());
223  }
224  if (!(m_bmtfInputsToDisable.all() || m_maskedBmtfInputs.all())) {
225  bxMin = std::max(bxMin, bmtfMuons->getFirstBX());
226  bxMax = std::min(bxMax, bmtfMuons->getLastBX());
227  }
228  if (!(m_omtfInputsToDisable.all() || m_maskedOmtfInputs.all())) {
229  bxMin = std::max(bxMin, omtfMuons->getFirstBX());
230  bxMax = std::min(bxMax, omtfMuons->getLastBX());
231  }
232  if (!(m_emtfInputsToDisable.all() || m_maskedEmtfInputs.all())) {
233  bxMin = std::max(bxMin, emtfMuons->getFirstBX());
234  bxMax = std::min(bxMax, emtfMuons->getLastBX());
235  }
236  if (bxMin > 0) {
237  bxMin = 0;
238  }
239  if (bxMax < 0) {
240  bxMax = 0;
241  }
242  if (bxMin > -1000) {
243  m_bxMin = bxMin;
244  } else {
245  m_bxMin = 0;
246  }
247  if (bxMax < 1000) {
248  m_bxMax = bxMax;
249  } else {
250  m_bxMax = 0;
251  }
252  }
253 
254  // set BX range for outputs
255  outMuons->setBXRange(m_bxMin, m_bxMax);
256  imdMuonsBMTF->setBXRange(m_bxMin, m_bxMax);
257  imdMuonsEMTFPos->setBXRange(m_bxMin, m_bxMax);
258  imdMuonsEMTFNeg->setBXRange(m_bxMin, m_bxMax);
259  imdMuonsOMTFPos->setBXRange(m_bxMin, m_bxMax);
260  imdMuonsOMTFNeg->setBXRange(m_bxMin, m_bxMax);
261 
262  for (int bx = m_bxMin; bx <= m_bxMax; ++bx) {
263  m_isolationUnit.setTowerSums(*trigTowers, bx);
264  MicroGMTConfiguration::InterMuonList internMuonsBmtf;
265  MicroGMTConfiguration::InterMuonList internMuonsEmtfPos;
266  MicroGMTConfiguration::InterMuonList internMuonsEmtfNeg;
267  MicroGMTConfiguration::InterMuonList internMuonsOmtfPos;
268  MicroGMTConfiguration::InterMuonList internMuonsOmtfNeg;
269 
270  // These wedges contain shared pointers to the ones in the InterMuonList
271  GMTInternalWedges omtfNegWedges;
272  GMTInternalWedges bmtfWedges;
273  GMTInternalWedges emtfPosWedges;
274  GMTInternalWedges emtfNegWedges;
275  GMTInternalWedges omtfPosWedges;
276 
277  // this converts the InputMuon type to the InternalMuon type and splits them into
278  // positive / negative eta collections necessary as LUTs may differ for pos / neg.
279  convertMuons(bmtfMuons, internMuonsBmtf, bmtfWedges, bx);
280  splitAndConvertMuons(emtfMuons, internMuonsEmtfPos, internMuonsEmtfNeg, emtfPosWedges, emtfNegWedges, bx);
281  splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges, bx);
282 
283  // cancel out within the track finders:
289 
290  // cancel out between track finder acceptance overlaps:
295 
296  m_isolationUnit.extrapolateMuons(internMuonsBmtf);
297  m_isolationUnit.extrapolateMuons(internMuonsEmtfNeg);
298  m_isolationUnit.extrapolateMuons(internMuonsEmtfPos);
299  m_isolationUnit.extrapolateMuons(internMuonsOmtfNeg);
300  m_isolationUnit.extrapolateMuons(internMuonsOmtfPos);
301 
302  // the rank calculated here is used in the sort below
303  calculateRank(internMuonsBmtf);
304  calculateRank(internMuonsEmtfNeg);
305  calculateRank(internMuonsEmtfPos);
306  calculateRank(internMuonsOmtfNeg);
307  calculateRank(internMuonsOmtfPos);
308 
309  // The sort function both sorts and removes all but best "nSurvivors"
310  sortMuons(internMuonsBmtf, 8);
311  sortMuons(internMuonsOmtfPos, 4);
312  sortMuons(internMuonsOmtfNeg, 4);
313  sortMuons(internMuonsEmtfPos, 4);
314  sortMuons(internMuonsEmtfNeg, 4);
315 
316  // This combines the 5 streams into one InternalMuon collection for
317  // the final global sort.
319  addMuonsToCollections(internMuonsEmtfPos, internalMuons, imdMuonsEMTFPos, bx);
320  addMuonsToCollections(internMuonsOmtfPos, internalMuons, imdMuonsOMTFPos, bx);
321  addMuonsToCollections(internMuonsBmtf, internalMuons, imdMuonsBMTF, bx);
322  addMuonsToCollections(internMuonsOmtfNeg, internalMuons, imdMuonsOMTFNeg, bx);
323  addMuonsToCollections(internMuonsEmtfNeg, internalMuons, imdMuonsEMTFNeg, bx);
324 
325  // sort internal muons and delete all but best 8
326  sortMuons(internalMuons, 8);
327 
328  m_isolationUnit.isolatePreSummed(internalMuons);
329  // copy muons to output collection...
330  for (const auto& mu : internalMuons) {
331  if (mu->hwPt() > 0) {
333  (mu->hwPt() - 1) * 0.5, mu->hwEta() * 0.010875, mu->hwGlobalPhi() * 0.010908, 0.0};
334  int iso = mu->hwAbsIso() + (mu->hwRelIso() << 1);
335  int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(mu->hwQual(), mu->trackFinderType(), mu->hwHF());
336  Muon outMu{vec,
337  mu->hwPt(),
338  mu->hwEta(),
339  mu->hwGlobalPhi(),
340  outMuQual,
341  mu->hwSign(),
342  mu->hwSignValid(),
343  iso,
344  mu->tfMuonIndex(),
345  0,
346  true,
347  mu->hwIsoSum(),
348  mu->hwDPhi(),
349  mu->hwDEta(),
350  mu->hwRank()};
351 
352  // Set coordinates at the vertex
353  outMu.setHwEtaAtVtx(MicroGMTConfiguration::calcMuonHwEtaExtra(outMu));
354  outMu.setHwPhiAtVtx(MicroGMTConfiguration::calcMuonHwPhiExtra(outMu));
355  outMu.setEtaAtVtx(MicroGMTConfiguration::calcMuonEtaExtra(outMu));
356  outMu.setPhiAtVtx(MicroGMTConfiguration::calcMuonPhiExtra(outMu));
357 
358  // Set displacement information
359  int hwPtUnconstrained{mu->hwPtUnconstrained()};
360  outMu.setPtUnconstrained(
361  hwPtUnconstrained == 0
362  ? 0
363  : (hwPtUnconstrained - 1)); // Don't want negative pT, unconstr. pT has LSB of 1 GeV.
364  outMu.setHwPtUnconstrained(hwPtUnconstrained);
365  outMu.setHwDXY(mu->hwDXY());
366 
367  if (mu->hwSignValid()) {
368  outMu.setCharge(1 - 2 * mu->hwSign());
369  } else {
370  outMu.setCharge(0);
371  }
372  m_debugOut << mu->hwCaloPhi() << " " << mu->hwCaloEta() << std::endl;
373  outMuons->push_back(bx, outMu);
374  }
375  }
376  }
377 
378  iEvent.put(std::move(outMuons));
379  iEvent.put(std::move(imdMuonsBMTF), "imdMuonsBMTF");
380  iEvent.put(std::move(imdMuonsEMTFPos), "imdMuonsEMTFPos");
381  iEvent.put(std::move(imdMuonsEMTFNeg), "imdMuonsEMTFNeg");
382  iEvent.put(std::move(imdMuonsOMTFPos), "imdMuonsOMTFPos");
383  iEvent.put(std::move(imdMuonsOMTFNeg), "imdMuonsOMTFNeg");
384 }
385 
386 bool L1TMuonProducer::compareMuons(const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu1,
387  const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2) {
388  return (mu1->hwWins() >= mu2->hwWins());
389 }
390 
392  MicroGMTConfiguration::InterMuonList::iterator mu1;
393  // reset from previous sort stage
394  for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
395  (*mu1)->setHwWins(0);
396  }
397 
398  for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
399  int mu1CancelBit = (*mu1)->hwCancelBit();
400  auto mu2 = mu1;
401  mu2++;
402  for (; mu2 != muons.end(); ++mu2) {
403  if (mu1CancelBit != 1 && (*mu2)->hwCancelBit() != 1) {
404  if ((*mu1)->hwRank() >= (*mu2)->hwRank()) {
405  (*mu1)->increaseWins();
406  } else {
407  (*mu2)->increaseWins();
408  }
409  } else if (mu1CancelBit != 1) {
410  (*mu1)->increaseWins();
411  } else if ((*mu2)->hwCancelBit() != 1) {
412  (*mu2)->increaseWins();
413  }
414  }
415  }
416 
417  size_t nMuonsBefore = muons.size();
418  int minWins = nMuonsBefore - nSurvivors;
419 
420  // remove all muons that were cancelled or that do not have sufficient rank
421  // (reduces the container size to nSurvivors)
422  muons.remove_if([&minWins](auto muon) { return ((muon->hwWins() < minWins) || (muon->hwCancelBit() == 1)); });
424 }
425 
427  for (auto& mu1 : muons) {
428  int rank = m_rankPtQualityLUT->lookup(mu1->hwPt(), mu1->hwQual());
429  mu1->setHwRank(rank);
430  }
431 }
432 
435  std::unique_ptr<MuonBxCollection>& out,
436  int bx) const {
437  for (auto& mu : coll) {
438  interout.push_back(mu);
439  math::PtEtaPhiMLorentzVector vec{(mu->hwPt() - 1) * 0.5, mu->hwEta() * 0.010875, mu->hwGlobalPhi() * 0.010908, 0.0};
440  int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(mu->hwQual(), mu->trackFinderType(), mu->hwHF());
441  // set tfMuonIndex and iso to 0 like in the FW
442  Muon outMu{vec,
443  mu->hwPt(),
444  mu->hwEta(),
445  mu->hwGlobalPhi(),
446  outMuQual,
447  mu->hwSign(),
448  mu->hwSignValid(),
449  0,
450  0,
451  0,
452  true,
453  0,
454  mu->hwDPhi(),
455  mu->hwDEta(),
456  mu->hwRank()};
457 
458  int hwPtUnconstrained{mu->hwPtUnconstrained()};
459  outMu.setPtUnconstrained(hwPtUnconstrained == 0
460  ? 0
461  : (hwPtUnconstrained - 1)); // Don't want negative pT, unconstr. pT has LSB of 1 GeV.
462  outMu.setHwPtUnconstrained(hwPtUnconstrained);
463  outMu.setHwDXY(mu->hwDXY());
464 
465  if (mu->hwSignValid()) {
466  outMu.setCharge(1 - 2 * mu->hwSign());
467  } else {
468  outMu.setCharge(0);
469  }
470 
471  out->push_back(bx, outMu);
472  }
473 }
474 
478  GMTInternalWedges& wedges_pos,
479  GMTInternalWedges& wedges_neg,
480  int bx) const {
481  // initialize the wedge collections:
482  for (int i = 0; i < 6; ++i) {
483  wedges_pos[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
484  wedges_pos[i].reserve(3);
485  wedges_neg[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
486  wedges_neg[i].reserve(3);
487  }
488  if (bx < in->getFirstBX() || bx > in->getLastBX())
489  return;
490  int muIdxAuto = 0;
491  int currentLink = 0;
492  for (size_t i = 0; i < in->size(bx); ++i, ++muIdxAuto) {
493  if (in->at(bx, i).hwPt() > 0) {
494  int link = in->at(bx, i).link();
495  if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) {
496  continue; // only process if input link is enabled and not masked
497  }
498  if (currentLink != link) {
499  muIdxAuto = 0;
500  currentLink = link;
501  }
502  int gPhi = MicroGMTConfiguration::calcGlobalPhi(
503  in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor());
504  int tfMuonIdx{computeMuonIdx(in->at(bx, i), currentLink, muIdxAuto)};
505  std::shared_ptr<GMTInternalMuon> out = std::make_shared<GMTInternalMuon>(in->at(bx, i), gPhi, tfMuonIdx);
506  if (in->at(bx, i).hwEta() > 0) {
507  out_pos.push_back(out);
508  wedges_pos[in->at(bx, i).processor()].push_back(out);
509  } else {
510  out_neg.emplace_back(out);
511  wedges_neg[in->at(bx, i).processor()].push_back(out);
512  }
513  }
514  }
515  for (int i = 0; i < 6; ++i) {
516  if (wedges_pos[i].size() > 3)
517  edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf+ / omtf+. Wedge " << i << ": Size "
518  << wedges_pos[i].size() << std::endl;
519  if (wedges_neg[i].size() > 3)
520  edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf- / omtf-. Wedge " << i << ": Size "
521  << wedges_neg[i].size() << std::endl;
522  }
523 }
524 
527  GMTInternalWedges& wedges,
528  int bx) const {
529  // initialize the wedge collection:
530  for (int i = 0; i < 12; ++i) {
531  wedges[i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
532  wedges[i].reserve(3);
533  }
534  if (bx < in->getFirstBX() || bx > in->getLastBX()) {
535  return;
536  }
537  int muIdxAuto = 0;
538  int currentLink = 0;
539  for (size_t i = 0; i < in->size(bx); ++i, ++muIdxAuto) {
540  if (in->at(bx, i).hwPt() > 0) {
541  int link = in->at(bx, i).link();
542  if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) {
543  continue; // only process if input link is enabled and not masked
544  }
545  if (currentLink != link) {
546  muIdxAuto = 0;
547  currentLink = link;
548  }
549  int gPhi = MicroGMTConfiguration::calcGlobalPhi(
550  in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor());
551  int tfMuonIdx{computeMuonIdx(in->at(bx, i), currentLink, muIdxAuto)};
552  std::shared_ptr<GMTInternalMuon> outMu = std::make_shared<GMTInternalMuon>(in->at(bx, i), gPhi, tfMuonIdx);
553  out.emplace_back(outMu);
554  wedges[in->at(bx, i).processor()].push_back(outMu);
555  }
556  }
557  for (int i = 0; i < 12; ++i) {
558  if (wedges[i].size() > 3) {
559  edm::LogWarning("Input Mismatch") << " too many inputs per processor for barrel. Wedge " << i << ": Size "
560  << wedges[i].size() << std::endl;
561  }
562  }
563 }
564 
565 int L1TMuonProducer::computeMuonIdx(const RegionalMuonCand& mu, int currentLink, int muIdxAuto) const {
566  // If the muon index was set in the data format we should use that. Otherwise we use the value computed from the position in the vector.
567  if (mu.muIdx() != -1) {
568  return 3 * (currentLink - 36) + mu.muIdx();
569  } else {
570  return 3 * (currentLink - 36) + muIdxAuto;
571  }
572 }
573 
574 // ------------ method called when starting to processes a run ------------
577 
578  std::unique_ptr<L1TMuonGlobalParams_PUBLIC> microGMTParams(
580  if (microGMTParams->pnodes_.empty()) {
582  microGMTParamsHelper = std::make_unique<L1TMuonGlobalParamsHelper>(*o2oProtoHandle.product());
583  } else
585  std::make_unique<L1TMuonGlobalParamsHelper>(cast_to_L1TMuonGlobalParams(*microGMTParams.get()));
586 
587  //microGMTParamsHelper->print(std::cout);
588  m_inputsToDisable = microGMTParamsHelper->inputsToDisable();
589  edm::LogVerbatim("L1TMuonProducer")
590  << "uGMT inputsToDisable: " << m_inputsToDisable
591  << "\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";
592  m_caloInputsToDisable = microGMTParamsHelper->caloInputsToDisable();
593  m_bmtfInputsToDisable = microGMTParamsHelper->bmtfInputsToDisable();
594  m_omtfInputsToDisable = microGMTParamsHelper->omtfInputsToDisable();
595  m_emtfInputsToDisable = microGMTParamsHelper->emtfInputsToDisable();
596  m_maskedInputs = microGMTParamsHelper->maskedInputs();
597  edm::LogVerbatim("L1TMuonProducer")
598  << "uGMT maskedInputs: " << m_maskedInputs
599  << "\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";
600  m_maskedCaloInputs = microGMTParamsHelper->maskedCaloInputs();
601  m_maskedBmtfInputs = microGMTParamsHelper->maskedBmtfInputs();
602  m_maskedOmtfInputs = microGMTParamsHelper->maskedOmtfInputs();
603  m_maskedEmtfInputs = microGMTParamsHelper->maskedEmtfInputs();
608 
609  if (m_autoCancelMode) {
610  if (microGMTParamsHelper->fwVersion() >= 0x6000000) {
612  }
613  // TODO: No decision yet on when to use EMTF track addresses for cancel-out.
614  // if (microGMTParamsHelper->fwVersion() > 0x5000000) {
615  // m_emtfCancelMode = cancelmode::tracks;
616  // }
617  }
618 }
619 
620 // ------------ method called when ending the processing of a run ------------
622 
623 // ------------ method called when starting to processes a luminosity block ------------
625 
626 // ------------ method called when ending the processing of a luminosity block ------------
628 
629 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
631  //The following says we do not know what parameters are allowed so do no validation
632  // Please change this to state exactly what you do use, even if it is no parameters
634  desc.setUnknown();
635  descriptions.addDefault(desc);
636 }
637 
638 //define this as a plug-in
size
Write out results.
const L1TMuonGlobalParams & cast_to_L1TMuonGlobalParams(const L1TMuonGlobalParams_PUBLIC &x)
int getLastBX() const
Log< level::Info, true > LogVerbatim
void beginRun(edm::Run const &, edm::EventSetup const &) override
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
void setCancelOutBitsOverlapEndcap(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and endcap track finders.
int getFirstBX() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void extrapolateMuons(MicroGMTConfiguration::InterMuonList &) const
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
std::ofstream m_debugOut
void setCancelOutBitsOverlapBarrel(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and barrel track finders.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_endcapTfInputToken
std::unique_ptr< L1TMuonGlobalParamsHelper > microGMTParamsHelper
std::bitset< 12 > m_bmtfInputsToDisable
void convertMuons(edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out, GMTInternalWedges &wedges, int bx) const
void setTowerSums(const MicroGMTConfiguration::CaloInputCollection &inputs, int bx)
int computeMuonIdx(const RegionalMuonCand &mu, int currentLink, int muIdxAuto) const
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_overlapTfInputToken
edm::EDGetTokenT< MicroGMTConfiguration::CaloInputCollection > m_caloTowerInputToken
MicroGMTIsolationUnit m_isolationUnit
delete x;
Definition: CaloConfig.h:22
l1t::cancelmode m_emtfCancelMode
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsO2ORcd > m_o2oProtoToken
void calculateRank(MicroGMTConfiguration::InterMuonList &muons) const
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankPtQualityLUT
void isolatePreSummed(MicroGMTConfiguration::InterMuonList &muons) const
void sortMuons(MicroGMTConfiguration::InterMuonList &, unsigned) const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
static ReturnType create(const std::string &filename, const int fwVersion, const unsigned ptFactor, const unsigned qualFactor)
edm::InputTag m_overlapTfInputTag
std::bitset< 12 > m_emtfInputsToDisable
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
void addDefault(ParameterSetDescription const &psetDescription)
Definition: Muon.py:1
void addMuonsToCollections(MicroGMTConfiguration::InterMuonList &coll, MicroGMTConfiguration::InterMuonList &interout, std::unique_ptr< MuonBxCollection > &out, int bx) const
void endRun(edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void splitAndConvertMuons(edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out_pos, MicroGMTConfiguration::InterMuonList &out_neg, GMTInternalWedges &wedges_pos, GMTInternalWedges &wedges_neg, int bx) const
GMTInternalMuonList InterMuonList
edm::InputTag m_barrelTfInputTag
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
edm::InputTag m_endcapTfInputTag
void produce(edm::Event &, const edm::EventSetup &) override
std::bitset< 12 > m_maskedBmtfInputs
BXVector< Muon > MuonBxCollection
Definition: Muon.h:11
void setCancelOutBits(GMTInternalWedges &, tftype, cancelmode)
Cancel out between sectors/wedges in one track finder.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~L1TMuonProducer() override
edm::ESGetToken< L1TMuonGlobalParams, L1TMuonGlobalParamsRcd > m_microGMTParamsToken
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_barrelTfInputToken
HLT enums.
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
std::bitset< 12 > m_maskedEmtfInputs
const L1TMuonGlobalParams_PUBLIC & cast_to_L1TMuonGlobalParams_PUBLIC(const L1TMuonGlobalParams &x)
l1t::cancelmode m_bmtfCancelMode
static bool compareMuons(const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu1, const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu2)
std::map< int, std::vector< std::shared_ptr< GMTInternalMuon > > > GMTInternalWedges
std::bitset< 72 > m_maskedInputs
std::bitset< 12 > m_maskedOmtfInputs
std::bitset< 72 > m_inputsToDisable
std::bitset< 28 > m_caloInputsToDisable
L1TMuonProducer(const edm::ParameterSet &)
std::bitset< 12 > m_omtfInputsToDisable
Log< level::Warning, false > LogWarning
MicroGMTCancelOutUnit m_cancelOutUnit
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
edm::InputTag m_trigTowerTag
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
std::bitset< 28 > m_maskedCaloInputs