CMS 3D CMS Logo

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

This creates a MET object from the difference in MET between two input jet collections. More...

#include <HLTMETCleanerUsingJetID.h>

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

Public Member Functions

 HLTMETCleanerUsingJetID (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTMETCleanerUsingJetID () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag goodJetsLabel_
 Input tag for the 'good jets' collection. More...
 
edm::InputTag jetsLabel_
 Input tag for the 'all jets' collection. More...
 
edm::EDGetTokenT< reco::CaloJetCollectionm_theGoodJetToken
 
edm::EDGetTokenT< reco::CaloJetCollectionm_theJetToken
 
edm::EDGetTokenT< reco::CaloMETCollectionm_theMETToken
 
double maxEta_
 Maximum (abs) eta requirement for jets. More...
 
edm::InputTag metLabel_
 Input tag for the MET collection. More...
 
double minPt_
 Minimum pt requirement for jets. 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 creates a MET object from the difference in MET between two input jet collections.

Author
Jia Fu Low (Nov 2013)

This code creates a new MET vector defined as:

output MET = input MET + MET from 'good jets' - MET from 'all jets'

See header file for more information.

Author
a Jet/MET person

Definition at line 33 of file HLTMETCleanerUsingJetID.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file HLTMETCleanerUsingJetID.cc.

References goodJetsLabel_, jetsLabel_, m_theGoodJetToken, m_theJetToken, m_theMETToken, metLabel_, and ~HLTMETCleanerUsingJetID().

15  : minPt_ (iConfig.getParameter<double>("minPt")),
16  maxEta_ (iConfig.getParameter<double>("maxEta")),
17  metLabel_ (iConfig.getParameter<edm::InputTag>("metLabel")),
18  jetsLabel_ (iConfig.getParameter<edm::InputTag>("jetsLabel")),
19  goodJetsLabel_ (iConfig.getParameter<edm::InputTag>("goodJetsLabel")) {
20  m_theMETToken = consumes<reco::CaloMETCollection>(metLabel_);
21  m_theJetToken = consumes<reco::CaloJetCollection>(jetsLabel_);
22  m_theGoodJetToken = consumes<reco::CaloJetCollection>(goodJetsLabel_);
23 
24  // Register the products
25  produces<reco::CaloMETCollection>();
26 }
T getParameter(std::string const &) const
edm::InputTag jetsLabel_
Input tag for the &#39;all jets&#39; collection.
edm::InputTag goodJetsLabel_
Input tag for the &#39;good jets&#39; collection.
double maxEta_
Maximum (abs) eta requirement for jets.
edm::EDGetTokenT< reco::CaloMETCollection > m_theMETToken
edm::InputTag metLabel_
Input tag for the MET collection.
edm::EDGetTokenT< reco::CaloJetCollection > m_theGoodJetToken
double minPt_
Minimum pt requirement for jets.
edm::EDGetTokenT< reco::CaloJetCollection > m_theJetToken
HLTMETCleanerUsingJetID::~HLTMETCleanerUsingJetID ( )
overridedefault

Referenced by HLTMETCleanerUsingJetID().

Member Function Documentation

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

Definition at line 32 of file HLTMETCleanerUsingJetID.cc.

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

32  {
34  desc.add<double>("minPt", 20.);
35  desc.add<double>("maxEta", 5.);
36  desc.add<edm::InputTag>("metLabel", edm::InputTag("hltMet"));
37  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4CaloJets"));
38  desc.add<edm::InputTag>("goodJetsLabel", edm::InputTag("hltCaloJetIDPassed"));
39  descriptions.add("hltMETCleanerUsingJetID",desc);
40 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTMETCleanerUsingJetID::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 43 of file HLTMETCleanerUsingJetID.cc.

References funct::abs(), PVValHelper::eta, edm::Event::getByToken(), topObjectSelection_cff::goodJets, fwrapper::jets, m_theGoodJetToken, m_theJetToken, m_theMETToken, maxEta_, RazorAnalyzer::met, minPt_, eostools::move(), EnergyCorrector::pt, edm::Event::put(), mps_fire::result, and mathSSE::sqrt().

43  {
44 
45  // Create a pointer to the products
46  std::unique_ptr<reco::CaloMETCollection> result(new reco::CaloMETCollection);
47 
51 
52  iEvent.getByToken(m_theMETToken, met);
53  iEvent.getByToken(m_theJetToken, jets);
54  iEvent.getByToken(m_theGoodJetToken, goodJets);
55 
56  double mex_jets = 0.;
57  double mey_jets = 0.;
58  double sumet_jets = 0.;
59  if (!jets->empty() ) {
60  for(auto const & j : *jets) {
61  double pt = j.pt() ;
62  double eta = j.eta();
63  double px = j.px() ;
64  double py = j.py() ;
65 
66  if (pt > minPt_ && std::abs(eta) < maxEta_) {
67  mex_jets -= px;
68  mey_jets -= py;
69  sumet_jets += pt;
70  }
71  }
72  }
73 
74  double mex_goodJets = 0.;
75  double mey_goodJets = 0.;
76  double sumet_goodJets = 0.;
77  if (!goodJets->empty()) {
78  for(auto const & j : *goodJets) {
79  double pt = j.pt() ;
80  double eta = j.eta();
81  double px = j.px() ;
82  double py = j.py() ;
83 
84  if (pt > minPt_ && std::abs(eta) < maxEta_) {
85  mex_goodJets -= px;
86  mey_goodJets -= py;
87  sumet_goodJets += pt;
88  }
89  }
90  }
91 
92  if (!met->empty()) {
93  double mex_diff = mex_goodJets - mex_jets;
94  double mey_diff = mey_goodJets - mey_jets;
95  //double sumet_diff = sumet_goodJets - sumet_jets; // cannot set sumet...
96  reco::Candidate::LorentzVector p4_clean(met->front().px()+mex_diff, mey_diff+met->front().py(), 0, sqrt((met->front().px()+mex_diff)*(met->front().px() +mex_diff)+(met->front().py()+mey_diff)*(met->front().py() +mey_diff)));
97 
98  reco::CaloMET cleanmet = met->front() ;
99  cleanmet.setP4(p4_clean);
100  result->push_back(cleanmet);
101  }
102 
103  iEvent.put(std::move(result));
104 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
double maxEta_
Maximum (abs) eta requirement for jets.
edm::EDGetTokenT< reco::CaloMETCollection > m_theMETToken
edm::EDGetTokenT< reco::CaloJetCollection > m_theGoodJetToken
double minPt_
Minimum pt requirement for jets.
T sqrt(T t)
Definition: SSEVec.h:18
vector< PseudoJet > jets
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
met
===> hadronic RAZOR
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
edm::EDGetTokenT< reco::CaloJetCollection > m_theJetToken
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag HLTMETCleanerUsingJetID::goodJetsLabel_
private

Input tag for the 'good jets' collection.

Definition at line 56 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

edm::InputTag HLTMETCleanerUsingJetID::jetsLabel_
private

Input tag for the 'all jets' collection.

Definition at line 53 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

edm::EDGetTokenT<reco::CaloJetCollection> HLTMETCleanerUsingJetID::m_theGoodJetToken
private

Definition at line 60 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

edm::EDGetTokenT<reco::CaloJetCollection> HLTMETCleanerUsingJetID::m_theJetToken
private

Definition at line 59 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

edm::EDGetTokenT<reco::CaloMETCollection> HLTMETCleanerUsingJetID::m_theMETToken
private

Definition at line 58 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

double HLTMETCleanerUsingJetID::maxEta_
private

Maximum (abs) eta requirement for jets.

Definition at line 47 of file HLTMETCleanerUsingJetID.h.

Referenced by produce().

edm::InputTag HLTMETCleanerUsingJetID::metLabel_
private

Input tag for the MET collection.

Definition at line 50 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

double HLTMETCleanerUsingJetID::minPt_
private

Minimum pt requirement for jets.

Definition at line 44 of file HLTMETCleanerUsingJetID.h.

Referenced by produce().