CMS 3D CMS Logo

Public Member Functions | Private Attributes

TopInitSubset Class Reference

#include <TopInitSubset.h>

Inheritance diagram for TopInitSubset:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_

Detailed Description

Definition at line 13 of file TopInitSubset.h.


Constructor & Destructor Documentation

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.

{
}

Member Function Documentation

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]

Member Data Documentation

Definition at line 25 of file TopInitSubset.h.

Referenced by produce().