CMS 3D CMS Logo

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

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

#include <HLTTrackMETProducer.h>

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

Public Member Functions

 HLTTrackMETProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTTrackMETProducer () 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, track, PFRecTrack, PFCandidate collections. More...
 
edm::EDGetTokenT< reco::JetViewm_theJetToken
 
edm::EDGetTokenT< reco::PFCandidateCollectionm_thePFCandidateToken
 
edm::EDGetTokenT< reco::PFRecTrackCollectionm_theRecTrackToken
 
edm::EDGetTokenT< reco::TrackCollectionm_theTrackToken
 
double maxEtaJet_
 Maximum (abs) eta requirement for jets (or objects used as input) More...
 
int minNJet_
 
double minPtJet_
 Minimum pt requirement for jets (or objects used as input) More...
 
edm::InputTag pfCandidatesLabel_
 
edm::InputTag pfRecTracksLabel_
 
edm::InputTag tracksLabel_
 
bool usePFCandidates_
 Use PF candidates as input instead of jets. More...
 
bool usePFCandidatesCharged_
 
bool usePFRecTracks_
 
bool usePt_
 
bool useTracks_
 

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 one of the input collections:

See header file for documentation

Author
Steven Lowette

Definition at line 41 of file HLTTrackMETProducer.h.

Constructor & Destructor Documentation

◆ HLTTrackMETProducer()

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

Definition at line 17 of file HLTTrackMETProducer.cc.

18  : usePt_(iConfig.getParameter<bool>("usePt")),
19  useTracks_(iConfig.getParameter<bool>("useTracks")),
20  usePFRecTracks_(iConfig.getParameter<bool>("usePFRecTracks")),
21  usePFCandidatesCharged_(iConfig.getParameter<bool>("usePFCandidatesCharged")),
22  usePFCandidates_(iConfig.getParameter<bool>("usePFCandidates")),
23  excludePFMuons_(iConfig.getParameter<bool>("excludePFMuons")),
24  minNJet_(iConfig.getParameter<int>("minNJet")),
25  minPtJet_(iConfig.getParameter<double>("minPtJet")),
26  maxEtaJet_(iConfig.getParameter<double>("maxEtaJet")),
27  jetsLabel_(iConfig.getParameter<edm::InputTag>("jetsLabel")),
28  tracksLabel_(iConfig.getParameter<edm::InputTag>("tracksLabel")),
29  pfRecTracksLabel_(iConfig.getParameter<edm::InputTag>("pfRecTracksLabel")),
30  pfCandidatesLabel_(iConfig.getParameter<edm::InputTag>("pfCandidatesLabel")) {
31  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
32  m_theTrackToken = consumes<reco::TrackCollection>(tracksLabel_);
33  m_theRecTrackToken = consumes<reco::PFRecTrackCollection>(pfRecTracksLabel_);
34  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
35 
36  // Register the products
37  produces<reco::METCollection>();
38 }

References jetsLabel_, m_theJetToken, m_thePFCandidateToken, m_theRecTrackToken, m_theTrackToken, pfCandidatesLabel_, pfRecTracksLabel_, and tracksLabel_.

◆ ~HLTTrackMETProducer()

HLTTrackMETProducer::~HLTTrackMETProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 44 of file HLTTrackMETProducer.cc.

44  {
45  // Current default is for hltPFMET
47  desc.add<bool>("usePt", true);
48  desc.add<bool>("useTracks", false);
49  desc.add<bool>("usePFRecTracks", false);
50  desc.add<bool>("usePFCandidatesCharged", true);
51  desc.add<bool>("usePFCandidates", false);
52  desc.add<bool>("excludePFMuons", false);
53  desc.add<int>("minNJet", 0);
54  desc.add<double>("minPtJet", 0.);
55  desc.add<double>("maxEtaJet", 999.);
56  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4PFJets"));
57  desc.add<edm::InputTag>("tracksLabel", edm::InputTag("hltL3Muons"));
58  desc.add<edm::InputTag>("pfRecTracksLabel", edm::InputTag("hltLightPFTracks"));
59  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
60  descriptions.add("hltTrackMETProducer", desc);
61 }

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

◆ produce()

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

Definition at line 64 of file HLTTrackMETProducer.cc.

