12 m_phiScaleTT(32./
M_PI)
77 std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>>
variables;
81 std::vector<MonitorTT> monTTs;
84 for (; ttIterator != ttIteratorEnd; ++ttIterator) {
85 const int layer = (*ttIterator)->layer();
87 const double eta = (*ttIterator)->eta();
88 if ( std::abs(eta) > 2.5)
continue;
90 if (!
tt->cpET())
continue;
93 const int em =
int(
tt->cpET());
96 monTT.
ttower=(*ttIterator);
98 monTTs.push_back(monTT);
102 const int had =
int(
tt->cpET());
105 monTT.
ttower=(*ttIterator);
107 monTTs.push_back(monTT);
113 auto mask_em_TT =
Monitored::Collection(
"mask_em_TT", monTTs, [](
const auto &tower ) {
return ( tower.ttower->layer()==0); } );
variables.push_back( mask_em_TT );
114 auto mask_had_TT =
Monitored::Collection(
"mask_had_TT", monTTs, [](
const auto &tower ){
return ( tower.ttower->layer()==1); } );
variables.push_back( mask_had_TT );
124 std::vector<int> errorsCMX(
m_crates * 2);
126 std::vector<MonitorCpmTT> monCpmTTs_em;
127 std::vector<MonitorCpmTT> monCpmTTs_had;
133 std::vector<MonitorCpmTT> monCpmOverlapTTs_em;
134 std::vector<MonitorCpmTT> monCpmOverlapTTs_had;
136 ATH_CHECK(
fillCpmTowerVectors(cpmTowerOverlapTES, monCpmOverlapTTs_em, monCpmOverlapTTs_had, errorsCPM, core, cpmLoc, GLinkParityError));
142 auto phiScaledCpmTT_em =
Monitored::Collection(
"phiScaledCpmTT_em", monCpmTTs_em, [](
const auto &
tt ){
return tt.phi_scaled;} );
143 variables.push_back( phiScaledCpmTT_em );
147 auto phiScaledCpmTT_had =
Monitored::Collection(
"phiScaledCpmTT_had", monCpmTTs_had, [](
const auto &
tt ){
return tt.phi_scaled;} );
148 variables.push_back( phiScaledCpmTT_had );
151 std::vector<MonitorCpmTT> monCpmTTs_em_tot(monCpmTTs_em.begin(),monCpmTTs_em.end());
152 monCpmTTs_em_tot.insert(monCpmTTs_em_tot.end(), monCpmOverlapTTs_em.begin(),monCpmOverlapTTs_em.end());
153 std::vector<MonitorCpmTT> monCpmTTs_had_tot(monCpmTTs_had.begin(),monCpmTTs_had.end());
154 monCpmTTs_had_tot.insert(monCpmTTs_had_tot.end(), monCpmOverlapTTs_had.begin(),monCpmOverlapTTs_had.end());
156 auto etaCpmTT_em_tot =
Monitored::Collection(
"etaCpmTT_em_tot", monCpmTTs_em_tot, [](
const auto &
tt ){
return tt.ttower->eta();} );
158 auto phiScaledCpmTT_em_tot =
Monitored::Collection(
"phiScaledCpmTT_em_tot", monCpmTTs_em_tot, [](
const auto &
tt ){
return tt.phi_scaled;} );
159 variables.push_back( phiScaledCpmTT_em_tot );
160 auto etaCpmTT_had_tot =
Monitored::Collection(
"etaCpmTT_had_tot", monCpmTTs_had_tot, [](
const auto &
tt ){
return tt.ttower->eta();} );
162 auto phiScaledCpmTT_had_tot =
Monitored::Collection(
"phiScaledCpmTT_had_tot", monCpmTTs_had_tot, [](
const auto &
tt ){
return tt.phi_scaled;} );
163 variables.push_back( phiScaledCpmTT_had_tot );
167 auto parityErrorCpmTT_em =
Monitored::Collection(
"parityErrorCpmTT_em", monCpmTTs_em_tot, [](
const auto &
tt ){
return tt.emParityError;} );
168 variables.push_back( parityErrorCpmTT_em );
169 auto linkDownErrorCpmTT_em =
Monitored::Collection(
"linkDownErrorCpmTT_em", monCpmTTs_em_tot, [](
const auto &
tt ){
return tt.emLinkDownError;} );
170 variables.push_back( linkDownErrorCpmTT_em );
171 auto parityErrorCpmTT_had =
Monitored::Collection(
"parityErrorCpmTT_had", monCpmTTs_had_tot, [](
const auto &
tt ){
return tt.hadParityError;} );
172 variables.push_back( parityErrorCpmTT_had );
173 auto linkDownErrorCpmTT_had =
Monitored::Collection(
"linkDownErrorCpmTT_had", monCpmTTs_had_tot, [](
const auto &
tt ){
return tt.hadLinkDownError;} );
174 variables.push_back( linkDownErrorCpmTT_had );
177 std::vector<MonitorCpmTT> monCpmTTs_tot(monCpmTTs_em_tot.begin(),monCpmTTs_em_tot.end());
178 monCpmTTs_tot.insert(monCpmTTs_tot.end(), monCpmTTs_had_tot.begin(),monCpmTTs_had_tot.end());
180 auto peakCpmTT_tot =
Monitored::Collection(
"peakCpmTT_tot", monCpmTTs_tot, [](
const auto &
tt ){
return tt.ttower->peak();} );
189 std::vector<MonitorTobRoI> monTobRoIsEner;
190 std::vector<MonitorTobRoI> monTobRoIsIsol;
193 std::vector<int> tobCount(vecSize);
202 for (; crIterator != crIteratorEnd; ++crIterator) {
203 const int type = (*crIterator)->type();
204 const int energy = (*crIterator)->energy();
205 const int isolation = (*crIterator)->isolation();
207 const double eta =
coord.eta();
208 const double phi =
coord.phi();
210 const double etaMod = eta - 0.05;
213 monTobRoI.
tobroi=(*crIterator);
216 monTobRoIsEner.push_back(monTobRoI);
225 thresholdWeightsEm = isolbits[thr];
229 thresholdWeightsTau = isolbits[thr];
236 monTobRoI.
tobroi=(*crIterator);
239 monTobRoIsIsol.push_back(monTobRoI);
241 const int crate = (*crIterator)->crate();
242 const int cpm = (*crIterator)->cpm();
246 auto etaTobRoIsEner =
Monitored::Collection(
"etaTobRoIsEner", monTobRoIsEner, [](
const auto &roi ){
return roi.etaMod;} );
248 auto phiTobRoIsEner =
Monitored::Collection(
"phiTobRoIsEner", monTobRoIsEner, [](
const auto &roi ){
return roi.phiMod;} );
250 auto energyTobRoIsEner =
Monitored::Collection(
"energyTobRoIsEner", monTobRoIsEner, [](
const auto &roi ){
return roi.tobroi->energy();} );
252 auto typeTobRoIsEner =
Monitored::Collection(
"typeTobRoIsEner", monTobRoIsEner, [](
const auto &roi ){
return roi.tobroi->type();} );
256 auto mask_tobroi_ener_em =
Monitored::Collection(
"mask_tobroi_ener_em", monTobRoIsEner, [](
const auto &roi ) {
return ( roi.tobroi->type()==0); } );
257 variables.push_back( mask_tobroi_ener_em );
258 auto mask_tobroi_ener_tau =
Monitored::Collection(
"mask_tobroi_ener_tau", monTobRoIsEner, [](
const auto &roi ){
return ( roi.tobroi->type()==1); } );
259 variables.push_back( mask_tobroi_ener_tau );
262 auto etaTobRoIsIsol =
Monitored::Collection(
"etaTobRoIsIsol", monTobRoIsIsol, [](
const auto &roi ){
return roi.etaMod;} );
264 auto phiTobRoIsIsol =
Monitored::Collection(
"phiTobRoIsIsol", monTobRoIsIsol, [](
const auto &roi ){
return roi.phiMod;} );
266 auto energyTobRoIsIsol =
Monitored::Collection(
"energyTobRoIsIsol", monTobRoIsIsol, [](
const auto &roi ){
return roi.tobroi->isolation();} );
269 auto mask_tobroi_isol_em =
Monitored::Collection(
"mask_tobroi_isol_em", monTobRoIsIsol, [](
const auto &roi ) {
return ( roi.tobroi->type()==0); } );
270 variables.push_back( mask_tobroi_isol_em );
271 auto mask_tobroi_isol_tau =
Monitored::Collection(
"mask_tobroi_isol_tau", monTobRoIsIsol, [](
const auto &roi ){
return ( roi.tobroi->type()==1); } );
272 variables.push_back( mask_tobroi_isol_tau );
276 std::vector<int> tobCountEm;
277 std::vector<int> tobCountTau;
278 for (
int crate = 0; crate <
m_crates; ++crate) {
279 for (
int cpm = 1; cpm <=
m_modules; ++cpm) {
285 tobCountEm.push_back(
val);
287 tobCountTau.push_back(
val);
301 std::vector<MonitorCmxCpTob> monCmxCpTobEnerLeft;
302 std::vector<MonitorCmxCpTob> monCmxCpTobEnerRight;
303 std::vector<MonitorCmxCpTob> monCmxCpTobError;
304 std::vector<MonitorCmxCpTob> monCmxCpTobIsolLeft;
305 std::vector<MonitorCmxCpTob> monCmxCpTobIsolRight;
307 tobCount.assign(vecSize, 0);
308 std::vector<int> cmxCount(
m_crates * 2);
316 for (; cmxCpTobIter != cmxCpTobIterEnd; ++cmxCpTobIter) {
317 const uint8_t crate = (*cmxCpTobIter)->crate();
318 const uint8_t cpm = (*cmxCpTobIter)->cpm();
319 const uint8_t cmx = (*cmxCpTobIter)->cmx();
320 const uint8_t chip = (*cmxCpTobIter)->chip();
321 const uint8_t location = (*cmxCpTobIter)->location();
323 const uint8_t isolation = (*cmxCpTobIter)->isolation();
326 const uint8_t y = chip * 4 + location;
329 monCmxCpTob.
tob=(*cmxCpTobIter);
333 monCmxCpTobEnerRight.push_back(monCmxCpTob);
335 monCmxCpTobEnerLeft.push_back(monCmxCpTob);
339 monCmxCpTob.
tob=(*cmxCpTobIter);
343 monCmxCpTobIsolRight.push_back(monCmxCpTob);
345 monCmxCpTobIsolLeft.push_back(monCmxCpTob);
347 int nBits=1;
int offset = 0;
348 const int mask = (1 << nBits) - 1;
350 const int hit = (isolation >> (nBits*thr)) &
mask;
353 cmxCpmTobsIsolBitsRight=thr+
offset;
354 cmxCpmTobsIsolBitsRightW=hit;
357 cmxCpmTobsIsolBitsLeft=thr+
offset;
358 cmxCpmTobsIsolBitsLeftW=hit;
366 monCmxCpTob.
tob=(*cmxCpTobIter);
374 const int ybase = cmx * 5;
375 monCmxCpTob.
ybase=ybase;
402 if (parity) errorsCMX[crate * 2 + cmx] |= (1 <<
TOBParity);
405 monCmxCpTobError.push_back(monCmxCpTob);
409 ++tobCount[
x * 2 + cmx];
410 ++cmxCount[crate * 2 + cmx];
418 for (
int crate = 0; crate <
m_crates; ++crate) {
419 for (
int cpm = 1; cpm <=
m_modules; ++cpm) {
420 for (
int cmx = 0; cmx < 2; ++cmx) {
421 int val = tobCount[(crate *
m_modules + cpm - 1) * 2 + cmx];
434 for (
int cmx = 0; cmx < 2; ++cmx) {
435 int val = cmxCount[crate * 2 + cmx];
452 auto cmxCpmTobsEnerLeft =
Monitored::Collection(
"cmxCpmTobsEnerLeft", monCmxCpTobEnerLeft, [](
const auto &tob ){
return tob.tob->energy();} );
454 auto cmxCpmTobsEnerRight =
Monitored::Collection(
"cmxCpmTobsEnerRight", monCmxCpTobEnerRight, [](
const auto &tob ){
return tob.tob->energy();} );
455 variables.push_back(cmxCpmTobsEnerRight);
457 auto cmxCpmTobsEnerXLeft =
Monitored::Collection(
"cmxCpmTobsEnerXLeft", monCmxCpTobEnerLeft, [](
const auto &tob ){
return tob.x;} );
458 variables.push_back(cmxCpmTobsEnerXLeft);
459 auto cmxCpmTobsEnerYLeft =
Monitored::Collection(
"cmxCpmTobsEnerYLeft", monCmxCpTobEnerLeft, [](
const auto &tob ){
return tob.y;} );
460 variables.push_back(cmxCpmTobsEnerYLeft);
461 auto cmxCpmTobsEnerXRight =
Monitored::Collection(
"cmxCpmTobsEnerXRight", monCmxCpTobEnerRight, [](
const auto &tob ){
return tob.x;} );
462 variables.push_back(cmxCpmTobsEnerXRight);
463 auto cmxCpmTobsEnerYRight =
Monitored::Collection(
"cmxCpmTobsEnerYRight", monCmxCpTobEnerRight, [](
const auto &tob ){
return tob.y;} );
464 variables.push_back(cmxCpmTobsEnerYRight);
467 auto cmxCpmTobsIsolLeft =
Monitored::Collection(
"cmxCpmTobsIsolLeft", monCmxCpTobIsolLeft, [](
const auto &tob ){
return tob.tob->isolation();} );
469 auto cmxCpmTobsIsolRight =
Monitored::Collection(
"cmxCpmTobsIsolRight", monCmxCpTobIsolRight, [](
const auto &tob ){
return tob.tob->isolation();} );
470 variables.push_back(cmxCpmTobsIsolRight);
472 auto cmxCpmTobsIsolXLeft =
Monitored::Collection(
"cmxCpmTobsIsolXLeft", monCmxCpTobIsolLeft, [](
const auto &tob ){
return tob.x;} );
473 variables.push_back(cmxCpmTobsIsolXLeft);
474 auto cmxCpmTobsIsolYLeft =
Monitored::Collection(
"cmxCpmTobsIsolYLeft", monCmxCpTobIsolLeft, [](
const auto &tob ){
return tob.y;} );
475 variables.push_back(cmxCpmTobsIsolYLeft);
476 auto cmxCpmTobsIsolXRight =
Monitored::Collection(
"cmxCpmTobsIsolXRight", monCmxCpTobIsolRight, [](
const auto &tob ){
return tob.x;} );
477 variables.push_back(cmxCpmTobsIsolXRight);
478 auto cmxCpmTobsIsolYRight =
Monitored::Collection(
"cmxCpmTobsIsolYRight", monCmxCpTobIsolRight, [](
const auto &tob ){
return tob.y;} );
479 variables.push_back(cmxCpmTobsIsolYRight);
482 auto cmxCpmTobsErrorX =
Monitored::Collection(
"cmxCpmTobsErrorX", monCmxCpTobError, [](
const auto &tob ){
return tob.x;} );
484 auto cmxCpmTobsErrorCmx =
Monitored::Collection(
"cmxCpmTobsErrorCmx", monCmxCpTobError, [](
const auto &tob ){
return tob.tob->cmx();} );
486 auto cmxCpmTobsErrorYbase =
Monitored::Collection(
"cmxCpmTobsErrorYbase", monCmxCpTobError, [](
const auto &tob ){
return tob.ybaseError;} );
487 variables.push_back(cmxCpmTobsErrorYbase);
489 auto cmxCpmTobsErrorParity =
Monitored::Collection(
"cmxCpmTobsErrorParity", monCmxCpTobError, [](
const auto &tob ){
return tob.parityError;} );
490 variables.push_back(cmxCpmTobsErrorParity);
497 std::vector<MonitorCmxCpHits> monCmxCpHits;
498 std::vector<MonitorCmxCpHits> monCmxCpHitsLeft;
499 std::vector<MonitorCmxCpHits> monCmxCpHitsRight;
522 for (; cmIterator != cmIteratorEnd; ++cmIterator) {
523 const uint32_t hits0 = (*cmIterator)->hits0();
524 const uint32_t hits1 = (*cmIterator)->hits1();
525 const uint8_t crate = (*cmIterator)->crate();
526 const uint8_t cmx = (*cmIterator)->cmx();
529 const uint8_t crateCmx = crate * 2 + cmx;
533 monCmxCpHit.
hit=(*cmIterator);
543 const int mask = (1 << nBits) - 1;
544 for (
int thr = 0; thr <
m_modules; ++thr) {
545 const int hit = (hits0 >> (nBits*thr)) &
mask;
559 const int mask = (1 << nBits) - 1;
560 for (
int thr = 0; thr < (
m_modules/2); ++thr) {
561 const int hit = (hits0 >> (nBits*thr)) &
mask;
564 cmxCpCountsY=crateCmx;
571 const int val = (hits0 >> (
mod * 3)) & 0x7;
574 cmxTopoTobsCpmRight=
val;
577 cmxTopoTobsCpmLeft=
val;
581 cmxCount[crate * 2 + cmx] +=
val;
587 const int mask = (1 << nBits) - 1;
588 for (
int thr = 0; thr < (
m_modules/2); ++thr) {
589 const int hit = (hits1 >> (nBits*thr)) &
mask;
592 cmxCpCountsY=crateCmx;
598 const int val = (hits1 >> (
mod * 3)) & 0x7;
601 cmxTopoTobsCpmRight=
val;
604 cmxTopoTobsCpmLeft=
val;
608 cmxCount[crate * 2 + cmx] +=
val;
622 const int mask = (1 << nBits) - 1;
624 for (
int thr = 0; thr < nThresh; ++thr) {
625 const int hit = (hits0 >> (nBits*thr)) &
mask;
628 cmxCpThresBinRightX=
bin;
629 cmxCpThresBinRightY=thr+
offset;
630 cmxCpThresBinRightHit=hit;
631 fill(
m_packageName,cmxCpThresBinRightX,cmxCpThresBinRightY,cmxCpThresBinRightHit);
633 cmxCpThresBinLeftX=
bin;
634 cmxCpThresBinLeftY=thr+
offset;
635 cmxCpThresBinLeftHit=hit;
645 const int offset = nThresh;
646 const int mask = (1 << nBits) - 1;
647 for (
int thr = 0; thr < nThresh; ++thr) {
648 const int hit = (hits1 >> (nBits*thr)) &
mask;
651 cmxCpThresBinRightX=
bin;
652 cmxCpThresBinRightY=thr+
offset;
653 cmxCpThresBinRightHit=hit;
654 fill(
m_packageName,cmxCpThresBinRightX,cmxCpThresBinRightY,cmxCpThresBinRightHit);
656 cmxCpThresBinLeftX=
bin;
657 cmxCpThresBinLeftY=thr+
offset;
658 cmxCpThresBinLeftHit=hit;
667 monCmxCpHits.push_back(monCmxCpHit);
669 monCmxCpHitsRight.push_back(monCmxCpHit);
671 monCmxCpHitsLeft.push_back(monCmxCpHit);
675 auto cmxCpmHitsPeak =
Monitored::Collection(
"cmxCpHitsPeak", monCmxCpHits, [](
const auto &hit ){
return hit.hit->peak();} );
677 auto cmxCpmHitsCrateSlices =
Monitored::Collection(
"cmxCpHitsCrateSlices", monCmxCpHits, [](
const auto &hit ){
return hit.crateSlices;} );
678 variables.push_back(cmxCpmHitsCrateSlices);
679 auto cmxCpmHitsCrateCmx =
Monitored::Collection(
"cmxCpHitsCrateCmx", monCmxCpHits, [](
const auto &hit ){
return hit.crateCmx;} );
682 auto cmxCpmHitsHits0 =
Monitored::Collection(
"cmxCpHitsHits0", monCmxCpHits, [](
const auto &hit ){
return hit.hit->hits0();} );
684 auto cmxCpmHitsHits1 =
Monitored::Collection(
"cmxCpHitsHits1", monCmxCpHits, [](
const auto &hit ){
return hit.hit->hits1();} );
687 auto cmxCpmHits0TopoCheckSum =
Monitored::Collection(
"cmxCpHits0TopoCheckSum", monCmxCpHits, [](
const auto &hit ){
return (hit.hit->hits0() && hit.srcTopoCheckSum);} );
688 variables.push_back(cmxCpmHits0TopoCheckSum);
693 for (
int crate = 0; crate <
m_crates; ++crate) {
694 for (
int cmx = 0; cmx < 2; ++cmx) {
695 int val = cmxCount[crate * 2 + cmx];
699 cmxCpTopoTobsCmxLeft=
val;
702 cmxCpTopoTobsCmxRight=
val;
714 std::vector<int> crateErr(4);
718 if ((errorsCPM[loc] >>
err) & 0
x1) {
726 if ((errorsCMX[loc] >>
err) & 0x1) {
731 crateErr[loc / 2] |= (1 <<
err);
739 cpmErrorSummary_Events=
err;
748 auto save = std::make_unique<std::vector<int>>(crateErr);
752 return StatusCode::FAILURE;
757 return StatusCode::SUCCESS;
765 std::vector<bool> nthres(nThresh,
false);
768 const int mask = (1 << nBits) - 1;
769 for (
int thr = 0; thr < nThresh; ++thr) {
770 const int hit = (
val >> (nBits*thr)) &
mask;
771 nthres[thr] =
bool(hit);
781 std::vector<MonitorCpmTT> &monCpmTTs_em, std::vector<MonitorCpmTT> &monCpmTTs_had,
782 std::vector<int> &errorsCPM,
791 for (; ctIterator != ctIteratorEnd; ++ctIterator) {
795 const double eta =
ct->eta();
796 const double phi =
ct->phi();
803 const unsigned int loc = crate *
m_modules + cpm - 1;
806 if (loc >= errorsCPM.size()) {
807 ATH_MSG_ERROR(
"Crate/module index out of range: " << loc <<
" >= "
808 << errorsCPM.size() <<
" crate " << crate
810 <<
" eta " << eta <<
" phi " << phi <<
811 " cpm " << cpm <<
" slices " <<
slices <<
817 bool emParityError=
false;
818 bool emLinkDownError=
false;
820 if (
error && loc < errorsCPM.size()) {
827 emLinkDownError=
true;
828 errorsCPM[loc] |= (1 <<
EMLink);
833 for (
int bit = 0; bit < 8; ++bit) {
834 if ((
status >> bit) & 0x1) {
835 GLinkParityError=bit;
843 bool hadParityError=
false;
844 bool hadLinkDownError=
false;
846 if (
error && loc < errorsCPM.size()) {
853 hadLinkDownError=
true;
854 errorsCPM[loc] |= (1 <<
HadLink);
867 monCpmTTs_em.push_back(monTT);
870 monCpmTTs_had.push_back(monTT);
876 return StatusCode::SUCCESS;