Execute method.
374 {
375
376
377
379
381 if ( eventInfo.isValid() ) {
384 m_evtNum = eventInfo->eventNumber();
388 } else {
395 }
396
397 std::ostringstream evState;
398 evState <<
"Run "<< std::setw(6) <<
m_runNum
400 <<
" Evt "<< std::setw(9) <<
m_evtNum
402 <<
" Flags 0x" << std::hex <<
m_tileFlag << std::dec;
403
404 std::ostringstream evtnum;
405 evtnum <<
"Run "<< std::setw(6) <<
m_runNum
407 <<
" Evt "<< std::setw(9) <<
m_evtNum
409
410 std::ostringstream nevtnum;
411 nevtnum << evtnum.str()
413
414 bool emptyBad = true;
415 bool badFromCell = false;
426
427 IdContext chan_context =
m_tileHWID->channel_context();
431 HWIdentifier ch_id =
m_tileHWID->channel_id(drawer_id,0);
432 m_tileHWID->get_hash(ch_id, hash, &chan_context);
434 std::fill(itr,itr+48,true);
435 }
436
439 if (statusOk) {
441
442 using namespace boost::local_time;
443 using namespace boost::posix_time;
444 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"));
445 local_date_time gva_time(from_time_t(eventInfo->timeStamp()),gva_tz);
446 evState << " " << gva_time << " ";
447
448
449 const char *
part[5] = {
"UNK",
"LBA",
"LBC",
"EBA",
"EBC" };
453 int n2 = (n1 +
dn - 1) % 64;
455 evState <<
" " <<
part[
rr] <<std::setw(2)<<std::setfill(
'0')<<n1+1
456 <<
" - " <<
part[
rr] <<std::setw(2)<<std::setfill(
'0')<<n2+1
457 <<
" " <<
dn <<
" consec bad ";
458 }
464 int pp = 1;
465 for (
int rr = 1;
rr < 5; ++
rr) {
466 if ((p2 & pp) || (p1 & pp)) {
467 evState <<
" " <<
part[
rr];
468 if (p2 & pp) {
469 if (p0 & pp) evState << " off";
470 else evState << " OFF";
471 }
472 if (p1 & pp) {
473 if (p0 & pp) evState << " mask";
474 else evState << " MASK";
475 }
476 }
477 pp <<= 1;
478 }
479 evState <<
" " <<
dn <<
" consec bad ";
480 }
481
483 int n1 = -1;
484 int n2 = -1;
490 std::vector<int> allmod;
491 std::vector<int> consec;
492 for (
int ros = 1;
ros < 5; ++
ros) {
493 int drmax = 65;
494 for (
int dr = 0;
dr < drmax; ++
dr) {
499 if (dr < 64) allmod.push_back((ros << 8) + dr);
500 } else if (m1 >= 0) {
502 if (m1 == 0) drmax +=
dm;
503 if (dm > dn) {
508 consec.clear();
509 consec.push_back((ros << 8) + m1);
510 } else if (dm == dn) {
511 if (m1 < 64) consec.push_back((ros << 8) + m1);
512 }
514 }
515 }
516 }
517 evState << " DCS " << allmod.size() << " off ";
518 if (dn > 1) {
520 if (consec.size() > 1) evState << "*" << (consec.size());
521 evState << " consec "
522 <<
part[
rr] << std::setw(2) << std::setfill(
'0') << (n1 % 64) + 1 <<
" - "
523 << part[
rr] << std::setw(2) << std::setfill(
'0') << (n2 % 64) + 1 <<
" ";
526 for (
size_t n = 1;
n < consec.size(); ++
n) {
529 evState << part[m1 >> 8] << std::setw(2) << std::setfill(
'0') << (
m1 % 64) + 1 <<
" - "
530 << part[m2 >> 8] << std::setw(2) << std::setfill(
'0') << (
m2 % 64) + 1 <<
" ";
531 for (
size_t m = 0;
m < allmod.size(); ++
m) {
533 if (mm >= m1 && mm <= m2) {
534 allmod[
m] += n1 -
m1;
535 }
536 }
537 }
538 } else {
540 }
541 if (allmod.size() > (size_t) dn) {
542 for (
size_t m = 0;
m < allmod.size(); ++
m) {
544 if (!(mm >= n1 && mm <= n2)) {
545 evState << part[mm >> 8] << std::setw(2) << std::setfill(
'0') << (
mm % 64) + 1 <<
" ";
546 }
547 }
548 }
549 }
550
552 }
553
554 int rawdata = -1;
555 const TileCell* cellminCh = 0;
556 const TileCell* cellmaxCh = 0;
557 const TileCell* tcellminCh = 0;
558 const TileCell* tcellmaxCh = 0;
559
561
562
564
565 if (!cellContainer.isValid()) {
566
567 ATH_MSG_WARNING(
"Unable to read CaloCellContainer from EventStore, disable reading of this container");
569
570 } else {
571
572 float emin = 0.;
573 float emax = 0.;
574 float tmin = 0.;
575 float tmax = 0.;
578 float tcmin = 0.;
579 float tcmax = 0.;
582 const TileCell* tcellmin = 0;
583 const TileCell* tcellmax = 0;
584
585
586
587
588
589
591
592 for (const CaloCell* cell : *cellContainer) {
593
594 Identifier
id =
cell->ID();
596 const TileCell* tile_cell =
dynamic_cast<const TileCell*
> (
cell);
597 if (tile_cell==0) continue;
598 const CaloDetDescrElement * caloDDE =
cell->caloDDE();
599 IdentifierHash hash1 = caloDDE->
onl1();
600 IdentifierHash hash2 = caloDDE->
onl2();
603 if (rawdata < 0) {
605 }
606
607 bool bad1 = tile_cell->
badch1();
608 bool bad2 = tile_cell->
badch2();
609 float ene1 = tile_cell->
ene1();
610 float ene2 = tile_cell->
ene2();
611 float time1 = tile_cell->
time1();
612 float time2 = tile_cell->
time2();
621
622 float ene = tile_cell->
energy();
623 bool eneOk = false;
628 } else {
630 }
631
632 if (eneOk) {
633 if (bad1 && bad2) {
635 } else {
637 }
638 }
639
641 bool timeOk = false;
646 } else {
648 }
649
650 if (timeOk) {
651 if (time != 0.) {
653 } else {
655 }
656 }
657
658 if (timeOk && eneOk) {
659
661 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
662 << " ene = " << ene << " time = " << time);
663
666
667 if (ene < emin) {
668 emin = ene;
670 } else if (ene > emax) {
671 emax = ene;
673 }
674
675 if (time<tmin) {
677 tcellmin = tile_cell;
678 }
679 else if (time>tmax) {
681 tcellmax = tile_cell;
682 }
683 }
684
685 if ( !(bad1 && bad2) ) {
686
687 bool ene1Ok = false;
688 bool time1Ok = false;
689
695 } else {
697 }
698
703 } else {
705 }
706
707 if (ene1Ok) {
709 }
710
711 if (time1Ok) {
712 if (time1 != 0.) {
714 } else {
716 }
717 }
718 }
719
720 bool ene2Ok = false;
721 bool time2Ok = false;
722
728 } else {
730 }
731
736 } else {
738 }
739
740 if (ene2Ok) {
742 }
743
744 if (time2Ok) {
745 if (time2 != 0.) {
747 } else {
749 }
750 }
751 }
752
753 bool over1=false;
754 bool over2=false;
755 if (checkOver) {
758 }
759
760 if ((ene1Ok && time1Ok) || over1) {
761
763 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
764 << " ch_ene1 = " << ene1 << " ch_t1 = " << time1
765 << ((over1)?" overflow":""));
766
769
770 if (ene1 < chmin) {
772 cellminCh = tile_cell;
773 } else if (ene1 > chmax) {
775 cellmaxCh = tile_cell;
776 }
777
778 if (time1 < tcmin) {
779 tcmin = time1;
780 tcellminCh = tile_cell;
781 } else if (time1 > tcmax) {
782 tcmax = time1;
783 tcellmaxCh = tile_cell;
784 }
785 }
786
787 if ((ene2Ok && time2Ok) || over2) {
788
790 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
id,-2)
791 << " ch_ene2 = " << ene2 << " ch_t2 = " << time2
792 << ((over2)?" overflow":""));
793
796
797 if (ene2 < chmin) {
799 cellminCh = tile_cell;
800 } else if (ene2 > chmax) {
802 cellmaxCh = tile_cell;
803 }
804
805 if (time2 < tcmin) {
806 tcmin = time2;
807 tcellminCh = tile_cell;
808 } else if (time2 > tcmax) {
809 tcmax = time2;
810 tcellmaxCh = tile_cell;
811 }
812 }
813
814 }
815 }
816 }
817
818 if (tcellmin && tcellmin != cellmin && tcellmin != cellmax) {
820 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmin->
ID(),-2)
821 <<
" ene = " << tcellmin->
energy()
822 <<
" tmin = " << tcellmin->
time());
823 }
824 if (tcellmax && tcellmax != cellmin && tcellmax != cellmax) {
826 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmax->
ID(),-2)
827 <<
" ene = " << tcellmax->
energy()
828 <<
" tmax = " << tcellmax->
energy());
829 }
830
831 if (tcellminCh && tcellminCh != cellminCh && tcellminCh != cellmaxCh) {
833 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellminCh->
ID(),-2)
834 <<
" ch_ene = " << tcellminCh->
ene1() <<
" " << tcellminCh->
ene2()
835 <<
" ch_tmin = " << tcellminCh->
time1() <<
" " << tcellminCh->
time2());
836 }
837 if (tcellmaxCh && tcellmaxCh != cellminCh && tcellmaxCh != cellmaxCh) {
839 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(tcellmaxCh->
ID(),-2)
840 <<
" ch_ene = " << tcellmaxCh->
ene1() <<
" " << tcellmaxCh->
ene2()
841 <<
" ch_tmax = " << tcellmaxCh->
time1() <<
" " << tcellmaxCh->
time2());
842 }
843
844 if (cellmin) {
846 statusOk = true;
847 const char *
tit = (tcellmin ==
cellmin) ?
" tmin = ": ((tcellmax ==
cellmin) ?
" tmax = ":
" t = ");
848 if (cellminCh!=cellmin) {
850 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmin->ID(),-2)
851 << " emin = " << emin
853 << " accepted");
854
855 } else {
857 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmin->ID(),-2)
858 << " emin = " << emin
859 << " ch_emin = " << chmin
861 << " accepted");
862 }
863 }
864
865 if (cellminCh) {
867 statusOk = true;
868 const char *
tit = (tcellminCh == cellminCh) ?
" tmin = ": ((tcellmaxCh == cellminCh) ?
" tmax = ":
" t = ");
869 if (cellminCh!=cellmin) {
871 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(cellminCh->
ID(),-2)
872 << " ch_emin = " << chmin
873 << tit << cellminCh->
time()
874 << " accepted");
875 }
876 }
877
878 if (cellmax) {
880 statusOk = true;
881 const char *
tit = (tcellmin ==
cellmax) ?
" tmin = ": ((tcellmax ==
cellmax) ?
" tmax = ":
" t = ");
882 if (cellmaxCh!=cellmax) {
884 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmax->ID(),-2)
885 << " emax = " << emax
887 << " accepted");
888
889 } else {
891 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(
cellmax->ID(),-2)
892 << " emax = " << emax
893 << " ch_emax = " << chmax
895 << " accepted");
896 }
897 }
898
899 if (cellmaxCh) {
901 statusOk = true;
902 const char *
tit = (tcellminCh == cellmaxCh) ?
" tmin = ": ((tcellmaxCh == cellmaxCh) ?
" tmax = ":
" t = ");
903 if (cellmaxCh!=cellmax) {
905 <<
" cell " << std::left << std::setw(14) <<
m_tileID->to_string(cellmaxCh->
ID(),-2)
906 << " ch_emax = " << chmax
907 << tit << cellmaxCh->
time()
908 << " accepted");
909 }
910 }
911
912 emptyBad = false;
913 badFromCell = true;
914 }
915 }
916
917 const TileDQstatus* DQstatus(0);
918
920
921
923
925 ATH_MSG_WARNING(
"Unable to read TileRawChannelContainer from EventStore, disable reading of this container");
927
928 } else {
929
932 float tcmin = 0.;
933 float tcmax = 0.;
934 const TileRawChannel* minCh = 0;
935 const TileRawChannel* maxCh = 0;
936 const TileRawChannel* tminCh = 0;
937 const TileRawChannel* tmaxCh = 0;
941 bool fillChanEne = ( !
m_readCells && allowAmpCheck );
942 if (!fillChanEne) {
947 }
948
951 else
952 rawdata = 0;
953
954 IdContext chan_context =
m_tileHWID->channel_context();
957
958 int nbadMax = 0;
959 int nbadMBMax = 0;
960 const TileRawChannelCollection * collMax = 0;
961 const TileRawChannelCollection * collMBMax = 0;
962
963 bool someDQerrors = false;
964
965 for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
966
967 int frag = rawChannelCollection->identify();
968 bool eb = (frag > 0x2ff);
969 bool ebsp = (frag == 0x30e || frag == 0x411);
970
975
976 int chMBTS = -1;
977 if (eb) {
978 for (int ch: {12,4,0}) {
979 m_cabling->h2s_cell_id_index(ros,drawer,ch,index,pmt);
980 if (index == -2) {
982 break;
983 }
984 }
985 }
986
987 HWIdentifier ch_id =
m_tileHWID->channel_id(ros,drawer,0);
988 m_tileHWID->get_hash(ch_id, hash, &chan_context);
989 int hashNext =
index = (
int)hash + 48;
990
991
992
993 uint32_t RODBCID = rawChannelCollection->getRODBCID();
994 uint32_t DSPBCID = rawChannelCollection->getFragDSPBCID();
995 uint32_t GlobalCRCErr = rawChannelCollection->getFragGlobalCRC() & 0x1;
996 uint32_t FE_DMUmask = rawChannelCollection->getFragFEChipMask();
997 uint32_t ROD_DMUmask = rawChannelCollection->getFragRODChipMask();
998 uint32_t BCIDErr = rawChannelCollection->getFragBCID();
999 uint32_t MemoryParityErr = rawChannelCollection->getFragMemoryPar();
1000 uint32_t HeaderFormatErr = rawChannelCollection->getFragHeaderBit();
1001 uint32_t HeaderParityErr = rawChannelCollection->getFragHeaderPar();
1002 uint32_t SampleFormatErr = rawChannelCollection->getFragSampleBit();
1003 uint32_t SampleParityErr = rawChannelCollection->getFragSamplePar();
1004 uint32_t SingleStrobeErr = rawChannelCollection->getFragSstrobe();
1005 uint32_t DoubleStrobeErr = rawChannelCollection->getFragDstrobe();
1006
1007 if (RODBCID!=0 && RODBCID !=
m_evtBCID ) {
1010 <<
" drw " <<
drwname(rawChannelCollection->identify())
1011 << " ROD BCID " << RODBCID << " is wrong - skipping");
1012
1015 << " suppressing further messages about drawer 0x" << std::hex << rawChannelCollection->identify()
1016 << std::dec << " being bad");
1017 }
1018 someDQerrors = true;
1019 continue;
1020 }
1021
1022 if (DSPBCID >= 0x7FFF
1023 && GlobalCRCErr
1024 && FE_DMUmask == 0xFFFF
1025 && ROD_DMUmask == 0xFFFF
1026 && BCIDErr == 0xFFFF
1027 && MemoryParityErr == 0xFFFF
1028 && HeaderFormatErr == 0xFFFF
1029 && HeaderParityErr == 0xFFFF
1030 && SampleFormatErr == 0xFFFF
1031 && SampleParityErr == 0xFFFF
1032 && SingleStrobeErr == 0xFFFF
1033 && DoubleStrobeErr == 0xFFFF) {
1034
1037 <<
" drw " <<
drwname(rawChannelCollection->identify())
1038 << " is OFF - skipping");
1039
1042 << " suppressing further messages about drawer 0x" << std::hex
1043 << rawChannelCollection->identify()
1044 << std::dec << " being bad");
1045 }
1046 continue;
1047 }
1048
1049 if (DSPBCID == 0
1050 && GlobalCRCErr == 0
1051 && FE_DMUmask == 0
1052 && ROD_DMUmask == 0
1053 && BCIDErr == 0
1054 && MemoryParityErr == 0
1055 && HeaderFormatErr == 0
1056 && HeaderParityErr == 0
1057 && SampleFormatErr == 0
1058 && SampleParityErr == 0
1059 && SingleStrobeErr == 0
1060 && DoubleStrobeErr == 0) {
1061
1064 <<
" drw " <<
drwname(rawChannelCollection->identify())
1065 << " is MISSING - skipping");
1066
1069 << " suppressing further messages about drawer 0x" << std::hex
1070 << rawChannelCollection->identify() << std::dec << " being bad");
1071 }
1072 continue;
1073 }
1074
1075 if (GlobalCRCErr) {
1076 GlobalCRCErr = 0xFFFF;
1080 <<
" drw " <<
drwname(rawChannelCollection->identify())
1081 << " global CRC error - skipping");
1082
1085 << " suppressing further messages about drawer 0x" << std::hex
1086 << rawChannelCollection->identify() << std::dec << " being bad");
1087 }
1088 someDQerrors = true;
1089 continue;
1090 }
1091 }
1092
1093 if (HeaderFormatErr || HeaderParityErr || SampleFormatErr || SampleParityErr ) {
1094 FE_DMUmask = 0xFFFF;
1095 } else {
1096 if (eb) {
1097 if (ebsp) FE_DMUmask<<=1;
1098 FE_DMUmask = (FE_DMUmask & 0xFF) | ((FE_DMUmask & 0xF00)<<2);
1099 }
1100 }
1101
1102 FE_DMUmask = ~FE_DMUmask & 0xFFFF;
1103 ROD_DMUmask = ~ROD_DMUmask & 0xFFFF;
1104
1105 if (BCIDErr & 0x2) {
1106 BCIDErr = 0xFFFF;
1110 <<
" drw " <<
drwname(rawChannelCollection->identify())
1111 << " BCID in DMU1 is bad - skipping");
1112
1115 << " suppressing further messages about drawer 0x"
1116 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1117 }
1118 someDQerrors = true;
1119 continue;
1120 }
1121
1122 } else {
1123
1124 if ( DSPBCID!=0xDEAD && DSPBCID!=
m_evtBCID ) {
1125 BCIDErr = 0xFFFF;
1129 <<
" drw " <<
drwname(rawChannelCollection->identify())
1130 << " DSP BCID is wrong - skipping");
1131
1134 << " suppressing further messages about drawer 0x"
1135 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1136 }
1137 someDQerrors = true;
1138 continue;
1139 }
1140 }
1141 }
1142
1143 uint32_t error = GlobalCRCErr | FE_DMUmask | ROD_DMUmask | BCIDErr | MemoryParityErr |
1144 HeaderFormatErr | HeaderParityErr | SampleFormatErr | SampleParityErr;
1145
1149 <<
" drw " <<
drwname(rawChannelCollection->identify())
1150 << " whole drawer is bad - skipping");
1151
1154 << " suppressing further messages about drawer 0x"
1155 << std::hex << rawChannelCollection->identify() << std::dec << " being bad");
1156 }
1157 someDQerrors = true;
1158 continue;
1159 }
1160
1161
1166 << " enabling messages about drawer 0x" << std::hex
1167 << rawChannelCollection->identify()
1168 << std::dec <<
" being bad after " <<
m_maxVerboseCnt <<
" good events");
1169 }
1170 }
1171
1173 if (eb) {
1174 if (ebsp) {
1175 errMB &= 0x3cfe;
1176 } else {
1177 errMB &= 0x3cff;
1178 }
1179 }
1180 int nbadMB = 0;
1181 while (errMB) {
1182 if (errMB & 0xF) ++nbadMB;
1183 errMB >>= 4;
1184 }
1186 if (nbadMB > nbadMBMax) {
1187 nbadMBMax = nbadMB;
1188 collMBMax = rawChannelCollection;
1189 }
1190
1191 int nerr = 0;
1192 for (uint32_t i = 0x8000;
i != 0;
i >>= 1) {
1193 if (error&i) {
1194 ++nerr;
1196 } else {
1197 if (emptyBad && nbadMB < 4) {
1201 } else {
1203 }
1204 }
1205 }
1206
1207 int nbad = ((ebsp) ? nerr-5 : ((eb) ? nerr-4 : nerr));
1208
1210 someDQerrors = true;
1211 if (nbad > nbadMax) {
1212 nbadMax = nbad;
1213 collMax = rawChannelCollection;
1214 }
1215 }
1216 if (someDQerrors) {
1219 }
1220 }
1221
1222 if (allowAmpCheck || emptyBad) {
1223
1224 for (const TileRawChannel* rawChannel : *rawChannelCollection) {
1225
1226 HWIdentifier adcId = rawChannel->adc_HWID();
1227 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1228 m_tileHWID->get_hash(chId, hash, &chan_context);
1232 int ch_type = 0;
1233 if (channel == chMBTS) {
1234 ch_type = 2;
1235 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1236 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1237 ch_type = 1;
1238 }
1241 (DQstatus && !DQstatus->isAdcDQgood(ros,drawer,channel,adc)) ||
1243 }
1244
1245 if (allowAmpCheck) {
1246
1247 float amp = rawChannel->amplitude();
1248 float time = rawChannel->time();
1249 if (fillChanEne) {
1253 } else {
1256 }
1257
1262 continue;
1263
1264 bool ampOk = false;
1269 } else {
1271 }
1272
1273 bool timeOk = false;
1278 } else {
1280 }
1281
1282 if (ampOk && timeOk) {
1283
1285 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1286 << " ch_ene = " << amp << " ch_t = " << time);
1287
1289
1290 if (amp < chmin) {
1292 minCh = rawChannel;
1293 } else if (amp > chmax) {
1295 maxCh = rawChannel;
1296 }
1297
1298 if (time<tcmin) {
1300 tminCh = rawChannel;
1301 }
1302 else if (time>tcmax) {
1304 tmaxCh = rawChannel;
1305 }
1306 }
1307 }
1308 }
1309 }
1310
1311 for (index = hashNext - 48;
index < hashNext; ++
index) {
1312 if ((
m_chanSel[index] && rawdata) || someDQerrors) {
1314 <<
" drw " <<
drwname(rawChannelCollection->identify())
1315 << " nBadMB = " << nbadMB
1316 << " nBadDMU = " << nbad
1318 << " DSPBCID = " << rawChannelCollection->getFragDSPBCID()
1319 << " GlobCRC = " << rawChannelCollection->getFragGlobalCRC() << " " << GlobalCRCErr
1320 << " error = 0x" << std::hex << error
1321 << " FE_CRC = 0x" << rawChannelCollection->getFragFEChipMask() << " 0x" << FE_DMUmask
1322 << " ROD_CRC = 0x" << rawChannelCollection->getFragRODChipMask() << " 0x" << ROD_DMUmask
1323 << " BCIDErr = 0x" << rawChannelCollection->getFragBCID() << " 0x" << BCIDErr
1324 << " MemPar = 0x" << rawChannelCollection->getFragMemoryPar()
1325 << " HeadForm = 0x"<< rawChannelCollection->getFragHeaderBit()
1326 << " HeadPar = 0x" << rawChannelCollection->getFragHeaderPar()
1327 << " SampForm = 0x"<< rawChannelCollection->getFragSampleBit()
1328 << " SampPar = 0x" << rawChannelCollection->getFragSamplePar()
1329 << std::dec);
1330 break;
1331 }
1332 }
1333 }
1334
1337 statusOk = true;
1340 << " nBadMB = " << nbadMBMax
1341 << " accepted");
1342
1345 statusOk = true;
1348 << " nBadDMU = " << nbadMax
1349 << " accepted");
1350 }
1351
1352 if (tminCh && tminCh != minCh && tminCh != maxCh) {
1354 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(tminCh->
adc_HWID())
1356 <<
" tmin =" << tminCh->
time());
1357 }
1358
1359 if (tmaxCh && tmaxCh != minCh && tmaxCh != maxCh) {
1361 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(tmaxCh->
adc_HWID())
1363 <<
" tmax = " << tmaxCh->
time());
1364 }
1365
1366 if (minCh) {
1368 statusOk = true;
1369 const char *
tit = (tminCh == minCh) ?
" tmin = ": ((tmaxCh == minCh) ?
" tmax = ":
" t = ");
1371 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(minCh->
adc_HWID())
1372 << " ch_emin = " << chmin
1373 << tit << minCh->
time()
1374 << " accepted");
1375 }
1376 if (maxCh) {
1378 statusOk = true;
1379 const char *
tit = (tminCh == maxCh) ?
" tmin = ": ((tmaxCh == maxCh) ?
" tmax = ":
" t = ");
1381 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(maxCh->
adc_HWID())
1382 << " ch_emax = " << chmax
1383 << tit << maxCh->
time()
1384 << " accepted");
1385 }
1386 emptyBad = false;
1387 }
1388 }
1389
1390
1392
1393
1395
1396 if (!digitsContainer.isValid()) {
1397 ATH_MSG_WARNING(
"Unable to read TileDigitsContainer from EventStore, disable reading of this container");
1399
1400 } else {
1401
1402 IdContext chan_context =
m_tileHWID->channel_context();
1403 IdentifierHash
hash;
1405 int nConst = 0;
1406 int nJump = 0;
1407 int nDmuErr = 0;
1408 int nOverLG = 0;
1409 int nOverHG = 0;
1410 int nUnderLG = 0;
1411 int nUnderHG = 0;
1412
1413 for (const TileDigitsCollection * digitsCollection : *digitsContainer) {
1414
1415 int frag = digitsCollection->identify();
1416 bool eb = (frag > 0x2ff);
1417 bool ebsp = (frag == 0x30e || frag == 0x411);
1418
1419 int ros = frag >> 8;
1420 int drawer = frag & 0x3F;
1423
1424 int chMBTS = -1;
1425 if (eb) {
1426 for (int ch: {12,4,0}) {
1427 m_cabling->h2s_cell_id_index(ros,drawer,ch,index,pmt);
1428 if (index == -2) {
1430 break;
1431 }
1432 }
1433 }
1434
1435 int nChBadDB = 0;
1436 int nChBadNC = 0;
1437 int nChBad = 0;
1438 int nChTot = 0;
1439 int nChDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1440 int nChBadDmu[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1441
1442 for (const TileDigits* tile_digits : *digitsCollection) {
1443
1444 ++nChTot;
1445
1446 HWIdentifier adcId = tile_digits->adc_HWID();
1447 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1448 m_tileHWID->get_hash(chId, hash, &chan_context);
1452 ++nChDmu[dmu];
1454 bool isConnected = (chEmpty < 2);
1455 if (!isConnected) ++nChBadNC;
1457 const char *cellname = "";
1458 int ch_type = 0;
1459 if (channel == chMBTS) {
1460 cellname = " MBTS";
1461 ch_type = 2;
1462 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1463 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1464 cellname = " GAP";
1465 ch_type = 1;
1466 } else if (chEmpty > 0) {
1467 cellname = " EMPTY";
1468 }
1469
1470 const char *badname = "";
1471 if (DQstatus && !DQstatus->isAdcDQgood(ros,drawer,channel,adc)) {
1472 badname = " BADDQ";
1473 if (isConnected) {
1474 ++nChBad;
1475 ++nChBadDmu[dmu];
1476 }
1478 badname = " BADDCS";
1479 }
else if (
m_tileBadChanTool->getAdcStatus(drawerIdx,channel,adc,ctx).isBad()) {
1480 badname = " BADDB";
1481 if (isConnected) {
1482 ++nChBadDB;
1483 }
1485 if (badFromCell) {
1486 if (ch_type != 2) badname = " BADQUAL";
1488 if (isConnected && ch_type!=2) {
1489 ++nChBad;
1490 ++nChBadDmu[dmu];
1491 }
1492 } else {
1493 badname = " BADUNKN";
1494 }
1495 }
else if (badFromCell &&
m_chanEne[hash] == 0.0) {
1496 badname = " BADDIGI";
1497 if (isConnected) {
1498 ++nChBad;
1499 ++nChBadDmu[dmu];
1500 }
1501 }
1502 const char *enename = " ene = ";
1503 const char *timename = " time = ";
1504 const char *qualname = " qual = ";
1505 if (badFromCell && badname[0] != 0) {
1506 enename = " BAD = ";
1508 qualname = " eDSP = ";
1510 }
1512 timename = " tDSP = ";
1514 }
1515 }
1516
1517 char badnm[30];
1518 sprintf(badnm," BADDIGIEX%s",badname);
1519 float dmin,dmax;
1520
1521 std::vector<float> samples = tile_digits->samples();
1522 int nSamp = samples.size();
1523 if (nSamp > 6) {
1524
1528
1530
1531 if (badname[0]==0) {
1532 if (err && err>-3) {
1533 if (isConnected || err != -2) {
1535 badname = badnm;
1536 ++nChBad;
1537 ++nChBadDmu[dmu];
1538 if (!isConnected) --nChBadNC;
1539 }
1540 if (err > 0) {
1541 if (err < 10) {
1543 } else if (err < 36) {
1545 }
1546 } else {
1547 badnm[9] = 48;
1548 }
1549 } else {
1550
1551
1553 if (warn) {
1555 sprintf(badnm," warningE%d%s",warn,badname);
1556 badname = badnm;
1557 }
1558 }
1559 }
1560
1561 if ((!err)
1562 && (useCh)
1563 && (badname[0] == 0 || badname[1] == 'w'
1565
1566 if (adc) {
1567
1571 ++nOverHG;
1572 }
1573 }
1577 ++nUnderHG;
1578 }
1579 }
1580
1581 } else {
1582
1586 ++nOverLG;
1587 }
1588 }
1592 ++nUnderLG;
1593 }
1594 }
1595 }
1596 }
1597
1598 bool someSampErrors = false;
1599
1601
1604
1605 float ped = samples[0];
1608 int nped = 1;
1609 int npedmax = 1;
1610 bool cnstPed = true;
1611 bool cnstPedmax = true;
1612 for (
int i = 1;
i < nSamp; ++
i) {
1613 float smp = samples[
i];
1614 float dped = smp -
ped;
1615 if (fabs(dped) < pedDelta) {
1616 ++nped;
1617 if (dped != 0.0) {
1618 cnstPed = false;
1620 }
1621 } else {
1622 if (nped>npedmax) {
1623 npedmax=nped;
1624 cnstPedmax = cnstPed;
1625 }
1626 cnstPed = true;
1628 nped = 1;
1629 }
1630 if (smp<dmin) {
1631 dmin = smp;
1632 } else if (smp>dmax) {
1633 dmax = smp;
1634 }
1635 }
1636 if (nped>npedmax) {
1637 npedmax=nped;
1638 cnstPedmax = cnstPed;
1639 }
1640
1641 if (dmax - dmin >= jumpDelta) {
1644 bool accCnst = false;
1645 bool accJump = false;
1646 bool cnstMin = true;
1647 bool cnstMax = true;
1648 bool jumpNeg = false;
1649 bool jumpPos = false;
1650 bool jumpEnd = false;
1651 bool jumpZer = false;
1652 bool jumpOve = false;
1653 bool narrowUp = false;
1654 bool narrowDown = false;
1655 if (npedmax >=
m_constLength && ((dmax-ped) >= jumpDelta || (ped-dmin) >= jumpDelta) ) {
1656 ++nConst;
1657 accCnst = true;
1658 }
1659 int nmin = 0;
1661 int pmin = -1;
1662 int pmax = -1;
1663 float abovemin = dmax;
1664 float belowmax = dmin;
1665 for (
int i = 0;
i < nSamp; ++
i) {
1666 float smp = samples[
i];
1667 if (smp - dmin < pedDelta) {
1668 ++nmin;
1670 if (smp != dmin) cnstMin = false;
1671 }
1672 if (dmax - smp < pedDelta) {
1675 if (smp != dmax) cnstMax = false;
1676 }
1677 if (smp < abovemin && smp > dmin) {
1678 abovemin = smp;
1679 }
1680 if (smp > belowmax && smp < dmax) {
1681 belowmax = smp;
1682 }
1683 }
1684 if (
nmax + nmin == nSamp) {
1685 if (
nmax > 1 && nmin > 1) {
1686 ++nJump;
1687 accJump = true;
1688 }
else if (
nmax == 1) {
1689 if (pmax < nSamp - 1) {
1690 ++nJump;
1691 accJump = true;
1692 jumpPos = true;
1693 cnstMax = false;
1694 }
1695 if (pmax == 0 || pmax == nSamp - 1) {
1696 jumpEnd = true;
1697 }
1698 } else if (nmin == 1) {
1699 ++nJump;
1700 accJump = true;
1701 jumpNeg = true;
1702 cnstMin = false;
1703 if (pmin == 0 || pmin == nSamp - 1) {
1704 jumpEnd = true;
1705 }
1706 }
1707 }
1708 if (dmin == 0.0) {
1709 if (!accJump) {
1710 ++nJump;
1711 accJump = true;
1712 cnstMin = false;
1713 cnstMax = false;
1714 }
1715 jumpZer = true;
1716 }
1718 if (!accJump) {
1719 ++nJump;
1720 accJump = true;
1721 cnstMin = false;
1722 cnstMax = false;
1723 }
1724 jumpOve = true;
1725 }
1727 if (pmax > 0 && pmax < nSamp-1 && std::max(samples[pmax-1], samples[pmax+1]) < dmin+secondMax) {
1728 if (!accJump) {
1729 ++nJump;
1730 accJump = true;
1731 cnstMax = false;
1732 if (nmin +
nmax != nSamp) {
1733 cnstMin = false;
1734 }
1735 }
1736 narrowUp = true;
1737 }
1738 if (pmin > 0 && pmin < nSamp - 1 && std::min(samples[pmin - 1], samples[pmin + 1]) > dmax - secondMax) {
1739 if (!accJump) {
1740 ++nJump;
1741 accJump = true;
1742 cnstMin = false;
1743 if (nmin +
nmax != nSamp) {
1744 cnstMax = false;
1745 }
1746 }
1747 narrowDown = true;
1748 }
1749
1750 if (accEmin || accEmax || accCnst || accJump) {
1751 someSampErrors = true;
1753 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1754 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1755 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1756 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1759 << cellname << badname
1760 << ((accEmin) ? " neg_e" : "")
1761 << ((accEmax) ? " pos_e" : "")
1762 << ((accCnst) ? " const" : "")
1763 << ((accCnst&&cnstPedmax) ? "Const" : "")
1764 << ((accJump) ? " jump" : "")
1765 << ((accJump&&jumpZer) ? "Zero" : "")
1766 << ((accJump&&jumpOve) ? "Over" : "")
1767 << ((accJump&&jumpPos) ? "SingleUp" : ((narrowUp) ? "NarrowUp" : "") )
1768 << ((accJump&&jumpNeg) ? "SingleDown" : ((narrowDown) ? "NarrowDown" : "") )
1769 << ((accJump&&jumpEnd) ? "AtEdge" : "")
1770 << ((accJump&&cnstMin) ? "ConstMin" : "")
1771 << ((accJump&&cnstMax) ? "ConstMax" : "")
1772 << " " << dmax-dmin);
1773 }
1774 }
1775 }
1776
1777 if (someSampErrors) {
1783 bool jumpZer = (dmin < 0.01);
1785 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1786 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1787 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1788 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1791 << cellname << badname
1792 << ((accEmin) ? " neg_e" : "")
1793 << ((accEmax) ? " pos_e" : "")
1794 <<((jumpZer) ? " underflow" : "")
1795 <<((jumpOve) ? " overflow" : "") );
1796 }
1797
1798 }
1799 }
1800 if (
m_checkDMUs && nChBad > 1 && nChBad + nChBadDB + nChBadNC < nChTot) {
1801 int nChBad1 = 0;
1802 int nChBad2 = 0;
1803 int nDmuBad1 = 0;
1804 int nDmuBad2 = 0;
1805 int nDmuBad = 0;
1806 int nDmuTot = 0;
1807 bool has23 = false;
1808 for (int dmu = 0; dmu < 16; ++dmu) {
1809 if (nChDmu[dmu] > 0) {
1810 ++nDmuTot;
1811 if (nChBadDmu[dmu] > 0) {
1812 ++nDmuBad;
1813 if (dmu < 8) {
1814 nChBad1 += nChBadDmu[dmu];
1815 ++nDmuBad1;
1816 } else {
1817 nChBad2 += nChBadDmu[dmu];
1818 ++nDmuBad2;
1819 }
1820 if (nChBadDmu[dmu] == 2 && nChDmu[dmu] == 3) has23 = true;
1821 }
1822 }
1823 }
1824 if (nDmuBad == 1 ) continue;
1825 if (nDmuBad == 2 && nChBad < 3) continue;
1826
1827 if (nDmuBad>2 || nChBad > 9 || nChTot > 19 || has23) {
1828
1829 ++nDmuErr;
1830
1831 for (const TileDigits* tile_digits : *digitsCollection) {
1832
1833 HWIdentifier adcId = tile_digits->adc_HWID();
1834 HWIdentifier chId =
m_tileHWID->channel_id(adcId);
1835 m_tileHWID->get_hash(chId, hash, &chan_context);
1837 std::vector<float> samples = tile_digits->samples();
1838
1839 if (!
m_chanSel[hash] && samples.size()>6) {
1843 const char *cellname = "";
1844 int ch_type = 0;
1845 if (channel == chMBTS) {
1846 cellname = " MBTS";
1847 ch_type = 2;
1848 } else if ( (ebsp && (channel == 18 || channel == 19 || channel == 12 || channel == 13) )
1849 || (eb && (channel == 0 || channel == 1 || channel == 12 || channel == 13) ) ) {
1850 cellname = " GAP";
1851 ch_type = 1;
1852 } else if (chEmpty > 0) {
1853 cellname = " EMPTY";
1854 }
1855 const char *badname = "";
1857 badname = " BADDB";
1858 } else if (DQstatus && !DQstatus->isAdcDQgood(ros, drawer, channel, adc)) {
1859 badname = " BADDQ";
1861 badname = " BADDCS";
1863 if (badFromCell) {
1864 if (ch_type != 2) badname = " BADQUAL";
1866 } else {
1867 badname = " BADUNKN";
1868 }
1869 }
else if (badFromCell &&
m_chanEne[hash] == 0.0) {
1870 badname = " BADDIGI";
1871 }
1872
1873 char badnm[30];
1874 sprintf(badnm, " BADDIGIEX%s", badname);
1875 float dmin, dmax;
1876
1879 if (err) {
1880 bool isConnected = (chEmpty < 2);
1881 if (isConnected || err != -2) {
1882 badname = badnm;
1883 }
1884 if (err > 0) {
1885 if (err < 10) {
1886 badnm[9] = 48 +
err;
1887 } else if (err < 36) {
1888 badnm[9] = 55 +
err;
1889 }
1890 } else {
1891 badnm[9] = 48;
1892 }
1893 }
1894
1895 const char *enename = " ene = ";
1896 const char *timename = " time = ";
1897 const char *qualname = " qual = ";
1898 if (badFromCell && badname[0] != 0) {
1899 enename = " BAD = ";
1901 qualname = " eDSP = ";
1903 }
1905 timename = " tDSP = ";
1907 }
1908 }
1909
1913 bool jumpZer = (dmin < 0.01);
1914
1916 <<
" chan " << std::left << std::setw(14) <<
m_tileHWID->to_string(adcId)
1917 << enename <<
m_chanEne[hash] <<
" samp = " << samples[0]
1918 << " " << samples[1] << " " << samples[2] << " " << samples[3]
1919 << " " << samples[4] << " " << samples[5] << " " << samples[6]
1922 << cellname << badname
1923 << ((accEmin) ? " neg_e" : "")
1924 << ((accEmax) ? " pos_e" : "")
1925 << ((jumpZer) ? " underflow" : "")
1926 << ((jumpOve) ? " overflow" : "") );
1927
1928 }
1929 }
1930 }
1931
1932 std::ostringstream badstr;
1933 badstr << " ch: " << nChBad1 << " + " << nChBad2 << " = " << nChBad << " / " << nChTot << " = " << 100*nChBad/nChTot
1934 << " % dmu: " << nDmuBad1 << " + " << nDmuBad2 << " = " << nDmuBad << " / " << nDmuTot << " ";
1935 for (int dmu=0; dmu<16; ++dmu) {
1936 if (nChDmu[dmu]>0) {
1937 badstr << " " << std::hex << dmu << "=" << nChBadDmu[dmu] << "/" << nChDmu[dmu];
1938 }
1939 }
1941 <<
" drw " <<
drwname(digitsCollection->identify()) << badstr.str());
1942 }
1943 }
1944
1945 if (nConst) {
1947 statusOk = true;
1949 << " n_const_sample_errors = " << nConst
1950 << " accepted");
1951 }
1952 if (nJump) {
1954 statusOk = true;
1956 << " n_jump_sample_errors = " << nJump
1957 << " accepted");
1958 }
1959 if (nOverLG) {
1961 statusOk = true;
1963 << " n_overflow_LG = " << nOverLG
1964 << " accepted");
1965 }
1966 if (nOverHG) {
1968 statusOk = true;
1970 << " n_overflow_HG = " << nOverHG
1971 << " accepted");
1972 }
1973 if (nUnderLG) {
1975 statusOk = true;
1977 << " n_underflow_LG = " << nUnderLG
1978 << " accepted");
1979 }
1980 if (nUnderHG) {
1982 statusOk = true;
1984 << " n_underflow_HG = " << nUnderHG
1985 << " accepted");
1986 }
1987 if (nDmuErr) {
1989 statusOk = true;
1991 << " n_DMU_errors = " << nDmuErr
1992 << " accepted");
1993 }
1994 }
1995 }
1996
1999 else
2001
2002 if (statusOk) {
2004
2005 } else {
2006
2007 }
2008
2009 return StatusCode::SUCCESS;
2010}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
static std::string drwname(int id)
static const Attributes_t empty
virtual void setFilterPassed(bool state, const EventContext &ctx) 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())