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::ProducerSourceFromFiles edm::ProducerSourceBase 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 void produce (Event &e)
virtual bool setRunAndEventInfo (EventID &, TimeValue_t &time)

Private Attributes

HepMC::GenEvent * evt_
HepMCFileReaderreader_
bool useExtendedAscii_

Detailed Description

Definition at line 25 of file MCFileSource.h.


Constructor & Destructor Documentation

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

Definition at line 25 of file MCFileSource.cc.

References convertXMLtoSQLite_cfg::fileName, edm::ProducerSourceFromFiles::fileNames(), HepMCFileReader::initialize(), reader_, and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                        :
  ProducerSourceFromFiles(pset, desc, false),
  reader_(HepMCFileReader::instance()), evt_(0)
{
  LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0];
  std::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 42 of file MCFileSource.cc.

                           {
}

Member Function Documentation

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

Implements edm::ProducerSourceBase.

Definition at line 54 of file MCFileSource.cc.

References evt_, and edm::Event::put().

                                   {
  // Store one HepMC event in the Event.

  std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  
  bare_product->addHepMCData(evt_);
  e.put(bare_product);
}
bool MCFileSource::setRunAndEventInfo ( EventID ,
TimeValue_t time 
) [private, virtual]

Implements edm::ProducerSourceBase.

Definition at line 46 of file MCFileSource.cc.

References evt_, HepMCFileReader::fillCurrentEventData(), and reader_.

                                                            {
  // Read one HepMC event
  LogInfo("MCFileSource") << "Start Reading";
  evt_ = reader_->fillCurrentEventData(); 
  return(evt_ != nullptr);
}

Member Data Documentation

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

Definition at line 36 of file MCFileSource.h.

Referenced by produce(), and setRunAndEventInfo().

Definition at line 35 of file MCFileSource.h.

Referenced by MCFileSource(), and setRunAndEventInfo().

Definition at line 37 of file MCFileSource.h.