CMS 3D CMS Logo

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_(nullptr)
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";
49  evt_ = reader_->fillCurrentEventData();
50  return(evt_ != nullptr);
51 }
52 
53 //-------------------------------------------------------------------------
55  // Store one HepMC event in the Event.
56 
57  auto bare_product = std::make_unique<HepMCProduct>();
58  bare_product->addHepMCData(evt_);
59  e.put(std::move(bare_product),"generator");
60  std::unique_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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
static PFTauRenderPlugin instance
edm::propagate_const< HepMC::GenEvent * > evt_
Definition: MCFileSource.h:37
#define nullptr
~MCFileSource() override
Definition: MCFileSource.cc:42
std::vector< std::string > const & fileNames() const
Definition: FromFiles.h:22
edm::propagate_const< HepMCFileReader * > reader_
Definition: MCFileSource.h:36
bool setRunAndEventInfo(EventID &, TimeValue_t &time, EventAuxiliary::ExperimentType &eType) override
Definition: MCFileSource.cc:46
unsigned long long TimeValue_t
Definition: Timestamp.h:28
void produce(Event &e) override
Definition: MCFileSource.cc:54
HLT enums.
def move(src, dest)
Definition: eostools.py:510