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 
20 
21 namespace edm {
22 
23 //-------------------------------------------------------------------------
25  ProducerSourceFromFiles(pset, desc, false),
26  reader_(HepMCFileReader::instance()), evt_(0)
27 {
28  LogInfo("MCFileSource") << "Reading HepMC file:" << fileNames()[0];
30  // strip the file:
31  if (fileName.find("file:") == 0){
32  fileName.erase(0,5);
33  }
34 
35  reader_->initialize(fileName);
36  produces<HepMCProduct>("generator");
37  produces<GenEventInfoProduct>("generator");
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,"generator");
60  std::auto_ptr<GenEventInfoProduct> info ( new GenEventInfoProduct( evt_ ) );
61  e.put(std::move(info),"generator" );
62 }
63 
64 }
MCFileSource(const ParameterSet &pset, const InputSourceDescription &desc)
Definition: MCFileSource.cc:24
static const TGPicture * info(bool iBackgroundIsBlack)
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: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:46
volatile std::atomic< bool > shutdown_flag false