CMS 3D CMS Logo

edm::H2RootNtplSource Class Reference

#include <IOMC/NtupleConverter/interface/H2RootNtplSource.h>

Inheritance diagram for edm::H2RootNtplSource:

edm::ExternalInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

List of all members.

Public Member Functions

 H2RootNtplSource (const ParameterSet &, const InputSourceDescription &)
virtual ~H2RootNtplSource ()

Public Attributes

unsigned int firstEvent_
Ntuple2HepMCFillerreader_

Private Member Functions

void clear ()
virtual bool produce (Event &e)

Private Attributes

HepMC::GenEvent * evt
std::string filename_
EventID nextID_


Detailed Description

Definition at line 19 of file H2RootNtplSource.h.


Constructor & Destructor Documentation

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 }


Member Function Documentation

void H2RootNtplSource::clear ( void   )  [private]

Definition at line 49 of file H2RootNtplSource.cc.

Referenced by ~H2RootNtplSource().

00049                              {
00050 }

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

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 }


Member Data Documentation

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.

Ntuple2HepMCFiller* edm::H2RootNtplSource::reader_

Definition at line 32 of file H2RootNtplSource.h.

Referenced by H2RootNtplSource(), and produce().


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