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 29 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 40 of file HLTMhtProducer.cc.

{}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 42 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 53 of file HLTMhtProducer.cc.

References abs, funct::cos(), etaJet_, edm::Event::getByLabel(), inputJetTag_, metsig::jet, analyzePatCleaning_cfg::jets, 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;
  edm::Handle<edm::View<reco::Jet> > jets;
  iEvent.getByLabel(inputJetTag_,jets);

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

      //---get MHT
      if (jetVar > minPtJet_ && std::abs(jet->eta()) < etaJet_) {
        mhtx -= jetVar*cos(jet->phi());
        mhty -= jetVar*sin(jet->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().