68 virtual void endJob() ;
75 static bool compareMuons(
const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu1,
76 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2);
96 std::auto_ptr<MuonBxCollection>& out,
163 produces<MuonBxCollection>();
164 produces<MuonBxCollection>(
"imdMuonsBMTF");
165 produces<MuonBxCollection>(
"imdMuonsEMTFPos");
166 produces<MuonBxCollection>(
"imdMuonsEMTFNeg");
167 produces<MuonBxCollection>(
"imdMuonsOMTFPos");
168 produces<MuonBxCollection>(
"imdMuonsOMTFNeg");
212 bxMin =
std::max(bxMin, trigTowers->getFirstBX());
213 bxMax =
std::min(bxMax, trigTowers->getLastBX());
216 bxMin =
std::max(bxMin, bmtfMuons->getFirstBX());
217 bxMax =
std::min(bxMax, bmtfMuons->getLastBX());
220 bxMin =
std::max(bxMin, omtfMuons->getFirstBX());
221 bxMax =
std::min(bxMax, omtfMuons->getLastBX());
224 bxMin =
std::max(bxMin, emtfMuons->getFirstBX());
225 bxMax =
std::min(bxMax, emtfMuons->getLastBX());
270 convertMuons(bmtfMuons, internMuonsBmtf, bmtfWedges, bx);
271 splitAndConvertMuons(emtfMuons, internMuonsEmtfPos, internMuonsEmtfNeg, emtfPosWedges, emtfNegWedges, bx);
272 splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges, bx);
322 for (
const auto&
mu : internalMuons) {
323 if (
mu->hwPt() > 0) {
325 int iso =
mu->hwAbsIso() + (
mu->hwRelIso() << 1);
326 int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(
mu->hwQual(),
mu->trackFinderType(),
mu->hwHF());
327 Muon outMu{vec,
mu->hwPt(),
mu->hwEta(),
mu->hwGlobalPhi(), outMuQual,
mu->hwSign(),
mu->hwSignValid(), iso,
mu->tfMuonIndex(), 0,
true,
mu->hwIsoSum(),
mu->hwDPhi(),
mu->hwDEta(),
mu->hwRank()};
328 if (
mu->hwSignValid()) {
329 outMu.setCharge(1 - 2 *
mu->hwSign());
333 m_debugOut <<
mu->hwCaloPhi() <<
" " <<
mu->hwCaloEta() << std::endl;
334 outMuons->push_back(bx, outMu);
339 iEvent.
put(outMuons);
340 iEvent.
put(imdMuonsBMTF,
"imdMuonsBMTF");
341 iEvent.
put(imdMuonsEMTFPos,
"imdMuonsEMTFPos");
342 iEvent.
put(imdMuonsEMTFNeg,
"imdMuonsEMTFNeg");
343 iEvent.
put(imdMuonsOMTFPos,
"imdMuonsOMTFPos");
344 iEvent.
put(imdMuonsOMTFNeg,
"imdMuonsOMTFNeg");
350 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2) {
351 return (mu1->hwWins() >= mu2->hwWins());
356 MicroGMTConfiguration::InterMuonList::iterator mu1;
358 for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
359 (*mu1)->setHwWins(0);
363 for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
364 int mu1CancelBit = (*mu1)->hwCancelBit();
365 nCancelled += mu1CancelBit;
368 for ( ; mu2 != muons.end(); ++mu2) {
369 if (mu1CancelBit != 1 && (*mu2)->hwCancelBit() != 1) {
370 if ((*mu1)->hwRank() >= (*mu2)->hwRank()) {
371 (*mu1)->increaseWins();
373 (*mu2)->increaseWins();
375 }
else if (mu1CancelBit != 1) {
376 (*mu1)->increaseWins();
377 }
else if ((*mu2)->hwCancelBit() != 1) {
378 (*mu2)->increaseWins();
383 size_t nMuonsBefore = muons.size();
384 int minWins = nMuonsBefore - nSurvivors;
389 while (mu1 != muons.end()) {
390 if ((*mu1)->hwWins() < minWins || (*mu1)->hwCancelBit() == 1) {
403 for (
auto& mu1 : muons) {
405 mu1->setHwRank(rank);
413 std::auto_ptr<MuonBxCollection>&
out,
int bx)
const
415 for (
auto&
mu : coll) {
416 interout.push_back(
mu);
419 int outMuQual = MicroGMTConfiguration::setOutputMuonQuality(
mu->hwQual(),
mu->trackFinderType(),
mu->hwHF());
420 Muon outMu{vec,
mu->hwPt(),
mu->hwEta(),
mu->hwGlobalPhi(), outMuQual,
mu->hwSign(),
mu->hwSignValid(), -1,
mu->tfMuonIndex(), 0,
true, -1,
mu->hwDPhi(),
mu->hwDEta(),
mu->hwRank()};
421 if (
mu->hwSignValid()) {
422 outMu.setCharge(1 - 2 *
mu->hwSign());
427 out->push_back(bx, outMu);
440 for (
int i = 0;
i < 6; ++
i) {
441 wedges_pos[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
442 wedges_pos[
i].reserve(3);
443 wedges_neg[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
444 wedges_neg[
i].reserve(3);
446 if (bx < in->getFirstBX() || bx > in->getLastBX())
return;
449 for (
size_t i = 0;
i < in->size(bx); ++
i, ++muIdx) {
450 int link = in->at(bx,
i).link();
452 if (currentLink != link) {
456 int gPhi = MicroGMTConfiguration::calcGlobalPhi(in->at(bx,
i).hwPhi(), in->at(bx,
i).trackFinderType(), in->at(bx,
i).processor());
457 int tfMuonIdx = 3 * (currentLink - 36) + muIdx;
458 std::shared_ptr<GMTInternalMuon>
out = std::make_shared<GMTInternalMuon>(in->at(bx,
i), gPhi, tfMuonIdx);
459 if(in->at(bx,
i).hwEta() > 0) {
460 out_pos.push_back(out);
461 wedges_pos[in->at(bx,
i).processor()].push_back(out);
463 out_neg.emplace_back(out);
464 wedges_neg[in->at(bx,
i).processor()].push_back(out);
467 for (
int i = 0;
i < 6; ++
i) {
468 if(wedges_pos[
i].
size() > 3)
edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for emtf+ / omtf+. Wedge " <<
i <<
": Size " << wedges_pos[
i].size() << std::endl;
469 if(wedges_neg[
i].
size() > 3)
edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for emtf- / omtf-. Wedge " <<
i <<
": Size " << wedges_neg[
i].size() << std::endl;
479 for (
int i = 0;
i < 12; ++
i) {
480 wedges[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
481 wedges[
i].reserve(3);
483 if (bx < in->getFirstBX() || bx > in->getLastBX())
return;
486 for (
size_t i = 0;
i < in->size(bx); ++
i, ++muIdx) {
487 int link = in->at(bx,
i).link();
489 if (currentLink != link) {
493 int gPhi = MicroGMTConfiguration::calcGlobalPhi(in->at(bx,
i).hwPhi(), in->at(bx,
i).trackFinderType(), in->at(bx,
i).processor());
494 int tfMuonIdx = 3 * (currentLink - 36) + muIdx;
495 std::shared_ptr<GMTInternalMuon> outMu = std::make_shared<GMTInternalMuon>(in->at(bx,
i), gPhi, tfMuonIdx);
496 out.emplace_back(outMu);
497 wedges[in->at(bx,
i).processor()].push_back(outMu);
499 for (
int i = 0;
i < 12; ++
i) {
500 if(wedges[
i].
size() > 3)
edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for barrel. Wedge " <<
i <<
": Size " << wedges[
i].size() << std::endl;
521 microGMTParamsRcd.
get(microGMTParamsHandle);
525 edm::LogError(
"L1TMuonProducer") <<
"Could not retrieve parameters from Event Setup" << std::endl;
T getParameter(std::string const &) const
void extrapolateMuons(MicroGMTConfiguration::InterMuonList &) const
void setCancelOutBitsOverlapEndcap(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and endcap track finders.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
void setCancelOutBitsOverlapBarrel(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and barrel track finders.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_endcapTfInputToken
std::unique_ptr< L1TMuonGlobalParamsHelper > microGMTParamsHelper
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
void convertMuons(edm::Handle< MicroGMTConfiguration::InputCollection > const &in, MicroGMTConfiguration::InterMuonList &out, GMTInternalWedges &wedges, int bx) const
std::bitset< 12 > m_bmtfInputsToDisable
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setTowerSums(const MicroGMTConfiguration::CaloInputCollection &inputs, int bx)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_overlapTfInputToken
edm::EDGetTokenT< MicroGMTConfiguration::CaloInputCollection > m_caloTowerInputToken
MicroGMTIsolationUnit m_isolationUnit
virtual void endRun(edm::Run const &, edm::EventSetup const &)
virtual void produce(edm::Event &, const edm::EventSetup &)
std::shared_ptr< MicroGMTRankPtQualLUT > m_rankPtQualityLUT
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
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
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void calculateRank(MicroGMTConfiguration::InterMuonList &muons) const
void get(HolderT &iHolder) const
void sortMuons(MicroGMTConfiguration::InterMuonList &, unsigned) const
GMTInternalMuonList InterMuonList
edm::InputTag m_barrelTfInputTag
edm::InputTag m_endcapTfInputTag
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
std::bitset< 12 > m_maskedBmtfInputs
void addMuonsToCollections(MicroGMTConfiguration::InterMuonList &coll, MicroGMTConfiguration::InterMuonList &interout, std::auto_ptr< MuonBxCollection > &out, int bx) const
BXVector< Muon > MuonBxCollection
void setCancelOutBits(GMTInternalWedges &, tftype, cancelmode)
Cancel out between sectors/wedges in one track finder.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_barrelTfInputToken
std::bitset< 12 > m_maskedEmtfInputs
static bool compareMuons(const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu1, const std::shared_ptr< MicroGMTConfiguration::InterMuon > &mu2)
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
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
MicroGMTCancelOutUnit m_cancelOutUnit
void initialise(L1TMuonGlobalParamsHelper *)
Initialisation from ES record.
edm::InputTag m_trigTowerTag
void isolatePreSummed(MicroGMTConfiguration::InterMuonList &muons) const
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
tuple size
Write out results.
std::bitset< 28 > m_maskedCaloInputs