Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23476 from kreczko/kreczko-issue-CMSLITDPG-588-part3
[L1T][DQMOffline] Added PFMetNoMu to L1T Offline DQM
- Loading branch information
Showing
9 changed files
with
168 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,26 @@ | ||
#ifndef L1TPFMetNoMuProducer_H | ||
#define L1TPFMetNoMuProducer_H | ||
|
||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "DataFormats/METReco/interface/PFMET.h" | ||
#include "DataFormats/METReco/interface/PFMETCollection.h" | ||
#include "DataFormats/MuonReco/interface/Muon.h" | ||
#include "DataFormats/MuonReco/interface/MuonFwd.h" | ||
|
||
class L1TPFMetNoMuProducer : public edm::stream::EDProducer<> { | ||
public: | ||
explicit L1TPFMetNoMuProducer(const edm::ParameterSet &ps); | ||
|
||
|
||
private: | ||
void produce(edm::Event &event, const edm::EventSetup &eventSetup); | ||
|
||
const edm::EDGetTokenT<reco::PFMETCollection> thePFMETCollection_; | ||
const edm::EDGetTokenT<reco::MuonCollection> theMuonCollection_; | ||
}; | ||
#endif |
This file contains 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,60 @@ | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "L1Trigger/L1TNtuples/interface/L1TPFMetNoMuProducer.h" | ||
|
||
L1TPFMetNoMuProducer::L1TPFMetNoMuProducer(const edm::ParameterSet &ps) | ||
: thePFMETCollection_(consumes<reco::PFMETCollection>( | ||
ps.getParameter<edm::InputTag>("pfMETCollection"))), | ||
theMuonCollection_(consumes<reco::MuonCollection>( | ||
ps.getParameter<edm::InputTag>("muonCollection"))) { | ||
produces<reco::PFMETCollection>(); | ||
} | ||
|
||
void L1TPFMetNoMuProducer::produce(edm::Event &event, | ||
const edm::EventSetup &eventSetup) { | ||
edm::Handle<reco::PFMETCollection> pfMet; | ||
event.getByToken(thePFMETCollection_, pfMet); | ||
|
||
edm::Handle<reco::MuonCollection> muons; | ||
event.getByToken(theMuonCollection_, muons); | ||
|
||
if (!pfMet.isValid()) { | ||
edm::LogWarning("L1TPFMetNoMuProducer") | ||
<< "invalid collection for pfMet" << std::endl; | ||
return; | ||
} | ||
if (!muons.isValid()) { | ||
edm::LogWarning("L1TPFMetNoMuProducer") | ||
<< "invalid collection for muons" << std::endl; | ||
return; | ||
} | ||
|
||
reco::PFMET thePFMetNoMu = pfMet.product()->front(); | ||
double pfMetNoMuPx = thePFMetNoMu.px(); | ||
double pfMetNoMuPy = thePFMetNoMu.py(); | ||
|
||
double muPx(0.), muPy(0.); | ||
|
||
for (auto muon = muons->begin(); muon != muons->end(); ++muon) { | ||
if (muon->isPFMuon()) { | ||
muPx += muon->px(); | ||
muPy += muon->py(); | ||
} | ||
} | ||
|
||
pfMetNoMuPx += muPx; | ||
pfMetNoMuPy += muPy; | ||
math::XYZTLorentzVector pfMetNoMuP4(pfMetNoMuPx, pfMetNoMuPy, 0, | ||
hypot(pfMetNoMuPx, pfMetNoMuPy)); | ||
|
||
thePFMetNoMu.setP4(pfMetNoMuP4); | ||
|
||
std::unique_ptr<reco::PFMETCollection> product(new reco::PFMETCollection); | ||
product->emplace_back(thePFMetNoMu.getSpecific(), thePFMetNoMu.sumEt(), | ||
thePFMetNoMu.p4(), thePFMetNoMu.vertex()); | ||
|
||
event.put(std::move(product)); | ||
} | ||
|
||
DEFINE_FWK_MODULE(L1TPFMetNoMuProducer); |
Oops, something went wrong.