CMS 3D CMS Logo

EcalRecHitParametersGPUESProducer.cc
Go to the documentation of this file.
1 #include <array>
2 #include <tuple>
3 #include <utility>
4 
21 
23 public:
25  ~EcalRecHitParametersGPUESProducer() override = default;
26 
28  std::unique_ptr<EcalRecHitParametersGPU> produce(JobConfigurationGPURecord const&);
29 
30 protected:
32  const edm::IOVSyncValue&,
33  edm::ValidityInterval&) override;
34 
35 private:
37 };
38 
40  setWhatProduced(this);
41  findingRecord<JobConfigurationGPURecord>();
42 }
43 
45  const edm::IOVSyncValue& iTime,
46  edm::ValidityInterval& oInterval) {
48 }
49 
52 
53  //---- db statuses to be exluded from reconstruction
54  d.add<std::vector<std::string>>("ChannelStatusToBeExcluded",
55  {
56  "kDAC",
57  "kNoisy",
58  "kNNoisy",
59  "kFixedG6",
60  "kFixedG1",
61  "kFixedG0",
62  "kNonRespondingIsolated",
63  "kDeadVFE",
64  "kDeadFE",
65  "kNoDataNoTP",
66  });
67 
68  // reco flags association to DB flag
69  edm::ParameterSetDescription desc_list_flagsMapDBReco;
70  desc_list_flagsMapDBReco.add<std::vector<std::string>>("kGood", {"kOk", "kDAC", "kNoLaser", "kNoisy"});
71  desc_list_flagsMapDBReco.add<std::vector<std::string>>("kNoisy", {"kNNoisy", "kFixedG6", "kFixedG1"});
72  desc_list_flagsMapDBReco.add<std::vector<std::string>>("kNeighboursRecovered",
73  {"kFixedG0", "kNonRespondingIsolated", "kDeadVFE"});
74  desc_list_flagsMapDBReco.add<std::vector<std::string>>("kTowerRecovered", {"kDeadFE"});
75  desc_list_flagsMapDBReco.add<std::vector<std::string>>("kDead", {"kNoDataNoTP"});
76 
77  d.add<edm::ParameterSetDescription>("flagsMapDBReco", desc_list_flagsMapDBReco);
78 
79  desc.addWithDefaultLabel(d);
80 }
81 
82 std::unique_ptr<EcalRecHitParametersGPU> EcalRecHitParametersGPUESProducer::produce(JobConfigurationGPURecord const&) {
83  auto const& channelStatusToBeExcluded = StringToEnumValue<EcalChannelStatusCode::Code>(
84  pset_.getParameter<std::vector<std::string>>("ChannelStatusToBeExcluded"));
85 
86  // https://github.com/cms-sw/cmssw/blob/266e21cfc9eb409b093e4cf064f4c0a24c6ac293/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitWorkerSimple.cc
87 
88  // Translate string representation of flagsMapDBReco into enum values
89  const edm::ParameterSet& p = pset_.getParameter<edm::ParameterSet>("flagsMapDBReco");
90  std::vector<std::string> recoflagbitsStrings = p.getParameterNames();
91 
92  std::vector<EcalRecHitParametersGPU::DBStatus> status;
93  status.reserve(recoflagbitsStrings.size());
94  for (auto const& recoflagbitsString : recoflagbitsStrings) {
95  EcalRecHit::Flags recoflagbit = (EcalRecHit::Flags)StringToEnumValue<EcalRecHit::Flags>(recoflagbitsString);
96  std::vector<std::string> dbstatus_s = p.getParameter<std::vector<std::string>>(recoflagbitsString);
97 
98  std::vector<uint32_t> db_reco_flags;
99  db_reco_flags.reserve(dbstatus_s.size());
100  for (auto const& dbstatusString : dbstatus_s) {
101  EcalChannelStatusCode::Code dbstatus =
102  (EcalChannelStatusCode::Code)StringToEnumValue<EcalChannelStatusCode::Code>(dbstatusString);
103  db_reco_flags.push_back(dbstatus);
104  }
105  status.emplace_back(static_cast<int>(recoflagbit), db_reco_flags);
106  }
107 
108  return std::make_unique<EcalRecHitParametersGPU>(channelStatusToBeExcluded, status);
109 }
110 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
~EcalRecHitParametersGPUESProducer() override=default
EcalRecHitParametersGPUESProducer(edm::ParameterSet const &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
d
Definition: ztail.py:151
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Definition: SourceFactory.h:92
static void fillDescriptions(edm::ConfigurationDescriptions &)
std::unique_ptr< EcalRecHitParametersGPU > produce(JobConfigurationGPURecord const &)