141 <<
" BCID = " << eventInfo->
bcid()
144 const std::vector<xAOD::EventInfo::StreamTag>& eventStreamTags = eventInfo->
streamTags();
145 if (!eventStreamTags.empty()) {
146 msg(MSG::DEBUG) <<
" stream name/type:";
147 for (
const auto& eventStreamTag : eventStreamTags) {
148 msg(MSG::DEBUG) <<
" " << eventStreamTag.name() <<
"/" << eventStreamTag.type();
156 static const float energyWeight[6] = {1.f/3.f, 1.f/6.f, 1.f/11.f, 1.f/11.f, 1.f/28.f, 1.f/28.f};
157 static const int gapScintIndex[6] = {0, 1, 2, 2, 3, 3};
159 std::vector<const CaloCell*> muonCells;
161 std::vector<int> energyBalModPartModule;
162 std::vector<int> energyBalModPartPartition;
164 std::vector<int> timeBalModPartModule;
165 std::vector<int> timeBalModPartPartition;
172 int nCellsOverThreshold[
MAX_PART]{};
178 unsigned int nMaskedChannelsDueDQ[
MAX_PART]{};
181 unsigned int nMaskedCellsDueDQ[
MAX_PART]{};
183 std::vector<int> negOccupModule[Tile::MAX_ROS - 1];
184 std::vector<int> negOccupChannel[Tile::MAX_ROS - 1];
186 std::vector<float> timeBal[Tile::MAX_ROS - 1];
187 std::vector<int> timeBalModule[Tile::MAX_ROS - 1];
189 std::vector<float> energyBal[Tile::MAX_ROS - 1];
190 std::vector<int> energyBalModule[Tile::MAX_ROS - 1];
192 std::vector<int> detailOccupModule[Tile::MAX_ROS - 1];
193 std::vector<int> detailOccupChannel[Tile::MAX_ROS - 1];
194 std::vector<float> detailOccupEnergies[Tile::MAX_ROS - 1];
196 std::vector<int> detailOccupGainModule[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
197 std::vector<int> detailOccupGainChannel[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
198 std::vector<float> detailOccupGainEnergies[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
200 std::vector<int> overThrOccupModule[Tile::MAX_ROS - 1];
201 std::vector<int> overThrOccupChannel[Tile::MAX_ROS - 1];
202 std::vector<float> overThrOccupWeight[Tile::MAX_ROS - 1];
204 std::vector<int> overThrOccupGainModule[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
205 std::vector<int> overThrOccupGainChannel[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
206 std::vector<float> overThrOccupGainWeight[Tile::MAX_ROS - 1][Tile::MAX_GAIN];
208 std::vector<int> overThr30GeVOccupModule[Tile::MAX_ROS - 1];
209 std::vector<int> overThr30GeVOccupChannel[Tile::MAX_ROS - 1];
211 std::vector<int> overThr300GeVOccupModule[Tile::MAX_ROS - 1];
212 std::vector<int> overThr300GeVOccupChannel[Tile::MAX_ROS - 1];
214 std::vector<int> eneDiff[Tile::MAX_ROS - 1];
215 std::vector<int> eneDiffChannel[Tile::MAX_ROS - 1];
216 std::vector<int> eneDiffModule[Tile::MAX_ROS - 1];
218 std::vector<int> maskedOnFlyDrawers[Tile::MAX_ROS - 1];
219 std::vector<int> maskedOnFlyChannel[Tile::MAX_ROS - 1];
221 std::vector<int> chanTime[Tile::MAX_ROS - 1];
222 std::vector<int> chanTimeDrawer[Tile::MAX_ROS - 1];
223 std::vector<int> chanTimeChannel[Tile::MAX_ROS - 1];
224 std::vector<int> chanTimeDigitizer[Tile::MAX_ROS - 1];
226 int nChannelsInPartition = 2880;
227 for (
unsigned int partition = 0; partition < Tile::MAX_ROS - 1; ++partition) {
228 if (partition > 1) nChannelsInPartition = 2048;
229 detailOccupModule[partition].reserve(nChannelsInPartition);
230 detailOccupChannel[partition].reserve(nChannelsInPartition);
231 detailOccupEnergies[partition].reserve(nChannelsInPartition);
234 std::vector<float> occupEta[
SAMP_ALL];
235 std::vector<float> occupPhi[
SAMP_ALL];
236 std::vector<float> occupEnergy[
SAMP_ALL];
238 std::vector<float> overThrOccupEta[
SAMP_ALL];
239 std::vector<float> overThrOccupPhi[
SAMP_ALL];
241 std::vector<float> sampChanTime[Tile::MAX_ROS - 1][
SAMP_ALL];
242 std::vector<float> sampEnergyDiff[Tile::MAX_ROS - 1][
SAMP_ALL];
243 std::vector<float> sampTimeDiff[Tile::MAX_ROS - 1][
SAMP_ALL];
255 bool isCollision =
true;
261 for (
const CaloCell* cell : *caloCellContainer) {
269 if (tile_cell == 0)
continue;
281 bool isMaskedChannel1 =
false;
282 bool isMaskedAdc1 =
false;
283 bool isMaskedAdc2 =
false;
285 int gain1 = tile_cell->
gain1();
286 int gain2 = tile_cell->
gain2();
296 partition1 = ros1 - 1;
305 partition2 = ros2 - 1;
321 bool single_PMT = single_PMT_C10 || single_PMT_scin;
325 bool realCell = single_PMT_C10 ||
m_cabling->TileGap_connected(
id);
328 bool isBadChannel1 = tile_cell->
badch1();
329 bool isBadChannel2 = tile_cell->
badch2();
331 int isCellGood = !tile_cell->
badcell();
337 double energy = cell->energy();
338 double time = cell->time();
339 double eta = cell->eta();
340 double phi = cell->phi();
341 double energy1 = tile_cell->
ene1();
342 double energy2 = tile_cell->
ene2();
343 double energyDiff = (single_PMT) ? 0.0 : tile_cell->
eneDiff();
344 double energyRatio = (energy != 0.0) ? energyDiff/energy : 0.0;
345 double time1 = tile_cell->
time1();
346 double time2 = tile_cell->
time2();
347 double timeDiff = (single_PMT) ? 0.0 : 2. * tile_cell->
timeDiff();
350 if (single_PMT_scin) {
352 if (tower > 9 && tower < 16) {
353 weight = energyWeight[tower - 10];
357 int idx = tower - 10;
358 if (idx >= 0 && idx <
static_cast<int>(std::size(gapScintIndex))) {
359 int gapScintIdx = gapScintIndex[idx];
360 unsigned int partition = (ros1 > 0) ? ros1 - 3 : ros2 - 3;
368 if (
msgLvl(MSG::VERBOSE)) {
370 msg(MSG::VERBOSE) <<
"Identifier: " <<
id <<
" " <<
m_tileID->to_string(
id,-2) <<
endmsg;
371 msg(MSG::VERBOSE) <<
" region: " <<
m_tileID->region(
id)
372 <<
" system: " <<
m_tileID->system(
id)
373 <<
" section: "<<
m_tileID->section(
id)
375 <<
" module: " <<
m_tileID->module(
id)
376 <<
" tower: " <<
m_tileID->tower(
id)
379 msg(MSG::VERBOSE) <<
"1st PMT ROS: " << ros1
380 <<
" drawer: " << drawer
381 <<
" ch1: " << channel1
382 <<
" gain1: " << gain1
383 <<
" qual1: " << (int)tile_cell->
qual1()
384 <<
" qbit1: " << (int)tile_cell->
qbit1()
385 << ((drawer != module) ?
" drawer != module":
" ") <<
endmsg;
387 msg(MSG::VERBOSE) <<
"2nd PMT ROS: " << ros2
388 <<
" drawer: " << drawer
389 <<
" ch2: " << channel2
390 <<
" gain2: " << gain2
391 <<
" qual2: " << (int)tile_cell->
qual2()
392 <<
" qbit2: " << (int)tile_cell->
qbit2()
393 << ((ros1 != ros2) ?
" ros1 != ros2" :
" ") <<
endmsg;
395 msg(MSG::VERBOSE) <<
"Bad status: " << !isCellGood
396 <<
" bad1: " << isBadChannel1
397 <<
" bad2: " << isBadChannel2
398 << ((single_PMT_scin && isBadChannel1 && !isMaskedChannel1)
399 ?
" NEW BAD E-cell" :
" ") <<
endmsg ;
401 msg(MSG::VERBOSE) <<
" real_cell: " << ((realCell) ?
"true" :
"false")
402 <<
" E-cell: " << ((single_PMT_scin) ?
"true" :
"false")
403 <<
" specC10: " << ((single_PMT_C10) ?
"true" :
"false") <<
endmsg;
405 msg(MSG::VERBOSE) <<
"Energy= " << energy <<
" = " << energy1 <<
" + " << energy2
406 <<
" ediff= " << energyDiff
407 <<
" eratio= " << energyRatio
408 <<
"\t Energy[GeV]= " << energy/
GeV <<
endmsg ;
410 msg(MSG::VERBOSE) <<
"Time= " << time <<
" = (" << time1 <<
" + " << time2 <<
")/2 "
411 <<
"tdiff= " << timeDiff
412 <<
"\t time[ns]= " << time/ns <<
endmsg ;
422 int quality1 = (int)tile_cell->
qual1();
423 int quality2 = (int)tile_cell->
qual2();
424 if (isBadChannel1 != isBadChannel2 && quality1 != quality2
425 && quality1 < 255 && quality2 < 255) {
426 if (isBadChannel1 && isOkChannel1) dbGain1 = 1 - gain1;
427 if (isBadChannel2 && isOkChannel2) dbGain2 = 1 - gain2;
440 bool channel1MaskedDueDQ(
false);
441 if (isBadChannel1 && isOkChannel1 && !(single_PMT_C10 && channel1 == 4)) {
443 ++nBadChannelsOnFly[partition1];
444 maskedOnFlyDrawers[partition1].push_back(drawer);
445 maskedOnFlyChannel[partition1].push_back(channel1);
447 if (!dqStatus->
isAdcDQgood(ros1, drawer, channel1, gain1)) {
448 channel1MaskedDueDQ =
true;
449 ++nMaskedChannelsDueDQ[partition1];
454 bool channel2MaskedDueDQ(
false);
455 if (isBadChannel2 && isOkChannel2 && !(single_PMT_C10 && channel2 == 4)) {
457 ++nBadChannelsOnFly[partition2];
458 maskedOnFlyDrawers[partition2].push_back(drawer);
459 maskedOnFlyChannel[partition2].push_back(channel2);
461 if (!dqStatus->
isAdcDQgood(ros2, drawer, channel2, gain2)) {
462 channel2MaskedDueDQ =
true;
463 ++nMaskedChannelsDueDQ[partition2];
473 muonCells.push_back(cell);
475 occupEta[sample].push_back(
eta);
476 occupPhi[sample].push_back(
phi);
477 occupEnergy[sample].push_back(energy);
480 detailOccupModule[partition1].push_back(module);
481 detailOccupChannel[partition1].push_back(channel1);
482 detailOccupEnergies[partition1].push_back(energy1 * weight);
484 detailOccupGainModule[partition1][gain1].push_back(module);
485 detailOccupGainChannel[partition1][gain1].push_back(channel1);
486 detailOccupGainEnergies[partition1][gain1].push_back(energy1 * weight);
490 detailOccupModule[partition2].push_back(module);
491 detailOccupChannel[partition2].push_back(channel2);
492 detailOccupEnergies[partition2].push_back(energy2);
494 detailOccupGainModule[partition2][gain2].push_back(module);
495 detailOccupGainChannel[partition2][gain2].push_back(channel2);
496 detailOccupGainEnergies[partition2][gain2].push_back(energy2);
500 ++nBadCells[partition1];
501 if (channel1MaskedDueDQ || channel2MaskedDueDQ) {
502 ++nMaskedCellsDueDQ[partition1];
508 negOccupModule[partition1].push_back(module);
509 negOccupChannel[partition1].push_back(channel1);
513 negOccupModule[partition2].push_back(module);
514 negOccupChannel[partition2].push_back(channel2);
522 if ((gain1 == 0) && (energy1 < 1000.)) {
523 ATH_MSG_DEBUG(
"Low energy in LG for time monitoring: " << Tile::getDrawerString(ros1, drawer)
524 <<
", channel = " << channel1 <<
", energy = " << energy1 <<
", time = " << time1);
526 chanTime[partition1].push_back(time1);
527 chanTimeDrawer[partition1].push_back(drawer);
528 chanTimeChannel[partition1].push_back(channel1);
529 chanTimeDigitizer[partition1].push_back(
getDigitizer(channel1));
531 sampChanTime[partition1][sample].push_back(time1);
537 if ((gain2 == 0) && (energy2 < 1000.)) {
538 ATH_MSG_DEBUG(
"Low energy in LG for time monitoring: " << Tile::getDrawerString(ros2, drawer)
539 <<
", channel = " << channel2 <<
", energy = " << energy2 <<
", time = " << time2);
541 chanTime[partition2].push_back(time2);
542 chanTimeDrawer[partition2].push_back(drawer);
543 chanTimeChannel[partition2].push_back(channel2);
544 chanTimeDigitizer[partition2].push_back(
getDigitizer(channel2));
546 sampChanTime[partition2][sample].push_back(time2);
552 overThrOccupEta[sample].push_back(
eta);
553 overThrOccupPhi[sample].push_back(
phi);
556 overThrOccupModule[partition1].push_back(module);
557 overThrOccupChannel[partition1].push_back(channel1);
558 overThrOccupWeight[partition1].push_back(weight);
561 overThrOccupGainModule[partition1][gain1].push_back(module);
562 overThrOccupGainChannel[partition1][gain1].push_back(channel1);
563 overThrOccupGainWeight[partition1][gain1].push_back(weight);
566 if (energy1 > 30000.) {
567 overThr30GeVOccupModule[partition1].push_back(module);
568 overThr30GeVOccupChannel[partition1].push_back(channel1);
570 if (energy1 > 300000.) {
571 overThr300GeVOccupModule[partition1].push_back(module);
572 overThr300GeVOccupChannel[partition1].push_back(channel1);
578 overThrOccupModule[partition2].push_back(module);
579 overThrOccupChannel[partition2].push_back(channel2);
580 overThrOccupWeight[partition2].push_back(1.0F);
583 overThrOccupGainModule[partition2][gain2].push_back(module);
584 overThrOccupGainChannel[partition2][gain2].push_back(channel2);
585 overThrOccupGainWeight[partition2][gain2].push_back(1.0F);
588 if (energy2 > 30000.) {
589 overThr30GeVOccupModule[partition2].push_back(module);
590 overThr30GeVOccupChannel[partition2].push_back(channel2);
592 if (energy2 > 300000.) {
593 overThr300GeVOccupModule[partition2].push_back(module);
594 overThr300GeVOccupChannel[partition2].push_back(channel2);
602 if ((gain1 == 0 && gain2 == 1 && (energy1 < 2000 || energy2 < 10 || std::abs(energy1 / energy2) > 5))
603 || (gain1 == 1 && gain2 == 0 && (energy2 < 2000 || energy1 < 10 || std::abs(energy2 / energy1) > 5))) {
605 fillEneAndTimeDiff =
false;
609 if (!(isBadChannel1 || isBadChannel2 || single_PMT)) {
612 energyBalModPartModule.push_back(module);
613 energyBalModPartPartition.push_back(partition1);
619 timeBalModPartModule.push_back(module);
620 timeBalModPartPartition.push_back(partition1);
623 energyBal[partition1].push_back(energyRatio);
624 energyBalModule[partition1].push_back(module);
626 eneDiff[partition1].push_back(energyDiff);
627 eneDiffChannel[partition1].push_back(channel1);
628 eneDiffModule[partition1].push_back(module);
630 eneDiff[partition2].push_back(-1.0 * energyDiff);
631 eneDiffChannel[partition2].push_back(channel2);
632 eneDiffModule[partition2].push_back(module);
634 if (fillEneAndTimeDiff) {
635 sampEnergyDiff[partition1][sample].push_back(energyDiff);
641 timeBal[partition1].push_back(timeDiff);
642 timeBalModule[partition1].push_back(module);
644 if (fillEneAndTimeDiff) {
645 sampTimeDiff[partition1][sample].push_back(timeDiff);
649 moduleCorr[partition1].
inputxy(module);
653 if (partition1 >= 0) {
656 ++nCellsOverThreshold[partition1];
661 if (partition1 >= 0) {
663 ++nCells[partition1];
666 energySample[partition1][sample] += energy;
672 for (
int partition = 0; partition <
PART_ALL; ++partition) {
674 nCells[
PART_ALL] += nCells[partition];
675 nBadCells[
PART_ALL] += nBadCells[partition];
677 nBadChannelsOnFly[
PART_ALL] += nBadChannelsOnFly[partition];
678 nCellsOverThreshold[
PART_ALL] += nCellsOverThreshold[partition];
680 nMaskedChannelsDueDQ[
PART_ALL] += nMaskedChannelsDueDQ[partition];
681 nMaskedCellsDueDQ[
PART_ALL] += nMaskedCellsDueDQ[partition];
683 for (
int sample = 0; sample <
SAMP_ALL; ++sample) {
684 energySample[partition][
SAMP_ALL] += energySample[partition][sample];
685 energySample[
PART_ALL][sample] += energySample[partition][sample];
693 msg(MSG::DEBUG) <<
"N Cells: "
702 msg(MSG::DEBUG) <<
"AboveThr: "
703 <<
" " << nCellsOverThreshold[
PART_LBA]
704 <<
" " << nCellsOverThreshold[
PART_LBC]
705 <<
" " << nCellsOverThreshold[
PART_EBA]
706 <<
" " << nCellsOverThreshold[
PART_EBC]
709 msg(MSG::DEBUG) <<
"MaskOnFly:"
710 <<
" " << nBadChannelsOnFly[
PART_LBA]
711 <<
" " << nBadChannelsOnFly[
PART_LBC]
712 <<
" " << nBadChannelsOnFly[
PART_EBA]
713 <<
" " << nBadChannelsOnFly[
PART_EBC]
716 msg(MSG::DEBUG) <<
"EneSampA:"
723 msg(MSG::DEBUG) <<
"EneSampB:"
730 msg(MSG::DEBUG) <<
"EneSampD:"
737 msg(MSG::DEBUG) <<
"EneSampE:"
744 msg(MSG::DEBUG) <<
"EneTotal:"
754 std::vector<int> partitions(Tile::MAX_ROS);
755 std::iota(partitions.begin(), partitions.end(), 0);
759 fill(
"TileBadCell", monPartition, monBadCells);
763 if (!energyBalModPartPartition.empty()) {
764 for (
int l1TriggerIdx : l1TriggersIndices) {
771 if (!timeBalModPartPartition.empty()) {
772 for (
int l1TriggerIdx : l1TriggersIndices) {
779 unsigned int bcid = eventInfo->
bcid();
781 for (
unsigned int partition = 0; partition < Tile::MAX_ROS - 1; ++partition) {
783 if (!maskedOnFlyDrawers[partition].
empty()) {
789 if (!negOccupModule[partition].
empty()) {
795 if (!energyBalModule[partition].
empty()) {
801 if (!timeBalModule[partition].
empty()) {
807 if (!chanTimeDrawer[partition].
empty()) {
812 for (
int l1TriggerIdx : l1TriggersIndices) {
818 if (!detailOccupModule[partition].
empty()) {
822 for (
int l1TriggerIdx : l1TriggersIndices) {
827 if (!overThrOccupModule[partition].
empty()) {
831 for (
int l1TriggerIdx : l1TriggersIndices) {
836 if (!overThr30GeVOccupModule[partition].
empty()) {
839 for (
int l1TriggerIdx : l1TriggersIndices) {
844 if (!overThr300GeVOccupModule[partition].
empty()) {
847 for (
int l1TriggerIdx : l1TriggersIndices) {
852 if (!eneDiff[partition].
empty()) {
856 for (
int l1TriggerIdx : l1TriggersIndices) {
861 for (
unsigned int gain = 0; gain < Tile::MAX_GAIN; ++gain) {
862 if (!overThrOccupGainModule[partition][gain].
empty()) {
866 for (
int l1TriggerIdx : l1TriggersIndices) {
871 if (!detailOccupGainModule[partition][gain].
empty()) {
875 for (
int l1TriggerIdx : l1TriggersIndices) {
882 for (
unsigned int sample = 0; sample <
SAMP_ALL; ++sample) {
883 if (!sampChanTime[partition][sample].
empty()) {
885 for (
int l1TriggerIdx : l1TriggersIndices) {
894 for (
unsigned int sample = 0; sample <
SAMP_ALL; ++sample) {
895 if (!sampEnergyDiff[partition][sample].
empty()) {
897 for (
int l1TriggerIdx : l1TriggersIndices) {
903 if (!sampTimeDiff[partition][sample].
empty()) {
905 for (
int l1TriggerIdx : l1TriggersIndices) {
915 for (
int partition = 0; partition <
MAX_PART; ++partition) {
929 if (moduleCorr[partition].numberOfPairs() > 0) {
933 std::vector<float> weight(moduleCorr[partition].numberOfPairs(), moduleCorr[partition].weight());
935 for (
int l1TriggerIdx : l1TriggersIndices) {
940 for (
int l1TriggerIdx : l1TriggersIndices) {
950 for (
int l1TriggerIdx : l1TriggersIndices) {
957 for (
unsigned int sample = 0; sample <
SAMP_ALL; ++sample) {
958 if (!occupEnergy[sample].
empty()) {
962 for (
int l1TriggerIdx : l1TriggersIndices) {
968 if (!overThrOccupEta[sample].
empty()) {
971 for (
int l1TriggerIdx : l1TriggersIndices) {
980 fill(
"TileCellMonExecuteTime", timer);
982 return StatusCode::SUCCESS;