Execute method.
375 {
376
377
378
380
382 if ( eventInfo.isValid() ) {
385 m_evtNum = eventInfo->eventNumber();
389 } else {
396 }
397
398 std::ostringstream evState;
399 evState <<
"Run "<< std::setw(6) <<
m_runNum
401 <<
" Evt "<< std::setw(9) <<
m_evtNum
403 <<
" Flags 0x" << std::hex <<
m_tileFlag << std::dec;
404
405 std::ostringstream evtnum;
406 evtnum <<
"Run "<< std::setw(6) <<
m_runNum
408 <<
" Evt "<< std::setw(9) <<
m_evtNum
410
411 std::ostringstream nevtnum;
412 nevtnum << evtnum.str()
414
415 bool emptyBad = true;
416 bool badFromCell = false;
427
428 IdContext chan_context =
m_tileHWID->channel_context();
432 HWIdentifier ch_id =
m_tileHWID->channel_id(drawer_id,0);
433 m_tileHWID->get_hash(ch_id, hash, &chan_context);
435 std::fill(itr,itr+48,true);
436 }
437
440 if (statusOk) {
442
443 using namespace boost::local_time;
444 using namespace boost::posix_time;
445 static const time_zone_ptr gva_tz(new posix_time_zone((std::string)"CET+01CEST01:00:00,M3.5.0/02:00:00,M10.5.0/03:00:00"));
446 local_date_time gva_time(from_time_t(eventInfo->timeStamp()),gva_tz);
447 evState << " " << gva_time << " ";
448
449
450 const char *
part[5] = {
"UNK",
"LBA",
"LBC",
"EBA",
"EBC" };
454 int n2 = (n1 +
dn - 1) % 64;
456 evState <<
" " <<
part[
rr] <<std::setw(2)<<std::setfill(
'0')<<n1+1
457 <<
" - " <<
part[
rr] <<std::setw(2)<<std::setfill(
'0')<<n2+1
458 <<
" " <<
dn <<
" consec bad ";
459 }
465 int pp = 1;
466 for (
int rr = 1;
rr < 5; ++
rr) {
467 if ((p2 & pp) || (p1 & pp)) {
468 evState <<
" " <<
part[
rr];
469 if (p2 & pp) {
470 if (p0 & pp) evState << " off";
471 else evState << " OFF";
472 }
473 if (p1 & pp) {
474 if (p0 & pp) evState << " mask";
475 else evState << " MASK";
476 }
477 }
478 pp <<= 1;
479 }
480 evState <<
" " <<
dn <<
" consec bad ";
481 }
482
484 int n1 = -1;
485 int n2 = -1;
491 std::vector<int> allmod;
492 std::vector<int> consec;
493 for (
int ros = 1;
ros < 5; ++
ros) {
494 int drmax = 65;
495 for (
int dr = 0;
dr < drmax; ++
dr) {
500 if (dr < 64) allmod.push_back((ros << 8) + dr);
501 } else if (m1 >= 0) {
503 if (m1 == 0) drmax +=
dm;
504 if (dm > dn) {
509 consec.clear();
510 consec.push_back((ros << 8) + m1);
511 } else if (dm == dn) {
512 if (m1 < 64) consec.push_back((ros << 8) + m1);
513 }
515 }
516 }
517 }
518 evState << " DCS " << allmod.size() << " off ";
519 if (dn > 1) {
521 if (consec.size() > 1) evState << "*" << (consec.size());
522 evState << " consec "
523 <<
part[
rr] << std::setw(2) << std::setfill(
'0') << (n1 % 64) + 1 <<
" - "
524 << part[
rr] << std::setw(2) << std::setfill(
'0') << (n2 % 64) + 1 <<
" ";
527 for (
size_t n = 1;
n < consec.size(); ++
n) {
530 evState << part[m1 >> 8] << std::setw(2) << std::setfill(
'0') << (
m1 % 64) + 1 <<
" - "
531 << part[m2 >> 8] << std::setw(2) << std::setfill(
'0') << (
m2 % 64) + 1 <<
" ";
532 for (
size_t m = 0;
m < allmod.size(); ++
m) {
534 if (mm >= m1 && mm <= m2) {
535 allmod[
m] += n1 -
m1;
536 }
537 }
538 }
539 } else {
541 }
542 if (allmod.size() > (size_t) dn) {
543 for (
size_t m = 0;
m < allmod.size(); ++
m) {
545 if (!(mm >= n1 && mm <= n2)) {
546 evState << part[mm >> 8] << std::setw(2) << std::setfill(
'0') << (
mm % 64) + 1 <<
" ";
547 }
548 }
549 }
550 }
551
553 }
554
555 int rawdata = -1;
556 const TileCell* cellminCh = 0;
557 const TileCell* cellmaxCh = 0;
558 const TileCell* tcellminCh = 0;
559 const TileCell* tcellmaxCh = 0;
560
562
563
565
566 if (!cellContainer.isValid()) {
567
568 ATH_MSG_WARNING(
"Unable to read CaloCellContainer from EventStore, disable reading of this container");
570
571 } else {
572
573 float emin = 0.;
574 float emax = 0.;
575 float tmin = 0.;
576 float tmax = 0.;
579 float tcmin = 0.;
580 float tcmax = 0.;
583 const TileCell* tcellmin = 0;
584 const TileCell* tcellmax = 0;
585
586
587
588
589
590
592
593 for (const CaloCell* cell : *cellContainer) {
594
595 Identifier
id =
cell->ID();
597 const TileCell* tile_cell =
dynamic_cast<const TileCell*
> (
cell);
598 if (tile_cell==0) continue;
599 const CaloDetDescrElement * caloDDE =
cell->caloDDE();
600 IdentifierHash hash1 = caloDDE->
onl1();
601 IdentifierHash hash2 = caloDDE->
onl2();
604 if (rawdata < 0) {
606 }
607
608 bool bad1 = tile_cell->
badch1();
609 bool bad2 = tile_cell->
badch2();
610 float ene1 = tile_cell->
ene1();
611 float ene2 = tile_cell->
ene2();
612 float time1 = tile_cell->
time1();
613 float time2 = tile_cell->
time2();
622
623 float ene = tile_cell->
energy();
624 bool eneOk = false;
629 } else {
631 }
632
633 if (eneOk) {
634 if (bad1 && bad2) {
636 } else {
638 }
639 }
640
642 bool timeOk = false;
647 } else {
649 }
650
651 if (timeOk) {
652 if (time != 0.) {
654 } else {
656 }
657 }
658
659 if (timeOk && eneOk) {
660
662 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
663 << " ene = " << ene << " time = " << time);
664
667
668 if (ene < emin) {
669 emin = ene;
671 } else if (ene > emax) {
672 emax = ene;
674 }
675
676 if (time<tmin) {
678 tcellmin = tile_cell;
679 }
680 else if (time>tmax) {
682 tcellmax = tile_cell;
683 }
684 }
685
686 if ( !(bad1 && bad2) ) {
687
688 bool ene1Ok = false;
689 bool time1Ok = false;
690
696 } else {
698 }
699
704 } else {
706 }
707
708 if (ene1Ok) {
710 }
711
712 if (time1Ok) {
713 if (time1 != 0.) {
715 } else {
717 }
718 }
719 }
720
721 bool ene2Ok = false;
722 bool time2Ok = false;
723
729 } else {
731 }
732
737 } else {
739 }
740
741 if (ene2Ok) {
743 }
744
745 if (time2Ok) {
746 if (time2 != 0.) {
748 } else {
750 }
751 }
752 }
753
754 bool over1=false;
755 bool over2=false;
756 if (checkOver) {
759 }
760
761 if ((ene1Ok && time1Ok) || over1) {
762
764 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
765 << " ch_ene1 = " << ene1 << " ch_t1 = " << time1
766 << ((over1)?" overflow":""));
767
770
771 if (ene1 < chmin) {
773 cellminCh = tile_cell;
774 } else if (ene1 > chmax) {
776 cellmaxCh = tile_cell;
777 }
778
779 if (time1 < tcmin) {
780 tcmin = time1;
781 tcellminCh = tile_cell;
782 } else if (time1 > tcmax) {
783 tcmax = time1;
784 tcellmaxCh = tile_cell;
785 }
786 }
787
788 if ((ene2Ok && time2Ok) || over2) {
789
791 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
792 << " ch_ene2 = " << ene2 << " ch_t2 = " << time2
793 << ((over2)?" overflow":""));
794
797
798 if (ene2 < chmin) {
800 cellminCh = tile_cell;
801 } else if (ene2 > chmax) {
803 cellmaxCh = tile_cell;
804 }
805
806 if (time2 < tcmin) {
807 tcmin = time2;
808 tcellminCh = tile_cell;
809 } else if (time2 > tcmax) {
810 tcmax = time2;
811 tcellmaxCh = tile_cell;
812 }
813 }
814
815 }
816 }
817 }
818
819 if (tcellmin && tcellmin != cellmin && tcellmin != cellmax) {
821 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmin->
ID(),-2)
822 <<
" ene = " << tcellmin->
energy()
823 <<
" tmin = " << tcellmin->
time());
824 }
825 if (tcellmax && tcellmax != cellmin && tcellmax != cellmax) {
827 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmax->
ID(),-2)
828 <<
" ene = " << tcellmax->
energy()
829 <<
" tmax = " << tcellmax->
energy());
830 }
831
832 if (tcellminCh && tcellminCh != cellminCh && tcellminCh != cellmaxCh) {
834 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellminCh->
ID(),-2)
835 <<
" ch_ene = " << tcellminCh->
ene1() <<
" " << tcellminCh->
ene2()
836 <<
" ch_tmin = " << tcellminCh->
time1() <<
" " << tcellminCh->
time2());
837 }
838 if (tcellmaxCh && tcellmaxCh != cellminCh && tcellmaxCh != cellmaxCh) {
840 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmaxCh->
ID(),-2)
841 <<
" ch_ene = " << tcellmaxCh->
ene1() <<
" " << tcellmaxCh->
ene2()
842 <<
" ch_tmax = " << tcellmaxCh->
time1() <<
" " << tcellmaxCh->
time2());
843 }
844
845 if (cellmin) {
847 statusOk = true;
848 const char *
tit = (tcellmin ==
cellmin) ?
" tmin = ": ((tcellmax ==
cellmin) ?
" tmax = ":
" t = ");
849 if (cellminCh!=cellmin) {
851 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmin->ID(),-2)
852 << " emin = " << emin
854 << " accepted");
855
856 } else {
858 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmin->ID(),-2)
859 << " emin = " << emin
860 << " ch_emin = " << chmin
862 << " accepted");
863 }
864 }
865
866 if (cellminCh) {
868 statusOk = true;
869 const char *
tit = (tcellminCh == cellminCh) ?
" tmin = ": ((tcellmaxCh == cellminCh) ?
" tmax = ":
" t = ");
870 if (cellminCh!=cellmin) {
872 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(cellminCh->
ID(),-2)
873 << " ch_emin = " << chmin
874 << tit << cellminCh->
time()
875 << " accepted");
876 }
877 }
878
879 if (cellmax) {
881 statusOk = true;
882 const char *
tit = (tcellmin ==
cellmax) ?
" tmin = ": ((tcellmax ==
cellmax) ?
" tmax = ":
" t = ");
883 if (cellmaxCh!=cellmax) {
885 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmax->ID(),-2)
886 << " emax = " << emax
888 << " accepted");
889
890 } else {
892 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmax->ID(),-2)
893 << " emax = " << emax
894 << " ch_emax = " << chmax
896 << " accepted");
897 }
898 }
899
900 if (cellmaxCh) {
902 statusOk = true;
903 const char *
tit = (tcellminCh == cellmaxCh) ?
" tmin = ": ((tcellmaxCh == cellmaxCh) ?
" tmax = ":
" t = ");
904 if (cellmaxCh!=cellmax) {
906 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(cellmaxCh->
ID(),-2)
907 << " ch_emax = " << chmax
908 << tit << cellmaxCh->
time()
909 << " accepted");
910 }
911 }
912
913 emptyBad = false;
914 badFromCell = true;
915 }
916 }
917
918 const TileDQstatus* DQstatus(0);
919
921
922
924
926 ATH_MSG_WARNING(
"Unable to read TileRawChannelContainer from EventStore, disable reading of this container");
928
929 } else {
930
933 float tcmin = 0.;
934 float tcmax = 0.;
935 const TileRawChannel* minCh = 0;
936 const TileRawChannel* maxCh = 0;
937 const TileRawChannel* tminCh = 0;
938 const TileRawChannel* tmaxCh = 0;
942 bool fillChanEne = ( !
m_readCells && allowAmpCheck );
943 if (!fillChanEne) {
948 }
949
952 else
953 rawdata = 0;
954
955 IdContext chan_context =
m_tileHWID->channel_context();
958
959 int nbadMax = 0;
960 int nbadMBMax = 0;
961 const TileRawChannelCollection * collMax = 0;
962 const TileRawChannelCollection * collMBMax = 0;
963
964 bool someDQerrors = false;
965
966 for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
967
968 int frag = rawChannelCollection->identify();
969 bool eb = (frag > 0x2ff);
970 bool ebsp = (frag == 0x30e || frag == 0x411);
971
976
977 int chMBTS = -1;
978 if (eb) {
979 for (int ch: {12,4,0}) {
980 m_cabling->h2s_cell_id_index(ros,drawer,ch,index,pmt);
981 if (index == -2) {
983 break;
984 }
985 }
986 }
987
988 HWIdentifier ch_id =
m_tileHWID->channel_id(ros,drawer,0);
989 m_tileHWID->get_hash(ch_id, hash, &chan_context);
990 int hashNext =
index = (
int)hash + 48;
991
992
993
994 uint32_t RODBCID = rawChannelCollection->getRODBCID();
995 uint32_t DSPBCID = rawChannelCollection->getFragDSPBCID();
996 uint32_t GlobalCRCErr = rawChannelCollection->getFragGlobalCRC() & 0x1;
997 uint32_t FE_DMUmask = rawChannelCollection->getFragFEChipMask();
998 uint32_t ROD_DMUmask = rawChannelCollection->getFragRODChipMask();
999 uint32_t BCIDErr = rawChannelCollection->getFragBCID();
1000 uint32_t MemoryParityErr = rawChannelCollection->getFragMemoryPar();
1001 uint32_t HeaderFormatErr = rawChannelCollection->getFragHeaderBit();
1002 uint32_t HeaderParityErr = rawChannelCollection->getFragHeaderPar();
1003 uint32_t SampleFormatErr = rawChannelCollection->getFragSampleBit();
1004 uint32_t SampleParityErr = rawChannelCollection->getFragSamplePar();
1005 uint32_t SingleStrobeErr = rawChannelCollection->getFragSstrobe();
1006 uint32_t DoubleStrobeErr = rawChannelCollection->getFragDstrobe();
1007
1008 if (RODBCID!=0 && RODBCID !=
m_evtBCID ) {
1011 <<
" drw " <<
drwname(rawChannelCollection->identify())
1012 << " ROD BCID " << RODBCID << " is wrong - skipping");
1013
1016 << " suppressing further messages about drawer 0x" << std::hex << rawChannelCollection->identify()
1017 << std::dec << " being bad");
1018 }
1019 someDQerrors = true;
1020 continue;
1021 }
1022
1023 if (DSPBCID >= 0x7FFF
1024 && GlobalCRCErr
1025 && FE_DMUmask == 0xFFFF
1026 && ROD_DMUmask == 0xFFFF
1027 && BCIDErr == 0xFFFF
1028 && MemoryParityErr == 0xFFFF
1029 && HeaderFormatErr == 0xFFFF
1030 && HeaderParityErr == 0xFFFF
1031 && SampleFormatErr == 0xFFFF
1032 && SampleParityErr == 0xFFFF
1033 && SingleStrobeErr == 0xFFFF
1034 && DoubleStrobeErr == 0xFFFF) {
1035
1038 <<
" drw " <<
drwname(rawChannelCollection->identify())
1039 << " is OFF - skipping");
1040
1043 << " suppressing further messages about drawer 0x" << std::hex
1044 << rawChannelCollection->identify()
1045 << std::dec << " being bad");
1046 }
1047 continue;
1048 }
1049
1050 if (DSPBCID == 0
1051 && GlobalCRCErr == 0
1052 && FE_DMUmask == 0
1053 && ROD_DMUmask == 0
1054 && BCIDErr == 0
1055 && MemoryParityErr == 0
1056 && HeaderFormatErr == 0
1057 && HeaderParityErr == 0
1058 && SampleFormatErr == 0
1059 && SampleParityErr == 0
1060 && SingleStrobeErr == 0
1061 && DoubleStrobeErr == 0) {
1062
1065 <<
" drw " <<
drwname(rawChannelCollection->identify())
1066 << " is MISSING - skipping");
1067
1070 << " suppressing further messages about drawer 0x" << std::hex
1071 << rawChannelCollection->identify() << std::dec << " being bad");
1072 }
1073 continue;
1074 }
1075
1076 if (GlobalCRCErr) {
1077 GlobalCRCErr = 0xFFFF;
1081 <<
" drw " <<
drwname(rawChannelCollection->identify())
1082 << " global CRC error - skipping");
1083
1086 << " suppressing further messages about drawer 0x" << std::hex
1087 << rawChannelCollection->identify() << std::dec << " being bad");
1088 }
1089 someDQerrors = true;
1090 continue;
1091 }
1092 }
1093
1094 if (HeaderFormatErr || HeaderParityErr || SampleFormatErr || SampleParityErr ) {
1095 FE_DMUmask = 0xFFFF;
1096 } else {
1097 if (eb) {
1098 if (ebsp) FE_DMUmask<<=1;
1099 FE_DMUmask = (FE_DMUmask & 0xFF) | ((FE_DMUmask & 0xF00)<<2);
1100 }
1101 }
1102
1103 FE_DMUmask = ~FE_DMUmask & 0xFFFF;
1104 ROD_DMUmask = ~ROD_DMUmask & 0xFFFF;
1105
1106 if (BCIDErr & 0x2) {
1107 BCIDErr = 0xFFFF;
1111 <<
" drw " <<
drwname(rawChannelCollection->identify())
1112 << " BCID in DMU1 is bad - skipping");
1113
1116 << " suppressing further messages about drawer 0x"
1117 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1118 }
1119 someDQerrors = true;
1120 continue;
1121 }
1122
1123 } else {
1124
1125 if ( DSPBCID!=0xDEAD && DSPBCID!=
m_evtBCID ) {
1126 BCIDErr = 0xFFFF;
1130 <<
" drw " <<
drwname(rawChannelCollection->identify())
1131 << " DSP BCID is wrong - skipping");
1132
1135 << " suppressing further messages about drawer 0x"
1136 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1137 }
1138 someDQerrors = true;
1139 continue;
1140 }
1141 }
1142 }
1143
1144 uint32_t error = GlobalCRCErr | FE_DMUmask | ROD_DMUmask | BCIDErr | MemoryParityErr |
1145 HeaderFormatErr | HeaderParityErr | SampleFormatErr | SampleParityErr;
1146
1150 <<
" drw " <<
drwname(rawChannelCollection->identify())
1151 << " whole drawer is bad - skipping");
1152
1155 << " suppressing further messages about drawer 0x"
1156 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1157 }
1158 someDQerrors = true;
1159 continue;
1160 }
1161
1162
1167 << " enabling messages about drawer 0x" << std::hex
1168 << rawChannelCollection->identify()
1169 << std::dec <<
" being bad after " <<
m_maxVerboseCnt <<
" good events");
1170 }
1171 }
1172
1174 if (eb) {
1175 if (ebsp) {
1176 errMB &= 0x3cfe;
1177 } else {
1178 errMB &= 0x3cff;
1179 }
1180 }
1181 int nbadMB = 0;
1182 while (errMB) {
1183 if (errMB & 0xF) ++nbadMB;
1184 errMB >>= 4;
1185 }
1187 if (nbadMB > nbadMBMax) {
1188 nbadMBMax = nbadMB;
1189 collMBMax = rawChannelCollection;
1190 }
1191
1192 int nerr = 0;
1193 for (uint32_t i = 0x8000;
i != 0;
i >>= 1) {
1194 if (error&i) {
1195 ++nerr;
1197 } else {
1198 if (emptyBad && nbadMB < 4) {
1202 } else {
1204 }
1205 }
1206 }
1207
1208 int nbad = ((ebsp) ? nerr-5 : ((eb) ? nerr-4 : nerr));
1209
1211 someDQerrors = true;
1212 if (nbad > nbadMax) {
1213 nbadMax = nbad;
1214 collMax = rawChannelCollection;
1215 }
1216 }
1217 if (someDQerrors) {
1220 }
1221 }
1222
1223 if (allowAmpCheck || emptyBad) {
1224
1225 for (const TileRawChannel* rawChannel : *rawChannelCollection) {
1226
1227 HWIdentifier adcId = rawChannel->adc_HWID();
1228 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1229 m_tileHWID->get_hash(chId, hash, &chan_context);
1233 int ch_type = 0;
1234 if (channel == chMBTS) {
1235 ch_type = 2;
1236 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1237 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1238 ch_type = 1;
1239 }
1242 (DQstatus && !DQstatus->isAdcDQgood(ros,drawer,channel,adc)) ||
1244 }
1245
1246 if (allowAmpCheck) {
1247
1248 float amp = rawChannel->amplitude();
1249 float time = rawChannel->time();
1250 if (fillChanEne) {
1254 } else {
1257 }
1258
1263 continue;
1264
1265 bool ampOk = false;
1270 } else {
1272 }
1273
1274 bool timeOk = false;
1279 } else {
1281 }
1282
1283 if (ampOk && timeOk) {
1284
1286 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1287 << " ch_ene = " << amp << " ch_t = " << time);
1288
1290
1291 if (amp < chmin) {
1293 minCh = rawChannel;
1294 } else if (amp > chmax) {
1296 maxCh = rawChannel;
1297 }
1298
1299 if (time<tcmin) {
1301 tminCh = rawChannel;
1302 }
1303 else if (time>tcmax) {
1305 tmaxCh = rawChannel;
1306 }
1307 }
1308 }
1309 }
1310 }
1311
1312 for (index = hashNext - 48;
index < hashNext; ++
index) {
1313 if ((
m_chanSel[index] && rawdata) || someDQerrors) {
1315 <<
" drw " <<
drwname(rawChannelCollection->identify())
1316 << " nBadMB = " << nbadMB
1317 << " nBadDMU = " << nbad
1319 << " DSPBCID = " << rawChannelCollection->getFragDSPBCID()
1320 << " GlobCRC = " << rawChannelCollection->getFragGlobalCRC() << " " << GlobalCRCErr
1321 << " error = 0x" << std::hex << error
1322 << " FE_CRC = 0x" << rawChannelCollection->getFragFEChipMask() << " 0x" << FE_DMUmask
1323 << " ROD_CRC = 0x" << rawChannelCollection->getFragRODChipMask() << " 0x" << ROD_DMUmask
1324 << " BCIDErr = 0x" << rawChannelCollection->getFragBCID() << " 0x" << BCIDErr
1325 << " MemPar = 0x" << rawChannelCollection->getFragMemoryPar()
1326 << " HeadForm = 0x"<< rawChannelCollection->getFragHeaderBit()
1327 << " HeadPar = 0x" << rawChannelCollection->getFragHeaderPar()
1328 << " SampForm = 0x"<< rawChannelCollection->getFragSampleBit()
1329 << " SampPar = 0x" << rawChannelCollection->getFragSamplePar()
1330 << std::dec);
1331 break;
1332 }
1333 }
1334 }
1335
1338 statusOk = true;
1341 << " nBadMB = " << nbadMBMax
1342 << " accepted");
1343
1346 statusOk = true;
1349 << " nBadDMU = " << nbadMax
1350 << " accepted");
1351 }
1352
1353 if (tminCh && tminCh != minCh && tminCh != maxCh) {
1355 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(tminCh->
adc_HWID())
1357 <<
" tmin =" << tminCh->
time());
1358 }
1359
1360 if (tmaxCh && tmaxCh != minCh && tmaxCh != maxCh) {
1362 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(tmaxCh->
adc_HWID())
1364 <<
" tmax = " << tmaxCh->
time());
1365 }
1366
1367 if (minCh) {
1369 statusOk = true;
1370 const char *
tit = (tminCh == minCh) ?
" tmin = ": ((tmaxCh == minCh) ?
" tmax = ":
" t = ");
1372 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(minCh->
adc_HWID())
1373 << " ch_emin = " << chmin
1374 << tit << minCh->
time()
1375 << " accepted");
1376 }
1377 if (maxCh) {
1379 statusOk = true;
1380 const char *
tit = (tminCh == maxCh) ?
" tmin = ": ((tmaxCh == maxCh) ?
" tmax = ":
" t = ");
1382 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(maxCh->
adc_HWID())
1383 << " ch_emax = " << chmax
1384 << tit << maxCh->
time()
1385 << " accepted");
1386 }
1387 emptyBad = false;
1388 }
1389 }
1390
1391
1393
1394
1396
1397 if (!digitsContainer.isValid()) {
1398 ATH_MSG_WARNING(
"Unable to read TileDigitsContainer from EventStore, disable reading of this container");
1400
1401 } else {
1402
1403 IdContext chan_context =
m_tileHWID->channel_context();
1404 IdentifierHash
hash;
1406 int nConst = 0;
1407 int nJump = 0;
1408 int nDmuErr = 0;
1409 int nOverLG = 0;
1410 int nOverHG = 0;
1411 int nUnderLG = 0;
1412 int nUnderHG = 0;
1413
1414 for (const TileDigitsCollection * digitsCollection : *digitsContainer) {
1415
1416 int frag = digitsCollection->identify();
1417 bool eb = (frag > 0x2ff);
1418 bool ebsp = (frag == 0x30e || frag == 0x411);
1419
1420 int ros = frag >> 8;
1421 int drawer = frag & 0x3F;
1424
1425 int chMBTS = -1;
1426 if (eb) {
1427 for (int ch: {12,4,0}) {
1428 m_cabling->h2s_cell_id_index(ros,drawer,ch,index,pmt);
1429 if (index == -2) {
1431 break;
1432 }
1433 }
1434 }
1435
1436 int nChBadDB = 0;
1437 int nChBadNC = 0;
1438 int nChBad = 0;
1439 int nChTot = 0;
1440 int nChDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1441 int nChBadDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1442
1443 for (const TileDigits* tile_digits : *digitsCollection) {
1444
1445 ++nChTot;
1446
1447 HWIdentifier adcId = tile_digits->adc_HWID();
1448 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1449 m_tileHWID->get_hash(chId, hash, &chan_context);
1453 ++nChDmu[dmu];
1455 bool isConnected = (chEmpty < 2);
1456 if (!isConnected) ++nChBadNC;
1458 const char *cellname = "";
1459 int ch_type = 0;
1460 if (channel == chMBTS) {
1461 cellname = " MBTS";
1462 ch_type = 2;
1463 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1464 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1465 cellname = " GAP";
1466 ch_type = 1;
1467 } else if (chEmpty > 0) {
1468 cellname = " EMPTY";
1469 }
1470
1471 const char *badname = "";
1472 if (DQstatus && !DQstatus->isAdcDQgood(ros,drawer,channel,adc)) {
1473 badname = " BADDQ";
1474 if (isConnected) {
1475 ++nChBad;
1476 ++nChBadDmu[dmu];
1477 }
1479 badname = " BADDCS";
1481 badname = " BADDB";
1482 if (isConnected) {
1483 ++nChBadDB;
1484 }
1486 if (badFromCell) {
1487 if (ch_type != 2) badname = " BADQUAL";
1489 if (isConnected && ch_type!=2) {
1490 ++nChBad;
1491 ++nChBadDmu[dmu];
1492 }
1493 } else {
1494 badname = " BADUNKN";
1495 }
1496 }
else if (badFromCell &&
m_chanEne[hash] == 0.0) {
1497 badname = " BADDIGI";
1498 if (isConnected) {
1499 ++nChBad;
1500 ++nChBadDmu[dmu];
1501 }
1502 }
1503 const char *enename = " ene = ";
1504 const char *timename = " time = ";
1505 const char *qualname = " qual = ";
1506 if (badFromCell && badname[0] != 0) {
1507 enename = " BAD = ";
1509 qualname = " eDSP = ";
1511 }
1513 timename = " tDSP = ";
1515 }
1516 }
1517
1518 char badnm[30];
1519 sprintf(badnm," BADDIGIEX%s",badname);
1520 float dmin,dmax;
1521
1522 std::vector<float> samples = tile_digits->samples();
1523 int nSamp = samples.size();
1524 if (nSamp > 6) {
1525
1529
1531
1532 if (badname[0]==0) {
1533 if (err && err>-3) {
1534 if (isConnected || err != -2) {
1536 badname = badnm;
1537 ++nChBad;
1538 ++nChBadDmu[dmu];
1539 if (!isConnected) --nChBadNC;
1540 }
1541 if (err > 0) {
1542 if (err < 10) {
1544 } else if (err < 36) {
1546 }
1547 } else {
1548 badnm[9] = 48;
1549 }
1550 } else {
1551
1552
1554 if (warn) {
1556 sprintf(badnm," warningE%d%s",warn,badname);
1557 badname = badnm;
1558 }
1559 }
1560 }
1561
1562 if ((!err)
1563 && (useCh)
1564 && (badname[0] == 0 || badname[1] == 'w'
1566
1567 if (adc) {
1568
1572 ++nOverHG;
1573 }
1574 }
1578 ++nUnderHG;
1579 }
1580 }
1581
1582 } else {
1583
1587 ++nOverLG;
1588 }
1589 }
1593 ++nUnderLG;
1594 }
1595 }
1596 }
1597 }
1598
1599 bool someSampErrors = false;
1600
1602
1605
1606 float ped = samples[0];
1609 int nped = 1;
1610 int npedmax = 1;
1611 bool cnstPed = true;
1612 bool cnstPedmax = true;
1613 for (
int i = 1;
i < nSamp; ++
i) {
1614 float smp = samples[
i];
1615 float dped = smp -
ped;
1616 if (fabs(dped) < pedDelta) {
1617 ++nped;
1618 if (dped != 0.0) {
1619 cnstPed = false;
1621 }
1622 } else {
1623 if (nped>npedmax) {
1624 npedmax=nped;
1625 cnstPedmax = cnstPed;
1626 }
1627 cnstPed = true;
1629 nped = 1;
1630 }
1631 if (smp<dmin) {
1632 dmin = smp;
1633 } else if (smp>dmax) {
1634 dmax = smp;
1635 }
1636 }
1637 if (nped>npedmax) {
1638 npedmax=nped;
1639 cnstPedmax = cnstPed;
1640 }
1641
1642 if (dmax - dmin >= jumpDelta) {
1645 bool accCnst = false;
1646 bool accJump = false;
1647 bool cnstMin = true;
1648 bool cnstMax = true;
1649 bool jumpNeg = false;
1650 bool jumpPos = false;
1651 bool jumpEnd = false;
1652 bool jumpZer = false;
1653 bool jumpOve = false;
1654 bool narrowUp = false;
1655 bool narrowDown = false;
1656 if (npedmax >=
m_constLength && ((dmax-ped) >= jumpDelta || (ped-dmin) >= jumpDelta) ) {
1657 ++nConst;
1658 accCnst = true;
1659 }
1660 int nmin = 0;
1662 int pmin = -1;
1663 int pmax = -1;
1664 float abovemin = dmax;
1665 float belowmax = dmin;
1666 for (
int i = 0;
i < nSamp; ++
i) {
1667 float smp = samples[
i];
1668 if (smp - dmin < pedDelta) {
1669 ++nmin;
1671 if (smp != dmin) cnstMin = false;
1672 }
1673 if (dmax - smp < pedDelta) {
1676 if (smp != dmax) cnstMax = false;
1677 }
1678 if (smp < abovemin && smp > dmin) {
1679 abovemin = smp;
1680 }
1681 if (smp > belowmax && smp < dmax) {
1682 belowmax = smp;
1683 }
1684 }
1685 if (
nmax + nmin == nSamp) {
1686 if (
nmax > 1 && nmin > 1) {
1687 ++nJump;
1688 accJump = true;
1689 }
else if (
nmax == 1) {
1690 if (pmax < nSamp - 1) {
1691 ++nJump;
1692 accJump = true;
1693 jumpPos = true;
1694 cnstMax = false;
1695 }
1696 if (pmax == 0 || pmax == nSamp - 1) {
1697 jumpEnd = true;
1698 }
1699 } else if (nmin == 1) {
1700 ++nJump;
1701 accJump = true;
1702 jumpNeg = true;
1703 cnstMin = false;
1704 if (pmin == 0 || pmin == nSamp - 1) {
1705 jumpEnd = true;
1706 }
1707 }
1708 }
1709 if (dmin == 0.0) {
1710 if (!accJump) {
1711 ++nJump;
1712 accJump = true;
1713 cnstMin = false;
1714 cnstMax = false;
1715 }
1716 jumpZer = true;
1717 }
1719 if (!accJump) {
1720 ++nJump;
1721 accJump = true;
1722 cnstMin = false;
1723 cnstMax = false;
1724 }
1725 jumpOve = true;
1726 }
1728 if (pmax > 0 && pmax < nSamp-1 && std::max(samples[pmax-1], samples[pmax+1]) < dmin+secondMax) {
1729 if (!accJump) {
1730 ++nJump;
1731 accJump = true;
1732 cnstMax = false;
1733 if (nmin +
nmax != nSamp) {
1734 cnstMin = false;
1735 }
1736 }
1737 narrowUp = true;
1738 }
1739 if (pmin > 0 && pmin < nSamp - 1 && std::min(samples[pmin - 1], samples[pmin + 1]) > dmax - secondMax) {
1740 if (!accJump) {
1741 ++nJump;
1742 accJump = true;
1743 cnstMin = false;
1744 if (nmin +
nmax != nSamp) {
1745 cnstMax = false;
1746 }
1747 }
1748 narrowDown = true;
1749 }
1750
1751 if (accEmin || accEmax || accCnst || accJump) {
1752 someSampErrors = true;
1754 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1755 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1756 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1757 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1760 << cellname << badname
1761 << ((accEmin) ? " neg_e" : "")
1762 << ((accEmax) ? " pos_e" : "")
1763 << ((accCnst) ? " const" : "")
1764 << ((accCnst&&cnstPedmax) ? "Const" : "")
1765 << ((accJump) ? " jump" : "")
1766 << ((accJump&&jumpZer) ? "Zero" : "")
1767 << ((accJump&&jumpOve) ? "Over" : "")
1768 << ((accJump&&jumpPos) ? "SingleUp" : ((narrowUp) ? "NarrowUp" : "") )
1769 << ((accJump&&jumpNeg) ? "SingleDown" : ((narrowDown) ? "NarrowDown" : "") )
1770 << ((accJump&&jumpEnd) ? "AtEdge" : "")
1771 << ((accJump&&cnstMin) ? "ConstMin" : "")
1772 << ((accJump&&cnstMax) ? "ConstMax" : "")
1773 << " " << dmax-dmin);
1774 }
1775 }
1776 }
1777
1778 if (someSampErrors) {
1784 bool jumpZer = (dmin < 0.01);
1786 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1787 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1788 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1789 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1792 << cellname << badname
1793 << ((accEmin) ? " neg_e" : "")
1794 << ((accEmax) ? " pos_e" : "")
1795 <<((jumpZer) ? " underflow" : "")
1796 <<((jumpOve) ? " overflow" : "") );
1797 }
1798
1799 }
1800 }
1801 if (
m_checkDMUs && nChBad > 1 && nChBad + nChBadDB + nChBadNC < nChTot) {
1802 int nChBad1 = 0;
1803 int nChBad2 = 0;
1804 int nDmuBad1 = 0;
1805 int nDmuBad2 = 0;
1806 int nDmuBad = 0;
1807 int nDmuTot = 0;
1808 bool has23 = false;
1809 for (int dmu = 0; dmu < 16; ++dmu) {
1810 if (nChDmu[dmu] > 0) {
1811 ++nDmuTot;
1812 if (nChBadDmu[dmu] > 0) {
1813 ++nDmuBad;
1814 if (dmu < 8) {
1815 nChBad1 += nChBadDmu[dmu];
1816 ++nDmuBad1;
1817 } else {
1818 nChBad2 += nChBadDmu[dmu];
1819 ++nDmuBad2;
1820 }
1821 if (nChBadDmu[dmu] == 2 && nChDmu[dmu] == 3) has23 = true;
1822 }
1823 }
1824 }
1825 if (nDmuBad == 1 ) continue;
1826 if (nDmuBad == 2 && nChBad < 3) continue;
1827
1828 if (nDmuBad>2 || nChBad > 9 || nChTot > 19 || has23) {
1829
1830 ++nDmuErr;
1831
1832 for (const TileDigits* tile_digits : *digitsCollection) {
1833
1834 HWIdentifier adcId = tile_digits->adc_HWID();
1835 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1836 m_tileHWID->get_hash(chId, hash, &chan_context);
1838 std::vector<float> samples = tile_digits->samples();
1839
1840 if (!
m_chanSel[hash] && samples.size()>6) {
1844 const char *cellname = "";
1845 int ch_type = 0;
1846 if (channel == chMBTS) {
1847 cellname = " MBTS";
1848 ch_type = 2;
1849 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1850 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1851 cellname = " GAP";
1852 ch_type = 1;
1853 } else if (chEmpty > 0) {
1854 cellname = " EMPTY";
1855 }
1856 const char *badname = "";
1858 badname = " BADDB";
1859 } else if (DQstatus && !DQstatus->isAdcDQgood(ros, drawer, channel, adc)) {
1860 badname = " BADDQ";
1862 badname = " BADDCS";
1864 if (badFromCell) {
1865 if (ch_type != 2) badname = " BADQUAL";
1867 } else {
1868 badname = " BADUNKN";
1869 }
1870 }
else if (badFromCell &&
m_chanEne[hash] == 0.0) {
1871 badname = " BADDIGI";
1872 }
1873
1874 char badnm[30];
1875 sprintf(badnm, " BADDIGIEX%s", badname);
1876 float dmin, dmax;
1877
1880 if (err) {
1881 bool isConnected = (chEmpty < 2);
1882 if (isConnected || err != -2) {
1883 badname = badnm;
1884 }
1885 if (err > 0) {
1886 if (err < 10) {
1887 badnm[9] = 48 +
err;
1888 } else if (err < 36) {
1889 badnm[9] = 55 +
err;
1890 }
1891 } else {
1892 badnm[9] = 48;
1893 }
1894 }
1895
1896 const char *enename = " ene = ";
1897 const char *timename = " time = ";
1898 const char *qualname = " qual = ";
1899 if (badFromCell && badname[0] != 0) {
1900 enename = " BAD = ";
1902 qualname = " eDSP = ";
1904 }
1906 timename = " tDSP = ";
1908 }
1909 }
1910
1914 bool jumpZer = (dmin < 0.01);
1915
1917 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1918 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1919 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1920 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1923 << cellname << badname
1924 << ((accEmin) ? " neg_e" : "")
1925 << ((accEmax) ? " pos_e" : "")
1926 << ((jumpZer) ? " underflow" : "")
1927 << ((jumpOve) ? " overflow" : "") );
1928
1929 }
1930 }
1931 }
1932
1933 std::ostringstream badstr;
1934 badstr << " ch: " << nChBad1 << " + " << nChBad2 << " = " << nChBad << " / " << nChTot << " = " << 100*nChBad/nChTot
1935 << " % dmu: " << nDmuBad1 << " + " << nDmuBad2 << " = " << nDmuBad << " / " << nDmuTot << " ";
1936 for (int dmu=0; dmu<16; ++dmu) {
1937 if (nChDmu[dmu]>0) {
1938 badstr << " " << std::hex << dmu << "=" << nChBadDmu[dmu] << "/" << nChDmu[dmu];
1939 }
1940 }
1942 <<
" drw " <<
drwname(digitsCollection->identify()) << badstr.str());
1943 }
1944 }
1945
1946 if (nConst) {
1948 statusOk = true;
1950 << " n_const_sample_errors = " << nConst
1951 << " accepted");
1952 }
1953 if (nJump) {
1955 statusOk = true;
1957 << " n_jump_sample_errors = " << nJump
1958 << " accepted");
1959 }
1960 if (nOverLG) {
1962 statusOk = true;
1964 << " n_overflow_LG = " << nOverLG
1965 << " accepted");
1966 }
1967 if (nOverHG) {
1969 statusOk = true;
1971 << " n_overflow_HG = " << nOverHG
1972 << " accepted");
1973 }
1974 if (nUnderLG) {
1976 statusOk = true;
1978 << " n_underflow_LG = " << nUnderLG
1979 << " accepted");
1980 }
1981 if (nUnderHG) {
1983 statusOk = true;
1985 << " n_underflow_HG = " << nUnderHG
1986 << " accepted");
1987 }
1988 if (nDmuErr) {
1990 statusOk = true;
1992 << " n_DMU_errors = " << nDmuErr
1993 << " accepted");
1994 }
1995 }
1996 }
1997
2000 else
2002
2003 if (statusOk) {
2005
2006 } else {
2007
2008 }
2009
2010 return StatusCode::SUCCESS;
2011}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static std::string drwname(int id)
static const Attributes_t empty
void setFilterPassed(bool state) const
float time() const
get time (data member)
double energy() const
get energy (data member)
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
std::vector< float > m_chanEne
bool m_bitTimeCell[ptnlength]
int Are3FF(std::vector< float > &OptFilterDigits, int OptFilterGain, int ch_type)
std::vector< float > m_chanDsp
bool m_bitEneChan[3][ptnlength]
ToolHandle< ITileBadChanTool > m_tileBadChanTool
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
std::vector< bool > m_chanSel
std::vector< bool > m_chanToSkip
ToolHandle< ITileDCSTool > m_tileDCS
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
std::vector< bool > m_chanBad
bool m_bitTimeChan[3][ptnlength]
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
std::vector< int > m_nDrawerOff
std::vector< float > m_chanTime
std::vector< bool > m_drawerToSkip
std::vector< float > m_chanTDsp
std::vector< float > m_chanQua
float m_ADCmaskValueMinusEps
bool m_bitEneCell[ptnlength]
uint8_t qual1(void) const
get quality of first PMT (data member)
float time1(void) const
get time of first PMT
int gain2(void) const
get gain of second PMT
bool badch1(void) const
check if first PMT is in bad channel list and masked
uint8_t qbit2(void) const
get quality bits of second PMT (data member)
int gain1(void) const
get gain of first PMT
uint8_t qual2(void) const
get quality of second PMT (data member)
float ene1(void) const
get energy of first PMT
bool badch2(void) const
check if second PMT is in bad channel list and masked
float time2(void) const
get time of second PMT
uint8_t qbit1(void) const
get quality bits of first PMT (data member)
float ene2(void) const
get energy of second PMT
static int isChEmpty(int partition, int drawer, int ch)
True if channel is not fully implemented.
static int CorruptedData(int ros, int drawer, int channel, int gain, const std::vector< float > &digits, float &dmin, float &dmax, float ADCmaxMinusEps, float ADCmaskValueMinusEps)
@ OnlineMegaElectronVolts
float time(int ind=0) const
float amplitude(int ind=0) const
HWIdentifier adc_HWID(void) const
@ Tile
The Tile calorimeter.
@ Warning
The sub-detector issued a warning.
@ Error
The sub-detector issued an error.
time(flags, cells_name, *args, **kw)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())