64  {
65  // Create a pointer to the products
66  std::unique_ptr<reco::METCollection> result(new reco::METCollection());
67 
68  if (pfCandidatesLabel_.label().empty())
69  excludePFMuons_ = false;
70 
72  if (!useJets) {
73  minNJet_ = 0;
74  }
75 
77  if (useJets)
78  iEvent.getByToken(m_theJetToken, jets);
79 
81  if (useTracks_)
82  iEvent.getByToken(m_theTrackToken, tracks);
83 
85  if (usePFRecTracks_)
86  iEvent.getByToken(m_theRecTrackToken, pfRecTracks);
87 
91 
92  int nj = 0;
93  double sumet = 0., mhx = 0., mhy = 0.;
94 
95  if (useJets && !jets->empty()) {
96  for (reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
97  double pt = usePt_ ? j->pt() : j->et();
98  double eta = j->eta();
99  double phi = j->phi();
100  double px = usePt_ ? j->px() : j->et() * cos(phi);
101  double py = usePt_ ? j->py() : j->et() * sin(phi);
102 
103  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
104  mhx -= px;
105  mhy -= py;
106  sumet += pt;
107  ++nj;
108  }
109  }
110 
111  } else if (useTracks_ && !tracks->empty()) {
112  for (auto const& j : *tracks) {
113  double pt = j.pt();
114  double px = j.px();
115  double py = j.py();
116  double eta = j.eta();
117 
118  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
119  mhx -= px;
120  mhy -= py;
121  sumet += pt;
122  ++nj;
123  }
124  }
125 
126  } else if (usePFRecTracks_ && !pfRecTracks->empty()) {
127  for (auto const& j : *pfRecTracks) {
128  double pt = j.trackRef()->pt();
129  double px = j.trackRef()->px();
130  double py = j.trackRef()->py();
131  double eta = j.trackRef()->eta();
132 
133  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
134  mhx -= px;
135  mhy -= py;
136  sumet += pt;
137  ++nj;
138  }
139  }
140 
141  } else if ((usePFCandidatesCharged_ || usePFCandidates_) && !pfCandidates->empty()) {
142  for (auto const& j : *pfCandidates) {
143  if (usePFCandidatesCharged_ && j.charge() == 0)
144  continue;
145  double pt = j.pt();
146  double px = j.px();
147  double py = j.py();
148  double eta = j.eta();
149 
150  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
151  mhx -= px;
152  mhy -= py;
153  sumet += pt;
154  ++nj;
155  }
156  }
157  }
158 
159  if (excludePFMuons_) {
160  for (auto const& j : *pfCandidates) {
161  if (std::abs(j.pdgId()) == 13) {
162  mhx += j.px();
163  mhy += j.py();
164  }
165  }
166  }
167 
168  if (nj < minNJet_) {
169  sumet = 0;
170  mhx = 0;
171  mhy = 0;
172  }
173 
174  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx * mhx + mhy * mhy));
175  reco::MET::Point vtx(0, 0, 0);
176  reco::MET mht(sumet, p4, vtx);
177  result->push_back(mht);
178 
179  // Put the products into the Event
180  iEvent.put(std::move(result));
181 }

References funct::abs(), funct::cos(), PVValHelper::eta, excludePFMuons_, iEvent, dqmiolumiharvest::j, singleTopDQM_cfi::jets, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, m_theRecTrackToken, m_theTrackToken, maxEtaJet_, minNJet_, minPtJet_, eostools::move(), p4, 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(), PDWG_EXOHSCP_cff::tracks, usePFCandidates_, usePFCandidatesCharged_, usePFRecTracks_, usePt_, useTracks_, and badGlobalMuonTaggersAOD_cff::vtx.

Member Data Documentation

◆ excludePFMuons_

bool HLTTrackMETProducer::excludePFMuons_
private

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

Definition at line 70 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ jetsLabel_

edm::InputTag HLTTrackMETProducer::jetsLabel_
private

Input jet, track, PFRecTrack, PFCandidate collections.

Definition at line 83 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

◆ m_theJetToken

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

Definition at line 88 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

◆ m_thePFCandidateToken

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

Definition at line 91 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

◆ m_theRecTrackToken

edm::EDGetTokenT<reco::PFRecTrackCollection> HLTTrackMETProducer::m_theRecTrackToken
private

Definition at line 90 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

◆ m_theTrackToken

edm::EDGetTokenT<reco::TrackCollection> HLTTrackMETProducer::m_theTrackToken
private

Definition at line 89 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

◆ maxEtaJet_

double HLTTrackMETProducer::maxEtaJet_
private

Maximum (abs) eta requirement for jets (or objects used as input)

Definition at line 80 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ minNJet_

int HLTTrackMETProducer::minNJet_
private

Minimum number of jets passing pt and eta requirements Ignored if jets are not used as input

Definition at line 74 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ minPtJet_

double HLTTrackMETProducer::minPtJet_
private

Minimum pt requirement for jets (or objects used as input)

