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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Author
Steven Lowette

Definition at line 21 of file HLTHtMhtProducer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file HLTHtMhtProducer.cc.

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

Definition at line 38 of file HLTHtMhtProducer.cc.

38  {
39 }

Member Function Documentation

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

Definition at line 42 of file HLTHtMhtProducer.cc.

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

42  {
44  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetCorrected"));
45  desc.add<bool>("usePt", true);
46  desc.add<int>("minNJetHt", 0);
47  desc.add<int>("minNJetMht", 0);
48  desc.add<double>("minPtJetHt", 40);
49  desc.add<double>("minPtJetMht", 30);
50  desc.add<double>("maxEtaJetHt", 3);
51  desc.add<double>("maxEtaJetMht", 999);
52  desc.add<bool>("useTracks", false);
53  desc.add<edm::InputTag>("tracksLabel", edm::InputTag("hltL3Muons"));
54  desc.add<bool>("excludePFMuons", false);
55  desc.add<edm::InputTag>("pfCandidatesLabel", edm::InputTag("hltParticleFlow"));
56  descriptions.add("hltHtMhtProducer", desc);
57 }
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 60 of file HLTHtMhtProducer.cc.

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

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

Member Data Documentation

bool HLTHtMhtProducer::excludePFMuons_
private

Definition at line 34 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::jetsLabel_
private

Definition at line 41 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::maxEtaJetHt_
private

Definition at line 39 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::maxEtaJetMht_
private

Definition at line 40 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetHt_
private

Definition at line 35 of file HLTHtMhtProducer.h.

Referenced by produce().

int HLTHtMhtProducer::minNJetMht_
private

Definition at line 36 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetHt_
private

Definition at line 37 of file HLTHtMhtProducer.h.

Referenced by produce().

double HLTHtMhtProducer::minPtJetMht_
private

Definition at line 38 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::pfCandidatesLabel_
private

Definition at line 43 of file HLTHtMhtProducer.h.

Referenced by produce().

edm::InputTag HLTHtMhtProducer::tracksLabel_
private

Definition at line 42 of file HLTHtMhtProducer.h.

Referenced by produce().

bool HLTHtMhtProducer::usePt_
private

Definition at line 32 of file HLTHtMhtProducer.h.

Referenced by produce().

bool HLTHtMhtProducer::useTracks_
private

Definition at line 33 of file HLTHtMhtProducer.h.

Referenced by produce().