CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTTrackMETProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~HLTTrackMETProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool excludePFMuons_
 
edm::InputTag jetsLabel_
 Input jet, track, PFRecTrack, PFCandidate collections. More...
 
edm::EDGetTokenT< reco::JetViewm_theJetToken
 
edm::EDGetTokenT
< reco::PFCandidateCollection
m_thePFCandidateToken
 
edm::EDGetTokenT
< reco::PFRecTrackCollection
m_theRecTrackToken
 
edm::EDGetTokenT
< reco::TrackCollection
m_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 42 of file HLTTrackMETProducer.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file HLTTrackMETProducer.cc.

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

18  :
19  usePt_ ( iConfig.getParameter<bool>("usePt") ),
20  useTracks_ ( iConfig.getParameter<bool>("useTracks") ),
21  usePFRecTracks_ ( iConfig.getParameter<bool>("usePFRecTracks") ),
22  usePFCandidatesCharged_ ( iConfig.getParameter<bool>("usePFCandidatesCharged") ),
23  usePFCandidates_ ( iConfig.getParameter<bool>("usePFCandidates") ),
24  excludePFMuons_ ( iConfig.getParameter<bool>("excludePFMuons") ),
25  minNJet_ ( iConfig.getParameter<int>("minNJet") ),
26  minPtJet_ ( iConfig.getParameter<double>("minPtJet") ),
27  maxEtaJet_ ( iConfig.getParameter<double>("maxEtaJet") ),
28  jetsLabel_ ( iConfig.getParameter<edm::InputTag>("jetsLabel") ),
29  tracksLabel_ ( iConfig.getParameter<edm::InputTag>("tracksLabel") ),
30  pfRecTracksLabel_ ( iConfig.getParameter<edm::InputTag>("pfRecTracksLabel") ),
31  pfCandidatesLabel_ ( iConfig.getParameter<edm::InputTag>("pfCandidatesLabel") ) {
32  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
33  m_theTrackToken = consumes<reco::TrackCollection>(tracksLabel_);
34  m_theRecTrackToken = consumes<reco::PFRecTrackCollection>(pfRecTracksLabel_);
35  m_thePFCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
36 
37  // Register the products
38  produces<reco::METCollection>();
39 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > m_theTrackToken
bool usePFCandidates_
Use PF candidates as input instead of jets.
edm::InputTag pfRecTracksLabel_
edm::InputTag pfCandidatesLabel_
edm::InputTag tracksLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
edm::InputTag jetsLabel_
Input jet, track, PFRecTrack, PFCandidate collections.
double minPtJet_
Minimum pt requirement for jets (or objects used as input)
edm::EDGetTokenT< reco::PFRecTrackCollection > m_theRecTrackToken
edm::EDGetTokenT< reco::JetView > m_theJetToken
double maxEtaJet_
Maximum (abs) eta requirement for jets (or objects used as input)
HLTTrackMETProducer::~HLTTrackMETProducer ( )

Definition at line 42 of file HLTTrackMETProducer.cc.

42 {}

Member Function Documentation

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

Definition at line 45 of file HLTTrackMETProducer.cc.

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

45  {
46  // Current default is for hltPFMET
48  desc.add<bool>("usePt", true);
49  desc.add<bool>("useTracks", false);
50  desc.add<bool>("usePFRecTracks", false);
51  desc.add<bool>("usePFCandidatesCharged", true);
52  desc.add<bool>("usePFCandidates", false);
53  desc.add<bool>("excludePFMuons", false);
54  desc.add<int>("minNJet",0);
55  desc.add<double>("minPtJet", 0.);
56  desc.add<double>("maxEtaJet", 999.);
57  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4PFJets"));
58  desc.add<edm::InputTag>("tracksLabel", edm::InputTag("hltL3Muons"));
59  desc.add<edm::InputTag>("pfRecTracksLabel", edm::InputTag("hltLightPFTracks"));
60  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
61  descriptions.add("hltTrackMETProducer", desc);
62 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTTrackMETProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 65 of file HLTTrackMETProducer.cc.

References funct::abs(), funct::cos(), eta(), excludePFMuons_, edm::Event::getByToken(), j, fwrapper::jets, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, m_theRecTrackToken, m_theTrackToken, maxEtaJet_, minNJet_, minPtJet_, p4, reco::tau::pfCandidates(), pfCandidatesLabel_, phi, EnergyCorrector::pt, edm::Event::put(), query::result, funct::sin(), mathSSE::sqrt(), testEve_cfg::tracks, usePFCandidates_, usePFCandidatesCharged_, usePFRecTracks_, usePt_, and useTracks_.

65  {
66 
67  // Create a pointer to the products
68  std::auto_ptr<reco::METCollection> result(new reco::METCollection());
69 
70  if (pfCandidatesLabel_.label() == "")
71  excludePFMuons_ = false;
72 
74  if (!useJets) {
75  minNJet_ = 0;
76  }
77 
79  if (useJets) iEvent.getByToken(m_theJetToken, jets);
80 
82  if (useTracks_) iEvent.getByToken(m_theTrackToken, tracks);
83 
85  if (usePFRecTracks_) iEvent.getByToken(m_theRecTrackToken, pfRecTracks);
86 
89  iEvent.getByToken(m_thePFCandidateToken, pfCandidates);
90 
91  int nj = 0;
92  double sumet = 0., mhx = 0., mhy = 0.;
93 
94  if (useJets && jets->size() > 0) {
95  for(reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
96  double pt = usePt_ ? j->pt() : j->et();
97  double eta = j->eta();
98  double phi = j->phi();
99  double px = usePt_ ? j->px() : j->et() * cos(phi);
100  double py = usePt_ ? j->py() : j->et() * sin(phi);
101 
102  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
103  mhx -= px;
104  mhy -= py;
105  sumet += pt;
106  ++nj;
107  }
108  }
109 
110  } else if (useTracks_ && tracks->size() > 0) {
111  for (reco::TrackCollection::const_iterator j = tracks->begin(); j != tracks->end(); ++j) {
112  double pt = j->pt();
113  double px = j->px();
114  double py = j->py();
115  double eta = j->eta();
116 
117  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
118  mhx -= px;
119  mhy -= py;
120  sumet += pt;
121  ++nj;
122  }
123  }
124 
125  } else if (usePFRecTracks_ && pfRecTracks->size() > 0) {
126  for (reco::PFRecTrackCollection::const_iterator j = pfRecTracks->begin(); j != pfRecTracks->end(); ++j) {
127  double pt = j->trackRef()->pt();
128  double px = j->trackRef()->px();
129  double py = j->trackRef()->py();
130  double eta = j->trackRef()->eta();
131 
132  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
133  mhx -= px;
134  mhy -= py;
135  sumet += pt;
136  ++nj;
137  }
138  }
139 
140  } else if ((usePFCandidatesCharged_ || usePFCandidates_) && pfCandidates->size() > 0) {
141  for (reco::PFCandidateCollection::const_iterator j = pfCandidates->begin(); j != pfCandidates->end(); ++j) {
142  if (usePFCandidatesCharged_ && j->charge() == 0) continue;
143  double pt = j->pt();
144  double px = j->px();
145  double py = j->py();
146  double eta = j->eta();
147 
148  if (pt > minPtJet_ && std::abs(eta) < maxEtaJet_) {
149  mhx -= px;
150  mhy -= py;
151  sumet += pt;
152  ++nj;
153  }
154  }
155  }
156 
157  if (excludePFMuons_) {
158  for (reco::PFCandidateCollection::const_iterator j = pfCandidates->begin(); j != pfCandidates->end(); ++j) {
159  if (std::abs(j->pdgId()) == 13) {
160  mhx += j->px();
161  mhy += j->py();
162  }
163  }
164  }
165 
166  if (nj < minNJet_) { sumet = 0; mhx = 0; mhy = 0; }
167 
168  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx*mhx + mhy*mhy));
169  reco::MET::Point vtx(0, 0, 0);
170  reco::MET mht(sumet, p4, vtx);
171  result->push_back(mht);
172 
173  // Put the products into the Event
174  iEvent.put(result);
175 }
edm::EDGetTokenT< reco::TrackCollection > m_theTrackToken
bool usePFCandidates_
Use PF candidates as input instead of jets.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
edm::InputTag pfCandidatesLabel_
T eta() const
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
Definition: MET.h:42
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
vector< PseudoJet > jets
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double minPtJet_
Minimum pt requirement for jets (or objects used as input)
edm::EDGetTokenT< reco::PFRecTrackCollection > m_theRecTrackToken
tuple tracks
Definition: testEve_cfg.py:39
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
std::string const & label() const
Definition: InputTag.h:42
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< reco::JetView > m_theJetToken
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
double maxEtaJet_
Maximum (abs) eta requirement for jets (or objects used as input)
Definition: DDAxes.h:10

