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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::CandidateViewm_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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 31 of file HLTHtMhtProducer.h.

Constructor & Destructor Documentation

◆ HLTHtMhtProducer()

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

Definition at line 20 of file HLTHtMhtProducer.cc.

References jetsLabel_, m_theJetToken, m_thePFCandidateToken, and pfCandidatesLabel_.

21  : usePt_(iConfig.getParameter<bool>("usePt")),
22  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
23  minNJetHt_(iConfig.getParameter<int>("minNJetHt")),
24  minNJetMht_(iConfig.getParameter<int>("minNJetMht")),
25  minPtJetHt_(iConfig.getParameter<double>("minPtJetHt")),
26  minPtJetMht_(iConfig.getParameter<double>("minPtJetMht")),
27  maxEtaJetHt_(iConfig.getParameter<double>("maxEtaJetHt")),
28  maxEtaJetMht_(iConfig.getParameter<double>("maxEtaJetMht")),
29  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
30  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
31  m_theJetToken = consumes<reco::CandidateView>(jetsLabel_);
32  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
33 
34  // Register the products
35  produces<reco::METCollection>();
36 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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::EDGetTokenT< reco::CandidateView > m_theJetToken
edm::InputTag jetsLabel_
Input jet, PFCandidate collections.

◆ ~HLTHtMhtProducer()

HLTHtMhtProducer::~HLTHtMhtProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 42 of file HLTHtMhtProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_2022v12_cff::InputTag.

42  {
43  // Current default is for hltHtMht
45  desc.add<bool>("usePt", false);
46  desc.add<bool>("excludePFMuons", false);
47  desc.add<int>("minNJetHt", 0);
48  desc.add<int>("minNJetMht", 0);
49  desc.add<double>("minPtJetHt", 40.);
50  desc.add<double>("minPtJetMht", 30.);
51  desc.add<double>("maxEtaJetHt", 3.);
52  desc.add<double>("maxEtaJetMht", 5.);
53  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetL1FastJetCorrected"));
54  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
55  descriptions.add("hltHtMhtProducer", desc);
56 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void HLTHtMhtProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 59 of file HLTHtMhtProducer.cc.

References funct::abs(), funct::cos(), PVValHelper::eta, excludePFMuons_, iEvent, PDWG_EXODelayedJetMET_cff::jets, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, maxEtaJetHt_, maxEtaJetMht_, minNJetHt_, minNJetMht_, minPtJetHt_, minPtJetMht_, eostools::move(), zmumugammaAnalyzer_cfi::pfCandidates, pfCandidatesLabel_, phi, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mps_fire::result, funct::sin(), mathSSE::sqrt(), usePt_, and extraflags_cff::vtx.

59  {
60  // Create a pointer to the products
61  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
62 
63  if (pfCandidatesLabel_.label().empty())
64  excludePFMuons_ = false;
65 
67  iEvent.getByToken(m_theJetToken, jets);
68 
70  if (excludePFMuons_)
72 
73  int nj_ht = 0, nj_mht = 0;
74  double ht = 0., mhx = 0., mhy = 0.;
75 
76  for (auto const& aJet : *jets) {
77  double const pt = usePt_ ? aJet.pt() : aJet.et();
78  double const eta = aJet.eta();
79  double const phi = aJet.phi();
80  double const px = usePt_ ? aJet.px() : aJet.et() * cos(phi);
81  double const py = usePt_ ? aJet.py() : aJet.et() * sin(phi);
82 
83  if (pt > minPtJetHt_ && std::abs(eta) < maxEtaJetHt_) {
84  ht += pt;
85  ++nj_ht;
86  }
87 
89  mhx -= px;
90  mhy -= py;
91  ++nj_mht;
92  }
93  }
94 
95  if (excludePFMuons_) {
96  for (auto const& aCand : *pfCandidates) {
97  if (std::abs(aCand.pdgId()) == 13) {
98  mhx += aCand.px();
99  mhy += aCand.py();
100  }
101  }
102  }
103 
104  if (nj_ht < minNJetHt_) {
105  ht = 0;
106  }
107  if (nj_mht < minNJetMht_) {
108  mhx = 0;
109  mhy = 0;
110  }
111 
112  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
113  reco::MET::Point vtx(0, 0, 0);
114  reco::MET htmht(ht, p4, vtx);
115  result->push_back(htmht);
116 
117  // Put the products into the Event
118  iEvent.put(std::move(result));
119 }
edm::InputTag pfCandidatesLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
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::string const & label() const
Definition: InputTag.h:36
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
int iEvent
Definition: GenABIO.cc:224
Definition: MET.h:41
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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:36
bool usePt_
Use pt; otherwise, use et.
edm::EDGetTokenT< reco::CandidateView > m_theJetToken
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ excludePFMuons_

bool HLTHtMhtProducer::excludePFMuons_
private

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

Definition at line 44 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ jetsLabel_

edm::InputTag HLTHtMhtProducer::jetsLabel_
private

Input jet, PFCandidate collections.

Definition at line 59 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

◆ m_theJetToken

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

Definition at line 62 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

◆ m_thePFCandidateToken

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

Definition at line 63 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

◆ maxEtaJetHt_

double HLTHtMhtProducer::maxEtaJetHt_
private

Maximum (abs) eta requirement for jets.

Definition at line 55 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ maxEtaJetMht_

double HLTHtMhtProducer::maxEtaJetMht_
private

Definition at line 56 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ minNJetHt_

int HLTHtMhtProducer::minNJetHt_
private

Minimum number of jets passing pt and eta requirements.

Definition at line 47 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ minNJetMht_

int HLTHtMhtProducer::minNJetMht_
private

Definition at line 48 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ minPtJetHt_

double HLTHtMhtProducer::minPtJetHt_
private

Minimum pt requirement for jets.

Definition at line 51 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ minPtJetMht_

double HLTHtMhtProducer::minPtJetMht_
private

Definition at line 52 of file HLTHtMhtProducer.h.

Referenced by produce().

◆ pfCandidatesLabel_

edm::InputTag HLTHtMhtProducer::pfCandidatesLabel_
private

Definition at line 60 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

◆ usePt_

bool HLTHtMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 40 of file HLTHtMhtProducer.h.

Referenced by produce().