-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add flag to drop quality of low-pt TkMuons without an SA match #41546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
56a81ec
Low-pt muon fix
folguera ff78706
Merged refs/pull/41546/head from repository cms-sw with cms-merge-topic
cmsbuild cd0de40
fix to avoid failing of automtated tests
folguera 996d361
remove commented line
folguera 53419b9
Merge pull request #2 from folguera/FixTo_epalencia_l1t-1109_v3
epalencia a1fe4ad
fix for low-pt fix
folguera ab707cd
Merge branch 'l1t-1109_v3' into fix_epalencia_l1t-1109_v3
folguera 281ede9
Merge pull request #3 from folguera/fix_epalencia_l1t-1109_v3
epalencia c63ee59
add code-format
folguera ff0fddf
Merge branch 'fix_epalencia_l1t-1109_v3' of https://github.com/folgue…
folguera 0eeb772
Merge pull request #4 from folguera/fix_epalencia_l1t-1109_v3
epalencia eaa2c4c
make eta parameter configurable
folguera e7798ed
switched to double to accomodate getparameter
folguera a559c5a
Merge pull request #5 from folguera/fix_epalencia_l1t-1109_v3
epalencia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| #include <memory> | ||
| #include "FWCore/Framework/interface/Frameworkfwd.h" | ||
| #include "FWCore/Framework/interface/stream/EDProducer.h" | ||
|
|
||
| #include "FWCore/Framework/interface/Event.h" | ||
| #include "FWCore/Framework/interface/MakerMacros.h" | ||
|
|
||
| #include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
| #include "FWCore/Utilities/interface/StreamID.h" | ||
| #include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" | ||
| #include "DataFormats/L1TMuonPhase2/interface/SAMuon.h" | ||
| #include "Node.h" | ||
|
|
||
| // | ||
| // class declaration | ||
| // | ||
| using namespace Phase2L1GMT; | ||
| using namespace l1t; | ||
|
|
||
| class Phase2L1TGMTFilter : public edm::stream::EDProducer<> { | ||
| public: | ||
| explicit Phase2L1TGMTFilter(const edm::ParameterSet&); | ||
| ~Phase2L1TGMTFilter() override; | ||
|
|
||
| static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
|
||
| private: | ||
| void beginStream(edm::StreamID) override; | ||
| void produce(edm::Event&, const edm::EventSetup&) override; | ||
| void endStream() override; | ||
| edm::EDGetTokenT<std::vector<l1t::TrackerMuon> > srcMuons_; | ||
| bool applyLowPtFilter_; | ||
| int ptBarrelMin_; | ||
| int ptEndcapMin_; | ||
| }; | ||
|
|
||
| Phase2L1TGMTFilter::Phase2L1TGMTFilter(const edm::ParameterSet& iConfig) | ||
| : srcMuons_(consumes<std::vector<l1t::TrackerMuon> >(iConfig.getParameter<edm::InputTag>("srcMuons"))), | ||
| applyLowPtFilter_(iConfig.getParameter<bool>("applyLowPtFilter")), | ||
| ptBarrelMin_(iConfig.getParameter<int>("ptBarrelMin")), | ||
| ptEndcapMin_(iConfig.getParameter<int>("ptEndcapMin")) { | ||
| produces<std::vector<l1t::TrackerMuon> >("l1tTkMuonsGmtLowPtFix").setBranchAlias("tkMuLowPtFix"); | ||
| } | ||
|
|
||
| Phase2L1TGMTFilter::~Phase2L1TGMTFilter() { | ||
| // do anything here that needs to be done at destruction time | ||
| // (e.g. close files, deallocate resources etc.) | ||
| } | ||
|
|
||
| // | ||
| // member functions | ||
| // | ||
|
|
||
| // ------------ method called to produce the data ------------ | ||
| void Phase2L1TGMTFilter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
| using namespace edm; | ||
| Handle<std::vector<l1t::TrackerMuon> > muonHandle; | ||
| iEvent.getByToken(srcMuons_, muonHandle); | ||
|
|
||
| std::vector<l1t::TrackerMuon> out; | ||
|
|
||
| for (uint i = 0; i < muonHandle->size(); ++i) { | ||
| auto mu = muonHandle->at(i); | ||
| bool noSAMatch = true; | ||
| if (applyLowPtFilter_) { | ||
| if ((fabs(mu.phEta()) < 0.9 && mu.phPt() < ptBarrelMin_) || | ||
| (fabs(mu.phEta()) > 0.9 && mu.phPt() < ptEndcapMin_)) { | ||
| // if quality is already set to 0 don't continue the loop. | ||
| for (const auto& r : mu.muonRef()) { | ||
| if (r.isNonnull()) { | ||
| noSAMatch = false; | ||
| break; | ||
| } | ||
| } | ||
| if (noSAMatch) | ||
| mu.setHwQual(0); | ||
| } | ||
| } | ||
| out.push_back(mu); // store all muons otherwise | ||
| } | ||
|
|
||
| // store results | ||
| std::unique_ptr<std::vector<l1t::TrackerMuon> > out1 = std::make_unique<std::vector<l1t::TrackerMuon> >(out); | ||
| iEvent.put(std::move(out1), "l1tTkMuonsGmtLowPtFix"); | ||
| } | ||
|
|
||
| // ------------ method called once each stream before processing any runs, lumis or events ------------ | ||
| void Phase2L1TGMTFilter::beginStream(edm::StreamID) {} | ||
|
|
||
| // ------------ method called once each stream after processing all runs, lumis and events ------------ | ||
| void Phase2L1TGMTFilter::endStream() {} | ||
|
|
||
| void Phase2L1TGMTFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
| //The following says we do not know what parameters are allowed so do no validation | ||
| // Please change this to state exactly what you do use, even if it is no parameters | ||
| edm::ParameterSetDescription desc; | ||
| desc.setUnknown(); | ||
| descriptions.addDefault(desc); | ||
| } | ||
|
|
||
| //define this as a plug-in | ||
| DEFINE_FWK_MODULE(Phase2L1TGMTFilter); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 0.9 should be a configurable parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rappoccio Do you want this to be in the cfg file? Or should we define it somewhere in the code? the limit between barrel and endcap is a fixed value. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@folguera provided the requested update.