67 virtual void endJob() ;
74 static bool compareMuons(
const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu1,
75 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2);
95 std::auto_ptr<MuonBxCollection>& out,
147 produces<MuonBxCollection>();
148 produces<MuonBxCollection>(
"imdMuonsBMTF");
149 produces<MuonBxCollection>(
"imdMuonsEMTFPos");
150 produces<MuonBxCollection>(
"imdMuonsEMTFNeg");
151 produces<MuonBxCollection>(
"imdMuonsOMTFPos");
152 produces<MuonBxCollection>(
"imdMuonsOMTFNeg");
215 convertMuons(bmtfMuons, internMuonsBmtf, bmtfWedges, bx);
216 splitAndConvertMuons(emtfMuons, internMuonsEmtfPos, internMuonsEmtfNeg, emtfPosWedges, emtfNegWedges, bx);
217 splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges, bx);
267 for (
const auto&
mu : internalMuons) {
268 if (
mu->hwPt() > 0) {
270 int iso =
mu->hwAbsIso() + (
mu->hwRelIso() << 1);
271 Muon outMu{vec,
mu->hwPt(),
mu->hwEta(),
mu->hwGlobalPhi(),
mu->hwQual(),
mu->hwSign(),
mu->hwSignValid(), iso, -1, 0,
true,
mu->hwIsoSum(),
mu->hwDPhi(),
mu->hwDEta(),
mu->hwRank()};
272 if (
mu->hwSignValid()) {
273 outMu.setCharge(1 - 2 *
mu->hwSign());
277 m_debugOut <<
mu->hwCaloPhi() <<
" " <<
mu->hwCaloEta() << std::endl;
278 outMuons->push_back(bx, outMu);
283 iEvent.
put(outMuons);
284 iEvent.
put(imdMuonsBMTF,
"imdMuonsBMTF");
285 iEvent.
put(imdMuonsEMTFPos,
"imdMuonsEMTFPos");
286 iEvent.
put(imdMuonsEMTFNeg,
"imdMuonsEMTFNeg");
287 iEvent.
put(imdMuonsOMTFPos,
"imdMuonsOMTFPos");
288 iEvent.
put(imdMuonsOMTFNeg,
"imdMuonsOMTFNeg");
294 const std::shared_ptr<MicroGMTConfiguration::InterMuon>& mu2) {
295 return (mu1->hwWins() >= mu2->hwWins());
300 MicroGMTConfiguration::InterMuonList::iterator mu1;
302 for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
303 (*mu1)->setHwWins(0);
307 for (mu1 = muons.begin(); mu1 != muons.end(); ++mu1) {
308 int mu1CancelBit = (*mu1)->hwCancelBit();
309 nCancelled += mu1CancelBit;
312 for ( ; mu2 != muons.end(); ++mu2) {
313 if (mu1CancelBit != 1 && (*mu2)->hwCancelBit() != 1) {
314 if ((*mu1)->hwRank() >= (*mu2)->hwRank()) {
315 (*mu1)->increaseWins();
317 (*mu2)->increaseWins();
319 }
else if (mu1CancelBit != 1) {
320 (*mu1)->increaseWins();
321 }
else if ((*mu2)->hwCancelBit() != 1) {
322 (*mu2)->increaseWins();
327 size_t nMuonsBefore = muons.size();
328 int minWins = nMuonsBefore - nCancelled - nSurvivors;
333 while (mu1 != muons.end()) {
334 if ((*mu1)->hwWins() < minWins || (*mu1)->hwCancelBit() == 1) {
347 for (
auto& mu1 : muons) {
349 mu1->setHwRank(rank);
357 std::auto_ptr<MuonBxCollection>&
out,
int bx)
const
359 for (
auto&
mu : coll) {
360 interout.push_back(
mu);
364 Muon outMu{vec,
mu->hwPt(),
mu->hwEta(),
mu->hwGlobalPhi(),
mu->hwQual(),
mu->hwSign(),
mu->hwSignValid(), -1, -1, 0,
true, -1,
mu->hwDPhi(),
mu->hwDEta(),
mu->hwRank()};
365 if (
mu->hwSignValid()) {
366 outMu.setCharge(1 - 2 *
mu->hwSign());
371 out->push_back(bx, outMu);
384 for (
int i = 0;
i < 6; ++
i) {
385 wedges_pos[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
386 wedges_pos[
i].reserve(3);
387 wedges_neg[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
388 wedges_neg[
i].reserve(3);
390 if (bx < in->getFirstBX() || bx > in->getLastBX())
return;
391 for (
size_t i = 0;
i < in->size(bx); ++
i) {
392 int gPhi = MicroGMTConfiguration::calcGlobalPhi(in->at(bx,
i).hwPhi(), in->at(bx,
i).trackFinderType(), in->at(bx,
i).processor());
393 std::shared_ptr<GMTInternalMuon>
out = std::make_shared<GMTInternalMuon>(in->at(bx,
i), gPhi);
394 if(in->at(bx,
i).hwEta() > 0) {
395 out_pos.push_back(out);
396 wedges_pos[in->at(bx,
i).processor()].push_back(out);
398 out_neg.emplace_back(out);
399 wedges_neg[in->at(bx,
i).processor()].push_back(out);
402 for (
int i = 0;
i < 6; ++
i) {
403 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;
404 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;
414 for (
int i = 0;
i < 12; ++
i) {
415 wedges[
i] = std::vector<std::shared_ptr<GMTInternalMuon>>();
416 wedges[
i].reserve(3);
418 if (bx < in->getFirstBX() || bx > in->getLastBX())
return;
419 for (
size_t i = 0;
i < in->size(bx); ++
i) {
420 int gPhi = MicroGMTConfiguration::calcGlobalPhi(in->at(bx,
i).hwPhi(), in->at(bx,
i).trackFinderType(), in->at(bx,
i).processor());
421 std::shared_ptr<GMTInternalMuon> outMu = std::make_shared<GMTInternalMuon>(in->at(bx,
i), gPhi);
422 out.emplace_back(outMu);
423 wedges[in->at(bx,
i).processor()].push_back(outMu);
425 for (
int i = 0;
i < 12; ++
i) {
426 if(wedges[
i].
size() > 3)
edm::LogWarning(
"Input Mismatch") <<
" too many inputs per processor for barrel. Wedge " <<
i <<
": Size " << wedges[
i].size() << std::endl;
447 microGMTParamsRcd.
get(microGMTParamsHandle);
451 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 setCancelOutBitsOverlapBarrel(GMTInternalWedges &, GMTInternalWedges &, cancelmode)
Cancel-out between overlap and barrel track finders.
edm::EDGetTokenT< MicroGMTConfiguration::InputCollection > m_endcapTfInputToken
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void initialise(L1TMuonGlobalParams *)
Initialisation from ES record.
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
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
void initialise(L1TMuonGlobalParams *)
Initialisation from ES record.
GMTInternalMuonList InterMuonList
edm::InputTag m_barrelTfInputTag
edm::InputTag m_endcapTfInputTag
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
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
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
L1TMuonProducer(const edm::ParameterSet &)
std::unique_ptr< L1TMuonGlobalParams > microGMTParams
MicroGMTCancelOutUnit m_cancelOutUnit
edm::InputTag m_trigTowerTag
void isolatePreSummed(MicroGMTConfiguration::InterMuonList &muons) const
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
tuple size
Write out results.