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 
11 #include <iostream>
12 #include <string>
13 
14 
21 
22 namespace edm {
23 
24 //-------------------------------------------------------------------------
26  ProducerSourceFromFiles(pset, desc, false),
27  reader_(HepMCFileReader::instance()), evt_(0)
28 {
29  LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0];
31  // strip the file:
32  if (fileName.find("file:") == 0){
33  fileName.erase(0,5);
34  }
35 
36  reader_->initialize(fileName);
37  produces<HepMCProduct>();
38 }
39 
40 
41 //-------------------------------------------------------------------------
43 }
44 
45 //-------------------------------------------------------------------------
47  // Read one HepMC event
48  LogInfo("MCFileSource") << "Start Reading";
50  return(evt_ != nullptr);
51 }
52 
53 //-------------------------------------------------------------------------
55  // Store one HepMC event in the Event.
56 
57  std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
58  bare_product->addHepMCData(evt_);
59  e.put(bare_product);
60 }
61 
62 }
MCFileSource(const ParameterSet &pset, const InputSourceDescription &desc)
Definition: MCFileSource.cc:25
static PFTauRenderPlugin instance
virtual void initialize(const std::string &filename)
virtual void produce(Event &e)
Definition: MCFileSource.cc:54
std::vector< std::string > const & fileNames() const
Definition: FromFiles.h:22
virtual ~MCFileSource()
Definition: MCFileSource.cc:42
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
HepMCFileReader * reader_
Definition: MCFileSource.h:35
unsigned long long TimeValue_t
Definition: Timestamp.h:27
HepMC::GenEvent * evt_
Definition: MCFileSource.h:36
HepMC::GenEvent * fillCurrentEventData()
virtual bool setRunAndEventInfo(EventID &, TimeValue_t &time)
Definition: MCFileSource.cc:46