CMS 3D CMS Logo

LHESource Class Reference

#include <GeneratorInterface/LHEInterface/plugins/LHESource.h>

Inheritance diagram for LHESource:

edm::ExternalInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper MCDBSource

List of all members.

Public Member Functions

 LHESource (const edm::ParameterSet &params, const edm::InputSourceDescription &desc)
virtual ~LHESource ()

Protected Member Functions

virtual void beginRun (edm::Run &run)
virtual void endJob ()
virtual void nextEvent ()
virtual bool produce (edm::Event &event)

Protected Attributes

boost::shared_ptr< lhef::LHEEventpartonLevel
std::auto_ptr< lhef::LHEReaderreader
boost::shared_ptr
< lhef::LHERunInfo
runInfo
unsigned int skipEvents


Detailed Description

Definition at line 21 of file LHESource.h.


Constructor & Destructor Documentation

LHESource::LHESource ( const edm::ParameterSet params,
const edm::InputSourceDescription desc 
) [explicit]

Definition at line 28 of file LHESource.cc.

00029                                                             :
00030         ExternalInputSource(params, desc, false),
00031         reader(new LHEReader(fileNames(), params.getUntrackedParameter<unsigned int>("seekEvent", 0))),
00032         skipEvents(params.getUntrackedParameter<unsigned int>("skipEvents", 0))
00033 {
00034         produces<LHEEventProduct>();
00035         produces<LHERunInfoProduct, edm::InRun>();
00036 }

LHESource::~LHESource (  )  [virtual]

Definition at line 38 of file LHESource.cc.

00039 {
00040 }


Member Function Documentation

void LHESource::beginRun ( edm::Run run  )  [protected, virtual]

Reimplemented from edm::ConfigurableInputSource.

Definition at line 67 of file LHESource.cc.

References LHERunInfoProduct::addComment(), LHERunInfoProduct::addHeader(), nextEvent(), edm::Run::put(), and runInfo.

00068 {
00069         nextEvent();
00070         if (runInfo) {
00071                 std::auto_ptr<LHERunInfoProduct> product(
00072                                 new LHERunInfoProduct(*runInfo->getHEPRUP()));
00073                 std::for_each(runInfo->getHeaders().begin(),
00074                               runInfo->getHeaders().end(),
00075                               boost::bind(
00076                                 &LHERunInfoProduct::addHeader,
00077                                 product.get(), _1));
00078                 std::for_each(runInfo->getComments().begin(),
00079                               runInfo->getComments().end(),
00080                               boost::bind(&LHERunInfoProduct::addComment,
00081                                 product.get(), _1));
00082                 run.put(product);
00083                 runInfo.reset();
00084 
00085         }
00086 }

void LHESource::endJob ( void   )  [protected, virtual]

Reimplemented from edm::InputSource.

Definition at line 42 of file LHESource.cc.

References reader.

00043 {
00044         reader.reset();
00045 }

void LHESource::nextEvent (  )  [protected, virtual]

Definition at line 47 of file LHESource.cc.

References partonLevel, reader, runInfo, and skipEvents.

Referenced by beginRun(), and produce().

00048 {
00049         if (partonLevel)
00050                 return;
00051 
00052         while(skipEvents > 0) {
00053                 skipEvents--;
00054                 partonLevel = reader->next();
00055                 if (!partonLevel)
00056                         return;
00057         }
00058 
00059         partonLevel = reader->next();
00060         if (!partonLevel)
00061                         return;
00062 
00063         if (!runInfo)
00064                 runInfo = partonLevel->getRunInfo();
00065 }

bool LHESource::produce ( edm::Event event  )  [protected, virtual]

Implements edm::ConfigurableInputSource.

Definition at line 88 of file LHESource.cc.

References LHEEventProduct::addComment(), nextEvent(), and partonLevel.

00089 {
00090         nextEvent();
00091         if (!partonLevel)
00092                 return false;
00093 
00094         std::auto_ptr<LHEEventProduct> product(
00095                         new LHEEventProduct(*partonLevel->getHEPEUP()));
00096         if (partonLevel->getPDF())
00097                 product->setPDF(*partonLevel->getPDF());
00098         std::for_each(partonLevel->getComments().begin(),
00099                       partonLevel->getComments().end(),
00100                       boost::bind(&LHEEventProduct::addComment,
00101                                   product.get(), _1));
00102         event.put(product);
00103 
00104         partonLevel.reset();
00105         return true;
00106 }


Member Data Documentation

boost::shared_ptr<lhef::LHEEvent> LHESource::partonLevel [protected]

Definition at line 37 of file LHESource.h.

Referenced by nextEvent(), and produce().

std::auto_ptr<lhef::LHEReader> LHESource::reader [protected]

Definition at line 34 of file LHESource.h.

Referenced by endJob(), and nextEvent().

boost::shared_ptr<lhef::LHERunInfo> LHESource::runInfo [protected]

Definition at line 36 of file LHESource.h.

Referenced by beginRun(), and nextEvent().

unsigned int LHESource::skipEvents [protected]

Definition at line 39 of file LHESource.h.

Referenced by nextEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:27:44 2009 for CMSSW by  doxygen 1.5.4