CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
HLTHtMhtProducer Class Reference

This produces a reco::MET object that stores HT and MHT. More...

#include <HLTHtMhtProducer.h>

Inheritance diagram for HLTHtMhtProducer:
edm::stream::EDProducer<>

Public Member Functions

 HLTHtMhtProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTHtMhtProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

bool excludePFMuons_
 
edm::InputTag jetsLabel_
 Input jet, PFCandidate collections. More...
 
edm::EDGetTokenT< reco::JetViewm_theJetToken
 
edm::EDGetTokenT< reco::PFCandidateCollectionm_thePFCandidateToken
 
double maxEtaJetHt_
 Maximum (abs) eta requirement for jets. More...
 
double maxEtaJetMht_
 
int minNJetHt_
 Minimum number of jets passing pt and eta requirements. More...
 
int minNJetMht_
 
double minPtJetHt_
 Minimum pt requirement for jets. More...
 
double minPtJetMht_
 
edm::InputTag pfCandidatesLabel_
 
bool usePt_
 Use pt; otherwise, use et. More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

This produces a reco::MET object that stores HT and MHT.

Author
Steven Lowette
Michele de Gruttola, Jia Fu Low (Nov 2013)

HT & MHT are calculated using input CaloJet or PFJet collection. MHT can include or exclude the contribution from muons. HT is stored as sumet_, MHT is stored as p4_ in the output.

See header file for documentation

Author
Steven Lowette

Definition at line 34 of file HLTHtMhtProducer.h.

Constructor & Destructor Documentation

HLTHtMhtProducer::HLTHtMhtProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 17 of file HLTHtMhtProducer.cc.

References jetsLabel_, m_theJetToken, m_thePFCandidateToken, pfCandidatesLabel_, and ~HLTHtMhtProducer().

18  : usePt_(iConfig.getParameter<bool>("usePt")),
19  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
20  minNJetHt_(iConfig.getParameter<int>("minNJetHt")),
21  minNJetMht_(iConfig.getParameter<int>("minNJetMht")),
22  minPtJetHt_(iConfig.getParameter<double>("minPtJetHt")),
23  minPtJetMht_(iConfig.getParameter<double>("minPtJetMht")),
24  maxEtaJetHt_(iConfig.getParameter<double>("maxEtaJetHt")),
25  maxEtaJetMht_(iConfig.getParameter<double>("maxEtaJetMht")),
26  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
27  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
28  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
29  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
30 
31  // Register the products
32  produces<reco::METCollection>();
33 }
T getParameter(std::string const &) const
edm::InputTag pfCandidatesLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
int minNJetHt_
Minimum number of jets passing pt and eta requirements.
double minPtJetHt_
Minimum pt requirement for jets.
double maxEtaJetHt_
Maximum (abs) eta requirement for jets.
bool usePt_
Use pt; otherwise, use et.
edm::InputTag jetsLabel_
Input jet, PFCandidate collections.
edm::EDGetTokenT< reco::JetView > m_theJetToken
HLTHtMhtProducer::~HLTHtMhtProducer ( )
overridedefault

Referenced by HLTHtMhtProducer().

Member Function Documentation

void HLTHtMhtProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 39 of file HLTHtMhtProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

