#include <IOMC/Input/interface/MCFileSource.h>
Public Member Functions | |
MCFileSource (const ParameterSet &pset, const InputSourceDescription &desc) | |
virtual | ~MCFileSource () |
Private Member Functions | |
void | clear () |
virtual bool | produce (Event &e) |
Private Attributes | |
HepMC::GenEvent * | evt_ |
HepMCFileReader * | reader_ |
bool | useExtendedAscii_ |
Definition at line 28 of file MCFileSource.h.
MCFileSource::MCFileSource | ( | const ParameterSet & | pset, | |
const InputSourceDescription & | desc | |||
) |
Definition at line 30 of file MCFileSource.cc.
References aod_PYTHIA_cfg::fileName, edm::ExternalInputSource::fileNames(), HepMCFileReader::initialize(), reader_, and useExtendedAscii_.
00030 : 00031 ExternalInputSource(pset, desc), 00032 reader_(HepMCFileReader::instance()), evt_(0), 00033 useExtendedAscii_(pset.getUntrackedParameter<bool>("useExtendedAscii",false)) 00034 { 00035 edm::LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0]; 00036 string fileName = fileNames()[0]; 00037 // strip the file: 00038 if (fileName.find("file:") == 0){ 00039 fileName.erase(0,5); 00040 } 00041 00042 reader_->initialize(fileName, useExtendedAscii_); 00043 produces<HepMCProduct>(); 00044 }
MCFileSource::~MCFileSource | ( | ) | [virtual] |
void edm::MCFileSource::clear | ( | ) | [private] |
Implements edm::ConfigurableInputSource.
Definition at line 53 of file MCFileSource.cc.
References evt_, HepMCFileReader::fillCurrentEventData(), edm::Event::put(), and reader_.
00053 { 00054 // Read one HepMC event and store it in the Event. 00055 00056 auto_ptr<HepMCProduct> bare_product(new HepMCProduct()); 00057 00058 edm::LogInfo("MCFileSource") << "Start Reading"; 00059 evt_ = reader_->fillCurrentEventData(); 00060 if (evt_ == 0) return false; 00061 00062 bare_product->addHepMCData(evt_); 00063 e.put(bare_product); 00064 00065 return true; 00066 }
HepMC::GenEvent* edm::MCFileSource::evt_ [private] |
HepMCFileReader* edm::MCFileSource::reader_ [private] |
bool edm::MCFileSource::useExtendedAscii_ [private] |