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, TopInitID::status, matplotRender::t, and TopInitID::tID.

Referenced by produce().

{
  for(reco::GenParticleCollection::const_iterator t=src.begin(); t!=src.end(); ++t){
    if( t->status()==TopInitID::status && std::abs(t->pdgId())==TopInitID::tID ){ //is top
      for(int idx=0; idx<(int)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(), runTheMatrix::sel, align_tpl::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 );
}

Member Data Documentation

Definition at line 25 of file TopInitSubset.h.

Referenced by produce().