#include <H2RootNtplSource.h>
Public Member Functions | |
H2RootNtplSource (const ParameterSet &, const InputSourceDescription &) | |
virtual | ~H2RootNtplSource () |
Public Attributes | |
unsigned int | firstEvent_ |
Ntuple2HepMCFiller * | reader_ |
Private Member Functions | |
void | clear () |
virtual bool | produce (Event &e) |
Private Attributes | |
HepMC::GenEvent * | evt |
std::string | filename_ |
EventID | nextID_ |
Definition at line 19 of file H2RootNtplSource.h.
H2RootNtplSource::H2RootNtplSource | ( | const ParameterSet & | pset, |
const InputSourceDescription & | desc | ||
) |
Definition at line 19 of file H2RootNtplSource.cc.
References gather_cfg::cout, convertXMLtoSQLite_cfg::fileName, edm::ExternalInputSource::fileNames(), firstEvent_, edm::ParameterSet::getUntrackedParameter(), Ntuple2HepMCFiller::initialize(), edm::InputSource::maxEvents(), reader_, and Ntuple2HepMCFiller::setEvent().
: ExternalInputSource(pset, desc), evt(0), firstEvent_ (pset.getUntrackedParameter<unsigned int>("firstEvent",0)), reader_( Ntuple2HepMCFiller::instance() ){ cout << "H2RootNtplSource: Reading HepMC file: " << fileNames()[0] << endl; string fileName = fileNames()[0]; // strip the file: if ( ! fileName.find("file:")){ fileName.erase(0,5); } //Max number of events processed cout << "H2RootNtplSource: Number of events to be processed = " << maxEvents() << endl; //First event firstEvent_ = pset.getUntrackedParameter<unsigned int>("firstEvent",0); cout << "H2RootNtplSource: Number of first event = " << firstEvent_ << endl; reader_->initialize(fileName,101); reader_->setEvent(firstEvent_); produces<HepMCProduct>(); }
H2RootNtplSource::~H2RootNtplSource | ( | ) | [virtual] |
void H2RootNtplSource::clear | ( | void | ) | [private] |
bool H2RootNtplSource::produce | ( | Event & | e | ) | [private, virtual] |
Implements edm::ConfigurableInputSource.
Definition at line 52 of file H2RootNtplSource.cc.
References gather_cfg::cout, evt, Ntuple2HepMCFiller::fillCurrentEventData(), edm::Event::put(), and reader_.
{ // no need to clean up GenEvent memory - now done in HepMCProduct //if ( evt != NULL ) delete evt ; auto_ptr<HepMCProduct> bare_product(new HepMCProduct()); cout << "H2RootNtplSource: Start Reading " << endl; evt = reader_->fillCurrentEventData(); if(evt) { bare_product->addHepMCData(evt ); e.put(bare_product); return true; } else return false; }
HepMC::GenEvent* edm::H2RootNtplSource::evt [private] |
Definition at line 27 of file H2RootNtplSource.h.
Referenced by produce().
std::string edm::H2RootNtplSource::filename_ [private] |
Definition at line 29 of file H2RootNtplSource.h.
unsigned int edm::H2RootNtplSource::firstEvent_ |
Definition at line 31 of file H2RootNtplSource.h.
Referenced by H2RootNtplSource().
EventID edm::H2RootNtplSource::nextID_ [private] |
Definition at line 28 of file H2RootNtplSource.h.
Definition at line 32 of file H2RootNtplSource.h.
Referenced by H2RootNtplSource(), and produce().