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
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTHtMhtProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~HLTHtMhtProducer ()
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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, PFCandidate collections. More...
 
edm::EDGetTokenT< reco::JetViewm_theJetToken
 
edm::EDGetTokenT
< reco::PFCandidateCollection
m_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<>
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 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 35 of file HLTHtMhtProducer.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file HLTHtMhtProducer.cc.

References jetsLabel_, m_theJetToken, m_thePFCandidateToken, and pfCandidatesLabel_.

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

Definition at line 37 of file HLTHtMhtProducer.cc.

37 {}

Member Function Documentation

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

Definition at line 40 of file HLTHtMhtProducer.cc.

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

40  {
41  // Current default is for hltHtMht
43  desc.add<bool>("usePt", false);
44  desc.add<bool>("excludePFMuons", false);
45  desc.add<int>("minNJetHt", 0);
46  desc.add<int>("minNJetMht", 0);
47  desc.add<double>("minPtJetHt", 40.);
48  desc.add<double>("minPtJetMht", 30.);
49  desc.add<double>("maxEtaJetHt", 3.);
50  desc.add<double>("maxEtaJetMht", 5.);
51  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetL1FastJetCorrected"));
52  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
53  descriptions.add("hltHtMhtProducer", desc);
54 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTHtMhtProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 57 of file HLTHtMhtProducer.cc.

References funct::abs(), funct::cos(), eta, excludePFMuons_, edm::Event::getByToken(), j, fwrapper::jets, edm::InputTag::label(), m_theJetToken, m_thePFCandidateToken, maxEtaJetHt_, maxEtaJetMht_, minNJetHt_, minNJetMht_, minPtJetHt_, minPtJetMht_, p4, reco::tau::pfCandidates(), pfCandidatesLabel_, phi, EnergyCorrector::pt, edm::Event::put(), mps_fire::result, funct::sin(), mathSSE::sqrt(), and usePt_.

57  {
58 
59  // Create a pointer to the products
60  std::auto_ptr<reco::METCollection> result(new reco::METCollection());
61 
62  if (pfCandidatesLabel_.label() == "")
63  excludePFMuons_ = false;
64 
66  iEvent.getByToken(m_theJetToken, jets);
67 
69  if (excludePFMuons_)
70  iEvent.getByToken(m_thePFCandidateToken, pfCandidates);
71 
72  int nj_ht = 0, nj_mht = 0;
73  double ht = 0., mhx = 0., mhy = 0.;
74 
75  if (jets->size() > 0) {
76  for(reco::JetView::const_iterator j = jets->begin(); j != jets->end(); ++j) {
77  double pt = usePt_ ? j->pt() : j->et();
78  double eta = j->eta();
79  double phi = j->phi();
80  double px = usePt_ ? j->px() : j->et() * cos(phi);
81  double py = usePt_ ? j->py() : j->et() * sin(phi);
82 
83  if (pt > minPtJetHt_ && std::abs(eta) < maxEtaJetHt_) {
84  ht += pt;
85  ++nj_ht;
86  }
87 
88  if (pt > minPtJetMht_ && std::abs(eta) < maxEtaJetMht_) {
89  mhx -= px;
90  mhy -= py;
91  ++nj_mht;
92  }
93  }
94  }
95 
96  if (excludePFMuons_) {
97  for (reco::PFCandidateCollection::const_iterator j = pfCandidates->begin(); j != pfCandidates->end(); ++j) {
98  if (std::abs(j->pdgId()) == 13) {
99  mhx += j->px();
100  mhy += j->py();
101  }
102  }
103  }
104 
105  if (nj_ht < minNJetHt_ ) { ht = 0; }
106  if (nj_mht < minNJetMht_) { mhx = 0; mhy = 0; }
107 
108  reco::MET::LorentzVector p4(mhx, mhy, 0, sqrt(mhx*mhx + mhy*mhy));
109  reco::MET::Point vtx(0, 0, 0);
110  reco::MET htmht(ht, p4, vtx);
111  result->push_back(htmht);
112 
113  // Put the products into the Event
114  iEvent.put(result);
115 }
edm::InputTag pfCandidatesLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePFCandidateToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
tuple result
Definition: mps_fire.py:83
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:121
Definition: MET.h:42
T sqrt(T t)
Definition: SSEVec.h:18
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
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 maxEtaJetHt_
Maximum (abs) eta requirement for jets.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
std::string const & label() const
Definition: InputTag.h:36
bool usePt_
Use pt; otherwise, use et.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
edm::EDGetTokenT< reco::JetView > m_theJetToken

Member Data Documentation

bool HLTHtMhtProducer::excludePFMuons_
private

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

Definition at line 48 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::jetsLabel_
private

Input jet, PFCandidate collections.

Definition at line 63 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

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

Definition at line 66 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

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

Definition at line 67 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

double HLTHtMhtProducer::maxEtaJetHt_
private

Maximum (abs) eta requirement for jets.

Definition at line 59 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::maxEtaJetMht_
private

Definition at line 60 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetHt_
private

Minimum number of jets passing pt and eta requirements.

Definition at line 51 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetMht_
private

Definition at line 52 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetHt_
private

Minimum pt requirement for jets.

Definition at line 55 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetMht_
private

Definition at line 56 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::pfCandidatesLabel_
private

Definition at line 64 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

bool HLTHtMhtProducer::usePt_
private

Use pt; otherwise, use et.

Definition at line 44 of file HLTHtMhtProducer.h.

Referenced by produce().