44 float convertPedWidths(
48 unsigned const x1 =
static_cast<unsigned>(std::floor(y));
49 unsigned const x2 =
static_cast<unsigned>(std::floor(y + 1.));
50 unsigned iun =
static_cast<unsigned>(
i);
56 int const x1 =
static_cast<int>(std::floor(x));
57 int const x2 =
static_cast<int>(std::floor(x + 1));
109 size_t const totalChannels =
110 pedestals.getAllContainers()[0].second.size() + pedestals.getAllContainers()[1].second.size();
112 auto product = std::make_unique<hcal::HcalMahiConditionsPortableHost>(totalChannels,
cms::alpakatools::host());
114 auto view = product->view();
117 auto const ped_unitIsADC = pedestals.isADC();
118 auto const effPed_unitIsADC = effectivePedestals.isADC();
121 auto const recoParams_containers = recoParams.getAllContainers();
122 auto const pedestals_containers = pedestals.getAllContainers();
123 auto const effectivePedestals_containers = effectivePedestals.getAllContainers();
124 auto const gains_containers =
gains.getAllContainers();
125 auto const lutCorrs_containers = lutCorrs.getAllContainers();
126 auto const respCorrs_containers = respCorrs.getAllContainers();
127 auto const timeCorrs_containers = timeCorrs.getAllContainers();
128 auto const pedestalWidths_containers = pedestalWidths.getAllContainers();
129 auto const effectivePedestalWidths_containers = effectivePedestalWidths.getAllContainers();
130 auto const gainWidths_containers = gainWidths.getAllContainers();
131 auto const channelQuality_containers = channelQuality.getAllContainers();
132 auto const qieTypes_containers = qieTypes.getAllContainers();
133 auto const qieData_containers = qieData.getAllContainers();
134 auto const sipmParameters_containers = sipmParameters.getAllContainers();
136 auto const& pedestals_barrel = pedestals_containers[0].second;
137 auto const& effectivePedestals_barrel = effectivePedestals_containers[0].second;
138 auto const& gains_barrel = gains_containers[0].second;
139 auto const& lutCorrs_barrel = lutCorrs_containers[0].second;
140 auto const& respCorrs_barrel = respCorrs_containers[0].second;
141 auto const& timeCorrs_barrel = timeCorrs_containers[0].second;
142 auto const& pedestalWidths_barrel = pedestalWidths_containers[0].second;
143 auto const& effectivePedestalWidths_barrel = effectivePedestalWidths_containers[0].second;
144 auto const& gainWidths_barrel = gainWidths_containers[0].second;
145 auto const& channelQuality_barrel = channelQuality_containers[0].second;
146 auto const& qieTypes_barrel = qieTypes_containers[0].second;
147 auto const& qieData_barrel = qieData_containers[0].second;
148 auto const& sipmParameters_barrel = sipmParameters_containers[0].second;
150 for (
uint64_t i = 0;
i < pedestals_barrel.size(); ++
i) {
154 auto const& qieCoder = qieData_barrel[
i];
155 auto const qieType = qieTypes_barrel[
i].getValue() > 1 ? 1 : 0;
156 auto const& qieShape = qieData.getShape(
qieType);
159 vi.pedestals_value()[0] = ped_unitIsADC ? convertPed(pedestals_barrel[
i].
getValue(0), 0, qieCoder, qieShape)
160 : pedestals_barrel[
i].getValue(0);
161 vi.pedestals_value()[1] = ped_unitIsADC ? convertPed(pedestals_barrel[
i].
getValue(1), 1, qieCoder, qieShape)
162 : pedestals_barrel[
i].getValue(1);
163 vi.pedestals_value()[2] = ped_unitIsADC ? convertPed(pedestals_barrel[
i].
getValue(2), 2, qieCoder, qieShape)
164 : pedestals_barrel[
i].getValue(2);
165 vi.pedestals_value()[3] = ped_unitIsADC ? convertPed(pedestals_barrel[
i].
getValue(3), 3, qieCoder, qieShape)
166 : pedestals_barrel[
i].getValue(3);
168 vi.pedestals_width()[0] =
171 pedestals_barrel[
i].
getValue(0), pedestalWidths_barrel[
i].getWidth(0), 0, qieCoder, qieShape)
172 : pedestalWidths_barrel[
i].getWidth(0);
173 vi.pedestals_width()[1] =
176 pedestals_barrel[
i].
getValue(1), pedestalWidths_barrel[
i].getWidth(1), 1, qieCoder, qieShape)
177 : pedestalWidths_barrel[
i].getWidth(1);
178 vi.pedestals_width()[2] =
181 pedestals_barrel[
i].
getValue(2), pedestalWidths_barrel[
i].getWidth(2), 2, qieCoder, qieShape)
182 : pedestalWidths_barrel[
i].getWidth(2);
183 vi.pedestals_width()[3] =
186 pedestals_barrel[
i].
getValue(3), pedestalWidths_barrel[
i].getWidth(3), 3, qieCoder, qieShape)
187 : pedestalWidths_barrel[
i].getWidth(3);
189 vi.effectivePedestals()[0] = effPed_unitIsADC
190 ? convertPed(effectivePedestals_barrel[
i].
getValue(0), 0, qieCoder, qieShape)
191 : effectivePedestals_barrel[
i].getValue(0);
192 vi.effectivePedestals()[1] = effPed_unitIsADC
193 ? convertPed(effectivePedestals_barrel[
i].
getValue(1), 1, qieCoder, qieShape)
194 : effectivePedestals_barrel[
i].getValue(1);
195 vi.effectivePedestals()[2] = effPed_unitIsADC
196 ? convertPed(effectivePedestals_barrel[
i].
getValue(2), 2, qieCoder, qieShape)
197 : effectivePedestals_barrel[
i].getValue(2);
198 vi.effectivePedestals()[3] = effPed_unitIsADC
199 ? convertPed(effectivePedestals_barrel[
i].
getValue(3), 3, qieCoder, qieShape)
200 : effectivePedestals_barrel[
i].getValue(3);
202 vi.effectivePedestalWidths()[0] = effPed_unitIsADC
203 ? convertPedWidths(effectivePedestals_barrel[
i].
getValue(0),
204 effectivePedestalWidths_barrel[
i].getWidth(0),
208 : effectivePedestalWidths_barrel[
i].getWidth(0);
209 vi.effectivePedestalWidths()[1] = effPed_unitIsADC
210 ? convertPedWidths(effectivePedestals_barrel[
i].
getValue(1),
211 effectivePedestalWidths_barrel[
i].getWidth(1),
215 : effectivePedestalWidths_barrel[
i].getWidth(1);
216 vi.effectivePedestalWidths()[2] = effPed_unitIsADC
217 ? convertPedWidths(effectivePedestals_barrel[
i].
getValue(2),
218 effectivePedestalWidths_barrel[
i].getWidth(2),
222 : effectivePedestalWidths_barrel[
i].getWidth(2);
223 vi.effectivePedestalWidths()[3] = effPed_unitIsADC
224 ? convertPedWidths(effectivePedestals_barrel[
i].
getValue(3),
225 effectivePedestalWidths_barrel[
i].getWidth(3),
229 : effectivePedestalWidths_barrel[
i].getWidth(3);
231 vi.gains_value()[0] = gains_barrel[
i].getValue(0);
232 vi.gains_value()[1] = gains_barrel[
i].getValue(1);
233 vi.gains_value()[2] = gains_barrel[
i].getValue(2);
234 vi.gains_value()[3] = gains_barrel[
i].getValue(3);
236 vi.lutCorrs_values() = lutCorrs_barrel[
i].getValue();
237 vi.respCorrs_values() = respCorrs_barrel[
i].getValue();
238 vi.timeCorrs_values() = timeCorrs_barrel[
i].getValue();
240 vi.pedestalWidths_sigma00() = *(pedestalWidths_barrel[
i].getValues());
241 vi.pedestalWidths_sigma01() = *(pedestalWidths_barrel[
i].getValues() + 1);
242 vi.pedestalWidths_sigma02() = *(pedestalWidths_barrel[
i].getValues() + 2);
243 vi.pedestalWidths_sigma03() = *(pedestalWidths_barrel[
i].getValues() + 3);
244 vi.pedestalWidths_sigma10() = *(pedestalWidths_barrel[
i].getValues() + 4);
245 vi.pedestalWidths_sigma11() = *(pedestalWidths_barrel[
i].getValues() + 5);
246 vi.pedestalWidths_sigma12() = *(pedestalWidths_barrel[
i].getValues() + 6);
247 vi.pedestalWidths_sigma13() = *(pedestalWidths_barrel[
i].getValues() + 7);
248 vi.pedestalWidths_sigma20() = *(pedestalWidths_barrel[
i].getValues() + 8);
249 vi.pedestalWidths_sigma21() = *(pedestalWidths_barrel[
i].getValues() + 9);
250 vi.pedestalWidths_sigma22() = *(pedestalWidths_barrel[
i].getValues() + 10);
251 vi.pedestalWidths_sigma23() = *(pedestalWidths_barrel[
i].getValues() + 11);
252 vi.pedestalWidths_sigma30() = *(pedestalWidths_barrel[
i].getValues() + 12);
253 vi.pedestalWidths_sigma31() = *(pedestalWidths_barrel[
i].getValues() + 13);
254 vi.pedestalWidths_sigma32() = *(pedestalWidths_barrel[
i].getValues() + 14);
255 vi.pedestalWidths_sigma33() = *(pedestalWidths_barrel[
i].getValues() + 15);
257 vi.gainWidths_value0() = gainWidths_barrel[
i].getValue(0);
258 vi.gainWidths_value1() = gainWidths_barrel[
i].getValue(1);
259 vi.gainWidths_value2() = gainWidths_barrel[
i].getValue(2);
260 vi.gainWidths_value3() = gainWidths_barrel[
i].getValue(3);
262 vi.channelQuality_status() = channelQuality_barrel[
i].getValue();
263 vi.qieTypes_values() = qieTypes_barrel[
i].getValue();
265 for (uint32_t
k = 0;
k < 4;
k++)
266 for (uint32_t
l = 0;
l < 4;
l++) {
268 vi.qieCoders_offsets()[
linear] = qieData_barrel[
i].offset(
k,
l);
269 vi.qieCoders_slopes()[
linear] = qieData_barrel[
i].slope(
k,
l);
272 vi.sipmPar_type() = sipmParameters_barrel[
i].getType();
273 vi.sipmPar_auxi1() = sipmParameters_barrel[
i].getauxi1();
274 vi.sipmPar_fcByPE() = sipmParameters_barrel[
i].getFCByPE();
275 vi.sipmPar_darkCurrent() = sipmParameters_barrel[
i].getDarkCurrent();
276 vi.sipmPar_auxi2() = sipmParameters_barrel[
i].getauxi2();
280 auto const& pedestals_endcaps = pedestals_containers[1].second;
281 auto const& effectivePedestals_endcaps = effectivePedestals_containers[1].second;
282 auto const& gains_endcaps = gains_containers[1].second;
283 auto const& lutCorrs_endcaps = lutCorrs_containers[1].second;
284 auto const& respCorrs_endcaps = respCorrs_containers[1].second;
285 auto const& timeCorrs_endcaps = timeCorrs_containers[1].second;
286 auto const& pedestalWidths_endcaps = pedestalWidths_containers[1].second;
287 auto const& effectivePedestalWidths_endcaps = effectivePedestalWidths_containers[1].second;
288 auto const& gainWidths_endcaps = gainWidths_containers[1].second;
289 auto const& channelQuality_endcaps = channelQuality_containers[1].second;
290 auto const& qieTypes_endcaps = qieTypes_containers[1].second;
291 auto const& qieData_endcaps = qieData_containers[1].second;
292 auto const& sipmParameters_endcaps = sipmParameters_containers[1].second;
294 auto const offset = pedestals_barrel.size();
296 for (
uint64_t i = 0;
i < pedestals_endcaps.size(); ++
i) {
297 auto const& qieCoder = qieData_endcaps[
i];
298 auto const qieType = qieTypes_endcaps[
i].getValue() > 1 ? 1 : 0;
299 auto const& qieShape = qieData.getShape(
qieType);
303 vi.pedestals_value()[0] = ped_unitIsADC ? convertPed(pedestals_endcaps[
i].
getValue(0), 0, qieCoder, qieShape)
304 : pedestals_endcaps[
i].getValue(0);
305 vi.pedestals_value()[1] = ped_unitIsADC ? convertPed(pedestals_endcaps[
i].
getValue(1), 1, qieCoder, qieShape)
306 : pedestals_endcaps[
i].getValue(1);
307 vi.pedestals_value()[2] = ped_unitIsADC ? convertPed(pedestals_endcaps[
i].
getValue(2), 2, qieCoder, qieShape)
308 : pedestals_endcaps[
i].getValue(2);
309 vi.pedestals_value()[3] = ped_unitIsADC ? convertPed(pedestals_endcaps[
i].
getValue(3), 3, qieCoder, qieShape)
310 : pedestals_endcaps[
i].getValue(3);
312 vi.pedestals_width()[0] =
315 pedestals_endcaps[
i].
getValue(0), pedestalWidths_endcaps[
i].getWidth(0), 0, qieCoder, qieShape)
316 : pedestalWidths_endcaps[
i].getWidth(0);
317 vi.pedestals_width()[1] =
320 pedestals_endcaps[
i].
getValue(1), pedestalWidths_endcaps[
i].getWidth(1), 1, qieCoder, qieShape)
321 : pedestalWidths_endcaps[
i].getWidth(1);
322 vi.pedestals_width()[2] =
325 pedestals_endcaps[
i].
getValue(2), pedestalWidths_endcaps[
i].getWidth(2), 2, qieCoder, qieShape)
326 : pedestalWidths_endcaps[
i].getWidth(2);
327 vi.pedestals_width()[3] =
330 pedestals_endcaps[
i].
getValue(3), pedestalWidths_endcaps[
i].getWidth(3), 3, qieCoder, qieShape)
331 : pedestalWidths_endcaps[
i].getWidth(3);
333 vi.effectivePedestals()[0] = effPed_unitIsADC
334 ? convertPed(effectivePedestals_endcaps[
i].
getValue(0), 0, qieCoder, qieShape)
335 : effectivePedestals_endcaps[
i].getValue(0);
336 vi.effectivePedestals()[1] = effPed_unitIsADC
337 ? convertPed(effectivePedestals_endcaps[
i].
getValue(1), 1, qieCoder, qieShape)
338 : effectivePedestals_endcaps[
i].getValue(1);
339 vi.effectivePedestals()[2] = effPed_unitIsADC
340 ? convertPed(effectivePedestals_endcaps[
i].
getValue(2), 2, qieCoder, qieShape)
341 : effectivePedestals_endcaps[
i].getValue(2);
342 vi.effectivePedestals()[3] = effPed_unitIsADC
343 ? convertPed(effectivePedestals_endcaps[
i].
getValue(3), 3, qieCoder, qieShape)
344 : effectivePedestals_endcaps[
i].getValue(3);
346 vi.effectivePedestalWidths()[0] = effPed_unitIsADC
347 ? convertPedWidths(effectivePedestals_endcaps[
i].
getValue(0),
348 effectivePedestalWidths_endcaps[
i].getWidth(0),
352 : effectivePedestalWidths_endcaps[
i].getWidth(0);
353 vi.effectivePedestalWidths()[1] = effPed_unitIsADC
354 ? convertPedWidths(effectivePedestals_endcaps[
i].
getValue(1),
355 effectivePedestalWidths_endcaps[
i].getWidth(1),
359 : effectivePedestalWidths_endcaps[
i].getWidth(1);
360 vi.effectivePedestalWidths()[2] = effPed_unitIsADC
361 ? convertPedWidths(effectivePedestals_endcaps[
i].
getValue(2),
362 effectivePedestalWidths_endcaps[
i].getWidth(2),
366 : effectivePedestalWidths_endcaps[
i].getWidth(2);
367 vi.effectivePedestalWidths()[3] = effPed_unitIsADC
368 ? convertPedWidths(effectivePedestals_endcaps[
i].
getValue(3),
369 effectivePedestalWidths_endcaps[
i].getWidth(3),
373 : effectivePedestalWidths_endcaps[
i].getWidth(3);
375 vi.gains_value()[0] = gains_endcaps[
i].getValue(0);
376 vi.gains_value()[1] = gains_endcaps[
i].getValue(1);
377 vi.gains_value()[2] = gains_endcaps[
i].getValue(2);
378 vi.gains_value()[3] = gains_endcaps[
i].getValue(3);
380 vi.lutCorrs_values() = lutCorrs_endcaps[
i].getValue();
381 vi.respCorrs_values() = respCorrs_endcaps[
i].getValue();
382 vi.timeCorrs_values() = timeCorrs_endcaps[
i].getValue();
384 vi.pedestalWidths_sigma00() = *(pedestalWidths_endcaps[
i].getValues());
385 vi.pedestalWidths_sigma01() = *(pedestalWidths_endcaps[
i].getValues() + 1);
386 vi.pedestalWidths_sigma02() = *(pedestalWidths_endcaps[
i].getValues() + 2);
387 vi.pedestalWidths_sigma03() = *(pedestalWidths_endcaps[
i].getValues() + 3);
388 vi.pedestalWidths_sigma10() = *(pedestalWidths_endcaps[
i].getValues() + 4);
389 vi.pedestalWidths_sigma11() = *(pedestalWidths_endcaps[
i].getValues() + 5);
390 vi.pedestalWidths_sigma12() = *(pedestalWidths_endcaps[
i].getValues() + 6);
391 vi.pedestalWidths_sigma13() = *(pedestalWidths_endcaps[
i].getValues() + 7);
392 vi.pedestalWidths_sigma20() = *(pedestalWidths_endcaps[
i].getValues() + 8);
393 vi.pedestalWidths_sigma21() = *(pedestalWidths_endcaps[
i].getValues() + 9);
394 vi.pedestalWidths_sigma22() = *(pedestalWidths_endcaps[
i].getValues() + 10);
395 vi.pedestalWidths_sigma23() = *(pedestalWidths_endcaps[
i].getValues() + 11);
396 vi.pedestalWidths_sigma30() = *(pedestalWidths_endcaps[
i].getValues() + 12);
397 vi.pedestalWidths_sigma31() = *(pedestalWidths_endcaps[
i].getValues() + 13);
398 vi.pedestalWidths_sigma32() = *(pedestalWidths_endcaps[
i].getValues() + 14);
399 vi.pedestalWidths_sigma33() = *(pedestalWidths_endcaps[
i].getValues() + 15);
401 vi.gainWidths_value0() = gainWidths_endcaps[
i].getValue(0);
402 vi.gainWidths_value1() = gainWidths_endcaps[
i].getValue(1);
403 vi.gainWidths_value2() = gainWidths_endcaps[
i].getValue(2);
404 vi.gainWidths_value3() = gainWidths_endcaps[
i].getValue(3);
406 vi.channelQuality_status() = channelQuality_endcaps[
i].getValue();
407 vi.qieTypes_values() = qieTypes_endcaps[
i].getValue();
409 for (uint32_t
k = 0;
k < 4;
k++)
410 for (uint32_t
l = 0;
l < 4;
l++) {
412 vi.qieCoders_offsets()[
linear] = qieData_endcaps[
i].offset(
k,
l);
413 vi.qieCoders_slopes()[
linear] = qieData_endcaps[
i].slope(
k,
l);
416 vi.sipmPar_type() = sipmParameters_endcaps[
i].getType();
417 vi.sipmPar_auxi1() = sipmParameters_endcaps[
i].getauxi1();
418 vi.sipmPar_fcByPE() = sipmParameters_endcaps[
i].getFCByPE();
419 vi.sipmPar_darkCurrent() = sipmParameters_endcaps[
i].getDarkCurrent();
420 vi.sipmPar_auxi2() = sipmParameters_endcaps[
i].getauxi2();
432 view.nEtaHB() = recConstants.getEtaRange(0).second - recConstants.getEtaRange(0).first + 1;
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
edm::ESGetToken< HcalQIETypes, HcalQIETypesRcd > qieTypesToken_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topologyToken_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > recConstantsToken_
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > respCorrsToken_
HcalMahiConditionsESProducer(edm::ParameterSet const &iConfig)
uint32_t cc[maxCellsPerHit]
edm::ESGetToken< HcalPedestalWidths, HcalPedestalWidthsRcd > effectivePedestalWidthsToken_
edm::ESGetToken< HcalGainWidths, HcalGainWidthsRcd > gainWidthsToken_
edm::ESGetToken< HcalTimeCorrs, HcalTimeCorrsRcd > timeCorrsToken_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > channelQualityToken_
edm::ESGetToken< HcalRecoParams, HcalRecoParamsRcd > recoParamsToken_
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > pedestalsToken_
edm::ESGetToken< HcalQIEData, HcalQIEDataRcd > qieDataToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr float gains[NGAINS]
std::unique_ptr< hcal::HcalMahiConditionsPortableHost > produce(HcalMahiConditionsRcd const &iRecord)
unsigned long long uint64_t
edm::ESGetToken< HcalPedestalWidths, HcalPedestalWidthsRcd > pedestalWidthsToken_
edm::ESGetToken< HcalSiPMParameters, HcalSiPMParametersRcd > sipmParametersToken_
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< HcalLUTCorrs, HcalLUTCorrsRcd > lutCorrsToken_
edm::ESGetToken< HcalPedestals, HcalPedestalsRcd > effectivePedestalsToken_
edm::ESGetToken< HcalGains, HcalGainsRcd > gainsToken_
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
static const int IPHI_MAX