Definition at line 77 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ pfCandidatesLabel_

edm::InputTag HLTTrackMETProducer::pfCandidatesLabel_
private

Definition at line 86 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

◆ pfRecTracksLabel_

edm::InputTag HLTTrackMETProducer::pfRecTracksLabel_
private

Definition at line 85 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

◆ tracksLabel_

edm::InputTag HLTTrackMETProducer::tracksLabel_
private

Definition at line 84 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

◆ usePFCandidates_

bool HLTTrackMETProducer::usePFCandidates_
private

Use PF candidates as input instead of jets.

Definition at line 66 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ usePFCandidatesCharged_

bool HLTTrackMETProducer::usePFCandidatesCharged_
private

Use PF charged candidates as input instead of jets. If true, it overrides usePFCandidates_.

Definition at line 63 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ usePFRecTracks_

bool HLTTrackMETProducer::usePFRecTracks_
private

Use PF tracks as input instead of jets. If true, it overrides usePFCandidatesCharged_ & usePFCandidates_.

Definition at line 59 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ usePt_

bool HLTTrackMETProducer::usePt_
private

Use pt; otherwise, use et. Ignored if jets are not used as input.

Definition at line 51 of file HLTTrackMETProducer.h.

Referenced by produce().

◆ useTracks_

bool HLTTrackMETProducer::useTracks_
private

Use reco tracks as input instead of jets. If true, it overrides usePFRecTracks, usePFCandidatesCharged_ & usePFCandidates_.

Definition at line 55 of file HLTTrackMETProducer.h.

Referenced by produce().

zmumugammaAnalyzer_cfi.pfCandidates
pfCandidates
Definition: zmumugammaAnalyzer_cfi.py:11
HLTTrackMETProducer::m_theRecTrackToken
edm::EDGetTokenT< reco::PFRecTrackCollection > m_theRecTrackToken
Definition: HLTTrackMETProducer.h:90
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
HLTTrackMETProducer::m_theTrackToken
edm::EDGetTokenT< reco::TrackCollection > m_theTrackToken
Definition: HLTTrackMETProducer.h:89
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTTrackMETProducer::pfRecTracksLabel_
edm::InputTag pfRecTracksLabel_
Definition: HLTTrackMETProducer.h:85
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
HLTTrackMETProducer::usePFCandidatesCharged_
bool usePFCandidatesCharged_
Definition: HLTTrackMETProducer.h:63
HLTTrackMETProducer::jetsLabel_
edm::InputTag jetsLabel_
Input jet, track, PFRecTrack, PFCandidate collections.
Definition: HLTTrackMETProducer.h:83
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
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
reco::MET
Definition: MET.h:41
HLTTrackMETProducer::usePt_
bool usePt_
Definition: HLTTrackMETProducer.h:51
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
HLTTrackMETProducer::m_thePFCandidateToken
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
Definition: HLTTrackMETProducer.h:91
HLTTrackMETProducer::usePFRecTracks_
bool usePFRecTracks_
Definition: HLTTrackMETProducer.h:59
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
HLTTrackMETProducer::useTracks_
bool useTracks_
Definition: HLTTrackMETProducer.h:55
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
HLTTrackMETProducer::tracksLabel_
edm::InputTag tracksLabel_
Definition: HLTTrackMETProducer.h:84
HLTTrackMETProducer::minNJet_
int minNJet_
Definition: HLTTrackMETProducer.h:74
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTTrackMETProducer::usePFCandidates_
bool usePFCandidates_
Use PF candidates as input instead of jets.
Definition: HLTTrackMETProducer.h:66
p4
double p4[4]
Definition: TauolaWrapper.h:92
HLTTrackMETProducer::m_theJetToken
edm::EDGetTokenT< reco::JetView > m_theJetToken
Definition: HLTTrackMETProducer.h:88
HLTTrackMETProducer::excludePFMuons_
bool excludePFMuons_
Definition: HLTTrackMETProducer.h:70
DDAxes::phi
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
eostools.move
def move(src, dest)
Definition: eostools.py:511
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:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HLTTrackMETProducer::minPtJet_
double minPtJet_
Minimum pt requirement for jets (or objects used as input)
Definition: HLTTrackMETProducer.h:77
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
HLTTrackMETProducer::maxEtaJet_
double maxEtaJet_
Maximum (abs) eta requirement for jets (or objects used as input)
Definition: HLTTrackMETProducer.h:80
edm::InputTag
Definition: InputTag.h:15
HLTTrackMETProducer::pfCandidatesLabel_
edm::InputTag pfCandidatesLabel_
Definition: HLTTrackMETProducer.h:86