CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/HLTrigger/JetMET/src/HLTPFJetIDProducer.cc

Go to the documentation of this file.
00001 #include "HLTrigger/JetMET/interface/HLTPFJetIDProducer.h"
00002 #include "DataFormats/JetReco/interface/PFJet.h"
00003 #include "DataFormats/JetReco/interface/PFJetCollection.h"
00004 #include "DataFormats/Common/interface/Handle.h"
00005 #include "FWCore/Framework/interface/ESHandle.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00007 
00008 HLTPFJetIDProducer::HLTPFJetIDProducer(const edm::ParameterSet& iConfig) :
00009   jetsInput_   (iConfig.getParameter<edm::InputTag>("jetsInput")),
00010   min_NHEF_     (iConfig.getParameter<double>("min_NHEF")),
00011   max_NHEF_     (iConfig.getParameter<double>("max_NHEF")),
00012   min_NEMF_     (iConfig.getParameter<double>("min_NEMF")),
00013   max_NEMF_     (iConfig.getParameter<double>("max_NEMF")),
00014   min_CEMF_     (iConfig.getParameter<double>("min_CEMF")),
00015   max_CEMF_     (iConfig.getParameter<double>("max_CEMF")),
00016   min_CHEF_     (iConfig.getParameter<double>("min_CHEF")),
00017   max_CHEF_     (iConfig.getParameter<double>("max_CHEF")),
00018   min_pt_       (iConfig.getParameter<double>("min_pt"))
00019 {
00020   produces< reco::PFJetCollection > ();
00021 }
00022 
00023 void HLTPFJetIDProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00024   edm::ParameterSetDescription desc;
00025   desc.add<edm::InputTag>("jetsInput",edm::InputTag("hltAntiKT5PFJets"));
00026   desc.add<double>("min_NHEF",-999.0);
00027   desc.add<double>("max_NHEF",999.0);
00028   desc.add<double>("min_NEMF",-999.0);
00029   desc.add<double>("max_NEMF",999.0);
00030   desc.add<double>("min_CEMF",-999.0);
00031   desc.add<double>("max_CEMF",999.0);
00032   desc.add<double>("min_CHEF",-999.0);
00033   desc.add<double>("max_CHEF",999.0);
00034   desc.add<double>("min_pt",30.0);
00035   descriptions.add("hltPFJetIDProducer", desc);
00036 }
00037 
00038 void HLTPFJetIDProducer::beginJob()
00039 {
00040 
00041 }
00042 
00043 HLTPFJetIDProducer::~HLTPFJetIDProducer()
00044 {
00045 
00046 }
00047 
00048 void HLTPFJetIDProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00049 {
00050 
00051   edm::Handle<reco::PFJetCollection> pfjets;
00052   iEvent.getByLabel(jetsInput_, pfjets);
00053 
00054   std::auto_ptr<reco::PFJetCollection> result (new reco::PFJetCollection);
00055 
00056   for (reco::PFJetCollection::const_iterator pfjetc = pfjets->begin(); 
00057        pfjetc != pfjets->end(); ++pfjetc) {
00058       
00059     if (std::abs(pfjetc->eta()) >= 2.4) {
00060       result->push_back(*pfjetc);
00061     } else {
00062       if (pfjetc->pt()<min_pt_) result->push_back(*pfjetc);
00063       else if ((pfjetc->neutralHadronEnergyFraction() >= min_NHEF_) && (pfjetc->neutralHadronEnergyFraction() <= max_NHEF_) && 
00064                (pfjetc->neutralEmEnergyFraction() >= min_NEMF_) && (pfjetc->neutralEmEnergyFraction() <= max_NEMF_) &&
00065                (pfjetc->chargedEmEnergyFraction() >= min_CEMF_) && (pfjetc->chargedEmEnergyFraction() <= max_CEMF_) &&
00066                (pfjetc->chargedHadronEnergyFraction() >= min_CHEF_) && (pfjetc->chargedHadronEnergyFraction() <= max_CHEF_)) {
00067         result->push_back(*pfjetc);
00068       }
00069     }
00070   } // pfjetc
00071 
00072   iEvent.put( result);
00073 
00074 }