#include <HLTHtMhtProducer.h>
Public Member Functions | |
HLTHtMhtProducer (const edm::ParameterSet &iConfig) | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
~HLTHtMhtProducer () | |
Static Public Member Functions | |
static void | fillDescriptions (edm::ConfigurationDescriptions &descriptions) |
Private Attributes | |
edm::InputTag | jetsLabel_ |
double | maxEtaJetHt_ |
double | maxEtaJetMht_ |
int | minNJetHt_ |
int | minNJetMht_ |
double | minPtJetHt_ |
double | minPtJetMht_ |
edm::InputTag | tracksLabel_ |
bool | usePt_ |
bool | useTracks_ |
Definition at line 21 of file HLTHtMhtProducer.h.
HLTHtMhtProducer::HLTHtMhtProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 18 of file HLTHtMhtProducer.cc.
: usePt_ ( iConfig.getParameter<bool>("usePt") ), useTracks_ ( iConfig.getParameter<bool>("useTracks") ), minNJetHt_ ( iConfig.getParameter<int>("minNJetHt") ), minNJetMht_ ( iConfig.getParameter<int>("minNJetMht") ), minPtJetHt_ ( iConfig.getParameter<double>("minPtJetHt") ), minPtJetMht_ ( iConfig.getParameter<double>("minPtJetMht") ), maxEtaJetHt_ ( iConfig.getParameter<double>("maxEtaJetHt") ), maxEtaJetMht_ ( iConfig.getParameter<double>("maxEtaJetMht") ), jetsLabel_ ( iConfig.getParameter<edm::InputTag>("jetsLabel") ), tracksLabel_ ( iConfig.getParameter<edm::InputTag>("tracksLabel") ) { produces<reco::METCollection>(); }
HLTHtMhtProducer::~HLTHtMhtProducer | ( | ) |
Definition at line 34 of file HLTHtMhtProducer.cc.
{ }
void HLTHtMhtProducer::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::EDProducer.
Definition at line 38 of file HLTHtMhtProducer.cc.
References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::add().
{ edm::ParameterSetDescription desc; desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetCorrected")); desc.add<bool>("usePt", true); desc.add<int>("minNJetHt", 0); desc.add<int>("minNJetMht", 0); desc.add<double>("minPtJetHt", 40); desc.add<double>("minPtJetMht", 30); desc.add<double>("maxEtaJetHt", 3); desc.add<double>("maxEtaJetMht", 999); desc.add<bool>("useTracks", false); desc.add<edm::InputTag>("tracksLabel", edm::InputTag("hltL3Muons")); descriptions.add("hltHtMhtProducer", desc); }
void HLTHtMhtProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 54 of file HLTHtMhtProducer.cc.
References funct::cos(), edm::Event::getByLabel(), metsig::jet, analyzePatCleaning_cfg::jets, jetsLabel_, maxEtaJetHt_, maxEtaJetMht_, minNJetHt_, minNJetMht_, minPtJetHt_, minPtJetMht_, edm::Event::put(), funct::sin(), mathSSE::sqrt(), testEve_cfg::tracks, tracksLabel_, usePt_, and useTracks_.
{ std::auto_ptr<reco::METCollection> metobject(new reco::METCollection()); edm::Handle<reco::CaloJetCollection> jets; iEvent.getByLabel(jetsLabel_, jets); edm::Handle<reco::TrackCollection> tracks; if (useTracks_) iEvent.getByLabel(tracksLabel_, tracks); int nj_ht = 0, nj_mht = 0; double ht=0.; double mhtx=0., mhty=0.; for (reco::CaloJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); jet++) { double mom = (usePt_ ? jet->pt() : jet->et()); if (mom > minPtJetHt_ and fabs(jet->eta()) < maxEtaJetHt_) { ht += mom; ++nj_ht; } if (mom > minPtJetMht_ and fabs(jet->eta()) < maxEtaJetMht_) { mhtx -= mom*cos(jet->phi()); mhty -= mom*sin(jet->phi()); ++nj_mht; } } if (useTracks_) { for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) { if (track->pt() > minPtJetHt_ and fabs(track->eta()) < maxEtaJetHt_) { ht += track->pt(); } if (track->pt() > minPtJetMht_ and fabs(track->eta()) < maxEtaJetMht_) { mhtx -= track->px(); mhty -= track->py(); } } } if (nj_ht < minNJetHt_ ) { ht = 0; } if (nj_mht < minNJetMht_) { mhtx = 0; mhty = 0; } metobject->push_back( reco::MET( ht, reco::MET::LorentzVector(mhtx, mhty, 0, sqrt(mhtx*mhtx + mhty*mhty)), reco::MET::Point() ) ); iEvent.put(metobject); }
edm::InputTag HLTHtMhtProducer::jetsLabel_ [private] |
Definition at line 40 of file HLTHtMhtProducer.h.
Referenced by produce().
double HLTHtMhtProducer::maxEtaJetHt_ [private] |
Definition at line 38 of file HLTHtMhtProducer.h.
Referenced by produce().
double HLTHtMhtProducer::maxEtaJetMht_ [private] |
Definition at line 39 of file HLTHtMhtProducer.h.
Referenced by produce().
int HLTHtMhtProducer::minNJetHt_ [private] |
Definition at line 34 of file HLTHtMhtProducer.h.
Referenced by produce().
int HLTHtMhtProducer::minNJetMht_ [private] |
Definition at line 35 of file HLTHtMhtProducer.h.
Referenced by produce().
double HLTHtMhtProducer::minPtJetHt_ [private] |
Definition at line 36 of file HLTHtMhtProducer.h.
Referenced by produce().
double HLTHtMhtProducer::minPtJetMht_ [private] |
Definition at line 37 of file HLTHtMhtProducer.h.
Referenced by produce().
edm::InputTag HLTHtMhtProducer::tracksLabel_ [private] |
Definition at line 41 of file HLTHtMhtProducer.h.
Referenced by produce().
bool HLTHtMhtProducer::usePt_ [private] |
Definition at line 32 of file HLTHtMhtProducer.h.
Referenced by produce().
bool HLTHtMhtProducer::useTracks_ [private] |
Definition at line 33 of file HLTHtMhtProducer.h.
Referenced by produce().