CMS 3D CMS Logo

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