![]() |
![]() |
#include <GeneratorInterface/LHEInterface/plugins/LHESource.h>
Public Member Functions | |
LHESource (const edm::ParameterSet ¶ms, 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::LHEEvent > | partonLevel |
std::auto_ptr< lhef::LHEReader > | reader |
boost::shared_ptr < lhef::LHERunInfo > | runInfo |
unsigned int | skipEvents |
Definition at line 21 of file LHESource.h.
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] |
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 }
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 }
boost::shared_ptr<lhef::LHEEvent> LHESource::partonLevel [protected] |
std::auto_ptr<lhef::LHEReader> LHESource::reader [protected] |
boost::shared_ptr<lhef::LHERunInfo> LHESource::runInfo [protected] |
unsigned int LHESource::skipEvents [protected] |