CMS 3D CMS Logo

HBHEDarkeningEP.cc
Go to the documentation of this file.
1 #include "HBHEDarkeningEP.h"
6 
7 #include <string>
8 #include <vector>
9 #include <map>
10 
12  setWhatProduced(this);
13  findingRecord<HBHEDarkeningRecord>();
14 }
15 
17 
19  const edm::IOVSyncValue& iTime,
20  edm::ValidityInterval& oInterval) {
22 }
23 
26  desc.add<int>("ieta_shift");
27  desc.add<double>("drdA");
28  desc.add<double>("drdB");
29  edm::ParameterSetDescription desc_dosemaps;
30  desc_dosemaps.add<int>("energy");
31  desc_dosemaps.add<edm::FileInPath>("file");
32  std::vector<edm::ParameterSet> default_dosemap(1);
33  desc.addVPSet("dosemaps", desc_dosemaps, default_dosemap);
35  desc_years.add<std::string>("year");
36  desc_years.add<double>("intlumi");
37  desc_years.add<double>("lumirate");
38  desc_years.add<int>("energy");
39  std::vector<edm::ParameterSet> default_year(1);
40  desc.addVPSet("years", desc_years, default_year);
41 
42  descriptions.addDefault(desc);
43 }
44 
45 // ------------ method called to produce the data ------------
47  //initialize dose maps
48  std::vector<edm::ParameterSet> p_dosemaps = pset_.getParameter<std::vector<edm::ParameterSet>>("dosemaps");
49  std::map<int, std::vector<std::vector<float>>> dosemaps;
50  for (const auto& p_dosemap : p_dosemaps) {
51  edm::FileInPath fp = p_dosemap.getParameter<edm::FileInPath>("file");
52  int file_energy = p_dosemap.getParameter<int>("energy");
53  dosemaps.emplace(file_energy, HBHEDarkening::readDoseMap(fp.fullPath()));
54  }
55 
56  //initialize years
57  std::vector<edm::ParameterSet> p_years = pset_.getParameter<std::vector<edm::ParameterSet>>("years");
58  std::vector<HBHEDarkening::LumiYear> years;
59  years.reserve(p_years.size());
60  for (const auto& p_year : p_years) {
61  years.emplace_back(p_year.getParameter<std::string>("year"),
62  p_year.getParameter<double>("intlumi"),
63  p_year.getParameter<double>("lumirate"),
64  p_year.getParameter<int>("energy"));
65  }
66 
67  return std::make_unique<HBHEDarkening>(pset_.getParameter<int>("ieta_shift"),
68  pset_.getParameter<double>("drdA"),
69  pset_.getParameter<double>("drdB"),
70  dosemaps,
71  years);
72 }
73 
ConfigurationDescriptions.h
HBHEDarkeningRecord
Definition: HBHEDarkeningRecord.h:4
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
HBHEDarkeningEP::~HBHEDarkeningEP
~HBHEDarkeningEP() override
Definition: HBHEDarkeningEP.cc:16
HBHEDarkeningEP::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: HBHEDarkeningEP.cc:18
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ValidityInterval
Definition: ValidityInterval.h:28
personalPlayback.fp
fp
Definition: personalPlayback.py:523
HBHEDarkeningEP::ReturnType
std::unique_ptr< HBHEDarkening > ReturnType
Definition: HBHEDarkeningEP.h:23
HBHEDarkening::readDoseMap
static std::vector< std::vector< float > > readDoseMap(const std::string &fullpath)
Definition: HBHEDarkening.cc:32
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::FileInPath
Definition: FileInPath.h:61
HBHEDarkeningEP.h
HBHEDarkeningEP::produce
ReturnType produce(const HBHEDarkeningRecord &)
Definition: HBHEDarkeningEP.cc:46
ParameterSetDescription.h
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
DEFINE_FWK_EVENTSETUP_SOURCE
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:91
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
FileInPath.h
SourceFactory.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HBHEDarkeningEP::pset_
const edm::ParameterSet & pset_
Definition: HBHEDarkeningEP.h:35
cond::ValidityInterval
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HBHEDarkeningEP::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HBHEDarkeningEP.cc:24
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HBHEDarkeningEP::HBHEDarkeningEP
HBHEDarkeningEP(const edm::ParameterSet &)
Definition: HBHEDarkeningEP.cc:11
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
HBHEDarkeningEP
Definition: HBHEDarkeningEP.h:18