CMS 3D CMS Logo

edm::MCFileSource Class Reference

#include <IOMC/Input/interface/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 28 of file MCFileSource.h.


Constructor & Destructor Documentation

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]

Definition at line 48 of file MCFileSource.cc.

00048                            {
00049 }


Member Function Documentation

void edm::MCFileSource::clear (  )  [private]

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

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 }


Member Data Documentation

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

Definition at line 38 of file MCFileSource.h.

Referenced by produce().

HepMCFileReader* edm::MCFileSource::reader_ [private]

Definition at line 37 of file MCFileSource.h.

Referenced by MCFileSource(), and produce().

bool edm::MCFileSource::useExtendedAscii_ [private]

Definition at line 39 of file MCFileSource.h.

Referenced by MCFileSource().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:48 2009 for CMSSW by  doxygen 1.5.4