CMS 3D CMS Logo

HcalChannelPropertiesEP.cc
Go to the documentation of this file.
4 
7 
10 
13 
18 
24 
26 public:
27  typedef std::unique_ptr<HcalRecoParams> ReturnType1;
28  typedef std::unique_ptr<HcalChannelPropertiesVec> ReturnType2;
29 
32  topoToken_ = cc1.consumes();
33  paramsToken_ = cc1.consumes();
34 
36  edm::ESInputTag qTag("", "withTopo");
37  condToken_ = cc2.consumes();
38  myParamsToken_ = cc2.consumes();
39  sevToken_ = cc2.consumes();
40  qualToken_ = cc2.consumes(qTag);
41  geomToken_ = cc2.consumes();
42  }
43 
44  inline ~HcalChannelPropertiesEP() override {}
45 
47  using namespace edm;
48 
49  const HcalTopology& htopo = rcd.getRecord<HcalRecNumberingRecord>().get(topoToken_);
51 
52  ReturnType1 prod = std::make_unique<HcalRecoParams>(params);
53  prod->setTopo(&htopo);
54  return prod;
55  }
56 
58  // There appears to be no easy way to trace the internal
59  // dependencies of HcalDbService. So, rebuild the product
60  // every time anything changes in the parent records.
61  // This means that we are sometimes going to rebuild the
62  // whole table on the lumi block boundaries instead of
63  // just updating the list of bad channels.
64  using namespace edm;
65 
66  // Retrieve various event setup records and data products
67  const HcalDbRecord& dbRecord = rcd.getRecord<HcalDbRecord>();
68  const HcalDbService& cond = dbRecord.get(condToken_);
71  const HcalChannelQuality& qual = dbRecord.getRecord<HcalChannelQualityRcd>().get(qualToken_);
73 
74  // HcalTopology is taken from "params" created by the "produce1" method
75  const HcalTopology& htopo(*params.topo());
76 
77  // Build the product
78  ReturnType2 prod = std::make_unique<HcalChannelPropertiesVec>(htopo.ncells());
79  std::array<HcalPipelinePedestalAndGain, 4> pedsAndGains;
81 
82  for (HcalSubdetector subd : subdetectors) {
83  const HcalGeometry* hcalGeom = static_cast<const HcalGeometry*>(geom.getSubdetectorGeometry(DetId::Hcal, subd));
84  const std::vector<DetId>& ids = hcalGeom->getValidDetIds(DetId::Hcal, subd);
85 
86  for (const auto cell : ids) {
87  const auto rawId = cell.rawId();
88 
89  // ADC decoding tools, etc
90  const HcalRecoParam* param_ts = params.getValues(rawId);
91  const HcalQIECoder* channelCoder = cond.getHcalCoder(cell);
92  const HcalQIEShape* shape = cond.getHcalShape(channelCoder);
93  const HcalSiPMParameter* siPMParameter = cond.getHcalSiPMParameter(cell);
94 
95  // Pedestals and gains
96  const HcalCalibrations& calib = cond.getHcalCalibrations(cell);
97  const HcalCalibrationWidths& calibWidth = cond.getHcalCalibrationWidths(cell);
98  for (int capid = 0; capid < 4; ++capid) {
99  pedsAndGains[capid] = HcalPipelinePedestalAndGain(calib.pedestal(capid),
100  calibWidth.pedestal(capid),
101  calib.effpedestal(capid),
102  calibWidth.effpedestal(capid),
103  calib.respcorrgain(capid),
104  calibWidth.gain(capid));
105  }
106 
107  // Channel quality
108  const HcalChannelStatus* digistatus = qual.getValues(rawId);
109  const bool taggedBadByDb = severity.dropChannel(digistatus->getValue());
110 
111  // Fill the table entry
112  const unsigned linearId = htopo.detId2denseId(cell);
113  prod->at(linearId) =
114  HcalChannelProperties(&calib, param_ts, channelCoder, shape, siPMParameter, pedsAndGains, taggedBadByDb);
115  }
116  }
117 
118  return prod;
119  }
120 
121  HcalChannelPropertiesEP() = delete;
124 
125 private:
133 };
134 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
double pedestal(int fCapId) const
get pedestal width for capid=0..3
HcalChannelPropertiesEP(const edm::ParameterSet &)
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
Definition: HcalGeometry.cc:76
edm::ESGetToken< HcalDbService, HcalDbRecord > condToken_
std::unique_ptr< HcalRecoParams > ReturnType1
ReturnType2 produce2(const HcalChannelPropertiesRecord &rcd)
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
double effpedestal(int fCapId) const
get effective pedestal width for capid=0..3
edm::ESGetToken< HcalRecoParams, HcalChannelPropertiesAuxRecord > myParamsToken_
const Item * getValues(DetId fId, bool throwOnFail=true) const
edm::ESGetToken< HcalRecoParams, HcalRecoParamsRcd > paramsToken_
HcalChannelPropertiesEP & operator=(const HcalChannelPropertiesEP &)=delete
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geomToken_
std::unique_ptr< HcalChannelPropertiesVec > ReturnType2
HcalChannelPropertiesEP()=delete
HcalSubdetector
Definition: HcalAssistant.h:31
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
uint32_t getValue() const
double gain(int fCapId) const
get gain width for capid=0..3
Definition: plugin.cc:23
HLT enums.
ReturnType1 produce1(const HcalChannelPropertiesAuxRecord &rcd)
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const