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

#include <HLTHtMhtProducer.h>

Inheritance diagram for HLTHtMhtProducer:
edm::EDProducer 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::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
 
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

bool excludePFMuons_
 
edm::InputTag jetsLabel_
 
edm::EDGetTokenT< edm::View
< reco::Jet > > 
m_theJetToken
 
edm::EDGetTokenT
< reco::PFCandidateCollection
m_thePfCandidateToken
 
edm::EDGetTokenT
< reco::TrackCollection
m_theTrackToken
 
double maxEtaJetHt_
 
double maxEtaJetMht_
 
int minNJetHt_
 
int minNJetMht_
 
double minPtJetHt_
 
double minPtJetMht_
 
edm::InputTag pfCandidatesLabel_
 
edm::InputTag tracksLabel_
 
bool usePt_
 
bool useTracks_
 

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

Author
Steven Lowette

Definition at line 26 of file HLTHtMhtProducer.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file HLTHtMhtProducer.cc.

References jetsLabel_, m_theJetToken, m_thePfCandidateToken, m_theTrackToken, pfCandidatesLabel_, and tracksLabel_.

16  :
17  usePt_ ( iConfig.getParameter<bool>("usePt") ),
18  useTracks_ ( iConfig.getParameter<bool>("useTracks") ),
19  excludePFMuons_ ( iConfig.getParameter<bool>("excludePFMuons") ),
20  minNJetHt_ ( iConfig.getParameter<int>("minNJetHt") ),
21  minNJetMht_ ( iConfig.getParameter<int>("minNJetMht") ),
22  minPtJetHt_ ( iConfig.getParameter<double>("minPtJetHt") ),
23  minPtJetMht_ ( iConfig.getParameter<double>("minPtJetMht") ),
24  maxEtaJetHt_ ( iConfig.getParameter<double>("maxEtaJetHt") ),
25  maxEtaJetMht_ ( iConfig.getParameter<double>("maxEtaJetMht") ),
26  jetsLabel_ ( iConfig.getParameter<edm::InputTag>("jetsLabel") ),
27  tracksLabel_ ( iConfig.getParameter<edm::InputTag>("tracksLabel") ),
28  pfCandidatesLabel_ ( iConfig.getParameter<edm::InputTag>("pfCandidatesLabel") )
29 {
30  m_theJetToken = consumes<edm::View<reco::Jet>>(jetsLabel_);
31  m_theTrackToken = consumes<reco::TrackCollection>(tracksLabel_);
32  m_thePfCandidateToken = consumes<reco::PFCandidateCollection>(pfCandidatesLabel_);
33  produces<reco::METCollection>();
34 }
T getParameter(std::string const &) const
edm::InputTag pfCandidatesLabel_
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePfCandidateToken
edm::EDGetTokenT< reco::TrackCollection > m_theTrackToken
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
edm::InputTag tracksLabel_
edm::InputTag jetsLabel_
HLTHtMhtProducer::~HLTHtMhtProducer ( )

Definition at line 37 of file HLTHtMhtProducer.cc.

37  {
38 }

Member Function Documentation

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

Definition at line 41 of file HLTHtMhtProducer.cc.

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

41  {
43  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetCorrected"));
44  desc.add<bool>("usePt", true);
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", 999);
51  desc.add<bool>("useTracks", false);
52  desc.add<edm::InputTag>("tracksLabel", edm::InputTag("hltL3Muons"));
53  desc.add<bool>("excludePFMuons", false);
54  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
55  descriptions.add("hltHtMhtProducer", desc);
56 }
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::EDProducer.

Definition at line 59 of file HLTHtMhtProducer.cc.

References funct::abs(), funct::cos(), excludePFMuons_, edm::Event::getByToken(), i, metsig::jet, fwrapper::jets, m_theJetToken, m_thePfCandidateToken, m_theTrackToken, maxEtaJetHt_, maxEtaJetMht_, minNJetHt_, minNJetMht_, minPtJetHt_, minPtJetMht_, reco::tau::pfCandidates(), edm::Event::put(), funct::sin(), mathSSE::sqrt(), testEve_cfg::tracks, usePt_, and useTracks_.

