IOMC
Input
src
MCFileSource.cc
Go to the documentation of this file.
1
9
#include <iostream>
10
#include <string>
11
12
#include "
FWCore/Framework/interface/Event.h
"
13
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
14
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
15
#include "
IOMC/Input/interface/HepMCFileReader.h
"
16
#include "
IOMC/Input/interface/MCFileSource.h
"
17
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
18
#include "
SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h
"
19
20
namespace
edm
{
21
22
//-------------------------------------------------------------------------
23
MCFileSource::MCFileSource
(
const
ParameterSet
&
pset
,
InputSourceDescription
const
&
desc
)
24
:
ProducerSourceFromFiles
(
pset
,
desc
,
false
), reader_(
HepMCFileReader
::
instance
()), evt_(nullptr) {
25
LogInfo
(
"MCFileSource"
) <<
"Reading HepMC file:"
<<
fileNames
(0)[0];
26
std::string
fileName
=
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
//-------------------------------------------------------------------------
38
MCFileSource::~MCFileSource
() {}
39
40
//-------------------------------------------------------------------------
41
bool
MCFileSource::setRunAndEventInfo
(
EventID
&,
TimeValue_t
&,
EventAuxiliary::ExperimentType
&) {
42
// Read one HepMC event
43
LogInfo
(
"MCFileSource"
) <<
"Start Reading"
;
44
evt_
=
reader_
->fillCurrentEventData();
45
return
(
evt_
!=
nullptr
);
46
}
47
48
//-------------------------------------------------------------------------
49
void
MCFileSource::produce
(
Event
&
e
) {
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
GenEventInfoProduct
Definition:
GenEventInfoProduct.h:17
edm::MCFileSource::~MCFileSource
~MCFileSource() override
Definition:
MCFileSource.cc:38
MessageLogger.h
funct::false
false
Definition:
Factorize.h:29
edm::MCFileSource::MCFileSource
MCFileSource(const ParameterSet &pset, const InputSourceDescription &desc)
Definition:
MCFileSource.cc:23
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::InputSourceDescription
Definition:
InputSourceDescription.h:20
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition:
FWCollectionSummaryWidget.cc:153
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
MillePedeFileConverter_cfg.fileName
fileName
Definition:
MillePedeFileConverter_cfg.py:32
edm::MCFileSource::reader_
edm::propagate_const< HepMCFileReader * > reader_
Definition:
MCFileSource.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
GenEventInfoProduct.h
Event.h
edm::FromFiles::fileNames
std::vector< std::string > fileNames(unsigned iCatalog) const
Definition:
FromFiles.h:22
edm::MCFileSource::produce
void produce(Event &e) override
Definition:
MCFileSource.cc:49
instance
static PFTauRenderPlugin instance
Definition:
PFTauRenderPlugin.cc:70
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
MCFileSource.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
edm::ProducerSourceFromFiles
Definition:
ProducerSourceFromFiles.h:17
edm::MCFileSource::setRunAndEventInfo
bool setRunAndEventInfo(EventID &, TimeValue_t &time, EventAuxiliary::ExperimentType &eType) override
Definition:
MCFileSource.cc:41
edm::EventAuxiliary::ExperimentType
ExperimentType
Definition:
EventAuxiliary.h:18
ParameterSet.h
HepMCProduct.h
HepMCFileReader.h
edm::EventID
Definition:
EventID.h:31
edm::Event
Definition:
Event.h:73
HepMCFileReader
Definition:
HepMCFileReader.h:27
edm::TimeValue_t
unsigned long long TimeValue_t
Definition:
Timestamp.h:28
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
edm::MCFileSource::evt_
edm::propagate_const< HepMC::GenEvent * > evt_
Definition:
MCFileSource.h:37
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16