CMS 3D CMS Logo

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

This produces a reco::MET object that stores MHT (or MET) More...

#include <HLTMhtProducer.h>

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

Public Member Functions

 HLTMhtProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTMhtProducer () 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 maxEtaJet_
 Maximum (abs) eta requirement for jets. More...
 
int minNJet_
 Minimum number of jets passing pt and eta requirements. More...
 
double minPtJet_
 Minimum pt requirement for jets. More...
 
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 MHT (or MET)

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

MHT (or MET) is calculated using input CaloJet or PFJet collection. MHT can include or exclude the contribution from muons.

See header file for documentation

Author
Steven Lowette

Definition at line 30 of file HLTMhtProducer.h.

Constructor & Destructor Documentation

◆ HLTMhtProducer()

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

Definition at line 20 of file HLTMhtProducer.cc.

References excludePFMuons_, jetsLabel_, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, and pfCandidatesLabel_.

21  : usePt_(iConfig.getParameter<bool>("usePt")),
22  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
23  minNJet_(iConfig.getParameter<int>("minNJet")),
24  minPtJet_(iConfig.getParameter<double>("minPtJet")),
25  maxEtaJet_(iConfig.getParameter<double>("maxEtaJet")),
26  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
27  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
28  m_theJetToken = consumes<reco::CandidateView>(jetsLabel_);
29  if (pfCandidatesLabel_.label().empty())
30  excludePFMuons_ = false;
31  if (excludePFMuons_)
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
int minNJet_
Minimum number of jets passing pt and eta requirements.
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
double maxEtaJet_
Maximum (abs) eta requirement for jets.
edm::EDGetTokenT< reco::CandidateView > m_theJetToken
edm::InputTag jetsLabel_
Input jet, PFCandidate collections.
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag pfCandidatesLabel_
double minPtJet_
Minimum pt requirement for jets.
bool usePt_
Use pt; otherwise, use et.

◆ ~HLTMhtProducer()

HLTMhtProducer::~HLTMhtProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 42 of file HLTMhtProducer.cc.

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

42  {
43  // Current default is for hltPFMET
45  desc.add<bool>("usePt", true);
46  desc.add<bool>("excludePFMuons", false);
47  desc.add<int>("minNJet", 0);
48  desc.add<double>("minPtJet", 0.);
49  desc.add<double>("maxEtaJet", 999.);
50  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4PFJets"));
51  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
52  descriptions.add("hltMhtProducer", desc);
53 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 56 of file HLTMhtProducer.cc.

References funct::abs(), funct::cos(), PVValHelper::eta, excludePFMuons_, iEvent, PDWG_EXODelayedJetMET_cff::jets, m_theJetToken, m_thePFCandidateToken, maxEtaJet_, minNJet_, minPtJet_, eostools::move(), zmumugammaAnalyzer_cfi::pfCandidates, phi, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, mps_fire::result, funct::sin(), mathSSE::sqrt(), usePt_, and L1BJetProducer_cff::vtx.

56  {
57  // Create a pointer to the products
58  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
59 
61  iEvent.getByToken(m_theJetToken, jets);
62 
64  if (excludePFMuons_)
66 
67  int nj = 0;
68  double sumet = 0., mhx = 0., mhy = 0.;
69 
70  for (auto const& aJet : *jets) {
71  double const pt = usePt_ ? aJet.pt() : aJet.et();
72  double const eta = aJet.eta();
73  double const phi = aJet.phi();
74  double const px = usePt_ ? aJet.px() : aJet.et() * cos(phi);
75  double const py = usePt_ ? aJet.py() : aJet.et() * sin(phi);
76 
77  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
78  mhx -= px;
79  mhy -= py;
80  sumet += pt;
81  ++nj;
82  }
83  }
84 
85  if (excludePFMuons_) {
86  for (auto const& aCand : *pfCandidates) {
87  if (std::abs(aCand.pdgId()) == 13) {
88  mhx += aCand.px();
89  mhy += aCand.py();
90  }
91  }
92  }
93 
94  if (nj < minNJet_) {
95  sumet = 0;
96  mhx = 0;
97  mhy = 0;
98  }
99 
100  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
101  reco::MET::Point vtx(0, 0, 0);
102  reco::MET mht(sumet, p4, vtx);
103  result->push_back(mht);
104 
105  // Put the products into the Event
106  iEvent.put(std::move(result));
107 }
int minNJet_
Minimum number of jets passing pt and eta requirements.
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
double maxEtaJet_
Maximum (abs) eta requirement for jets.
edm::EDGetTokenT< reco::CandidateView > m_theJetToken
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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 minPtJet_
Minimum pt requirement for jets.
bool usePt_
Use pt; otherwise, use et.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ excludePFMuons_

bool HLTMhtProducer::excludePFMuons_
private

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

Definition at line 43 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ jetsLabel_

edm::InputTag HLTMhtProducer::jetsLabel_
private

Input jet, PFCandidate collections.

Definition at line 55 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer().

◆ m_theJetToken

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

Definition at line 58 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ m_thePFCandidateToken

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

Definition at line 59 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ maxEtaJet_

double HLTMhtProducer::maxEtaJet_
private

Maximum (abs) eta requirement for jets.

Definition at line 52 of file HLTMhtProducer.h.

Referenced by produce().

◆ minNJet_

int HLTMhtProducer::minNJet_
private

Minimum number of jets passing pt and eta requirements.

Definition at line 46 of file HLTMhtProducer.h.

Referenced by produce().

◆ minPtJet_

double HLTMhtProducer::minPtJet_
private

Minimum pt requirement for jets.

Definition at line 49 of file HLTMhtProducer.h.

Referenced by produce().

◆ pfCandidatesLabel_

edm::InputTag HLTMhtProducer::pfCandidatesLabel_
private

Definition at line 56 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer().

◆ usePt_

bool HLTMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 39 of file HLTMhtProducer.h.

Referenced by produce().