CMS 3D CMS Logo

HepPDTESSource.cc
Go to the documentation of this file.
1 #include "HepPDT/HeavyIonUnknownID.hh"
3 
5  : pdtFileName(cfg.getParameter<edm::FileInPath>("pdtFileName")) {
6  setWhatProduced(this);
7  findingRecord<PDTRecord>();
8 }
9 
11 
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 
29  const edm::IOVSyncValue &,
30  edm::ValidityInterval &oInterval) {
31  // the same PDT is valid for any time
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:297
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