Member Data Documentation

bool HLTTrackMETProducer::excludePFMuons_
private

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

Definition at line 71 of file HLTTrackMETProducer.h.

Referenced by produce().

edm::InputTag HLTTrackMETProducer::jetsLabel_
private

Input jet, track, PFRecTrack, PFCandidate collections.

Definition at line 84 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

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

Definition at line 89 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

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

Definition at line 92 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

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

Definition at line 91 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

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

Definition at line 90 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

double HLTTrackMETProducer::maxEtaJet_
private

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

Definition at line 81 of file HLTTrackMETProducer.h.

Referenced by produce().

int HLTTrackMETProducer::minNJet_
private

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

Definition at line 75 of file HLTTrackMETProducer.h.

Referenced by produce().

double HLTTrackMETProducer::minPtJet_
private

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

Definition at line 78 of file HLTTrackMETProducer.h.

Referenced by produce().

edm::InputTag HLTTrackMETProducer::pfCandidatesLabel_
private

Definition at line 87 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer(), and produce().

edm::InputTag HLTTrackMETProducer::pfRecTracksLabel_
private

Definition at line 86 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

edm::InputTag HLTTrackMETProducer::tracksLabel_
private

Definition at line 85 of file HLTTrackMETProducer.h.

Referenced by HLTTrackMETProducer().

bool HLTTrackMETProducer::usePFCandidates_
private

Use PF candidates as input instead of jets.

Definition at line 67 of file HLTTrackMETProducer.h.

Referenced by produce().

bool HLTTrackMETProducer::usePFCandidatesCharged_
private

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

Definition at line 64 of file HLTTrackMETProducer.h.

Referenced by produce().

bool HLTTrackMETProducer::usePFRecTracks_
private

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

Definition at line 60 of file HLTTrackMETProducer.h.

Referenced by produce().

bool HLTTrackMETProducer::usePt_
private

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

Definition at line 52 of file HLTTrackMETProducer.h.

Referenced by produce().

bool HLTTrackMETProducer::useTracks_
private

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

Definition at line 56 of file HLTTrackMETProducer.h.

Referenced by produce().