CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 HLTHtMhtProducer (const edm::ParameterSet &iConfig)
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 ~HLTHtMhtProducer ()

Static Public Member Functions

static void fillDescriptions (edm::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_

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.

                                                                  :
  usePt_          ( iConfig.getParameter<bool>("usePt") ),
  useTracks_      ( iConfig.getParameter<bool>("useTracks") ),
  excludePFMuons_ ( iConfig.getParameter<bool>("excludePFMuons") ),
  minNJetHt_      ( iConfig.getParameter<int>("minNJetHt") ),
  minNJetMht_     ( iConfig.getParameter<int>("minNJetMht") ),
  minPtJetHt_     ( iConfig.getParameter<double>("minPtJetHt") ),
  minPtJetMht_    ( iConfig.getParameter<double>("minPtJetMht") ),
  maxEtaJetHt_    ( iConfig.getParameter<double>("maxEtaJetHt") ),
  maxEtaJetMht_   ( iConfig.getParameter<double>("maxEtaJetMht") ),
  jetsLabel_      ( iConfig.getParameter<edm::InputTag>("jetsLabel") ),
  tracksLabel_    ( iConfig.getParameter<edm::InputTag>("tracksLabel") ),
  pfCandidatesLabel_ ( iConfig.getParameter<edm::InputTag>("pfCandidatesLabel") )
{
  produces<reco::METCollection>();
}
HLTHtMhtProducer::~HLTHtMhtProducer ( )

Definition at line 38 of file HLTHtMhtProducer.cc.

                                    {
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 42 of file HLTHtMhtProducer.cc.

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

                                                                                   {
  edm::ParameterSetDescription desc;
  desc.add<edm::InputTag>("jetsLabel", edm::InputTag("hltCaloJetCorrected"));
  desc.add<bool>("usePt", true);
  desc.add<int>("minNJetHt", 0);
  desc.add<int>("minNJetMht", 0);
  desc.add<double>("minPtJetHt", 40);
  desc.add<double>("minPtJetMht", 30);
  desc.add<double>("maxEtaJetHt", 3);
  desc.add<double>("maxEtaJetMht", 999);
  desc.add<bool>("useTracks", false);
  desc.add<edm::InputTag>("tracksLabel",  edm::InputTag("hltL3Muons"));
  desc.add<bool>("excludePFMuons", false);
  desc.add<edm::InputTag>("pfCandidatesLabel",  edm::InputTag("hltParticleFlow"));
  descriptions.add("hltHtMhtProducer", desc);
}
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, analyzePatCleaning_cfg::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_.

                                                                            {

  std::auto_ptr<reco::METCollection> metobject(new reco::METCollection());

  //edm::Handle<reco::CaloJetCollection> jets;
  edm::Handle<edm::View<reco::Jet> > jets;
  iEvent.getByLabel(jetsLabel_, jets);
  edm::Handle<reco::TrackCollection> tracks;
  if (useTracks_) iEvent.getByLabel(tracksLabel_, tracks);
  edm::Handle<reco::PFCandidateCollection> pfCandidates;
  if (excludePFMuons_) iEvent.getByLabel(pfCandidatesLabel_, pfCandidates);
  
  int nj_ht = 0, nj_mht = 0;
  double ht=0.;
  double mhtx=0., mhty=0.;

  //for (reco::CaloJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); jet++) {
  for(edm::View<reco::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); jet++ ) {
    double mom = (usePt_ ? jet->pt() : jet->et());
    if (mom > minPtJetHt_ and std::abs(jet->eta()) < maxEtaJetHt_) {
      ht += mom;
      ++nj_ht;
    }
    if (mom > minPtJetMht_ and std::abs(jet->eta()) < maxEtaJetMht_) {
      mhtx -= mom*cos(jet->phi());
      mhty -= mom*sin(jet->phi());
      ++nj_mht;
    }
  }
  if (useTracks_) {
    for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); track++) {
      if (track->pt() > minPtJetHt_ and std::abs(track->eta()) < maxEtaJetHt_) {
        ht += track->pt();
      }
      if (track->pt() > minPtJetMht_ and std::abs(track->eta()) < maxEtaJetMht_) {
        mhtx -= track->px();
        mhty -= track->py();
      }
    }
  }
  if (excludePFMuons_) {
    reco::PFCandidateCollection::const_iterator i (pfCandidates->begin());
    for (; i != pfCandidates->end(); ++i) {
      if(abs(i->pdgId())==13){
        mhtx += (i->pt())*cos(i->phi());
        mhty += (i->pt())*sin(i->phi());
      }
    }
  }

  if (nj_ht  < minNJetHt_ ) { ht = 0; }
  if (nj_mht < minNJetMht_) { mhtx = 0; mhty = 0; }

  metobject->push_back(
    reco::MET(
      ht,
      reco::MET::LorentzVector(mhtx, mhty, 0, sqrt(mhtx*mhtx + mhty*mhty)),
      reco::MET::Point()
    )
  );

  iEvent.put(metobject);
}

Member Data Documentation

Definition at line 34 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 41 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 39 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 40 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 35 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 36 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 37 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 38 of file HLTHtMhtProducer.h.

Referenced by produce().

Definition at line 43 of file HLTHtMhtProducer.h.

Referenced by produce().

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().

Definition at line 33 of file HLTHtMhtProducer.h.

Referenced by produce().