21 : params_(
params), firstCallEB_(
true), firstCallEE_(
true), iEvent_(1) {
41 if (
params.getParameter<
bool>(
"configFromCondDB")) {
46 edm::LogWarning(
"EcalSelectiveReadout") <<
"Parameter configFromCondDB of EcalSelectiveReadout module not found. "
47 "Selective readout configuration will be read from python file.";
108 unique_ptr<EBDigiCollection> selectedEBDigis;
109 unique_ptr<EEDigiCollection> selectedEEDigis;
110 unique_ptr<EBSrFlagCollection> ebSrFlags;
111 unique_ptr<EESrFlagCollection> eeSrFlags;
140 selectedEBDigis.get(),
141 selectedEEDigis.get(),
151 suppressor_->getEcalSelectiveReadout()->printHeader(srfFile);
153 srfFile <<
"# Event " <<
iEvent_ <<
"\n";
154 suppressor_->getEcalSelectiveReadout()->print(srfFile);
178 event.getByToken(
EB_token, hEBDigis);
191 event.getByToken(
EE_token, hEEDigis);
248 const char tccFlagMarker[] = {
'x',
'.',
'S',
'?',
'C',
'E',
'E',
'E',
'E'};
255 os <<
"# TCC flag map\n#\n"
258 <<
": 000 (low interest)\n"
261 <<
": 001 (mid interest)\n"
264 <<
": 010 (not valid)\n"
267 <<
": 011 (high interest)\n"
270 <<
": 1xx forced readout (Hw error)\n"
274 vector<vector<int> > ttf(
nEta, vector<int>(
nPhi, -1));
277 if (trigPrim.
size() > 0) {
280 int iPhi0 = trigPrim.
id().
iphi() - 1;
281 ttf[iEta0][iPhi0] = trigPrim.
ttFlag();
285 for (
int iPhi = 0; iPhi <
nPhi; ++iPhi) {
296 static std::atomic<bool> warnWeightCnt{
true};
297 bool expected =
true;
298 if ((
int)
weights.size() > nFIRTaps &&
299 warnWeightCnt.compare_exchange_strong(expected,
false, std::memory_order_acq_rel)) {
300 edm::LogWarning(
"Configuration") <<
"The list of DCC zero suppression FIR "
301 "weights given in parameter dccNormalizedWeights is longer "
302 "than the expected depth of the FIR filter :("
305 "The last weights will be discarded.";
310 double maxWeight =
weights[iMaxWeight];
312 for (
unsigned i = 0;
i <
weights.size(); ++
i) {
315 maxWeight =
weights[iMaxWeight];
327 if (rc && maxWeightBin != binOfMax) {
328 edm::LogWarning(
"Configuration") <<
"The maximum weight of DCC zero suppression FIR filter is not "
329 "applied to the expected maximum sample("
331 << (binOfMax == 1 ?
"st"
332 : (binOfMax == 2 ?
"nd" : (binOfMax == 3 ?
"rd" :
"th")))
333 <<
" time sample). This may indicate faulty 'dccNormalizedWeights' "
334 "or 'ecalDccZs1sSample' parameters.";
341 int& binOfMax)
const {
345 vector<string> ebDigiParamList =
result.getParameterNames();
346 string bofm(
"binOfMaximum");
347 if (
find(ebDigiParamList.begin(), ebDigiParamList.end(), bofm) != ebDigiParamList.end()) {
348 binOfMax =
result.getParameter<
int>(
"binOfMaximum");
361 const char srpFlagMarker[] = {
'.',
'z',
'Z',
'F',
'4',
'5',
'6',
'7'};
365 const char*
date = ctime(&
t);
366 os <<
"#SRP flag map\n#\n"
381 <<
": full readout\n"
416 os <<
"# Event " <<
iEvent <<
"\n";
424 for (
size_t i = 0;
i <
sizeof(eeSrf) /
sizeof(
int); ((
int*)eeSrf)[
i++] = -1) {
428 int iZ0 =
flag.id().zside() > 0 ? 1 : 0;
429 int iX0 =
flag.id().ix() - 1;
430 int iY0 =
flag.id().iy() - 1;
432 assert(iX0 >= 0 && iX0 < nScX);
433 assert(iY0 >= 0 && iY0 < nScY);
434 eeSrf[iZ0][iX0][iY0] =
flag.value();
436 const int nEbTtEta = 34;
437 const int nEeTtEta = 11;
438 const int nTtEta = nEeTtEta * 2 + nEbTtEta;
439 const int nTtPhi = 72;
440 int ebSrf[nEbTtEta][nTtPhi];
441 for (
size_t i = 0;
i <
sizeof(ebSrf) /
sizeof(
int); ((
int*)ebSrf)[
i++] = -1) {
446 int iEta0 =
iEta + nTtEta / 2 - (
iEta >= 0 ? 1 : 0);
447 int iEbEta0 = iEta0 - nEeTtEta;
448 int iPhi0 =
flag.id().iphi() - 1;
449 assert(iEbEta0 >= 0 && iEbEta0 < nEbTtEta);
450 assert(iPhi0 >= 0 && iPhi0 < nTtPhi);
457 ebSrf[iEbEta0][iPhi0] =
flag.value();
463 for (
int iX0 = 0; iX0 < nScX; ++iX0) {
464 for (
int iY0 = 0; iY0 < nScY; ++iY0) {
465 int srFlag = eeSrf[0][iX0][iY0];
473 for (
int iEta0 = 0; iEta0 < nEbTtEta; ++iEta0) {
474 for (
int iPhi0 = 0; iPhi0 < nTtPhi; ++iPhi0) {
475 int srFlag = ebSrf[iEta0][iPhi0];
483 for (
int iX0 = 0; iX0 < nScX; ++iX0) {
484 for (
int iY0 = 0; iY0 < nScY; ++iY0) {
485 int srFlag = eeSrf[1][iX0][iY0];
499 <<
"Selective readout emulator, EcalSelectiveReadout, supports only single set of ZS weights. "
500 "while the configuration contains "
516 <<
"Inconsistency between number of weigth sets (" << settings.
dccNormalizedWeights_.size() <<
") and "