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

Public Member Functions

 HLTMETCleanerUsingJetID (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~HLTMETCleanerUsingJetID ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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
 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
 
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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::CaloJetCollection
m_theGoodJetToken
 
edm::EDGetTokenT
< reco::CaloJetCollection
m_theJetToken
 
edm::EDGetTokenT
< reco::CaloMETCollection
m_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...
 
bool usePt_
 Use pt; otherwise, use et. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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 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, and metLabel_.

15  : usePt_ (iConfig.getParameter<bool>("usePt")),
16  minPt_ (iConfig.getParameter<double>("minPt")),
17  maxEta_ (iConfig.getParameter<double>("maxEta")),
18  metLabel_ (iConfig.getParameter<edm::InputTag>("metLabel")),
19  jetsLabel_ (iConfig.getParameter<edm::InputTag>("jetsLabel")),
20  goodJetsLabel_ (iConfig.getParameter<edm::InputTag>("goodJetsLabel")) {
21  m_theMETToken = consumes<reco::CaloMETCollection>(metLabel_);
22  m_theJetToken = consumes<reco::CaloJetCollection>(jetsLabel_);
23  m_theGoodJetToken = consumes<reco::CaloJetCollection>(goodJetsLabel_);
24 
25  // Register the products
26  produces<reco::CaloMETCollection>();
27 }
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
bool usePt_
Use pt; otherwise, use et.
HLTMETCleanerUsingJetID::~HLTMETCleanerUsingJetID ( )

Definition at line 30 of file HLTMETCleanerUsingJetID.cc.

30 {}

Member Function Documentation

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

Definition at line 33 of file HLTMETCleanerUsingJetID.cc.

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

33  {
35  desc.add<bool>("usePt", false);
36  desc.add<double>("minPt", 20.);
37  desc.add<double>("maxEta", 5.);
38  desc.add<edm::InputTag>("metLabel", edm::InputTag("hltMet"));
39  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltAntiKT4CaloJets"));
40  desc.add<edm::InputTag>("goodJetsLabel", edm::InputTag("hltCaloJetIDPassed"));
41  descriptions.add("hltMETCleanerUsingJetID",desc);
42 }
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 
)
virtual

Implements edm::EDProducer.

Definition at line 45 of file HLTMETCleanerUsingJetID.cc.

References funct::abs(), funct::cos(), eta(), edm::Event::getByToken(), topObjectSelection_cff::goodJets, j, fwrapper::jets, m_theGoodJetToken, m_theJetToken, m_theMETToken, maxEta_, caloMETBenchmarkGeneric_cfi::met, minPt_, reco::LeafCandidate::p4(), phi, RecoTauCleanerPlugins::pt, edm::Event::put(), query::result, reco::LeafCandidate::setP4(), funct::sin(), mathSSE::sqrt(), and usePt_.

45  {
46 
47  // Create a pointer to the products
48  std::auto_ptr<reco::CaloMETCollection> result(new reco::CaloMETCollection);
49 
53 
54  iEvent.getByToken(m_theMETToken, met);
55  iEvent.getByToken(m_theJetToken, jets);
56  iEvent.getByToken(m_theGoodJetToken, goodJets);
57 
58  double mex_jets = 0.;
59  double mey_jets = 0.;
60  double sumet_jets = 0.;
61  if (jets->size() > 0 ) {
62  for(reco::CaloJetCollection::const_iterator j = jets->begin(); j != jets->end(); ++j) {
63  double pt = usePt_ ? j->pt() : j->et();
64  double eta = j->eta();
65  double phi = j->phi();
66  double px = usePt_ ? j->px() : j->et() * cos(phi);
67  double py = usePt_ ? j->py() : j->et() * sin(phi);
68 
69  if (pt > minPt_ && std::abs(eta) < maxEta_) {
70  mex_jets -= px;
71  mey_jets -= py;
72  sumet_jets += pt;
73  }
74  }
75  }
76 
77  double mex_goodJets = 0.;
78  double mey_goodJets = 0.;
79  double sumet_goodJets = 0.;
80  if (goodJets->size() > 0) {
81  for(reco::CaloJetCollection::const_iterator j = goodJets->begin(); j != goodJets->end(); ++j) {
82  double pt = usePt_ ? j->pt() : j->et();
83  double eta = j->eta();
84  double phi = j->phi();
85  double px = usePt_ ? j->px() : j->pt() * cos(phi);
86  double py = usePt_ ? j->py() : j->pt() * sin(phi);
87 
88  if (pt > minPt_ && std::abs(eta) < maxEta_) {
89  mex_goodJets -= px;
90  mey_goodJets -= py;
91  sumet_goodJets += pt;
92  }
93  }
94  }
95 
96  if (met->size() > 0) {
97  double mex_diff = mex_goodJets - mex_jets;
98  double mey_diff = mey_goodJets - mey_jets;
99  //double sumet_diff = sumet_goodJets - sumet_jets; // cannot set sumet...
100  reco::Candidate::LorentzVector p4_diff(mex_diff, mey_diff, 0, sqrt(mex_diff*mex_diff + mey_diff*mey_diff));
101 
102  reco::CaloMET cleanmet = met->front();
103  cleanmet.setP4(cleanmet.p4() + p4_diff);
104  result->push_back(cleanmet);
105  }
106 
107  iEvent.put( result );
108 }
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double maxEta_
Maximum (abs) eta requirement for jets.
T eta() const
edm::EDGetTokenT< reco::CaloMETCollection > m_theMETToken
edm::EDGetTokenT< reco::CaloJetCollection > m_theGoodJetToken
double minPt_
Minimum pt requirement for jets.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
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
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
edm::EDGetTokenT< reco::CaloJetCollection > m_theJetToken
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
bool usePt_
Use pt; otherwise, use et.
Definition: DDAxes.h:10

Member Data Documentation

edm::InputTag HLTMETCleanerUsingJetID::goodJetsLabel_
private

Input tag for the 'good jets' collection.

Definition at line 58 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

edm::InputTag HLTMETCleanerUsingJetID::jetsLabel_
private

Input tag for the 'all jets' collection.

Definition at line 55 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

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

Definition at line 62 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

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

Definition at line 61 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

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

Definition at line 60 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID(), and produce().

double HLTMETCleanerUsingJetID::maxEta_
private

Maximum (abs) eta requirement for jets.

Definition at line 49 of file HLTMETCleanerUsingJetID.h.

Referenced by produce().

edm::InputTag HLTMETCleanerUsingJetID::metLabel_
private

Input tag for the MET collection.

Definition at line 52 of file HLTMETCleanerUsingJetID.h.

Referenced by HLTMETCleanerUsingJetID().

double HLTMETCleanerUsingJetID::minPt_
private

Minimum pt requirement for jets.

Definition at line 46 of file HLTMETCleanerUsingJetID.h.

Referenced by produce().

bool HLTMETCleanerUsingJetID::usePt_
private

Use pt; otherwise, use et.

Definition at line 43 of file HLTMETCleanerUsingJetID.h.

Referenced by produce().