59  {
60 
61  std::auto_ptr<reco::METCollection> metobject(new reco::METCollection());
62 
63  //edm::Handle<reco::CaloJetCollection> jets;
65  iEvent.getByToken(m_theJetToken, jets);
67  if (useTracks_) iEvent.getByToken(m_theTrackToken, tracks);
69  if (excludePFMuons_) iEvent.getByToken(m_thePfCandidateToken, pfCandidates);
70 
71  int nj_ht = 0, nj_mht = 0;
72  double ht=0.;
73  double mhtx=0., mhty=0.;
74 
75  //for (reco::CaloJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); jet++) {
76  for(edm::View<reco::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); jet++ ) {
77  double mom = (usePt_ ? jet->pt() : jet->et());
78  if (mom > minPtJetHt_ and std::abs(jet->eta()) < maxEtaJetHt_) {
79  ht += mom;
80  ++nj_ht;
81  }
82  if (mom > minPtJetMht_ and std::abs(jet->eta()) < maxEtaJetMht_) {
83  mhtx -= mom*cos(jet->phi());
84  mhty -= mom*sin(jet->phi());
85  ++nj_mht;
86  }
87  }
88  if (useTracks_) {
89  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) {
90  if (track->pt() > minPtJetHt_ and std::abs(track->eta()) < maxEtaJetHt_) {
91  ht += track->pt();
92  }
93  if (track->pt() > minPtJetMht_ and std::abs(track->eta()) < maxEtaJetMht_) {
94  mhtx -= track->px();
95  mhty -= track->py();
96  }
97  }
98  }
99  if (excludePFMuons_) {
100  reco::PFCandidateCollection::const_iterator i (pfCandidates->begin());
101  for (; i != pfCandidates->end(); ++i) {
102  if(abs(i->pdgId())==13){
103  mhtx += (i->pt())*cos(i->phi());
104  mhty += (i->pt())*sin(i->phi());
105  }
106  }
107  }
108 
109  if (nj_ht < minNJetHt_ ) { ht = 0; }
110  if (nj_mht < minNJetMht_) { mhtx = 0; mhty = 0; }
111 
112  metobject->push_back(
113  reco::MET(
114  ht,
115  reco::MET::LorentzVector(mhtx, mhty, 0, sqrt(mhtx*mhtx + mhty*mhty)),
117  )
118  );
119 
120  iEvent.put(metobject);
121 }
int i
Definition: DBlmapReader.cc:9
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
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:116
Definition: MET.h:32
edm::EDGetTokenT< reco::PFCandidateCollection > m_thePfCandidateToken
T sqrt(T t)
Definition: SSEVec.h:48
vector< PseudoJet > jets
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::EDGetTokenT< reco::TrackCollection > m_theTrackToken
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< edm::View< reco::Jet > > m_theJetToken
tuple tracks
Definition: testEve_cfg.py:39
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
math::XYZPoint Point
point in the space
Definition: Candidate.h:45

Member Data Documentation

bool HLTHtMhtProducer::excludePFMuons_
private

Definition at line 43 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::jetsLabel_
private

Definition at line 50 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

edm::EDGetTokenT<edm::View<reco::Jet> > HLTHtMhtProducer::m_theJetToken
private

Definition at line 37 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

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

Definition at line 39 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

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

Definition at line 38 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer(), and produce().

double HLTHtMhtProducer::maxEtaJetHt_
private

Definition at line 48 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::maxEtaJetMht_
private

Definition at line 49 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetHt_
private

Definition at line 44 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetMht_
private

Definition at line 45 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetHt_
private

Definition at line 46 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetMht_
private

Definition at line 47 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::pfCandidatesLabel_
private

Definition at line 52 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

edm::InputTag HLTHtMhtProducer::tracksLabel_
private

Definition at line 51 of file HLTHtMhtProducer.h.

Referenced by HLTHtMhtProducer().

bool HLTHtMhtProducer::usePt_
private

Definition at line 41 of file HLTHtMhtProducer.h.

Referenced by produce().

bool HLTHtMhtProducer::useTracks_
private

Definition at line 42 of file HLTHtMhtProducer.h.

Referenced by produce().