CMS 3D CMS Logo

HcalChannelPropertiesEP.cc
Go to the documentation of this file.
4 
7 
10 
13 
16 
21 
27 
29 public:
30  typedef std::unique_ptr<HcalRecoParams> ReturnType1;
31  typedef std::unique_ptr<HcalChannelPropertiesVec> ReturnType2;
32  typedef std::unique_ptr<HcalPFCuts> ReturnType3;
33 
36  topoToken_ = cc1.consumes();
37  paramsToken_ = cc1.consumes();
38 
40  edm::ESInputTag qTag("", "withTopo");
41  condToken_ = cc2.consumes();
42  myParamsToken_ = cc2.consumes();
43  sevToken_ = cc2.consumes();
44  qualToken_ = cc2.consumes(qTag);
45  geomToken_ = cc2.consumes();
46 
47  edm::es::Label productLabel("withTopo");
48  auto cc3 = setWhatProduced(this, &HcalChannelPropertiesEP::produce3, productLabel);
49  topoToken3_ = cc3.consumes();
50  pfcutsToken_ = cc3.consumes();
51  }
52 
53  inline ~HcalChannelPropertiesEP() override {}
54 
56  const HcalTopology& htopo = rcd.get(topoToken_);
57  const HcalRecoParams& params = rcd.get(paramsToken_);
58 
59  ReturnType1 prod = std::make_unique<HcalRecoParams>(params);
60  prod->setTopo(&htopo);
61  return prod;
62  }
63 
65  // There appears to be no easy way to trace the internal
66  // dependencies of HcalDbService. So, rebuild the product
67  // every time anything changes in the parent records.
68  // This means that we are sometimes going to rebuild the
69  // whole table on the lumi block boundaries instead of
70  // just updating the list of bad channels.
71  //
72  // Retrieve various event setup records and data products
73  const HcalDbRecord& dbRecord = rcd.getRecord<HcalDbRecord>();
74  const HcalDbService& cond = dbRecord.get(condToken_);
77  const HcalChannelQuality& qual = dbRecord.get(qualToken_);
78  const CaloGeometry& geom = rcd.get(geomToken_);
79 
80  // HcalTopology is taken from "params" created by the "produce1" method
81  const HcalTopology& htopo(*params.topo());
82 
83  // Build the product
84  ReturnType2 prod = std::make_unique<HcalChannelPropertiesVec>(htopo.ncells());
85  std::array<HcalPipelinePedestalAndGain, 4> pedsAndGains;
87 
88  for (HcalSubdetector subd : subdetectors) {
89  const HcalGeometry* hcalGeom = static_cast<const HcalGeometry*>(geom.getSubdetectorGeometry(DetId::Hcal, subd));
90  const std::vector<DetId>& ids = hcalGeom->getValidDetIds(DetId::Hcal, subd);
91 
92  for (const auto cell : ids) {
93  const auto rawId = cell.rawId();
94 
95  // ADC decoding tools, etc
96  const HcalRecoParam* param_ts = params.getValues(rawId);
97  const HcalQIECoder* channelCoder = cond.getHcalCoder(cell);
98  const HcalQIEShape* shape = cond.getHcalShape(channelCoder);
99  const HcalSiPMParameter* siPMParameter = cond.getHcalSiPMParameter(cell);
100 
101  // Pedestals and gains
102  const HcalCalibrations& calib = cond.getHcalCalibrations(cell);
103  const HcalCalibrationWidths& calibWidth = cond.getHcalCalibrationWidths(cell);
104  for (int capid = 0; capid < 4; ++capid) {
105  pedsAndGains[capid] = HcalPipelinePedestalAndGain(calib.pedestal(capid),
106  calibWidth.pedestal(capid),
107  calib.effpedestal(capid),
108  calibWidth.effpedestal(capid),
109  calib.respcorrgain(capid),
110  calibWidth.gain(capid));
111  }
112 
113  // Channel quality
114  const HcalChannelStatus* digistatus = qual.getValues(rawId);
115  const bool taggedBadByDb = severity.dropChannel(digistatus->getValue());
116 
117  // Fill the table entry
118  const unsigned linearId = htopo.detId2denseId(cell);
119  prod->at(linearId) =
120  HcalChannelProperties(&calib, param_ts, channelCoder, shape, siPMParameter, pedsAndGains, taggedBadByDb);
121  }
122  }
123 
124  return prod;
125  }
126 
128  const HcalTopology& htopo = rcd.get(topoToken3_);
129  const HcalPFCuts& cuts = rcd.get(pfcutsToken_);
130 
131  ReturnType3 prod = std::make_unique<HcalPFCuts>(cuts);
132  prod->setTopo(&htopo);
133  return prod;
134  }
135 
136  HcalChannelPropertiesEP() = delete;
139 
140 private:
149 };
150 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
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_
std::unique_ptr< HcalPFCuts > ReturnType3
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
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > pfcutsToken_
double gain(int fCapId) const
get gain width for capid=0..3
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken3_
ReturnType1 produce1(const HcalChannelPropertiesAuxRecord &rcd)
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
ReturnType3 produce3(const HcalPFCutsRcd &rcd)