CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

HLTMhtProducer Class Reference

#include <HLTMhtProducer.h>

Inheritance diagram for HLTMhtProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 HLTMhtProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~HLTMhtProducer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Attributes

double etaJet_
edm::InputTag inputJetTag_
double minPtJet_
bool usePt_

Detailed Description

Author:
Gheorghe Lungu

Definition at line 19 of file HLTMhtProducer.h.


Constructor & Destructor Documentation

HLTMhtProducer::HLTMhtProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 28 of file HLTMhtProducer.cc.

References etaJet_, edm::ParameterSet::getParameter(), inputJetTag_, minPtJet_, and usePt_.

{
  inputJetTag_ = iConfig.getParameter< edm::InputTag > ("inputJetTag");
  minPtJet_= iConfig.getParameter<double> ("minPtJet");
  etaJet_= iConfig.getParameter<double> ("etaJet");
  usePt_= iConfig.getParameter<bool>("usePt");

  //register your products
  produces<reco::METCollection>();
}
HLTMhtProducer::~HLTMhtProducer ( )

Definition at line 39 of file HLTMhtProducer.cc.

{}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 41 of file HLTMhtProducer.cc.

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

                                                                                {
  edm::ParameterSetDescription desc;
  desc.add<edm::InputTag>("inputJetTag",edm::InputTag("hltMCJetCorJetIcone5HF07"));
  desc.add<double>("minPtJet",20.0);
  desc.add<double>("etaJet",9999.0);
  desc.add<bool>("usePt",true);
  descriptions.add("hltMhtProducer",desc);
}
void HLTMhtProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 52 of file HLTMhtProducer.cc.

References funct::cos(), etaJet_, edm::Event::getByLabel(), inputJetTag_, minPtJet_, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, query::result, funct::sin(), mathSSE::sqrt(), and usePt_.

{
  using namespace std;
  using namespace edm;
  using namespace reco;

  auto_ptr<reco::METCollection> result (new reco::METCollection); 

  math::XYZPoint vtx(0,0,0);
  
  Handle<CaloJetCollection> recocalojets;
  iEvent.getByLabel(inputJetTag_,recocalojets);

  // look at all candidates,  check cuts and add to result object
  double mhtx=0., mhty=0., mht;
  double jetVar;
  
  if(recocalojets->size() > 0){
    // events with at least one jet
    for (CaloJetCollection::const_iterator recocalojet = recocalojets->begin(); recocalojet != recocalojets->end(); recocalojet++) {
      jetVar = recocalojet->pt();
      if (!usePt_) jetVar = recocalojet->et();

      //---get MHT
      if (jetVar > minPtJet_ && fabs(recocalojet->eta()) < etaJet_) {
        mhtx -= jetVar*cos(recocalojet->phi());
        mhty -= jetVar*sin(recocalojet->phi());
      }
    }
    mht = sqrt(mhtx*mhtx + mhty*mhty);

    math::XYZTLorentzVector mhtVec(mhtx,mhty,0,mht);
    reco::MET mhtobj(mhtVec,vtx);
    result->push_back( mhtobj );
    
  } // events with at least one jet
  
    
  // put object into the Event
  iEvent.put(result);

}

Member Data Documentation

double HLTMhtProducer::etaJet_ [private]

Definition at line 30 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

Definition at line 28 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

double HLTMhtProducer::minPtJet_ [private]

Definition at line 29 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().

bool HLTMhtProducer::usePt_ [private]

Definition at line 31 of file HLTMhtProducer.h.

Referenced by HLTMhtProducer(), and produce().