26 typedef std::multimap<DetId, CaloSamples> HcalDigiMap;
34 coder.fC2adc(fC, digi, capIdOffset);
40 for (
int i = 0;
i < digi.size(); ++
i) {
41 int capId(digi.sample(
i).capid());
42 fC[
i] -=
calib.pedestal(capId);
47 void convertAdc2fChelper<QIE10DataFrame>(
const QIE10DataFrame &digi,
53 int capId(digi[
i].capid());
54 fC[
i] -=
calib.pedestal(capId);
59 void convertAdc2fChelper<QIE11DataFrame>(
const QIE11DataFrame &digi,
65 int capId(digi[
i].capid());
66 fC[
i] -=
calib.pedestal(capId);
76 coder.adc2fC(digi, fC);
82 template <
class DIGIS>
84 for (
auto digi = digis.begin(); digi != digis.end(); ++digi) {
86 convertAdc2fC(*digi,
conditions, keepPedestals, fC);
87 if (!keepPedestals &&
map.find(digi->id()) ==
map.end()) {
89 <<
"No signal hits found for HCAL cell " << digi->id() <<
" Pedestals may be lost for mixed hit";
100 for (
auto digiItr = digis.
begin(); digiItr != digis.
end(); ++digiItr) {
103 convertAdc2fC(digi,
conditions, keepPedestals, fC);
104 if (!keepPedestals &&
map.find(digi.id()) ==
map.end()) {
106 <<
"No signal hits found for HCAL cell " << digi.id() <<
" Pedestals may be lost for mixed hit";
117 for (
auto digiItr = digis.
begin(); digiItr != digis.
end(); ++digiItr) {
120 convertAdc2fC(digi,
conditions, keepPedestals, fC);
121 if (!keepPedestals &&
map.find(digi.id()) ==
map.end()) {
123 <<
"No signal hits found for HCAL cell " << digi.id() <<
" Pedestals may be lost for mixed hit";
129 template <
class DIGIS>
135 if (!
e.getByToken(
token, digis))
141 template <
class DIGIS>
147 auto digis = edm::getProductByTag<DIGIS>(
ep,
tag, mcc);
155 template <
class DIGIS>
156 void buildHcalDigisHelper(DIGIS &digis,
157 const DetId &formerID,
162 convertFc2adc(resultSample,
conditions, digis.back(),
168 const DetId &formerID,
180 const DetId &formerID,
190 template <
class DIGIS>
192 std::unique_ptr<DIGIS> digis(
new DIGIS);
202 if (currentID == formerID) {
204 unsigned int sizenew = (hitSample).
size();
205 unsigned int sizeold = resultSample.
size();
206 if (sizenew > sizeold) {
209 for (
unsigned int isamp = 0; isamp < sizenew; isamp++) {
210 resultSample[isamp] += hitSample[isamp];
214 bool lastEntry = (++hit1 ==
map.end());
215 if (currentID != formerID || lastEntry) {
216 if (formerID > 0 || lastEntry) {
218 buildHcalDigisHelper(*digis, formerID, resultSample,
conditions);
221 formerID = currentID;
222 resultSample = hitSample;
234 DataMixingHcalDigiWorker::DataMixingHcalDigiWorker() {}
238 : label_(ps.getParameter<
std::
string>(
"Label")) {
301 LogInfo(
"DataMixingHcalDigiWorker") <<
"===============> adding MC signals for " <<
e.id();
316 ZDCDigis = pZDCDigis.
product();
318 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
335 coder.
adc2fC((*it), tool);
355 unsigned int eventNr,
358 LogDebug(
"DataMixingHcalDigiWorker") <<
"\n===============> adding pileups from event " <<
ep->id()
359 <<
" for bunchcrossing " << bcr;
374 std::shared_ptr<Wrapper<ZDCDigiCollection>
const> ZDCDigisPTR =
378 const ZDCDigiCollection *ZDCDigis = const_cast<ZDCDigiCollection *>(ZDCDigisPTR->product());
380 LogDebug(
"DataMixingHcalDigiWorker") <<
"total # ZDC digis: " << ZDCDigis->
size();
392 coder.
adc2fC((*it), tool);
417 std::unique_ptr<QIE10DigiCollection> QIE10digis =
419 std::unique_ptr<QIE11DigiCollection> QIE11digis =
439 ZDCDigiMap::const_iterator iZDCchk;
442 currentID = iZDC->first;
444 if (currentID == formerID) {
447 unsigned int sizenew = (iZDC->second).
size();
448 unsigned int sizeold = ZDC_old.
size();
450 unsigned int max_samp =
std::max(sizenew, sizeold);
456 if (sizenew > sizeold)
462 for (
unsigned int isamp = 0; isamp < max_samp; isamp++) {
463 if (isamp < sizenew) {
464 fC_new = (iZDC->second)[isamp];
469 if (isamp < sizeold) {
470 fC_old = ZDC_old[isamp];
476 fC_sum = fC_new + fC_old;
479 ZDC_bigger[isamp] = fC_sum;
481 ZDC_old[isamp] = fC_sum;
485 ZDC_old = ZDC_bigger;
499 unsigned int sizeold = ZDC_old.
size();
500 for (
unsigned int isamp = 0; isamp < sizeold; isamp++) {
501 coder.
fC2adc(ZDC_old, (ZDCdigis->back()),
506 formerID = currentID;
507 ZDC_old = iZDC->second;
522 unsigned int sizeold = (iZDC->second).
size();
523 for (
unsigned int isamp = 0; isamp < sizeold; isamp++) {
524 coder.
fC2adc(ZDC_old, (ZDCdigis->back()),
533 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HBHE Merged digis: " << HBHEdigis->size();
534 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HO Merged digis: " << HOdigis->size();
535 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # HF Merged digis: " << HFdigis->size();
536 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # QIE10 Merged digis: " << QIE10digis->size();
537 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # QIE11 Merged digis: " << QIE11digis->size();
538 LogInfo(
"DataMixingHcalDigiWorker") <<
"total # ZDC Merged digis: " << ZDCdigis->size();