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_ |
Definition at line 16 of file GenEventWeightProducer.cc.
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 }
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 }
edm::InputTag GenEventWeightProducer::src_ [private] |