CMS 3D CMS Logo

SiStripClusterizerConditionsESProducer.cc
Go to the documentation of this file.
1 
7 #include <memory>
8 
14 
17 
20 
22 public:
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28  using ReturnType = std::unique_ptr<SiStripClusterizerConditions>;
30 
31 private:
35 };
36 
38  auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("Label"));
39 
40  m_gainToken = cc.consumesFrom<SiStripGain, SiStripGainRcd>();
43  edm::ESInputTag{"", iConfig.getParameter<std::string>("QualityLabel")});
44 }
45 
48  desc.add<std::string>("QualityLabel", "");
49  desc.add<std::string>("Label", "");
50  descriptions.add("SiStripClusterizerConditionsESProducer", desc);
51 }
52 
54  const SiStripClusterizerConditionsRcd& iRecord) {
55  auto gainsH = iRecord.getTransientHandle(m_gainToken);
56  const auto& noises = iRecord.get(m_noisesToken);
57  const auto& quality = iRecord.get(m_qualityToken);
58 
59  auto product = std::make_unique<SiStripClusterizerConditions>(&quality);
60 
61  const auto& connected = quality.cabling()->connected();
62  const auto& detCabling = quality.cabling()->getDetCabling();
63  product->reserve(connected.size());
64  for (const auto& conn : connected) {
65  const auto det = conn.first;
66  if (!quality.IsModuleBad(det)) {
67  const auto gainRange = gainsH->getRange(det);
68  std::vector<float> invGains;
69  invGains.reserve(6);
71  gainRange.first, gainRange.second, std::back_inserter(invGains), [](auto gain) { return 1.f / gain; });
72 
73  static const std::vector<const FedChannelConnection*> noConn{};
74  const auto detConn_it = detCabling.find(det);
75 
76  product->emplace_back(det,
77  quality.getRange(det),
78  noises.getRange(det),
79  invGains,
80  (detCabling.end() != detConn_it) ? (*detConn_it).second : noConn);
81  }
82  }
83  LogDebug("SiStripClusterizerConditionsESProducer")
84  << "Produced a SiStripClusterizerConditions object for " << product->allDets().size() << " modules";
85  return product;
86 }
87 
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
string quality
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > m_noisesToken
ReturnType produce(const SiStripClusterizerConditionsRcd &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< SiStripGain, SiStripGainRcd > m_gainToken
conn
Definition: getInfo.py:9
std::unique_ptr< SiStripClusterizerConditions > ReturnType
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > m_qualityToken
#define LogDebug(id)
unsigned transform(const HcalDetId &id, unsigned transformCode)