CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TopQuarkAnalysis/TopEventProducers/src/TtGenEventReco.cc

Go to the documentation of this file.
00001 #include "FWCore/Utilities/interface/EDMException.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 
00004 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
00005 #include "TopQuarkAnalysis/TopEventProducers/interface/TopDecaySubset.h"
00006 #include "TopQuarkAnalysis/TopEventProducers/interface/TtGenEventReco.h"
00007 
00008 TtGenEventReco::TtGenEventReco(const edm::ParameterSet& cfg):
00009   src_ ( cfg.getParameter<edm::InputTag>( "src"  ) ),
00010   init_( cfg.getParameter<edm::InputTag>( "init" ) )
00011 {
00012   produces<TtGenEvent>();
00013 }
00014 
00015 TtGenEventReco::~TtGenEventReco()
00016 {
00017 }
00018 
00019 void
00020 TtGenEventReco::produce(edm::Event& evt, const edm::EventSetup& setup)
00021 {     
00022   edm::Handle<reco::GenParticleCollection> parts;
00023   evt.getByLabel(src_,  parts);
00024 
00025   edm::Handle<reco::GenParticleCollection> inits;
00026   evt.getByLabel(init_, inits);
00027 
00028   //add TopDecayTree
00029   reco::GenParticleRefProd cands( parts );
00030 
00031   //add InitialStatePartons
00032   reco::GenParticleRefProd initParts( inits );
00033 
00034   //add genEvt to the output stream
00035   TtGenEvent* genEvt = new TtGenEvent( cands, initParts );
00036   std::auto_ptr<TtGenEvent> gen( genEvt );
00037   evt.put( gen );
00038 }