CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/HLTrigger/btau/src/GetJetsFromHLTobject.cc

Go to the documentation of this file.
00001 #include "DataFormats/Common/interface/RefVector.h"
00002 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
00003 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00004 
00005 #include "GetJetsFromHLTobject.h"
00006 
00007 GetJetsFromHLTobject::GetJetsFromHLTobject(const edm::ParameterSet& iConfig) :
00008   m_jets( iConfig.getParameter<edm::InputTag>("jets") )
00009 {
00010   produces<reco::CaloJetCollection>();
00011 }
00012 
00013 
00014 void
00015 GetJetsFromHLTobject::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00016 {
00017    using namespace edm;
00018    using namespace reco;
00019    std::auto_ptr<reco::CaloJetCollection> jets( new reco::CaloJetCollection() );
00020 
00021    Handle<trigger::TriggerFilterObjectWithRefs> hltObject;
00022    iEvent.getByLabel(m_jets, hltObject);
00023    std::vector<reco::CaloJetRef> refs;
00024    hltObject->getObjects( trigger::TriggerBJet, refs );
00025    for (size_t i = 0; i < refs.size(); i++) {
00026      jets->push_back(* refs[i]);
00027    }
00028    
00029    iEvent.put(jets);
00030 }