10 #include <unordered_set>
13 : unpacker_(conf.getUntrackedParameter<
int>(
"HcalFirstFED",
int(
FEDNumbering::MINHCALFEDID)),
14 conf.getParameter<
int>(
"firstSample"),
15 conf.getParameter<
int>(
"lastSample")),
17 conf.getParameter<
bool>(
"FilterDataQuality"), conf.getParameter<
bool>(
"FilterDataQuality"),
false, 0, 0, -1),
19 firstFED_(conf.getUntrackedParameter<
int>(
"HcalFirstFED",
FEDNumbering::MINHCALFEDID)),
20 unpackCalib_(conf.getUntrackedParameter<
bool>(
"UnpackCalib",
false)),
21 unpackZDC_(conf.getUntrackedParameter<
bool>(
"UnpackZDC",
false)),
22 unpackTTP_(conf.getUntrackedParameter<
bool>(
"UnpackTTP",
false)),
23 unpackUMNio_(conf.getUntrackedParameter<
bool>(
"UnpackUMNio",
false)),
30 silent_(conf.getUntrackedParameter<
bool>(
"silent",
true)),
31 complainEmptyData_(conf.getUntrackedParameter<
bool>(
"ComplainEmptyData",
false)),
32 unpackerMode_(conf.getUntrackedParameter<
int>(
"UnpackerMode", 0)),
33 expectedOrbitMessageTime_(conf.getUntrackedParameter<
int>(
"ExpectedOrbitMessageTime", -1)) {
52 std::ostringstream
ss;
55 edm::LogInfo(
"HCAL") <<
"HcalRawToDigi will unpack FEDs ( " <<
ss.str() <<
")";
58 produces<HBHEDigiCollection>();
59 produces<HFDigiCollection>();
60 produces<HODigiCollection>();
61 produces<HcalTrigPrimDigiCollection>();
62 produces<HOTrigPrimDigiCollection>();
63 produces<HcalUnpackerReport>();
65 produces<HcalCalibDigiCollection>();
67 produces<ZDCDigiCollection>();
69 produces<HcalTTPDigiCollection>();
71 produces<HcalUMNioDigi>();
72 produces<QIE10DigiCollection>();
73 produces<QIE11DigiCollection>();
75 produces<QIE10DigiCollection>(
"ZDC");
76 produces<QIE10DigiCollection>(
"LASERMON");
82 <<
"Cannot create an additional QIE10 sample with name ZDC, it is already created! It must be removed along "
83 "with the corresponding entry in saveQIE10DataNSamples"
92 <<
"Cannot create an additional QIE10 sample with name LASERMON, it is already created! It must be removed "
93 "along with the corresponding entry in saveQIE10DataNSamples"
104 <<
"The saveQIE10DataTags and saveQIE10DataNSamples inputs must be the same length! These will be ignored"
111 <<
"The saveQIE11DataTags and saveQIE11DataNSamples inputs must be the same length! These will be ignored"
125 produces<QIE10DigiCollection>(
tag);
138 produces<QIE11DigiCollection>(
tag);
152 desc.add<
int>(
"firstSample", 0);
153 desc.add<
int>(
"lastSample", 9);
154 desc.add<
bool>(
"FilterDataQuality",
true);
155 desc.addUntracked<std::vector<int>>(
"FEDs", std::vector<int>());
156 desc.addUntracked<
bool>(
"UnpackZDC",
true);
157 desc.addUntracked<
bool>(
"UnpackCalib",
true);
158 desc.addUntracked<
bool>(
"UnpackUMNio",
true);
159 desc.addUntracked<
bool>(
"UnpackTTP",
true);
160 desc.addUntracked<
bool>(
"silent",
true);
161 desc.addUntracked<std::vector<int>>(
"saveQIE10DataNSamples", std::vector<int>());
162 desc.addUntracked<std::vector<std::string>>(
"saveQIE10DataTags", std::vector<std::string>());
163 desc.addUntracked<std::vector<int>>(
"saveQIE11DataNSamples", std::vector<int>());
164 desc.addUntracked<std::vector<std::string>>(
"saveQIE11DataTags", std::vector<std::string>());
165 desc.addUntracked<
bool>(
"ComplainEmptyData",
false);
166 desc.addUntracked<
int>(
"UnpackerMode", 0);
167 desc.addUntracked<
int>(
"ExpectedOrbitMessageTime", -1);
170 descriptions.
add(
"hcalRawToDigi",
desc);
185 std::vector<HBHEDataFrame>
hbhe;
186 std::vector<HODataFrame>
ho;
187 std::vector<HFDataFrame>
hf;
188 std::vector<HcalTriggerPrimitiveDigi> htp;
189 std::vector<HcalCalibDataFrame> hc;
190 std::vector<ZDCDataFrame>
zdc;
191 std::vector<HcalTTPDigi> ttp;
192 std::vector<HOTriggerPrimitiveDigi> hotp;
194 auto report = std::make_unique<HcalUnpackerReport>();
221 colls.
umnio = &umnio;
238 if (fed.
size() == 0) {
244 }
else if (fed.
size() < 8 * 3) {
281 std::unordered_set<uint32_t> cacheForHFdup;
282 unsigned int cntHFdup = 0;
283 for (
auto& hf_digi :
hf) {
284 if (!cacheForHFdup.insert(hf_digi.id().rawId()).
second)
288 edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for " << cntHFdup <<
" times" << std::endl;
293 if (addtl.second->samples() == colls.
qie10->
samples()) {
295 edm::LogWarning(
"HcalRawToDigi") <<
"QIE10 data requested to be stored in tag " <<
tag
296 <<
" is already stored in the default QIE10 collection. "
297 <<
"To avoid duplicating, remove the tag " <<
tag
298 <<
" from the saveQIE10DataTags and the value of " << addtl.second->samples()
299 <<
" from the saveQIE10DataNSamples "
300 <<
"configurables to HcalRawToDigi" << std::endl;
304 if (addtl.second->samples() == colls.
qie11->
samples()) {
306 edm::LogWarning(
"HcalRawToDigi") <<
"QIE11 data requested to be stored in tag " <<
tag
307 <<
" is already stored in the default QIE11 collection. "
308 <<
"To avoid duplicating, remove the tag " <<
tag
309 <<
" from the saveQIE11DataTags and the value of " << addtl.second->samples()
310 <<
" from the saveQIE11DataNSamples "
311 <<
"configurables to HcalRawToDigi" << std::endl;
316 auto hbhe_prod = std::make_unique<HBHEDigiCollection>();
317 auto hf_prod = std::make_unique<HFDigiCollection>();
318 auto ho_prod = std::make_unique<HODigiCollection>();
319 auto htp_prod = std::make_unique<HcalTrigPrimDigiCollection>();
320 auto hotp_prod = std::make_unique<HOTrigPrimDigiCollection>();
322 if (colls.
qie10 ==
nullptr) {
325 std::unique_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
331 std::unique_ptr<QIE10DigiCollection> qie10ZDC_prod(colls.
qie10ZDC);
337 std::unique_ptr<QIE10DigiCollection> qie10Lasermon_prod(colls.
qie10Lasermon);
339 if (colls.
qie11 ==
nullptr) {
342 std::unique_ptr<QIE11DigiCollection> qie11_prod(colls.
qie11);
346 std::unordered_map<int, std::unique_ptr<QIE10DigiCollection>> qie10_prodAddtl;
347 std::unordered_map<int, std::unique_ptr<QIE11DigiCollection>> qie11_prodAddtl;
349 qie10_prodAddtl[orig.first] = std::unique_ptr<QIE10DigiCollection>(orig.second);
352 qie11_prodAddtl[orig.first] = std::unique_ptr<QIE11DigiCollection>(orig.second);
355 hbhe_prod->swap_contents(
hbhe);
357 hf_prod->swap_contents(
hf);
358 ho_prod->swap_contents(
ho);
359 htp_prod->swap_contents(htp);
360 hotp_prod->swap_contents(hotp);
370 hbhe_prod->
swap(filtered_hbhe);
371 ho_prod->swap(filtered_ho);
372 hf_prod->swap(filtered_hf);
373 qie10_prod->swap(filtered_qie10);
374 qie11_prod->swap(filtered_qie11);
377 for (
auto&
prod : qie10_prodAddtl) {
379 prod.second->swap(filtered_qie10);
382 for (
auto&
prod : qie11_prodAddtl) {
384 prod.second->swap(filtered_qie11);
396 qie10ZDC_prod->sort();
397 qie10Lasermon_prod->sort();
401 for (
auto&
prod : qie10_prodAddtl) {
404 for (
auto&
prod : qie11_prodAddtl) {
415 e.put(
std::move(qie10Lasermon_prod),
"LASERMON");
419 for (
auto&
prod : qie10_prodAddtl) {
424 for (
auto&
prod : qie11_prodAddtl) {
431 auto hc_prod = std::make_unique<HcalCalibDigiCollection>();
432 hc_prod->swap_contents(hc);
436 hc_prod->
swap(filtered_calib);
445 auto prod = std::make_unique<ZDCDigiCollection>();
450 prod->swap(filtered_zdc);
458 auto prod = std::make_unique<HcalTTPDigiCollection>();
459 prod->swap_contents(ttp);
467 if (colls.
umnio !=
nullptr) {
468 e.put(std::make_unique<HcalUMNioDigi>(umnio));