CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/HLTrigger/JetMET/src/AnyJetToCaloJetProducer.cc

Go to the documentation of this file.
00001 #include "HLTrigger/JetMET/interface/AnyJetToCaloJetProducer.h"
00002 #include "DataFormats/Common/interface/Handle.h"
00003 #include "DataFormats/Common/interface/View.h"
00004 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00005 
00006 AnyJetToCaloJetProducer::AnyJetToCaloJetProducer(const edm::ParameterSet& iConfig)
00007 {
00008   jetSrc_ = iConfig.getParameter<edm::InputTag>("Source");
00009   produces<reco::CaloJetCollection>();
00010 }
00011 
00012 AnyJetToCaloJetProducer::~AnyJetToCaloJetProducer(){ }
00013 
00014 void AnyJetToCaloJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iES)
00015 {
00016   std::auto_ptr<reco::CaloJetCollection> newjets(new reco::CaloJetCollection());
00017   
00018   edm::Handle<edm::View<reco::Jet> > jets;
00019   if (iEvent.getByLabel( jetSrc_, jets )) {
00020     for(edm::View<reco::Jet>::const_iterator i = jets->begin(); i != jets->end(); i++ ) {
00021       reco::CaloJet jet(i->p4(), i->vertex(), reco::CaloJet::Specific());
00022       newjets->push_back(jet);
00023     }
00024   }
00025   
00026   iEvent.put(newjets);
00027 }
00028 
00029