39  {
40  // Current default is for hltHtMht
42  desc.add<bool>("usePt", false);
43  desc.add<bool>("excludePFMuons", false);
44  desc.add<int>("minNJetHt", 0);
45  desc.add<int>("minNJetMht", 0);
46  desc.add<double>("minPtJetHt", 40.);
47  desc.add<double>("minPtJetMht", 30.);
48  desc.add<double>("maxEtaJetHt", 3.);
49  desc.add<double>("maxEtaJetMht", 5.);
50  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetL1FastJetCorrected"));
51  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
52  descriptions.add("hltHtMhtProducer", desc);
53 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTHtMhtProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 56 of file HLTHtMhtProducer.cc.

References funct::abs(), edm::View< T >::begin(), funct::cos(), edm::View< T >::empty(), edm::View< T >::end(), PVValHelper::eta, excludePFMuons_, edm::Event::getByToken(), dqmiolumiharvest::j, singleTopDQM_cfi::jets, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, maxEtaJetHt_, maxEtaJetMht_, minNJetHt_, minNJetMht_, minPtJetHt_, minPtJetMht_, eostools::move(), p4, zmumugammaAnalyzer_cfi::pfCandidates, pfCandidatesLabel_, phi, DiDispStaMuonMonitor_cfi::pt, edm::Event::put(), multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mps_fire::result, funct::sin(), mathSSE::sqrt(), usePt_, and badGlobalMuonTaggersAOD_cff::vtx.

56  {
57  // Create a pointer to the products
58  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
59 
60  if (pfCandidatesLabel_.label().empty())
61  excludePFMuons_ = false;
62 
64  iEvent.getByToken(m_theJetToken, jets);
65 
67  if (excludePFMuons_)
68  iEvent.getByToken(m_thePFCandidateToken, pfCandidates);
69 
70  int nj_ht = 0, nj_mht = 0;
71  double ht = 0., mhx = 0., mhy = 0.;
72 
73  if (!jets->empty()) {
74  for (reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
75  double pt = usePt_ ? j->pt() : j->et();
76  double eta = j->eta();
77  double phi = j->phi();
78  double px = usePt_ ? j->px() : j->et() * cos(phi);
79  double py = usePt_ ? j->py() : j->et() * sin(phi);
80 
81  if (pt > minPtJetHt_ && std::abs(eta) < maxEtaJetHt_) {
82  ht += pt;
83  ++nj_ht;
84  }
85 
86  if (pt > minPtJetMht_ && std::abs(eta) < maxEtaJetMht_) {
87  mhx -= px;
88  mhy -= py;
89  ++nj_mht;
90  }
91  }
92  }
93 
94  if (excludePFMuons_) {
95  for (auto const& j : *pfCandidates) {
96  if (std::abs(j.pdgId()) == 13) {
97  mhx += j.px();
98  mhy += j.py();
99  }
100  }
101  }
102 
103  if (nj_ht < minNJetHt_) {
104  ht = 0;
105  }
106  if (nj_mht < minNJetMht_) {
107  mhx = 0;
108  mhy = 0;
109  }
110 
111  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
112  reco::MET::Point vtx(0, 0, 0);
113  reco::MET htmht(ht, p4, vtx);
114  result->push_back(htmht);
115 
116  // Put the products into the Event
117  iEvent.put(std::move(result));
118 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
edm::InputTag pfCandidatesLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int minNJetHt_
Minimum number of jets passing pt and eta requirements.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double minPtJetHt_
Minimum pt requirement for jets.
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
const_iterator begin() const
Definition: MET.h:41
T sqrt(T t)
Definition: SSEVec.h:19
double p4[4]
Definition: TauolaWrapper.h:92
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool empty() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double maxEtaJetHt_
Maximum (abs) eta requirement for jets.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
std::string const & label() const
Definition: InputTag.h:36
bool usePt_
Use pt; otherwise, use et.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
const_iterator end() const
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::JetView > m_theJetToken

Member Data Documentation

bool HLTHtMhtProducer::excludePFMuons_
private

Exclude PF muons in the MHT calculation (but not HT) Ignored if pfCandidatesLabel_ is empty.

Definition at line 47 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::jetsLabel_
private

Input jet, PFCandidate collections.

Definition at line 62 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

edm::EDGetTokenT<reco::JetView> HLTHtMhtProducer::m_theJetToken
private

Definition at line 65 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

edm::EDGetTokenT<reco::PFCandidateCollection> HLTHtMhtProducer::m_thePFCandidateToken
private

Definition at line 66 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

double HLTHtMhtProducer::maxEtaJetHt_
private

Maximum (abs) eta requirement for jets.

Definition at line 58 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::maxEtaJetMht_
private

Definition at line 59 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetHt_
private

Minimum number of jets passing pt and eta requirements.

Definition at line 50 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetMht_
private

Definition at line 51 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetHt_
private

Minimum pt requirement for jets.

Definition at line 54 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetMht_
private

Definition at line 55 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::pfCandidatesLabel_
private

Definition at line 63 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

bool HLTHtMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 43 of file HLTHtMhtProducer.h.

Referenced by produce().