CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::MCFileSource Class Reference

#include <MCFileSource.h>

Inheritance diagram for edm::MCFileSource:
edm::ExternalInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

List of all members.

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_
HepMCFileReaderreader_
bool useExtendedAscii_

Detailed Description

Definition at line 23 of file MCFileSource.h.


Constructor & Destructor Documentation

MCFileSource::MCFileSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Definition at line 30 of file MCFileSource.cc.

References convertXMLtoSQLite_cfg::fileName, edm::ExternalInputSource::fileNames(), HepMCFileReader::initialize(), and reader_.

                                                                                        :
  ExternalInputSource(pset, desc),
  reader_(HepMCFileReader::instance()), evt_(0)
{
  edm::LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0];
  string fileName = fileNames()[0];
  // strip the file: 
  if (fileName.find("file:") == 0){
    fileName.erase(0,5);
  }  
  
  reader_->initialize(fileName);  
  produces<HepMCProduct>();
}
MCFileSource::~MCFileSource ( ) [virtual]

Definition at line 47 of file MCFileSource.cc.

                           {
}

Member Function Documentation

void edm::MCFileSource::clear ( ) [private]
bool MCFileSource::produce ( Event e) [private, virtual]

Implements edm::ConfigurableInputSource.

Definition at line 52 of file MCFileSource.cc.

References evt_, HepMCFileReader::fillCurrentEventData(), edm::Event::put(), and reader_.

                                   {
  // Read one HepMC event and store it in the Event.

  auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  

  edm::LogInfo("MCFileSource") << "Start Reading";
  evt_ = reader_->fillCurrentEventData(); 
  if (evt_ == 0) return false;

  bare_product->addHepMCData(evt_);
  e.put(bare_product);

  return true;
}

Member Data Documentation

HepMC::GenEvent* edm::MCFileSource::evt_ [private]

Definition at line 33 of file MCFileSource.h.

Referenced by produce().

Definition at line 32 of file MCFileSource.h.

Referenced by MCFileSource(), and produce().

Definition at line 34 of file MCFileSource.h.