#include <TopInitSubset.h>
Public Member Functions | |
void | fillOutput (const reco::GenParticleCollection &, reco::GenParticleCollection &) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
TopInitSubset (const edm::ParameterSet &) | |
~TopInitSubset () | |
Private Attributes | |
edm::InputTag | src_ |
Definition at line 13 of file TopInitSubset.h.
TopInitSubset::TopInitSubset | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 3 of file TopInitSubset.cc.
: src_ ( cfg.getParameter<edm::InputTag>( "src" ) ) { produces<reco::GenParticleCollection>(); }
TopInitSubset::~TopInitSubset | ( | ) |
Definition at line 9 of file TopInitSubset.cc.
{ }
void TopInitSubset::fillOutput | ( | const reco::GenParticleCollection & | src, |
reco::GenParticleCollection & | sel | ||
) |
Definition at line 28 of file TopInitSubset.cc.
References abs, funct::false, configurableAnalysis::GenParticle, UserOptions_cff::idx, lumiQTWidget::t, and TopInitID::tID.
Referenced by produce().
{ for(reco::GenParticleCollection::const_iterator t=src.begin(); t!=src.end(); ++t){ if( std::abs(t->pdgId())==TopInitID::tID ){ bool hasTopMother = false; for(unsigned idx=0; idx<t->numberOfMothers(); ++idx) if( std::abs(t->mother(idx)->pdgId())==TopInitID::tID ) hasTopMother = true; if(hasTopMother) continue; for(unsigned idx=0; idx<t->numberOfMothers(); ++idx){ reco::GenParticle* cand = new reco::GenParticle( t->mother(idx)->threeCharge(), t->mother(idx)->p4(), t->mother(idx)->vertex(), t->mother(idx)->pdgId(), t->mother(idx)->status(), false ); std::auto_ptr<reco::GenParticle> ptr( cand ); sel.push_back( *ptr ); } break; } } }
void TopInitSubset::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | setup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 14 of file TopInitSubset.cc.
References fillOutput(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), edm::Event::put(), EgammaValidation_Wenu_cff::sel, alcazmumu_cfi::src, and src_.
{ edm::Handle<reco::GenParticleCollection> src; evt.getByLabel(src_, src); const reco::GenParticleRefProd ref = evt.getRefBeforePut<reco::GenParticleCollection>(); std::auto_ptr<reco::GenParticleCollection> sel( new reco::GenParticleCollection ); //fill output collection fillOutput( *src, *sel ); evt.put( sel ); }
edm::InputTag TopInitSubset::src_ [private] |
Definition at line 25 of file TopInitSubset.h.
Referenced by produce().