test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MCFileSource.cc
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include <string>
11 
12 
19 
20 namespace edm {
21 
22 //-------------------------------------------------------------------------
24  ProducerSourceFromFiles(pset, desc, false),
25  reader_(HepMCFileReader::instance()), evt_(0)
26 {
27  LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0];
29  // strip the file:
30  if (fileName.find("file:") == 0){
31  fileName.erase(0,5);
32  }
33 
34  reader_->initialize(fileName);
35  produces<HepMCProduct>();
36 }
37 
38 
39 //-------------------------------------------------------------------------
41 }
42 
43 //-------------------------------------------------------------------------
45  // Read one HepMC event
46  LogInfo("MCFileSource") << "Start Reading";
48  return(evt_ != nullptr);
49 }
50 
51 //-------------------------------------------------------------------------
53  // Store one HepMC event in the Event.
54 
55  std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
56  bare_product->addHepMCData(evt_);
57  e.put(bare_product);
58 }
59 
60 }
MCFileSource(const ParameterSet &pset, const InputSourceDescription &desc)
Definition: MCFileSource.cc:23
static PFTauRenderPlugin instance
virtual void initialize(const std::string &filename)
virtual void produce(Event &e)
Definition: MCFileSource.cc:52
std::vector< std::string > const & fileNames() const
Definition: FromFiles.h:22
virtual ~MCFileSource()
Definition: MCFileSource.cc:40
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
HepMCFileReader * reader_
Definition: MCFileSource.h:35
unsigned long long TimeValue_t
Definition: Timestamp.h:28
HepMC::GenEvent * evt_
Definition: MCFileSource.h:36
HepMC::GenEvent * fillCurrentEventData()
virtual bool setRunAndEventInfo(EventID &, TimeValue_t &time)
Definition: MCFileSource.cc:44
volatile std::atomic< bool > shutdown_flag false