SimGeneral
HepPDTESSource
src
HepPDTESSource.cc
Go to the documentation of this file.
1
#include "HepPDT/HeavyIonUnknownID.hh"
2
#include "
SimGeneral/HepPDTESSource/interface/HepPDTESSource.h
"
3
4
HepPDTESSource::HepPDTESSource
(
const
edm::ParameterSet
&
cfg
)
5
:
pdtFileName
(
cfg
.getParameter<
edm
::FileInPath>(
"pdtFileName"
)) {
6
setWhatProduced
(
this
);
7
findingRecord<PDTRecord>();
8
}
9
10
HepPDTESSource::~HepPDTESSource
() {}
11
12
HepPDTESSource::ReturnType
HepPDTESSource::produce
(
const
PDTRecord
&iRecord) {
13
using namespace
edm::es
;
14
auto
pdt = std::make_unique<PDT>(
"PDG table"
,
new
HepPDT::HeavyIonUnknownID);
15
std::ifstream pdtFile(
pdtFileName
.
fullPath
().c_str());
16
if
(!pdtFile)
17
throw
cms::Exception
(
"FileNotFound"
,
"can't open pdt file"
) <<
"cannot open "
<<
pdtFileName
.
fullPath
();
18
{
// notice: the builder has to be destroyed
19
// in order to fill the table!
20
HepPDT::TableBuilder builder(*pdt);
21
if
(!addParticleTable(pdtFile, builder)) {
22
throw
cms::Exception
(
"ConfigError"
,
"can't read pdt file"
) <<
"wrong format of "
<<
pdtFileName
.
fullPath
();
23
}
24
}
25
return
pdt;
26
}
27
28
void
HepPDTESSource::setIntervalFor
(
const
edm::eventsetup::EventSetupRecordKey
&,
29
const
edm::IOVSyncValue
&,
30
edm::ValidityInterval
&oInterval) {
31
// the same PDT is valid for any time
32
oInterval =
edm::ValidityInterval
(
edm::IOVSyncValue::beginOfTime
(),
edm::IOVSyncValue::endOfTime
());
33
}
34
35
// define this as a plug-in
36
// DEFINE_FWK_EVENTSETUP_SOURCE( HepPDTESSource );
HepPDTESSource::pdtFileName
edm::FileInPath pdtFileName
Definition:
HepPDTESSource.h:49
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
edm::ValidityInterval
Definition:
ValidityInterval.h:28
HepPDTESSource::~HepPDTESSource
~HepPDTESSource() override
destructor
Definition:
HepPDTESSource.cc:10
HepPDTESSource::ReturnType
std::unique_ptr< PDT > ReturnType
define the return type
Definition:
HepPDTESSource.h:40
edm::eventsetup::EventSetupRecordKey
Definition:
EventSetupRecordKey.h:30
HepPDTESSource.h
HepPDTESSource::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
set validity interval
Definition:
HepPDTESSource.cc:28
HepPDTESSource::produce
ReturnType produce(const PDTRecord &)
return the particle table
Definition:
HepPDTESSource.cc:12
edm::IOVSyncValue
Definition:
IOVSyncValue.h:31
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition:
IOVSyncValue.cc:82
HepPDTESSource::HepPDTESSource
HepPDTESSource(const edm::ParameterSet &)
constructor from parameter set
Definition:
HepPDTESSource.cc:4
looper.cfg
cfg
Definition:
looper.py:296
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition:
Time.h:17
Exception
Definition:
hltDiff.cc:245
edm::es
Definition:
es_Label.h:33
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition:
IOVSyncValue.cc:88
PDTRecord
Definition:
PDTRecord.h:14
pythiapdt_cfi.pdtFileName
pdtFileName
Definition:
pythiapdt_cfi.py:4
edm::FileInPath::fullPath
std::string fullPath() const
Definition:
FileInPath.cc:161
Generated for CMSSW Reference Manual by
1.8.16