![]() |
![]() |
#include <IOMC/NtupleConverter/interface/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 GenMuonPlsPt100GeV_cfg::cout, lat::endl(), aod_PYTHIA_cfg::fileName, edm::ExternalInputSource::fileNames(), firstEvent_, edm::ParameterSet::getUntrackedParameter(), Ntuple2HepMCFiller::initialize(), edm::InputSource::maxEvents(), reader_, and Ntuple2HepMCFiller::setEvent().
00019 : 00020 ExternalInputSource(pset, desc), 00021 evt(0), firstEvent_ (pset.getUntrackedParameter<unsigned int>("firstEvent",0)), 00022 reader_( Ntuple2HepMCFiller::instance() ){ 00023 00024 00025 cout << "H2RootNtplSource: Reading HepMC file: " << fileNames()[0] << endl; 00026 string fileName = fileNames()[0]; 00027 // strip the file: 00028 if ( ! fileName.find("file:")){ 00029 fileName.erase(0,5); 00030 } 00031 //Max number of events processed 00032 cout << "H2RootNtplSource: Number of events to be processed = " << maxEvents() << endl; 00033 00034 //First event 00035 firstEvent_ = pset.getUntrackedParameter<unsigned int>("firstEvent",0); 00036 cout << "H2RootNtplSource: Number of first event = " << firstEvent_ << endl; 00037 00038 reader_->initialize(fileName,101); 00039 reader_->setEvent(firstEvent_); 00040 produces<HepMCProduct>(); 00041 00042 }
H2RootNtplSource::~H2RootNtplSource | ( | ) | [virtual] |
Definition at line 45 of file H2RootNtplSource.cc.
References clear().
00045 { 00046 clear(); 00047 }
Implements edm::ConfigurableInputSource.
Definition at line 52 of file H2RootNtplSource.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), evt, Ntuple2HepMCFiller::fillCurrentEventData(), edm::Event::put(), and reader_.
00052 { 00053 00054 00055 // no need to clean up GenEvent memory - now done in HepMCProduct 00056 //if ( evt != NULL ) delete evt ; 00057 00058 00059 auto_ptr<HepMCProduct> bare_product(new HepMCProduct()); 00060 cout << "H2RootNtplSource: Start Reading " << endl; 00061 evt = reader_->fillCurrentEventData(); 00062 if(evt) { 00063 bare_product->addHepMCData(evt ); 00064 e.put(bare_product); 00065 return true; 00066 } 00067 else return false; 00068 00069 00070 }
HepMC::GenEvent* edm::H2RootNtplSource::evt [private] |
std::string edm::H2RootNtplSource::filename_ [private] |
Definition at line 29 of file H2RootNtplSource.h.
unsigned int edm::H2RootNtplSource::firstEvent_ |
EventID edm::H2RootNtplSource::nextID_ [private] |
Definition at line 28 of file H2RootNtplSource.h.