73 static bool compareMuons(
const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu1,
74 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2);
94 std::unique_ptr<MuonBxCollection>&
out,
166 produces<MuonBxCollection>();
167 produces<MuonBxCollection>(
"imdMuonsBMTF");
168 produces<MuonBxCollection>(
"imdMuonsEMTFPos");
169 produces<MuonBxCollection>(
"imdMuonsEMTFNeg");
170 produces<MuonBxCollection>(
"imdMuonsOMTFPos");
171 produces<MuonBxCollection>(
"imdMuonsOMTFNeg");
265 splitAndConvertMuons(emtfMuons, internMuonsEmtfPos, internMuonsEmtfNeg, emtfPosWedges, emtfNegWedges,
bx);
266 splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges,
bx);
315 for (
const auto&
mu : internalMuons) {
316 if (
mu->hwPt() > 0) {
318 (
mu->hwPt() - 1) * 0.5,
mu->hwEta() * 0.010875,
mu->hwGlobalPhi() * 0.010908, 0.0};
319 int iso =
mu->hwAbsIso() + (
mu->hwRelIso() << 1);
320 int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(
mu->hwQual(),
mu->trackFinderType(),
mu->hwHF());
336 if (
mu->hwSignValid()) {
337 outMu.setCharge(1 - 2 *
mu->hwSign());
342 outMu.setHwEtaAtVtx(MicroGMTConfiguration::calcMuonHwEtaExtra(outMu));
343 outMu.setHwPhiAtVtx(MicroGMTConfiguration::calcMuonHwPhiExtra(outMu));
344 outMu.setEtaAtVtx(MicroGMTConfiguration::calcMuonEtaExtra(outMu));
345 outMu.setPhiAtVtx(MicroGMTConfiguration::calcMuonPhiExtra(outMu));
346 m_debugOut <<
mu->hwCaloPhi() <<
" " <<
mu->hwCaloEta() << std::endl;
347 outMuons->push_back(
bx, outMu);
361 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2) {
362 return (mu1->hwWins() >= mu2->hwWins());
366 MicroGMTConfiguration::InterMuonList::iterator mu1;
368 for (mu1 =
muons.begin(); mu1 !=
muons.end(); ++mu1) {
369 (*mu1)->setHwWins(0);
373 for (mu1 =
muons.begin(); mu1 !=
muons.end(); ++mu1) {
374 int mu1CancelBit = (*mu1)->hwCancelBit();
375 nCancelled += mu1CancelBit;
378 for (; mu2 !=
muons.end(); ++mu2) {
379 if (mu1CancelBit != 1 && (*mu2)->hwCancelBit() != 1) {
380 if ((*mu1)->hwRank() >= (*mu2)->hwRank()) {
381 (*mu1)->increaseWins();
383 (*mu2)->increaseWins();
385 }
else if (mu1CancelBit != 1) {
386 (*mu1)->increaseWins();
387 }
else if ((*mu2)->hwCancelBit() != 1) {
388 (*mu2)->increaseWins();
393 size_t nMuonsBefore =
muons.size();
394 int minWins = nMuonsBefore - nSurvivors;
398 muons.remove_if([&minWins](
auto muon) {
return ((
muon->hwWins() < minWins) || (
muon->hwCancelBit() == 1)); });
403 for (
auto& mu1 :
muons) {
405 mu1->setHwRank(rank);
411 std::unique_ptr<MuonBxCollection>&
out,
413 for (
auto&
mu : coll) {
414 interout.push_back(
mu);
416 int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(
mu->hwQual(),
mu->trackFinderType(),
mu->hwHF());
433 if (
mu->hwSignValid()) {
434 outMu.setCharge(1 - 2 *
mu->hwSign());
439 out->push_back(
bx, outMu);
450 for (
int i = 0;
i < 6; ++
i) {
451 wedges_pos[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
452 wedges_pos[
i].reserve(3);
453 wedges_neg[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
454 wedges_neg[
i].reserve(3);
456 if (bx < in->getFirstBX() ||
bx >
in->getLastBX())
460 for (
size_t i = 0;
i <
in->size(
bx); ++
i, ++muIdx) {
464 if (currentLink !=
link) {
468 int gPhi = MicroGMTConfiguration::calcGlobalPhi(
469 in->at(
bx,
i).hwPhi(),
in->at(
bx,
i).trackFinderType(),
in->at(
bx,
i).processor());
470 int tfMuonIdx = 3 * (currentLink - 36) + muIdx;
471 std::shared_ptr<GMTInternalMuon>
out = std::make_shared<GMTInternalMuon>(
in->at(
bx,
i), gPhi, tfMuonIdx);
472 if (
in->at(
bx,
i).hwEta() > 0) {
473 out_pos.push_back(
out);
474 wedges_pos[
in->at(
bx,
i).processor()].push_back(
out);
476 out_neg.emplace_back(
out);
477 wedges_neg[
in->at(
bx,
i).processor()].push_back(
out);
480 for (
int i = 0;
i < 6; ++
i) {
481 if (wedges_pos[
i].
size() > 3)
482 edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for emtf+ / omtf+. Wedge " <<
i <<
": Size "
483 << wedges_pos[
i].size() << std::endl;
484 if (wedges_neg[
i].
size() > 3)
485 edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for emtf- / omtf-. Wedge " <<
i <<
": Size "
486 << wedges_neg[
i].size() << std::endl;
495 for (
int i = 0;
i < 12; ++
i) {
496 wedges[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
497 wedges[
i].reserve(3);
499 if (bx < in->getFirstBX() ||
bx >
in->getLastBX())
503 for (
size_t i = 0;
i <
in->size(
bx); ++
i, ++muIdx) {
507 if (currentLink !=
link) {
511 int gPhi = MicroGMTConfiguration::calcGlobalPhi(
512 in->at(
bx,
i).hwPhi(),
in->at(
bx,
i).trackFinderType(),
in->at(
bx,
i).processor());
513 int tfMuonIdx = 3 * (currentLink - 36) + muIdx;
514 std::shared_ptr<GMTInternalMuon> outMu = std::make_shared<GMTInternalMuon>(
in->at(
bx,
i), gPhi, tfMuonIdx);
515 out.emplace_back(outMu);
516 wedges[
in->at(
bx,
i).processor()].push_back(outMu);
518 for (
int i = 0;
i < 12; ++
i) {
519 if (wedges[
i].
size() > 3)
520 edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for barrel. Wedge " <<
i <<
": Size "
521 << wedges[
i].size() << std::endl;
529 microGMTParamsRcd.
get(microGMTParamsHandle);
531 std::unique_ptr<L1TMuonGlobalParams_PUBLIC> microGMTParams(
533 if (microGMTParams->pnodes_.empty()) {
545 <<
"\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";
553 <<
"\n EMTF-|OMTF-| BMTF |OMTF+|EMTF+| CALO | res 0";