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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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 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<>
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 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 33 of file HLTMhtProducer.h.

Constructor & Destructor Documentation

◆ HLTMhtProducer()

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

Definition at line 17 of file HLTMhtProducer.cc.

18  : usePt_(iConfig.getParameter<bool>("usePt")),
19  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
20  minNJet_(iConfig.getParameter<int>("minNJet")),
21  minPtJet_(iConfig.getParameter<double>("minPtJet")),
22  maxEtaJet_(iConfig.getParameter<double>("maxEtaJet")),
23  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
24  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
25  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
26  if (pfCandidatesLabel_.label().empty())
27  excludePFMuons_ = false;
28  if (excludePFMuons_)
29  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
30 
31  // Register the products
32  produces<reco::METCollection>();
33 }

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

◆ ~HLTMhtProducer()

HLTMhtProducer::~HLTMhtProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 39 of file HLTMhtProducer.cc.

39  {
40  // Current default is for hltPFMET
42  desc.add<bool>("usePt", true);
43  desc.add<bool>("excludePFMuons", false);
44  desc.add<int>("minNJet", 0);
45  desc.add<double>("minPtJet", 0.);
46  desc.add<double>("maxEtaJet", 999.);
47  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4PFJets"));
48  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
49  descriptions.add("hltMhtProducer", desc);
50 }

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

◆ produce()

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

Definition at line 53 of file HLTMhtProducer.cc.

53  {
54  // Create a pointer to the products
55  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
56 
58  iEvent.getByToken(m_theJetToken, jets);
59 
61  if (excludePFMuons_)
63 
64  int nj = 0;
65  double sumet = 0., mhx = 0., mhy = 0.;
66 
67  if (!jets->empty()) {
68  for (reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
69  double pt = usePt_ ? j->pt() : j->et();
70  double eta = j->eta();
71  double phi = j->phi();
72  double px = usePt_ ? j->px() : j->et() * cos(phi);
73  double py = usePt_ ? j->py() : j->et() * sin(phi);
74 
75  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
76  mhx -= px;
77  mhy -= py;
78  sumet += pt;
79  ++nj;
80  }
81  }
82  }
83 
84  if (excludePFMuons_) {
85  for (auto const& j : *pfCandidates) {
86  if (std::abs(j.pdgId()) == 13) {
87  mhx += j.px();
88  mhy += j.py();
89  }
90  }
91  }
92 
93  if (nj < minNJet_) {
94  sumet = 0;
95  mhx = 0;
96  mhy = 0;
97  }
98 
99  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
100  reco::MET::Point vtx(0, 0, 0);
101  reco::MET mht(sumet, p4, vtx);
102  result->push_back(mht);
103 
104  // Put the products into the Event
105  iEvent.put(std::move(result));
106 }

References funct::abs(), funct::cos(), PVValHelper::eta, excludePFMuons_, iEvent, dqmiolumiharvest::j, singleTopDQM_cfi::jets, m_theJetToken, m_thePFCandidateToken, maxEtaJet_, minNJet_, minPtJet_, eostools::move(), p4, 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 extraflags_cff::vtx.

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 46 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ jetsLabel_

edm::InputTag HLTMhtProducer::jetsLabel_
private

Input jet, PFCandidate collections.

Definition at line 58 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer().

◆ m_theJetToken

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

Definition at line 61 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ m_thePFCandidateToken

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

Definition at line 62 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

◆ maxEtaJet_

double HLTMhtProducer::maxEtaJet_
private

Maximum (abs) eta requirement for jets.

Definition at line 55 of file HLTMhtProducer.h.

Referenced by produce().

◆ minNJet_

int HLTMhtProducer::minNJet_
private

Minimum number of jets passing pt and eta requirements.

Definition at line 49 of file HLTMhtProducer.h.

Referenced by produce().

◆ minPtJet_

double HLTMhtProducer::minPtJet_
private

Minimum pt requirement for jets.

Definition at line 52 of file HLTMhtProducer.h.

Referenced by produce().

◆ pfCandidatesLabel_

edm::InputTag HLTMhtProducer::pfCandidatesLabel_
private

Definition at line 59 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer().

◆ usePt_

bool HLTMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 42 of file HLTMhtProducer.h.

Referenced by produce().

zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
HLTMhtProducer::minNJet_
int minNJet_
Minimum number of jets passing pt and eta requirements.
Definition: HLTMhtProducer.h:49
HLTMhtProducer::excludePFMuons_
bool excludePFMuons_
Definition: HLTMhtProducer.h:46
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
HLTMhtProducer::m_thePFCandidateToken
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
Definition: HLTMhtProducer.h:62
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::METCollection
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:22
HLTMhtProducer::maxEtaJet_
double maxEtaJet_
Maximum (abs) eta requirement for jets.
Definition: HLTMhtProducer.h:55
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
reco::MET
Definition: MET.h:41
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HLTMhtProducer::pfCandidatesLabel_
edm::InputTag pfCandidatesLabel_
Definition: HLTMhtProducer.h:59
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTMhtProducer::jetsLabel_
edm::InputTag jetsLabel_
Input jet, PFCandidate collections.
Definition: HLTMhtProducer.h:58
p4
double p4[4]
Definition: TauolaWrapper.h:92
DDAxes::phi
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLTMhtProducer::m_theJetToken
edm::EDGetTokenT< reco::JetView > m_theJetToken
Definition: HLTMhtProducer.h:61
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HLTMhtProducer::minPtJet_
double minPtJet_
Minimum pt requirement for jets.
Definition: HLTMhtProducer.h:52
HLTMhtProducer::usePt_
bool usePt_
Use pt; otherwise, use et.
Definition: HLTMhtProducer.h:42
edm::InputTag
Definition: InputTag.h:15