CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

edm::H2RootNtplSource Class Reference

#include <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 gather_cfg::cout, convertXMLtoSQLite_cfg::fileName, edm::ExternalInputSource::fileNames(), firstEvent_, edm::ParameterSet::getUntrackedParameter(), Ntuple2HepMCFiller::initialize(), edm::InputSource::maxEvents(), reader_, and Ntuple2HepMCFiller::setEvent().

                                                                                                  :
ExternalInputSource(pset, desc),  
evt(0), firstEvent_ (pset.getUntrackedParameter<unsigned int>("firstEvent",0)),
reader_( Ntuple2HepMCFiller::instance() ){
        

        cout << "H2RootNtplSource: Reading HepMC file: " << fileNames()[0] << endl;
        string fileName = fileNames()[0];
        // strip the file: 
        if ( ! fileName.find("file:")){
          fileName.erase(0,5);
        }   
        //Max number of events processed  
        cout << "H2RootNtplSource: Number of events to be processed = " << maxEvents() << endl;
        
        //First event
        firstEvent_ = pset.getUntrackedParameter<unsigned int>("firstEvent",0);
        cout << "H2RootNtplSource: Number of first event  = " << firstEvent_ << endl;   

        reader_->initialize(fileName,101);  
        reader_->setEvent(firstEvent_);
        produces<HepMCProduct>();

}
H2RootNtplSource::~H2RootNtplSource ( ) [virtual]

Definition at line 45 of file H2RootNtplSource.cc.

References clear().

                                   {
        clear();
}

Member Function Documentation

void H2RootNtplSource::clear ( void  ) [private]

Definition at line 49 of file H2RootNtplSource.cc.

Referenced by ~H2RootNtplSource().

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

Implements edm::ConfigurableInputSource.

Definition at line 52 of file H2RootNtplSource.cc.

References gather_cfg::cout, evt, Ntuple2HepMCFiller::fillCurrentEventData(), edm::Event::put(), and reader_.

                                        {
        

        // no need to clean up GenEvent memory - now done in HepMCProduct
        //if ( evt != NULL ) delete evt ;
   
                
                auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  
                cout << "H2RootNtplSource: Start Reading  " << endl;
                evt = reader_->fillCurrentEventData(); 
                if(evt)  {
                  bare_product->addHepMCData(evt );
                  e.put(bare_product);
                  return true;
                }
                else return false;
        
        
}

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.

Definition at line 31 of file H2RootNtplSource.h.

Referenced by H2RootNtplSource().

Definition at line 28 of file H2RootNtplSource.h.

Definition at line 32 of file H2RootNtplSource.h.

Referenced by H2RootNtplSource(), and produce().