CMS 3D CMS Logo

GenEventWeightProducer Class Reference

Author:
Luca Lista, INFN
More...

Inheritance diagram for GenEventWeightProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 GenEventWeightProducer (const edm::ParameterSet &)
 constructor

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es)

Private Attributes

edm::InputTag src_


Detailed Description

Author:
Luca Lista, INFN

Version:
Id
GenEventWeightProducer.cc,v 1.1 2007/06/12 11:53:57 llista Exp

Definition at line 16 of file GenEventWeightProducer.cc.


Constructor & Destructor Documentation

GenEventWeightProducer::GenEventWeightProducer ( const edm::ParameterSet p  ) 

constructor

Definition at line 35 of file GenEventWeightProducer.cc.

00035                                                                        :
00036   src_( p.getParameter<InputTag>( "src" ) ) {
00037   produces<double>();
00038 }


Member Function Documentation

void GenEventWeightProducer::produce ( edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 41 of file GenEventWeightProducer.cc.

References lat::endl(), TtGenEvtProducer_cfi::genEvt, edm::Event::getByLabel(), edm::errors::InvalidReference, edm::Event::put(), src_, and weight.

00041                                                                        {
00042   Handle<HepMCProduct> mc;
00043   evt.getByLabel( src_, mc );
00044   const GenEvent * genEvt = mc->GetEvent();
00045   if( genEvt == 0 ) 
00046     throw edm::Exception( edm::errors::InvalidReference ) 
00047       << "HepMC has null pointer to GenEvent" << endl;
00048   auto_ptr<double> weight( new double(1) );
00049   HepMC::WeightContainer wc = genEvt->weights();
00050   if ( wc.size() > 0 )  (*weight) = wc[ 0 ];
00051   evt.put( weight );
00052 }


Member Data Documentation

edm::InputTag GenEventWeightProducer::src_ [private]

Definition at line 23 of file GenEventWeightProducer.cc.

Referenced by produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:21:12 2009 for CMSSW by  doxygen 1.5.4