open($fh, ">>",Hmon::HMONDIR."/files/speaklog");
}
$fh->autoflush(1);
- print $fh $str."\n";
+ print $fh "$id\t$str\n";
$speaklog->{$id} = time();
close($fh);
$oldmsg->{$id}=$str;
if($b >= 0x8b00 && $b < 0x8bff) { return "STS Hubs";}
if($b >= 0x8c00 && $b < 0x8cff) { return "fRPC Hubs";}
if($b >= 0x8d00 && $b < 0x8dff) { return "iTOF Hubs";}
- if($b >= 0x9000 && $b < 0xafff) { return "MDC";}
+ if($b >= 0x8e00 && $b < 0x8fff) { return "MDC";}
+ if($b >= 0xa000 && $b < 0xbfff) { return "MDC";}
$entries->{'server'} = ['fill', 'cpu', '', 'ebinputs', 'onlineqa']; #icinga, pwrsup
$entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits'];
$entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage'];
-$entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other'];
+$entries->{'endp'} = ['mdc','mdc12','rich', 'tof', 'other']; #'rpc',
$entries->{'feeerr'} = ['feeerr','trginp','trgqual','rpc','tof'];
$entries->{'rich'} = ['temp','LV','bkpl','isob','richthr'];
#$entries->{'padiwa'} = ['ecal','start','sts','itof','hodo'];
#$entries->{'hv2'} = ['mdchv','stshv','frpchv','itofhv','valve'];
$entries->{'hv2'} = ['mdchv','','','','sequencer'];
$entries->{'misc'} = ['seu','calib','magnet','env','valve'];
-$entries->{'misc2'} = ['ecal','tdctot','','',''];
+$entries->{'misc2'} = ['ecal','tdctot','boards','ip',''];
$entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu'];
# Switched off systems
###############################################################################
-our $RichOff = 1;
+our $RichOff = 0;
our $MdcHvOff = 0;
our $RichHvOff = 0;
# Missing Boards
###############################################################################
-our @mdc_boards_removed =(); # 2333 added 2024-03-01 #(0x2203, 0x2027, 0x2057); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
+our @mdc_boards_removed =(0x2257); # 2333 added 2024-03-01 #(0x2203, 0x2027, 0x2057); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
+our @mdc_new_boards_removed =(0x8e95,0xa950,0xa951);
+
our @mdc_chambers_removed =();
our @rich_boards_removed =();#(0x71a4,0x71a5,0x71b4,0x71b5,0x72a4,0x72a5,0x72b4,0x72b5,0x73a4,0x73a5,0x73b4,0x73b5,0x826a);
our @tof_boards_removed =();
<li>If there is a "Sync" error reported at the same time, look there.
<li>If the boards listed are from RICH (address starting with 7), do a "Resync DiRich".
<ul><li>If this didn't help, try a "Reboot DiRich" and "Reboot RICH Combiner" (takes 1 second only) followed by a DAQ restart</ul>
+<li>If the boards listed are from MDC 1/2 (address starting with A), do a "Resync MDC 12".
<li>Do a DAQ restart
<li>If it happens several times for the same board, consider a reboot of the corresponding board (see the list on the web server)
--- /dev/null
+<h3>MDC Endpoints</h3>
+
+This button shows if all new MDC boards are active.
+
+<h4>Error Handling</h4>
+<ul>
+<li>Do a "Resync MDC 12" (while DAQ is running, no restart required)
+<li>If this doesn't work, try a DAQ restart
+</ul>
+<br>
+
<h4>Single Event Upsets in FPGA</h4>
Radition effects can change the configuration of FPGA and alter their behavior.
Few of them are able to monitor these changes. The number shown is a rough estimate
-for the severity of radiation effects in the system. Note that neither MDC nor RICH
-front-ends (the most exposed systems!) can be included here.
+for the severity of radiation effects in the system. Note that RICH
+front-ends (one of the most exposed system!) can't be included here.
<h4>Error Handling</h4>
DAQ restart is needed.
Doing so before an actual failure of a board is always simpler and quicker.
-<p>Suggestion: Use reboot "Quite-a-lot" first, and then see if any reported errors remain.
-<p>The full message contains the addresses of affected boards - consider rebooting the
-coresponding subsystem at your convenience.
-
+<p>For MDC boards, you can do a "Resync MDC 12" at any time, without a DAQ restart.
+<p>For others use the appropriate reboot buttons, e.g. for RICH boards, use "Reboot RICH" and a DAQ restart.
+<p>You can also use "Quite-a-lot" in case of many systems affected
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Time::HiRes qw( gettimeofday usleep time );
+use FileHandle;
+use Data::Dumper;
+use POSIX qw/floor ceil/;
+use List::Util 'max';
+use Perl2Epics;
+use QA;
+use MDC;
+
+use Hmon;
+my $flog = Hmon::OpenLogfile();
+my $fqa = QA::OpenQAFile();
+
+use HADES::TrbNet;
+
+
+my $timer = 0;
+
+
+trb_init_ports() or die trb_strerror();
+
+
+while(1) {
+
+ my $noaddrboards="";
+ my $wrongtimeboards="";
+
+ my $boards = trb_register_read(0xffff,0x40);
+ foreach my $board ( keys %$boards ) {
+ next if $board == 0xfc00;
+ if ($board >= 0xf000) {
+ $noaddrboards .= sprintf("%04x (%s), ",$board,Hmon::getsystem($board));
+ }
+ if ($board >= 0xa000 && $board <= 0xbfff && $boards->{$board} < 0x65000000) {
+ $wrongtimeboards .= sprintf("%04x (%s), ",$board,Hmon::getsystem($board));
+ }
+ }
+
+ my $qastate = QA::OK;
+ my $status = "";
+ my $longmsg = "No wrong compile times or addresses found";
+ if ($noaddrboards ne "" || $wrongtimeboards ne "") {
+ chop $noaddrboards; chop $noaddrboards;
+ chop $wrongtimeboards; chop $wrongtimeboards;
+ $qastate = QA::ERROR;
+ $status = "Error";
+ $longmsg .= "Boards without valid addresses: $noaddrboards<br>" if $noaddrboards ne "";
+ $longmsg .= "Boards with wrong compile time: $wrongtimeboards" if $wrongtimeboards ne "";
+ }
+ QA::WriteQALog($fqa, "misc2", "boards", 30, $qastate,"Boards", $status,$longmsg);
+
+ system("logger -p local1.info -t DAQ Boards \\<E\\> $longmsg") if $qastate != QA::OK && $timer == 0;
+
+ $timer++ if $qastate != QA::OK;
+ $timer = 0 if $timer >= 15;
+ sleep 2;
+ };
###
);
-push(@mdc_boards,(0x8500, 0x8501, 0x8502, 0x8503, 0x8504, 0x8510, 0x8511, 0x8512, 0x8513, 0x8520, 0x8521, 0x8522, 0x8523, 0x8530, 0x8531, 0x8532, 0x8533, 0x8540, 0x8541, 0x8542, 0x8543, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554)); #MDC 1/2 hubs
-
-#push(@mdc_boards,( 0x8e00, 0xa000, 0xa001, 0x8e01, 0xa010, 0xa011, 0xa012, 0x8e02, 0xa020, 0xa021, 0xa022, 0x8e03, 0xa030, 0xa031, 0x8e04, 0xa040, 0xa041, 0x8e05, 0xa050, 0xa051, 0x8e06, 0xa060, 0xa061, 0xa062, 0x8e07, 0xa070, 0xa071, 0xa072, 0x8e08, 0xa080, 0xa081, 0x8e09, 0xa090, 0xa091, 0x8e0a, 0xa0a0, 0xa0a1, 0xa0a2, 0x8e0b, 0xa0b0, 0xa0b1, 0x8e0c, 0xa0c0, 0xa0c1, 0xa0c2, 0x8e0d, 0xa0d0, 0xa0d1, 0x8e10, 0xa100, 0xa101, 0x8e11, 0xa110, 0xa111, 0xa112, 0x8e12, 0xa120, 0xa121, 0xa122, 0x8e13, 0xa130, 0xa131, 0x8e14, 0xa140, 0xa141, 0x8e15, 0xa150, 0xa151, 0x8e16, 0xa160, 0xa161, 0xa162, 0x8e17, 0xa170, 0xa171, 0xa172, 0x8e18, 0xa180, 0xa181, 0x8e19, 0xa190, 0xa191, 0x8e1a, 0xa1a0, 0xa1a1, 0xa1a2, 0x8e1b, 0xa1b0, 0xa1b1, 0x8e1c, 0xa1c0, 0xa1c1, 0xa1c2, 0x8e1d, 0xa1d0, 0xa1d1, 0x8e20, 0xa200, 0xa201, 0x8e21, 0xa210, 0xa211, 0xa212, 0x8e22, 0xa220, 0xa221, 0xa222, 0x8e23, 0xa230, 0xa231, 0x8e24, 0xa240, 0xa241, 0x8e25, 0xa250, 0xa251, 0x8e26, 0xa260, 0xa261, 0xa262, 0x8e27, 0xa270, 0xa271, 0xa272, 0x8e28, 0xa280, 0xa281, 0x8e29, 0xa290, 0xa291, 0x8e2a, 0xa2a0, 0xa2a1, 0xa2a2, 0x8e2b, 0xa2b0, 0xa2b1, 0x8e2c, 0xa2c0, 0xa2c1, 0xa2c2, 0x8e2d, 0xa2d0, 0xa2d1, 0x8e30, 0xa300, 0xa301, 0x8e31, 0xa310, 0xa311, 0xa312, 0x8e32, 0xa320, 0xa321, 0xa322, 0x8e33, 0xa330, 0xa331, 0x8e34, 0xa340, 0xa341, 0x8e35, 0xa350, 0xa351, 0x8e36, 0xa360, 0xa361, 0xa362, 0x8e37, 0xa370, 0xa371, 0xa372, 0x8e38, 0xa380, 0xa381, 0x8e39, 0xa390, 0xa391, 0x8e3a, 0xa3a0, 0xa3a1, 0xa3a2, 0x8e3b, 0xa3b0, 0xa3b1, 0x8e3c, 0xa3c0, 0xa3c1, 0xa3c2, 0x8e3d, 0xa3d0, 0xa3d1, 0x8e40, 0xa400, 0xa401, 0x8e41, 0xa410, 0xa411, 0xa412, 0x8e42, 0xa420, 0xa421, 0xa422, 0x8e43, 0xa430, 0xa431, 0x8e44, 0xa440, 0xa441, 0x8e45, 0xa450, 0xa451, 0x8e46, 0xa460, 0xa461, 0xa462, 0x8e47, 0xa470, 0xa471, 0xa472, 0x8e48, 0xa480, 0xa481, 0x8e49, 0xa490, 0xa491, 0x8e4a, 0xa4a0, 0xa4a1, 0xa4a2, 0x8e4b, 0xa4b0, 0xa4b1, 0x8e4c, 0xa4c0, 0xa4c1, 0xa4c2, 0x8e4d, 0xa4d0, 0xa4d1, 0x8e50, 0xa500, 0xa501, 0x8e51, 0xa510, 0xa511, 0xa512, 0x8e52, 0xa520, 0xa521, 0xa522, 0x8e53, 0xa530, 0xa531, 0x8e54, 0xa540, 0xa541, 0x8e55, 0xa550, 0xa551, 0x8e56, 0xa560, 0xa561, 0xa562, 0x8e57, 0xa570, 0xa571, 0xa572, 0x8e58, 0xa580, 0xa581, 0x8e59, 0xa590, 0xa591, 0x8e5a, 0xa5a0, 0xa5a1, 0xa5a2, 0x8e5b, 0xa5b0, 0xa5b1, 0x8e5c, 0xa5c0, 0xa5c1, 0xa5c2, 0x8e5d, 0xa5d0, 0xa5d1)); #MDC I
-
-push(@mdc_boards,( 0x8e60, 0xa600, 0xa601, 0x8e61, 0xa610, 0xa611, 0x8e62, 0xa620, 0xa621, 0x8e63, 0xa630, 0xa631, 0x8e64, 0xa640, 0xa641, 0x8e65, 0xa650, 0xa651, 0x8e66, 0xa660, 0xa661, 0x8e67, 0xa670, 0xa671, 0x8e68, 0xa680, 0xa681, 0x8e69, 0xa690, 0xa691, 0x8e6a, 0xa6a0, 0xa6a1, 0x8e6b, 0xa6b0, 0xa6b1, 0x8e6c, 0xa6c0, 0xa6c1, 0x8e6d, 0xa6d0, 0xa6d1, 0x8e6e, 0xa6e0, 0xa6e1, 0xa6e2, 0x8e6f, 0xa6f0, 0xa6f1, 0xa6f2, 0x8e70, 0xa700, 0xa701, 0x8e71, 0xa710, 0xa711, 0x8e72, 0xa720, 0xa721, 0x8e73, 0xa730, 0xa731, 0x8e74, 0xa740, 0xa741, 0x8e75, 0xa750, 0xa751, 0x8e76, 0xa760, 0xa761, 0x8e77, 0xa770, 0xa771, 0x8e78, 0xa780, 0xa781, 0x8e79, 0xa790, 0xa791, 0x8e7a, 0xa7a0, 0xa7a1, 0x8e7b, 0xa7b0, 0xa7b1, 0x8e7c, 0xa7c0, 0xa7c1, 0x8e7d, 0xa7d0, 0xa7d1, 0x8e7e, 0xa7e0, 0xa7e1, 0xa7e2, 0x8e7f, 0xa7f0, 0xa7f1, 0xa7f2, 0x8e80, 0xa800, 0xa801, 0x8e81, 0xa810, 0xa811, 0x8e82, 0xa820, 0xa821, 0x8e83, 0xa830, 0xa831, 0x8e84, 0xa840, 0xa841, 0x8e85, 0xa850, 0xa851, 0x8e86, 0xa860, 0xa861, 0x8e87, 0xa870, 0xa871, 0x8e88, 0xa880, 0xa881, 0x8e89, 0xa890, 0xa891, 0x8e8a, 0xa8a0, 0xa8a1, 0x8e8b, 0xa8b0, 0xa8b1, 0x8e8c, 0xa8c0, 0xa8c1, 0x8e8d, 0xa8d0, 0xa8d1, 0x8e8e, 0xa8e0, 0xa8e1, 0xa8e2, 0x8e8f, 0xa8f0, 0xa8f1, 0xa8f2, 0x8e90, 0xa900, 0xa901, 0x8e91, 0xa910, 0xa911, 0x8e92, 0xa920, 0xa921, 0x8e93, 0xa930, 0xa931, 0x8e94, 0xa940, 0xa941, 0x8e95, 0xa950, 0xa951, 0x8e96, 0xa960, 0xa961, 0x8e97, 0xa970, 0xa971, 0x8e98, 0xa980, 0xa981, 0x8e99, 0xa990, 0xa991, 0x8e9a, 0xa9a0, 0xa9a1, 0x8e9b, 0xa9b0, 0xa9b1, 0x8e9c, 0xa9c0, 0xa9c1, 0x8e9d, 0xa9d0, 0xa9d1, 0x8e9e, 0xa9e0, 0xa9e1, 0xa9e2, 0x8e9f, 0xa9f0, 0xa9f1, 0xa9f2, 0x8ea0, 0xaa00, 0xaa01, 0x8ea1, 0xaa10, 0xaa11, 0x8ea2, 0xaa20, 0xaa21, 0x8ea3, 0xaa30, 0xaa31, 0x8ea4, 0xaa40, 0xaa41, 0x8ea5, 0xaa50, 0xaa51, 0x8ea6, 0xaa60, 0xaa61, 0x8ea7, 0xaa70, 0xaa71, 0x8ea8, 0xaa80, 0xaa81, 0x8ea9, 0xaa90, 0xaa91, 0x8eaa, 0xaaa0, 0xaaa1, 0x8eab, 0xaab0, 0xaab1, 0x8eac, 0xaac0, 0xaac1, 0x8ead, 0xaad0, 0xaad1, 0x8eae, 0xaae0, 0xaae1, 0xaae2, 0x8eaf, 0xaaf0, 0xaaf1, 0xaaf2, 0x8eb0, 0xab00, 0xab01, 0x8eb1, 0xab10, 0xab11, 0x8eb2, 0xab20, 0xab21, 0x8eb3, 0xab30, 0xab31, 0x8eb4, 0xab40, 0xab41, 0x8eb5, 0xab50, 0xab51, 0x8eb6, 0xab60, 0xab61, 0x8eb7, 0xab70, 0xab71, 0x8eb8, 0xab80, 0xab81, 0x8eb9, 0xab90, 0xab91, 0x8eba, 0xaba0, 0xaba1, 0x8ebb, 0xabb0, 0xabb1, 0x8ebc, 0xabc0, 0xabc1, 0x8ebd, 0xabd0, 0xabd1, 0x8ebe, 0xabe0, 0xabe1, 0xabe2, 0x8ebf, 0xabf0, 0xabf1, 0xabf2)); #MDC II
-
+# push(@mdc_boards,(0x8500, 0x8501, 0x8502, 0x8503, 0x8504, 0x8510, 0x8511, 0x8512, 0x8513, 0x8520, 0x8521, 0x8522, 0x8523, 0x8530, 0x8531, 0x8532, 0x8533, 0x8540, 0x8541, 0x8542, 0x8543, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554)); #MDC 1/2 hubs
+#
+# push(@mdc_boards,( 0x8e00, 0xa000, 0xa001, 0x8e01, 0xa010, 0xa011, 0xa012, 0x8e02, 0xa020, 0xa021, 0xa022, 0x8e03, 0xa030, 0xa031, 0x8e04, 0xa040, 0xa041, 0x8e05, 0xa050, 0xa051, 0x8e06, 0xa060, 0xa061, 0xa062, 0x8e07, 0xa070, 0xa071, 0xa072, 0x8e08, 0xa080, 0xa081, 0x8e09, 0xa090, 0xa091, 0x8e0a, 0xa0a0, 0xa0a1, 0xa0a2, 0x8e0b, 0xa0b0, 0xa0b1, 0x8e0c, 0xa0c0, 0xa0c1, 0xa0c2, 0x8e0d, 0xa0d0, 0xa0d1, 0x8e10, 0xa100, 0xa101, 0x8e11, 0xa110, 0xa111, 0xa112, 0x8e12, 0xa120, 0xa121, 0xa122, 0x8e13, 0xa130, 0xa131, 0x8e14, 0xa140, 0xa141, 0x8e15, 0xa150, 0xa151, 0x8e16, 0xa160, 0xa161, 0xa162, 0x8e17, 0xa170, 0xa171, 0xa172, 0x8e18, 0xa180, 0xa181, 0x8e19, 0xa190, 0xa191, 0x8e1a, 0xa1a0, 0xa1a1, 0xa1a2, 0x8e1b, 0xa1b0, 0xa1b1, 0x8e1c, 0xa1c0, 0xa1c1, 0xa1c2, 0x8e1d, 0xa1d0, 0xa1d1, 0x8e20, 0xa200, 0xa201, 0x8e21, 0xa210, 0xa211, 0xa212, 0x8e22, 0xa220, 0xa221, 0xa222, 0x8e23, 0xa230, 0xa231, 0x8e24, 0xa240, 0xa241, 0x8e25, 0xa250, 0xa251, 0x8e26, 0xa260, 0xa261, 0xa262, 0x8e27, 0xa270, 0xa271, 0xa272, 0x8e28, 0xa280, 0xa281, 0x8e29, 0xa290, 0xa291, 0x8e2a, 0xa2a0, 0xa2a1, 0xa2a2, 0x8e2b, 0xa2b0, 0xa2b1, 0x8e2c, 0xa2c0, 0xa2c1, 0xa2c2, 0x8e2d, 0xa2d0, 0xa2d1, 0x8e30, 0xa300, 0xa301, 0x8e31, 0xa310, 0xa311, 0xa312, 0x8e32, 0xa320, 0xa321, 0xa322, 0x8e33, 0xa330, 0xa331, 0x8e34, 0xa340, 0xa341, 0x8e35, 0xa350, 0xa351, 0x8e36, 0xa360, 0xa361, 0xa362, 0x8e37, 0xa370, 0xa371, 0xa372, 0x8e38, 0xa380, 0xa381, 0x8e39, 0xa390, 0xa391, 0x8e3a, 0xa3a0, 0xa3a1, 0xa3a2, 0x8e3b, 0xa3b0, 0xa3b1, 0x8e3c, 0xa3c0, 0xa3c1, 0xa3c2, 0x8e3d, 0xa3d0, 0xa3d1, 0x8e40, 0xa400, 0xa401, 0x8e41, 0xa410, 0xa411, 0xa412, 0x8e42, 0xa420, 0xa421, 0xa422, 0x8e43, 0xa430, 0xa431, 0x8e44, 0xa440, 0xa441, 0x8e45, 0xa450, 0xa451, 0x8e46, 0xa460, 0xa461, 0xa462, 0x8e47, 0xa470, 0xa471, 0xa472, 0x8e48, 0xa480, 0xa481, 0x8e49, 0xa490, 0xa491, 0x8e4a, 0xa4a0, 0xa4a1, 0xa4a2, 0x8e4b, 0xa4b0, 0xa4b1, 0x8e4c, 0xa4c0, 0xa4c1, 0xa4c2, 0x8e4d, 0xa4d0, 0xa4d1, 0x8e50, 0xa500, 0xa501, 0x8e51, 0xa510, 0xa511, 0xa512, 0x8e52, 0xa520, 0xa521, 0xa522, 0x8e53, 0xa530, 0xa531, 0x8e54, 0xa540, 0xa541, 0x8e55, 0xa550, 0xa551, 0x8e56, 0xa560, 0xa561, 0xa562, 0x8e57, 0xa570, 0xa571, 0xa572, 0x8e58, 0xa580, 0xa581, 0x8e59, 0xa590, 0xa591, 0x8e5a, 0xa5a0, 0xa5a1, 0xa5a2, 0x8e5b, 0xa5b0, 0xa5b1, 0x8e5c, 0xa5c0, 0xa5c1, 0xa5c2, 0x8e5d, 0xa5d0, 0xa5d1)); #MDC I
+#
+# push(@mdc_boards,( 0x8e60, 0xa600, 0xa601, 0x8e61, 0xa610, 0xa611, 0x8e62, 0xa620, 0xa621, 0x8e63, 0xa630, 0xa631, 0x8e64, 0xa640, 0xa641, 0x8e65, 0xa650, 0xa651, 0x8e66, 0xa660, 0xa661, 0x8e67, 0xa670, 0xa671, 0x8e68, 0xa680, 0xa681, 0x8e69, 0xa690, 0xa691, 0x8e6a, 0xa6a0, 0xa6a1, 0x8e6b, 0xa6b0, 0xa6b1, 0x8e6c, 0xa6c0, 0xa6c1, 0x8e6d, 0xa6d0, 0xa6d1, 0x8e6e, 0xa6e0, 0xa6e1, 0xa6e2, 0x8e6f, 0xa6f0, 0xa6f1, 0xa6f2, 0x8e70, 0xa700, 0xa701, 0x8e71, 0xa710, 0xa711, 0x8e72, 0xa720, 0xa721, 0x8e73, 0xa730, 0xa731, 0x8e74, 0xa740, 0xa741, 0x8e75, 0xa750, 0xa751, 0x8e76, 0xa760, 0xa761, 0x8e77, 0xa770, 0xa771, 0x8e78, 0xa780, 0xa781, 0x8e79, 0xa790, 0xa791, 0x8e7a, 0xa7a0, 0xa7a1, 0x8e7b, 0xa7b0, 0xa7b1, 0x8e7c, 0xa7c0, 0xa7c1, 0x8e7d, 0xa7d0, 0xa7d1, 0x8e7e, 0xa7e0, 0xa7e1, 0xa7e2, 0x8e7f, 0xa7f0, 0xa7f1, 0xa7f2, 0x8e80, 0xa800, 0xa801, 0x8e81, 0xa810, 0xa811, 0x8e82, 0xa820, 0xa821, 0x8e83, 0xa830, 0xa831, 0x8e84, 0xa840, 0xa841, 0x8e85, 0xa850, 0xa851, 0x8e86, 0xa860, 0xa861, 0x8e87, 0xa870, 0xa871, 0x8e88, 0xa880, 0xa881, 0x8e89, 0xa890, 0xa891, 0x8e8a, 0xa8a0, 0xa8a1, 0x8e8b, 0xa8b0, 0xa8b1, 0x8e8c, 0xa8c0, 0xa8c1, 0x8e8d, 0xa8d0, 0xa8d1, 0x8e8e, 0xa8e0, 0xa8e1, 0xa8e2, 0x8e8f, 0xa8f0, 0xa8f1, 0xa8f2, 0x8e90, 0xa900, 0xa901, 0x8e91, 0xa910, 0xa911, 0x8e92, 0xa920, 0xa921, 0x8e93, 0xa930, 0xa931, 0x8e94, 0xa940, 0xa941, 0x8e95, 0xa950, 0xa951, 0x8e96, 0xa960, 0xa961, 0x8e97, 0xa970, 0xa971, 0x8e98, 0xa980, 0xa981, 0x8e99, 0xa990, 0xa991, 0x8e9a, 0xa9a0, 0xa9a1, 0x8e9b, 0xa9b0, 0xa9b1, 0x8e9c, 0xa9c0, 0xa9c1, 0x8e9d, 0xa9d0, 0xa9d1, 0x8e9e, 0xa9e0, 0xa9e1, 0xa9e2, 0x8e9f, 0xa9f0, 0xa9f1, 0xa9f2, 0x8ea0, 0xaa00, 0xaa01, 0x8ea1, 0xaa10, 0xaa11, 0x8ea2, 0xaa20, 0xaa21, 0x8ea3, 0xaa30, 0xaa31, 0x8ea4, 0xaa40, 0xaa41, 0x8ea5, 0xaa50, 0xaa51, 0x8ea6, 0xaa60, 0xaa61, 0x8ea7, 0xaa70, 0xaa71, 0x8ea8, 0xaa80, 0xaa81, 0x8ea9, 0xaa90, 0xaa91, 0x8eaa, 0xaaa0, 0xaaa1, 0x8eab, 0xaab0, 0xaab1, 0x8eac, 0xaac0, 0xaac1, 0x8ead, 0xaad0, 0xaad1, 0x8eae, 0xaae0, 0xaae1, 0xaae2, 0x8eaf, 0xaaf0, 0xaaf1, 0xaaf2, 0x8eb0, 0xab00, 0xab01, 0x8eb1, 0xab10, 0xab11, 0x8eb2, 0xab20, 0xab21, 0x8eb3, 0xab30, 0xab31, 0x8eb4, 0xab40, 0xab41, 0x8eb5, 0xab50, 0xab51, 0x8eb6, 0xab60, 0xab61, 0x8eb7, 0xab70, 0xab71, 0x8eb8, 0xab80, 0xab81, 0x8eb9, 0xab90, 0xab91, 0x8eba, 0xaba0, 0xaba1, 0x8ebb, 0xabb0, 0xabb1, 0x8ebc, 0xabc0, 0xabc1, 0x8ebd, 0xabd0, 0xabd1, 0x8ebe, 0xabe0, 0xabe1, 0xabe2, 0x8ebf, 0xabf0, 0xabf1, 0xabf2)); #MDC II
+#
#old planes 3/4
-# foreach my $p (2..3) {
-# foreach my $s (0..5) {
-# foreach my $m (0..15) {
-# next if($p==0 && $m >=14);
-# my $address = 0x2000 + $p*0x100 + $s*0x10 + $m;
-# push (@mdc_boards, $address);
-# }
-# }
-# }
+ foreach my $p (2..3) {
+ foreach my $s (0..5) {
+ foreach my $m (0..15) {
+ next if($p==0 && $m >=14);
+ my $address = 0x2000 + $p*0x100 + $s*0x10 + $m;
+ push (@mdc_boards, $address);
+ }
+ }
+ }
-# foreach my $mdc_sec (@QA::mdc_chambers_removed) {
-# foreach my $m (0..15) {
-# next if($mdc_sec<0x10 && $m >=14);
-# my $address = 0x2000 + $mdc_sec*0x10 + $m;
-# push (@QA::mdc_boards_removed, $address);
-# }
-# }
-
- my @rich_boards =(0x8017,0x8018,
- 0x83c0,0x83c1,0x83c2,0x83c3,0x83c4,0x83c5,0x83c6,0x83c7,0x83c8,0x83c9,0x83ca,0x83cb,
+ foreach my $mdc_sec (@QA::mdc_chambers_removed) {
+ foreach my $m (0..15) {
+ next if($mdc_sec<0x10 && $m >=14);
+ my $address = 0x2000 + $mdc_sec*0x10 + $m;
+ push (@QA::mdc_boards_removed, $address);
+ }
+ }
+
+ my @rich_boards =(
0x7010,0x7011,0x7020,0x7021,0x7030,0x7031,0x7040,0x7041,0x7050,0x7051,0x7060,0x7061,
0x7100,0x7101,0x7110,0x7111,0x7120,0x7121,0x7130,0x7131,0x7140,0x7141,0x7150,0x7151,0x7160,0x7161,0x7170,0x7171,0x7180,0x7181,0x7190,0x7191,
0x7200,0x7201,0x7210,0x7211,0x7220,0x7221,0x7230,0x7231,0x7240,0x7241,0x7250,0x7251,0x7260,0x7261,0x7270,0x7271,0x7280,0x7281,0x7290,0x7291,
0x6710,0x6711,0x6712,0x6713,
0x6720,0x6722,0x6723, #0x6721
-);
+# );
#RPC -> is ECAL, STS
- my @rpc_boards = (
+# my @rpc_boards = (
0x8a00,0x8a01,0x8a02,0x8a03,0x8a04,0x8a05,
0x6000,0x6001,0x6002,0x6003,0x6004,0x6005,0x6006,
0x6010,0x6011,0x6012,0x6013,0x6014,0x6015,0x6016,
#cts
0x0002,0x0003,
#central hub
- 0x8000,0x8011,0x8012,0x8013,0x8014,0x8800, 0x8810,
+ 0x8000,0x8011,0x8012,0x8013,0x8014,0x8800, 0x8810,0x8017,0x8018,
#innerTOF
+
# 0x8d00,0x5d00,0x5d01,0x5d02,0x5d03,0x5d04,0x5d05,
# 0x8d00,0x5d01,0x5d04,
+ #RICH Hubs
+ 0x83c0,0x83c1,0x83c2,0x83c3,0x83c4,0x83c5,0x83c6,0x83c7,0x83c8,0x83c9,0x83ca,0x83cb,
+
# #Pion
# 0x8900,0x3800,0x3801,
# 0x8910,0x3810,0x3811,
my $num_mdc_mistake = (scalar @{$mdc_results[4]});
my @sorted_mdc_results = sort @{$mdc_results[2]};
- $mdcmissingtime = 0 if $num_mdc_missing <= 2;
- $mdcmissingtime += max(0,$num_mdc_missing-2);
+ $mdcmissingtime = 0 if $num_mdc_missing < 2;
+ $mdcmissingtime += max(0,$num_mdc_missing-1);
#Are two boards from the same chamber missing?
my @mdcboards = (@sorted_mdc_results,@QA::mdc_boards_removed);
$fh->autoflush(1);
seek($fh, 0, 0);
- my $title = "MDC";
+ my $title = "MDC 3/4";
my $value = "OK ".(scalar @mdc_boards - scalar @QA::mdc_boards_removed);
$value .= "(-".(scalar @QA::mdc_boards_removed).")" if scalar @QA::mdc_boards_removed;
if ($num_mdc_missing > 0) {$value = "$num_mdc_missing / ".(scalar @mdc_boards - scalar @QA::mdc_boards_removed)." miss";}
$qastate = max($qastate,QA::ERROR) if $samechamberboards;
$qastate = max($qastate,QA::WARN) if $samesectorboards;
$qastate = max($qastate,QA::ERROR) if $samesectorboards > 2;
- $qastate = max($qastate,QA::WARN) if $mdcmissingtime > 600;
+ $qastate = max($qastate,QA::WARN) if $mdcmissingtime > 200;
$qastate = max($qastate,QA::NOTE) if $num_mdc_missing >= 1;
$longtext .= "<br>Some boards are missing for a long time. Better do a restart." if $mdcmissingtime > 360;
my $num_tof_mistake = (scalar @{$tof_results[4]});
my @sorted_tof_results = sort @{$tof_results[2]};
- my $tof_title = "TOF/RPC/FW";
+ my $tof_title = "TOF/RPC/FW/EC";
my $tof_value = "OK ".(scalar @tof_boards);
if ($num_tof_missing > 0) {$tof_value = "$num_tof_missing / ".(scalar @tof_boards)." miss";}
if ($num_tof_mistake > 0) {$tof_value = "Check Script";}
if ($num_tof_mistake > 0) {$tof_longtext .= " Endp @{$tof_results[4]} not known";}
$qastate = QA::GetQAState('below',$num_tof_missing,@QA::TofEndpMissingLimits);
- Hmon::Speak('tofmiss',"$num_tof_missing toff, R-P-C frontends missing") if($qastate > 60);
+ Hmon::Speak('tofmiss',"$num_tof_missing frontends missing") if($qastate > 60);
QA::WriteQALog($flog,"endp","tof",$waittime,$qastate,
$tof_title,$tof_value,$tof_longtext);
if($qastate > 60) {
else {$timecnt->{tof} = 0;}
- ###rpc
- my(%rpc_mask, @rpc_results);
- $rpc_results[$_] = [] foreach (0 .. 7);
- foreach my $element (@all_boards) { $rpc_mask{$element} |= 1 }
- foreach my $element (@rpc_boards) { $rpc_mask{$element} |= 2 }
- foreach my $element (@QA::rpc_boards_removed) { $rpc_mask{$element} |= 4 }
- foreach my $element (keys %rpc_mask) {
- push @{$rpc_results[0]}, sprintf("0x%04x (%s), ",$element,Hmon::getsystem($element));
- push @{$rpc_results[$rpc_mask{$element}]}, sprintf("0x%04x (%s), ",$element,Hmon::getsystem($element));
- }
-
- my $num_rpc_missing = (scalar @{$rpc_results[2]});
- my $num_rpc_mistake = (scalar @{$rpc_results[4]});
- my @sorted_rpc_results = sort @{$rpc_results[2]};
-
- my $rpc_title = "ECal";
- my $rpc_value = "OK ".(scalar @rpc_boards);
- if ($num_rpc_missing > 0) {$rpc_value = "$num_rpc_missing / ".(scalar @rpc_boards)." miss";}
- if ($num_rpc_mistake > 0) {$rpc_value = "Check Script";}
- my $rpc_longtext = (scalar @rpc_boards). " boards. ";
- if ($num_rpc_missing > 0) {$rpc_longtext = "Endp @sorted_rpc_results missing"};
- if ($num_rpc_mistake > 0) {$rpc_longtext .= " Endp @{$rpc_results[4]} not known";}
-
- $qastate = QA::GetQAState('below',$num_rpc_missing,@QA::RpcEndpMissingLimits);
- Hmon::Speak('rpcmiss',"$num_rpc_missing Forward Frontends missing") if($qastate > 60);
- QA::WriteQALog($flog,"endp","rpc",$waittime,$qastate,
- $rpc_title,$rpc_value,$rpc_longtext);
- if($qastate > 60) {
- $rpc_longtext =~ s/\(/\\\(/g;
- $rpc_longtext =~ s/\)/\\\)/g;
- system("logger -p local1.info -t DAQ Endp \\<E\\> $rpc_longtext") unless (($timecnt->{rpc}++)%$loggerperiod);
- }
+# ###rpc
+# my(%rpc_mask, @rpc_results);
+# $rpc_results[$_] = [] foreach (0 .. 7);
+# foreach my $element (@all_boards) { $rpc_mask{$element} |= 1 }
+# foreach my $element (@rpc_boards) { $rpc_mask{$element} |= 2 }
+# foreach my $element (@QA::rpc_boards_removed) { $rpc_mask{$element} |= 4 }
+# foreach my $element (keys %rpc_mask) {
+# push @{$rpc_results[0]}, sprintf("0x%04x (%s), ",$element,Hmon::getsystem($element));
+# push @{$rpc_results[$rpc_mask{$element}]}, sprintf("0x%04x (%s), ",$element,Hmon::getsystem($element));
+# }
+#
+# my $num_rpc_missing = (scalar @{$rpc_results[2]});
+# my $num_rpc_mistake = (scalar @{$rpc_results[4]});
+# my @sorted_rpc_results = sort @{$rpc_results[2]};
+#
+# my $rpc_title = "ECal";
+# my $rpc_value = "OK ".(scalar @rpc_boards);
+# if ($num_rpc_missing > 0) {$rpc_value = "$num_rpc_missing / ".(scalar @rpc_boards)." miss";}
+# if ($num_rpc_mistake > 0) {$rpc_value = "Check Script";}
+# my $rpc_longtext = (scalar @rpc_boards). " boards. ";
+# if ($num_rpc_missing > 0) {$rpc_longtext = "Endp @sorted_rpc_results missing"};
+# if ($num_rpc_mistake > 0) {$rpc_longtext .= " Endp @{$rpc_results[4]} not known";}
+#
+# $qastate = QA::GetQAState('below',$num_rpc_missing,@QA::RpcEndpMissingLimits);
+# Hmon::Speak('rpcmiss',"$num_rpc_missing Forward Frontends missing") if($qastate > 60);
+# QA::WriteQALog($flog,"endp","rpc",$waittime,$qastate,
+# $rpc_title,$rpc_value,$rpc_longtext);
+# if($qastate > 60) {
+# $rpc_longtext =~ s/\(/\\\(/g;
+# $rpc_longtext =~ s/\)/\\\)/g;
+# system("logger -p local1.info -t DAQ Endp \\<E\\> $rpc_longtext") unless (($timecnt->{rpc}++)%$loggerperiod);
+# }
###other
my(%other_mask, @other_results);
use LWP::Simple qw(get);
use Try::Tiny;
-# trb_init_ports() or die trb_strerror();
+trb_init_ports() or die trb_strerror();
my $fqa = QA::OpenQAFile();
my %hubnames = (
my $counter = 0;
my $errorcnt = 0;
- my $longstatus = 0;
+ my $longstatus = "";
my $qastate = QA::OK;
- while(my($b, $det) = each %hubnames) {
- $counter++;
-# print $b."\n";
- my $cmd = "ping $b -c 1 -w 1 >/dev/null 2>&1";
- my $i=2;
- my $err = 0;
- while($i--) {
- qx($cmd);
- $err = $?;
- last unless $err;
- sleep 1;
- }
- if($err) {
- $errorcnt++;
- $longstatus .= "Hub $b ($det) not reached<br>";
- print $longstatus."\n";
- $qastate = QA::ERROR;
- }
- }
+# while(my($b, $det) = each %hubnames) {
+# $counter++;
+# # print $b."\n";
+# my $cmd = "ping $b -c 1 -w 1 >/dev/null 2>&1";
+# my $i=2;
+# my $err = 0;
+# while($i--) {
+# qx($cmd);
+# $err = $?;
+# last unless $err;
+# sleep 1;
+# }
+# if($err) {
+# $errorcnt++;
+# $longstatus .= "Hub $b ($det) not reached<br>";
+# print $longstatus."\n";
+# $qastate = QA::ERROR;
+# }
+# }
+
+
+trb_init_ports() or die trb_strerror();
+
+my $errorfound = 0;
+my $o = trb_register_read_mem(0xff7f,0x83c0,0,4);
+foreach my $b (keys %$o) {
+ next if $b < 0x2000;
+ next if $b >= 0xf000;
+ next if $b == 0x8800;
+ $counter++;
+ next if $o->{$b}[0] != 0;
+ next if $o->{$b}[3] != 0;
+ $errorcnt++;
+ $errorfound = -1;
+ my $str = sprintf("%04x",$b);
+ print "Without IP: $str. Rebooting.\n";
+ system("trbcmd reload 0x$str");
+
+ }
+
+if($errorfound == -1) {$qastate = QA::FATAL;}
+
my $shortstatus = "OK $counter";
$shortstatus = " $errorcnt / $counter" if $qastate == QA::ERROR;
- QA::WriteQALog($fqa, "server", "ip", 60, $qastate, "Trb IP",
+ QA::WriteQALog($fqa, "misc2", "ip", 30, $qastate, "Trb IP",
$shortstatus, $longstatus);
- sleep 20;
+ sleep 10;
}
my $value = "";
$value = "$trginperr errors" if $trginperr;
- QA::WriteQALog($fqa, "feeerr", "trginp", 60, $trginperr?QA::ERROR:QA::OK, "Trg. Inputs",$value ,$trginperrlist);
+ QA::WriteQALog($fqa, "feeerr", "trginp", 60, ($trginperr>5)?QA::ERROR:QA::OK, "Trg. Inputs",$value ,$trginperrlist);
#Clean up and sleep (also needed at start-up)
trb_register_write(0xffff,0x20,0x10);
my $cnt2 = 0;
my $temp = trb_register_read(0xffff,0);
- foreach my $b (keys %{$temp}) {
+ foreach my $b (sort keys %{$temp}) {
if ($temp->{$b} & 0x10) {
$cnt++;
- $msg .= sprintf("%04x (%s)",$b,Hmon::getsystem($b));
- if(Hmon::getsystem($b) == "DiRICH" && $cnt+$cnt2 < 2) {
+ $msg .= sprintf("%04x (%s), ",$b,Hmon::getsystem($b));
+ if(Hmon::getsystem($b) eq "DiRICH" && $cnt+$cnt2 < 2) {
#Stopping trigger
system("trbcmd setbit 0x0003 0xa0c0 0x400");
#send local reset
#Starting trigger
system("trbcmd clearbit 0x0003 0xa0c0 0x400");
$cnt--;
- $msg .= "->AR";
+# $msg .= "->AR";
$cnt2++;
system("logger -p local1.info -t DAQ 'RICH <I> Re-Included DiRich to DAQ: $msg'");
}
$status = QA::ERROR if $cnt;
QA::WriteQALog($fqa,"daq","outofsync",20,$status,'Sync',$txt,$msg);
- sleep 2;
+ sleep 1;
}
$values = Hmon::MakeDifferences(\%store, \%laststore, 2**31*2);
$max = 1.1E6;
$min = 0;
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Busy times (normalized to 100%)");
- for (my $l = 0; $l < 4; $l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Busy times (normalized to 100%)");
+ for (my $l = 2; $l < 4; $l++) {
$str[0][$l] =
Hmon::MakeTitle(9, 3, "MDC $l Busy times (normalized to 100%)");
$str[1][$l] = "";
$str[2][$l] .= Hmon::MakeFooter();
}
Hmon::WriteFile("MDCBusy",
- $str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".
- $str[1][2]."<p>".$str[1][3].$str[2][0]);
+ $str[0][4]."<p>" #.$str[1][0].$str[1][1]."<p>".
+ .$str[1][2]."<p>".$str[1][3].$str[2][0]);
($min, $max, $avg, $mean) = Hmon::MakeMinMax3($values, 4, 6, 16, 1);
# Hmon::WriteLog($flog, "MDC BusyTime",
}
($min,$max) = Hmon::MakeMinMax3($store, 4, 6, 16);
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Failures");
- for (my $l = 0; $l < 4;$l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Failures");
+ for (my $l = 2; $l < 4;$l++) {
$str[0][$l] = Hmon::MakeTitle(9, 3, "MDC $l Failures");
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
my $values = {};
$values = Hmon::MakeDifferences(\%store, \%laststore, 2**31*2);
($min,$max,$avg) = Hmon::MakeMinMax3($values, 4, 6, 16, 0);
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Rates (log-scale, all MBO)");
- for (my $l = 0; $l < 4;$l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Rates (log-scale, all MBO)");
+ for (my $l = 2; $l < 4;$l++) {
$str[0][$l] = Hmon::MakeTitle(9, 3, "MDC $l Rates (log-scale, all MBO)");
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
}
Hmon::WriteFile("MDCRates",
- $str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".
- $str[1][2]."<p>".$str[1][3].$str[2][0]);
+ $str[0][4]."<p>".#$str[1][0].$str[1][1]."<p>".
+ $str[1][2]."<p>".$str[1][3].$str[2][3]);
# Hmon::WriteLog($flog, "MDC Rates", "Data Rates (words/s): min. %i - max. %i - Ø %i", $min, $max, $avg);
%laststore = %store;
$qastate = QA::WARN if($error);
$qastate = QA::ERROR if($error > 2);
$status = $error." errors" if $error;
- my $longmsg = sprintf("All MDC motherboard deliver data - Avg. number of words per second: %i - Avg number of words per event: %i",$avg,$avg/($rate || 1));
+ my $longmsg = sprintf("All MDC 3/4 motherboard deliver data - Avg. number of words per second: %i - Avg number of words per event: %i",$avg,$avg/($rate || 1));
$longmsg = "MDC motherboards not delivering data: $boardlist" if $error;
QA::WriteQALog($fqa, "mdc", "blocked", 20, $qastate,"MBO w/o data", $status,$longmsg);
Hmon::Speak('mdcnodata',"$error M-B-O collect no data") if($error > 2 && $iteration%3==0);
my %store;
my %store2;
- for (my $l = 0; $l < 4; $l++) {
+ for (my $l = 2; $l < 4; $l++) {
for (my $s = 0; $s < 6; $s++) {
for (my $b = 0; $b < 16; $b++) {
$store2{$l}->{$s}->{$b} = ($store_lo{$l}->{$s}->{$b}||0) + ($store_hi{$l}->{$s}->{$b}||0);
if ($min == 0 && $max == 0) {
$max = 1;
}
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Retransmission Rate ");
- for (my $l = 0; $l < 4; $l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Retransmission Rate ");
+ for (my $l = 2; $l < 4; $l++) {
$str[0][$l] = Hmon::MakeTitle(9, 3, "MDC $l Retransmission Rate ");
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
}
Hmon::WriteFile("MDCRetransmissionRate",
- $str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".
- $str[1][2]."<p>".$str[1][3].$str[2][0]);
+ $str[0][4]."<p>".#$str[1][0].$str[1][1]."<p>".
+ $str[1][2]."<p>".$str[1][3].$str[2][3]);
($min, $max) = Hmon::MakeMinMax3(\%store2, 4, 6, 16, 0);
if ($min == 0 && $max == 0) {
$max = 1;
}
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Retransmission Total ");
- for (my $l = 0; $l < 4; $l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Retransmission Total ");
+ for (my $l = 2; $l < 4; $l++) {
$str[0][$l] = Hmon::MakeTitle(9, 3, "MDC $l Retransmission Total ");
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
}
Hmon::WriteFile("MDCRetransmission",
- $str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".
+ $str[0][4]."<p>". #$str[1][0].$str[1][1]."<p>".
$str[1][2]."<p>".$str[1][3].$str[2][0]);
use List::Util 'max';
use Perl2Epics;
use QA;
+use MDC;
use Hmon;
my $flog = Hmon::OpenLogfile();
my $id_2 = ($board >> 0) & 0x0f;
$store->{$id_0}->{$id_1}->{$id_2} =
(($rh_mdc_temp->{$board} >> 20) & 0xfff) / 16;
- # printf "temp: %x %x %x\n", $id_0, $id_1, $id_2;
- # printf "temp: %x\n", $store->{$id_0}->{$id_1}->{$id_2};
}
+ $rh_mdc_temp = trb_register_read(0xfe90, 0x0) or sleep 5 and next;
+
+ foreach my $board (sort {$a <=> $b} keys %$rh_mdc_temp) {
+ my ($pl,$se,$bo,$en) = MDC::get_position($board);
+ $store->{$pl}->{$se}->{$bo} = (($rh_mdc_temp->{$board} >> 20) & 0xfff) / 16;
+ }
+
($min,$max) = Hmon::MakeMinMax3($store, 4, 6, 16);
- $str[0][4] = Hmon::MakeTitle(10, 6, "MDC Temperatures");
- for (my $l = 2; $l < 4;$l++) {
+ $str[0][4] = Hmon::MakeTitle(10, 10, "MDC Temperatures");
+ for (my $l = 0; $l < 4;$l++) {
$str[0][$l] = Hmon::MakeTitle(9, 3, "MDC $l Temperatures");
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
$str[2][$l] .= Hmon::MakeFooter();
# Hmon::WriteFile("MDC".$l."Temperature",$str[0][$l].$str[1][$l].$str[2][$l]);
}
- Hmon::WriteFile("MDCTemperature",$str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".$str[1][2]."<p>".$str[1][3].$str[2][0]);
+ Hmon::WriteFile("MDCTemperature",$str[0][4]."<p>".$str[1][0]."<p>".$str[1][1]."<p>".$str[1][2]."<p>".$str[1][3].$str[2][3]); #
my @mint; my @maxt;
for (my $i = 0; $i<4; $i++) {
Hmon::WriteLog($flog, "MDC $i Temp","Temperatures, Sector %i: min. %.1f°C - max. %.1f°C - Ø %.1f°C",$i,$min,$max,$avg);
}
+
+
my $qastate = QA::GetQAState('below', max(@maxt), @QA::MdcTempLimits);
my $str = sprintf("%i/%i/%i/%i", $maxt[0], $maxt[1], $maxt[2], $maxt[3]);
QA::WriteQALog($fqa,"mdc","temp", 40, $qastate, "Temperature", $str,
my $r_store = \%store;
$values = Hmon::MakeDifferences($r_store, \%laststore, 2**31*2);
($min,$max,$avg) = Hmon::MakeMinMax3($r_store, 4, 6, 16, 0);
- $str[0][4] = Hmon::MakeTitle(9, 10, "MDC Missing Tokens");
- for (my $l = 0; $l < 4;$l++) {
+ $str[0][4] = Hmon::MakeTitle(9, 6, "MDC Missing Tokens");
+ for (my $l = 2; $l < 4;$l++) {
$str[1][$l] = "";
for (my $s = 0; $s < 6;$s++) {
for (my $b = 0; $b < 16; $b++) {
Hmon::WriteFile("MDCTokenMiss",
- $str[0][4]."<p>".$str[1][0].$str[1][1]."<p>".
+ $str[0][4]."<p>". #$str[1][0].$str[1][1]."<p>".
$str[1][2]."<p>".$str[1][3].$str[2][0]);
my $qastate = QA::GetQAState('below', $sum, @QA::MdcTokenMissLimits);
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use POSIX qw(strftime);
+use FileHandle;
+use Hmon;
+use QA;
+use Getopt::Long;
+use Data::Dumper;
+use List::MoreUtils qw(uniq);
+use List::Util qw(min max);
+use HADES::TrbNet;
+use Storable qw(store lock_retrieve);
+
+
+
+trb_init_ports() or die trb_strerror();
+my $flog = QA::OpenQAFile();
+my $waittime = 15;
+my $loggerperiod = 12; #times 5 seconds sleep
+my $timecnt;
+
+
+while(1) {
+ my $allboards = trb_register_read(0xffff, 0x0) or sleep 5 and next;
+
+ ####config
+
+ my @mdc_boards;
+
+push(@mdc_boards,(0x8500, 0x8501, 0x8502, 0x8503, 0x8504, 0x8510, 0x8511, 0x8512, 0x8513, 0x8520, 0x8521, 0x8522, 0x8523, 0x8530, 0x8531, 0x8532, 0x8533, 0x8540, 0x8541, 0x8542, 0x8543, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554)); #MDC 1/2 hubs
+
+push(@mdc_boards,( 0x8e00, 0xa000, 0xa001, 0x8e01, 0xa010, 0xa011, 0xa012, 0x8e02, 0xa020, 0xa021, 0xa022, 0x8e03, 0xa030, 0xa031, 0x8e04, 0xa040, 0xa041, 0x8e05, 0xa050, 0xa051, 0x8e06, 0xa060, 0xa061, 0xa062, 0x8e07, 0xa070, 0xa071, 0xa072, 0x8e08, 0xa080, 0xa081, 0x8e09, 0xa090, 0xa091, 0x8e0a, 0xa0a0, 0xa0a1, 0xa0a2, 0x8e0b, 0xa0b0, 0xa0b1, 0x8e0c, 0xa0c0, 0xa0c1, 0xa0c2, 0x8e0d, 0xa0d0, 0xa0d1, 0x8e10, 0xa100, 0xa101, 0x8e11, 0xa110, 0xa111, 0xa112, 0x8e12, 0xa120, 0xa121, 0xa122, 0x8e13, 0xa130, 0xa131, 0x8e14, 0xa140, 0xa141, 0x8e15, 0xa150, 0xa151, 0x8e16, 0xa160, 0xa161, 0xa162, 0x8e17, 0xa170, 0xa171, 0xa172, 0x8e18, 0xa180, 0xa181, 0x8e19, 0xa190, 0xa191, 0x8e1a, 0xa1a0, 0xa1a1, 0xa1a2, 0x8e1b, 0xa1b0, 0xa1b1, 0x8e1c, 0xa1c0, 0xa1c1, 0xa1c2, 0x8e1d, 0xa1d0, 0xa1d1, 0x8e20, 0xa200, 0xa201, 0x8e21, 0xa210, 0xa211, 0xa212, 0x8e22, 0xa220, 0xa221, 0xa222, 0x8e23, 0xa230, 0xa231, 0x8e24, 0xa240, 0xa241, 0x8e25, 0xa250, 0xa251, 0x8e26, 0xa260, 0xa261, 0xa262, 0x8e27, 0xa270, 0xa271, 0xa272, 0x8e28, 0xa280, 0xa281, 0x8e29, 0xa290, 0xa291, 0x8e2a, 0xa2a0, 0xa2a1, 0xa2a2, 0x8e2b, 0xa2b0, 0xa2b1, 0x8e2c, 0xa2c0, 0xa2c1, 0xa2c2, 0x8e2d, 0xa2d0, 0xa2d1, 0x8e30, 0xa300, 0xa301, 0x8e31, 0xa310, 0xa311, 0xa312, 0x8e32, 0xa320, 0xa321, 0xa322, 0x8e33, 0xa330, 0xa331, 0x8e34, 0xa340, 0xa341, 0x8e35, 0xa350, 0xa351, 0x8e36, 0xa360, 0xa361, 0xa362, 0x8e37, 0xa370, 0xa371, 0xa372, 0x8e38, 0xa380, 0xa381, 0x8e39, 0xa390, 0xa391, 0x8e3a, 0xa3a0, 0xa3a1, 0xa3a2, 0x8e3b, 0xa3b0, 0xa3b1, 0x8e3c, 0xa3c0, 0xa3c1, 0xa3c2, 0x8e3d, 0xa3d0, 0xa3d1, 0x8e40, 0xa400, 0xa401, 0x8e41, 0xa410, 0xa411, 0xa412, 0x8e42, 0xa420, 0xa421, 0xa422, 0x8e43, 0xa430, 0xa431, 0x8e44, 0xa440, 0xa441, 0x8e45, 0xa450, 0xa451, 0x8e46, 0xa460, 0xa461, 0xa462, 0x8e47, 0xa470, 0xa471, 0xa472, 0x8e48, 0xa480, 0xa481, 0x8e49, 0xa490, 0xa491, 0x8e4a, 0xa4a0, 0xa4a1, 0xa4a2, 0x8e4b, 0xa4b0, 0xa4b1, 0x8e4c, 0xa4c0, 0xa4c1, 0xa4c2, 0x8e4d, 0xa4d0, 0xa4d1, 0x8e50, 0xa500, 0xa501, 0x8e51, 0xa510, 0xa511, 0xa512, 0x8e52, 0xa520, 0xa521, 0xa522, 0x8e53, 0xa530, 0xa531, 0x8e54, 0xa540, 0xa541, 0x8e55, 0xa550, 0xa551, 0x8e56, 0xa560, 0xa561, 0xa562, 0x8e57, 0xa570, 0xa571, 0xa572, 0x8e58, 0xa580, 0xa581, 0x8e59, 0xa590, 0xa591, 0x8e5a, 0xa5a0, 0xa5a1, 0xa5a2, 0x8e5b, 0xa5b0, 0xa5b1, 0x8e5c, 0xa5c0, 0xa5c1, 0xa5c2, 0x8e5d, 0xa5d0, 0xa5d1)); #MDC I
+
+push(@mdc_boards,( 0x8e60, 0xa600, 0xa601, 0x8e61, 0xa610, 0xa611, 0x8e62, 0xa620, 0xa621, 0x8e63, 0xa630, 0xa631, 0x8e64, 0xa640, 0xa641, 0x8e65, 0xa650, 0xa651, 0x8e66, 0xa660, 0xa661, 0x8e67, 0xa670, 0xa671, 0x8e68, 0xa680, 0xa681, 0x8e69, 0xa690, 0xa691, 0x8e6a, 0xa6a0, 0xa6a1, 0x8e6b, 0xa6b0, 0xa6b1, 0x8e6c, 0xa6c0, 0xa6c1, 0x8e6d, 0xa6d0, 0xa6d1, 0x8e6e, 0xa6e0, 0xa6e1, 0xa6e2, 0x8e6f, 0xa6f0, 0xa6f1, 0xa6f2, 0x8e70, 0xa700, 0xa701, 0x8e71, 0xa710, 0xa711, 0x8e72, 0xa720, 0xa721, 0x8e73, 0xa730, 0xa731, 0x8e74, 0xa740, 0xa741, 0x8e75, 0xa750, 0xa751, 0x8e76, 0xa760, 0xa761, 0x8e77, 0xa770, 0xa771, 0x8e78, 0xa780, 0xa781, 0x8e79, 0xa790, 0xa791, 0x8e7a, 0xa7a0, 0xa7a1, 0x8e7b, 0xa7b0, 0xa7b1, 0x8e7c, 0xa7c0, 0xa7c1, 0x8e7d, 0xa7d0, 0xa7d1, 0x8e7e, 0xa7e0, 0xa7e1, 0xa7e2, 0x8e7f, 0xa7f0, 0xa7f1, 0xa7f2, 0x8e80, 0xa800, 0xa801, 0x8e81, 0xa810, 0xa811, 0x8e82, 0xa820, 0xa821, 0x8e83, 0xa830, 0xa831, 0x8e84, 0xa840, 0xa841, 0x8e85, 0xa850, 0xa851, 0x8e86, 0xa860, 0xa861, 0x8e87, 0xa870, 0xa871, 0x8e88, 0xa880, 0xa881, 0x8e89, 0xa890, 0xa891, 0x8e8a, 0xa8a0, 0xa8a1, 0x8e8b, 0xa8b0, 0xa8b1, 0x8e8c, 0xa8c0, 0xa8c1, 0x8e8d, 0xa8d0, 0xa8d1, 0x8e8e, 0xa8e0, 0xa8e1, 0xa8e2, 0x8e8f, 0xa8f0, 0xa8f1, 0xa8f2, 0x8e90, 0xa900, 0xa901, 0x8e91, 0xa910, 0xa911, 0x8e92, 0xa920, 0xa921, 0x8e93, 0xa930, 0xa931, 0x8e94, 0xa940, 0xa941, 0x8e95, 0xa950, 0xa951, 0x8e96, 0xa960, 0xa961, 0x8e97, 0xa970, 0xa971, 0x8e98, 0xa980, 0xa981, 0x8e99, 0xa990, 0xa991, 0x8e9a, 0xa9a0, 0xa9a1, 0x8e9b, 0xa9b0, 0xa9b1, 0x8e9c, 0xa9c0, 0xa9c1, 0x8e9d, 0xa9d0, 0xa9d1, 0x8e9e, 0xa9e0, 0xa9e1, 0xa9e2, 0x8e9f, 0xa9f0, 0xa9f1, 0xa9f2, 0x8ea0, 0xaa00, 0xaa01, 0x8ea1, 0xaa10, 0xaa11, 0x8ea2, 0xaa20, 0xaa21, 0x8ea3, 0xaa30, 0xaa31, 0x8ea4, 0xaa40, 0xaa41, 0x8ea5, 0xaa50, 0xaa51, 0x8ea6, 0xaa60, 0xaa61, 0x8ea7, 0xaa70, 0xaa71, 0x8ea8, 0xaa80, 0xaa81, 0x8ea9, 0xaa90, 0xaa91, 0x8eaa, 0xaaa0, 0xaaa1, 0x8eab, 0xaab0, 0xaab1, 0x8eac, 0xaac0, 0xaac1, 0x8ead, 0xaad0, 0xaad1, 0x8eae, 0xaae0, 0xaae1, 0xaae2, 0x8eaf, 0xaaf0, 0xaaf1, 0xaaf2, 0x8eb0, 0xab00, 0xab01, 0x8eb1, 0xab10, 0xab11, 0x8eb2, 0xab20, 0xab21, 0x8eb3, 0xab30, 0xab31, 0x8eb4, 0xab40, 0xab41, 0x8eb5, 0xab50, 0xab51, 0x8eb6, 0xab60, 0xab61, 0x8eb7, 0xab70, 0xab71, 0x8eb8, 0xab80, 0xab81, 0x8eb9, 0xab90, 0xab91, 0x8eba, 0xaba0, 0xaba1, 0x8ebb, 0xabb0, 0xabb1, 0x8ebc, 0xabc0, 0xabc1, 0x8ebd, 0xabd0, 0xabd1, 0x8ebe, 0xabe0, 0xabe1, 0xabe2, 0x8ebf, 0xabf0, 0xabf1, 0xabf2)); #MDC II
+
+my $totalboards = scalar @mdc_boards;
+my $removedboards = scalar @QA::mdc_new_boards_removed;
+my $missingboards;
+my $missinglist = "";
+
+foreach my $b (@mdc_boards) {
+ next if $allboards->{$b};
+
+ next if grep( /^$b$/, @QA::mdc_new_boards_removed);
+
+ $missingboards->{$b} = 1;
+ $missinglist .= sprintf("%04x, ",$b);
+ }
+
+my $missing_number = scalar keys %$missingboards;
+
+# my(%mdc_mask, @mdc_results);
+# $mdc_results[$_] = [] foreach (0 .. 7);
+# foreach my $element (@all_boards) { $mdc_mask{$element} |= 1 }
+# foreach my $element (@mdc_boards) { $mdc_mask{$element} |= 2 }
+# foreach my $element (@QA::mdc_boards_removed) { $mdc_mask{$element} |= 4 }
+# foreach my $element (keys %mdc_mask) {
+# push @{$mdc_results[0]}, sprintf("0x%x",$element);
+# push @{$mdc_results[$mdc_mask{$element}]}, sprintf("0x%x",$element);
+# }
+#
+# my $num_mdc_missing = (scalar @{$mdc_results[2]});
+# my $num_mdc_mistake = (scalar @{$mdc_results[4]});
+# my @sorted_mdc_results = sort @{$mdc_results[2]};
+#
+# $mdcmissingtime = 0 if $num_mdc_missing <= 2;
+# $mdcmissingtime += max(0,$num_mdc_missing-2);
+#
+# #Are two boards from the same chamber missing?
+# my @mdcboards = (@sorted_mdc_results,@QA::mdc_boards_removed);
+# chop(@mdcboards);
+# my @uniqchambers = uniq @mdcboards;
+# my $samechamberboards = (scalar @mdcboards) - (scalar @uniqchambers);
+# # if(scalar @mdcboards != scalar @uniqchambers) {$samechamberboards = 1;}
+#
+# #Are two boards from the same sector missing?
+# my @mdcboardssec = chop(@mdcboards);
+# my @uniqchamberssec = uniq @mdcboardssec;
+# my $samesectorboards = (scalar @mdcboardssec) - (scalar @uniqchamberssec);
+# # if(scalar @mdcboards != scalar @uniqchambers) {$samesectorboards = 1;}
+#
+# print $fh "$num_mdc_missing\n";
+# $fh->autoflush(1);
+# seek($fh, 0, 0);
+#
+# my $title = "MDC";
+# my $value = "OK ".(scalar @mdc_boards - scalar @QA::mdc_boards_removed);
+# $value .= "(-".(scalar @QA::mdc_boards_removed).")" if scalar @QA::mdc_boards_removed;
+# if ($num_mdc_missing > 0) {$value = "$num_mdc_missing / ".(scalar @mdc_boards - scalar @QA::mdc_boards_removed)." miss";}
+# if ($num_mdc_mistake > 0) {$value = "Check Script";}
+# my $longtext = (scalar @mdc_boards). " boards. ".(scalar @QA::mdc_boards_removed)." removed<br>";
+# if ($num_mdc_missing > 0) {$longtext .= "Endp @sorted_mdc_results missing<br>"};
+# if ($num_mdc_mistake > 0) {$longtext .= " Endp @{$mdc_results[4]} not known";}
+#
+# my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits);
+# $qastate = max($qastate,QA::ERROR) if $samechamberboards;
+# $qastate = max($qastate,QA::WARN) if $samesectorboards;
+# $qastate = max($qastate,QA::ERROR) if $samesectorboards > 2;
+# $qastate = max($qastate,QA::WARN) if $mdcmissingtime > 600;
+# $qastate = max($qastate,QA::NOTE) if $num_mdc_missing >= 1;
+#
+# $longtext .= "<br>Some boards are missing for a long time. Better do a restart." if $mdcmissingtime > 360;
+
+# Hmon::Speak('mdcmissonce',"$num_mdc_missing M-D-C Frontends missing") if($qastate > 60 && $qastate < QA::ERROR );
+# Hmon::Speak('mdcmiss',"$num_mdc_missing M-D-C Frontends missing") if($qastate >= QA::ERROR );
+# QA::WriteQALog($flog,"endp","mdc",$waittime,$qastate,$title,$value,$longtext);
+# if($qastate > 60) {
+# $longtext =~ s/\<br\>//g;
+# $longtext =~ s/\(/\\\\\(/g;
+# $longtext =~ s/\)/\\\\\)/g;
+# system("logger -p local1.info -t DAQ Endp \\<E\\> $longtext") unless (($timecnt->{mdc}++)%$loggerperiod);
+# }
+# else {$timecnt->{mdc} = 0;}
+#
+
+chop $missinglist; chop $missinglist;
+
+my $qastate = QA::OK;
+ $qastate = QA::WARN if $missing_number;
+ $qastate = QA::ERROR if $missing_number > 1;
+
+my $value = "OK ".(scalar @mdc_boards - scalar @QA::mdc_new_boards_removed);
+ $value .= "(-".(scalar @QA::mdc_new_boards_removed).")" if scalar @QA::mdc_new_boards_removed;
+
+ if ($missing_number > 0) {$value = "$missing_number / ".(scalar @mdc_boards - scalar @QA::mdc_new_boards_removed)." miss";}
+
+my $longtext = "";
+ $longtext .= "Missing boards: $missinglist<br>" if $missing_number;
+
+Hmon::Speak('mdcmissonce',"$missing_number new M-D-C Frontends missing") if($qastate > 60 );
+
+QA::WriteQALog($flog,"endp","mdc12",10,$qastate,"MDC 1/2",$value,$longtext);
+
+ sleep(5);
+}
my $fqa = QA::OpenQAFile();
+my $CONF_rate = shift @ARGV // 1E20;
+my $CONF_list = shift @ARGV;
HPlot::PlotInit({
name => "MdcRate",
my $histmax = 500;
-
+my $noisy;
trb_init_ports() or die trb_strerror();
my $qastate = QA::OK;
$vdiff /= $tdiff->[2];
$diff->[2]{$b}[$v] = $vdiff;
$histograms->[2][histbin($vdiff)]++;
+
+ if($CONF_list && $vdiff > $CONF_rate) {
+ $noisy->{"$b -p ".int($v/8)}=1;
+ }
}
}
+
+ if ($CONF_list) {
+# print Dumper $noisy;
+ foreach my $nb (sort keys %$noisy) {
+ print (" ./pasttrec_set_threshold.pl -b $nb $CONF_list\n");
+ }
+ exit;
+ }
+
HPlot::PlotDrawFork('MdcRate');
HPlot::PlotDrawFork('MdcSpikeRate');
foreach my $board ( keys %$rh_mdc_temp) {
-# my $id_0 = ($board >> 7)&2 + (($board >> 4)&0xf) / 6;
-# my $id_1 = ($board >> 4&0xf) % 6;
-# my $id_2 = ($board >> 0) & 0x0f;
my ($pl,$se,$bo,$en) = MDC::get_position($board);
$store->{$pl}->{$se}->{$bo} = ($rh_mdc_temp->{$board} & 0xffff) / 256;
- # printf "temp: %x %x %x\n", $id_0, $id_1, $id_2;
- # printf "temp: %x\n", $store->{$id_0}->{$id_1}->{$id_2};
}
($min,$max) = Hmon::MakeMinMax3($store, 4, 6, 16);
$str[2][0] .= Hmon::MakeFooter();
Hmon::WriteFile("MDCNewTemperature",$str[0][4]."<p>".$str[1][0]."<p>".$str[1][1]."<p>".$str[2][0]);#."<p>".$str[1][2]."<p>".$str[1][3].$str[2][0]);
-# my @mint; my @maxt;
-# for (my $i = 0; $i<4; $i++) {
-# ($mint[$i],$maxt[$i],$avg,$mean) = Hmon::MakeMinMax2(\%{$store->{$i}},6,16,1);
-# Hmon::WriteLog($flog, "MDC $i Temp","Temperatures, Sector %i: min. %.1f°C - max. %.1f°C - Ø %.1f°C",$i,$min,$max,$avg);
-# }
-#
-# my $qastate = QA::GetQAState('below', max(@maxt), @QA::MdcTempLimits);
-# my $str = sprintf("%i/%i/%i/%i", $maxt[0], $maxt[1], $maxt[2], $maxt[3]);
-# QA::WriteQALog($fqa,"mdc","temp", 40, $qastate, "Temperature", $str,
-# "Max. temperature in each plane of MDC are " . $str);
$store = {};
-# if($qastate >= QA::ERROR || ( $data->{'TempAlarmEPICS'}->{'val'}//0 > 0 ) ) {
-# if($mailerrstatecnt++ >= 60) {
-# Hmon::SendEmail('c.wendisch@gsi.de',"Error: MDC Temperature too high","MDC temperatures are too high:
-# \n$str\n".$data->{'TempAlarmEPICS'}->{'val'});
-# $mailerrstatecnt = 0;
-# }
-# }
-
sleep 20;
}
close FILE;
# print Dumper $sensors;
-
+sleep 9; #Time for SFP readings
while (1) {
HPlot::PlotClear('MDCNew1wire');
my $cmd = "cd ../../hades_mdc_settings/scripts/;./read_1wire_sensors.pl";
# print Dumper $store;
# last;
- sleep 10;
+ sleep 31;
}
my $msg = "";
# JAM2020- the pgrep command defaults on lxhadeb06 have changed for debian9. use -fal instead -fl:
- my $cmd = "ssh hadesp67 'pgrep -fal \"hadesonlineserver.exe .* 567\" | sort -n -k5 | grep -v zsh' </dev/null";
+ my $cmd = "ssh hadesp66 'pgrep -fal \"hadesonlineserver.exe .* 567\" | sort -n -k5 | grep -v zsh' </dev/null";
my @out = qx($cmd);
my $oldgberate;
while (1) {
my $boardlist = "";
+ my $boardlist2 = "";
my $rh_status = trb_register_read(0x0003, 0xa0f8) or sleep 5 and next;
my $rh_evts = trb_register_read(0x0002, 0x0001) or sleep 5 and next;
my $gbe_rate = trb_register_read(0xff7f, 0x83f3) or sleep 5 and next;
}
}
}
+
+ #Case board rebooted / is out of sync with buffer fill levels
+ my $buffer_level = trb_register_read(0xffff, 0x7110) or sleep 5 and next;
+ my $count;
+ foreach my $b (sort keys %$buffer_level) {
+ next if $b >= 0x8000 && $b <= 0x8fff;
+ next if $b == 0xfc00;
+ next if $b >= 0x0100 && $b <= 0x0120;
+ $count->{$buffer_level->{$b}&0xffff}++;
+ }
+ foreach my $c (keys %$count) {
+ if ($count->{$c}<=3) {
+ SINGLESEARCH : foreach my $b (sort keys %$buffer_level) {
+ next if $b >= 0x8000 && $b <= 0x8fff;
+ next if $b == 0xfc00;
+ next if $b >= 0x0100 && $b <= 0x0120;
+ if(($buffer_level->{$b}&0xffff) == $c) {
+ my $db_level = trb_register_read_mem($b, 0x7100,0,16);
+ foreach my $d (@{$db_level->{$b}}) {
+ next SINGLESEARCH if ($d & (1 << 17));
+ }
+ $boardlist2 .= sprintf("%04x (%s), ",$b,Hmon::getsystem($b));
+ }
+ }
+ }
+ }
}
- chop $boardlist; chop $boardlist;
- $qastate = QA::ERROR if $boardlist ne "";
- $status = "Waiting" if $boardlist ne "";
- $longmsg = "Read-out seems to be stuck. Hubs waiting for read-out: $boardlist" if $boardlist ne "";
+ if ($boardlist ne "" || $boardlist2 ne "") {
+ chop $boardlist; chop $boardlist;
+ chop $boardlist2; chop $boardlist2;
+ $qastate = QA::ERROR;
+ $status = "Waiting";
+ $longmsg = "Read-out seems to be stuck.<br>";
+ $longmsg .= "Hubs waiting for read-out: $boardlist<br>" if $boardlist ne "";
+ $longmsg .= "Boards out of sync: $boardlist2" if $boardlist2 ne "";
+ }
- system("logger -p local1.info -t DAQ Readout \\<E\\> $longmsg") if $boardlist ne "" && $timer == 0;
Hmon::Speak('busy', "Error: Data taking not running.") if $qastate >= QA::ERROR;
QA::WriteQALog($fqa, "daq", "readout", 30, $qastate,"Read-out", $status,$longmsg);
# print $qastate." ".$status." ".$longmsg."\n";
+ $longmsg =~ s/\(/\\\\\(/g;
+ $longmsg =~ s/\)/\\\\\)/g;
+ system("logger -p local1.info -t DAQ Readout \\<E\\> $longmsg") if $boardlist ne "" && $timer == 0;
$timer++ if $boardlist ne "";
$timer = 0 if $timer >= 15;
sleep(1);
$seuboards++;
push(@boards,$b);
}
- $longtext = "$seuboards out of $totalboards monitored report some radiation issues<br>";
- $longtext .= sprintf("%04x (%s)<br>",$_,Hmon::getsystem($_)) for sort @boards;
+ $longtext = "$seuboards out of $totalboards monitored report some radiation issues<br> ";
+ $longtext .= sprintf("%04x (%s), ",$_,Hmon::getsystem($_)) for sort @boards;
+ chop $longtext;chop $longtext;
if($seuboards >= 8) {
- $longtext .= "<br>Quite many boards seem to be affected by radiation. It's suggested to reboot \"Quite-a-lot\" before the next DAQ restart.";
+ $longtext .= "<br>Quite many boards seem to be affected by radiation. Better do some reboots before the next DAQ restart.";
$qastate = QA::WARN;
}
if($seuboards >= 16) {
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Data::TreeDumper;
+use Hmon;
+use QA;
+use HPlot;
+use lib '.';
+use lib '/home/hadaq/trbsoft/hades_mdc_settings/scripts';
+use MDC;
+use MDCPower;
+use Time::HiRes qw(usleep time);
+use List::Util qw[min max];
+
+use HADES::TrbNet;
+
+#$ENV{DAQOPSERVER} = 'localhost:40';
+trb_init_ports() or die trb_strerror();
+
+
+
+HPlot::PlotInit({
+ name => "MDCSfpRx",
+ file => "files/MDCSfpRx",
+ title => "MDC SFP RX Power",
+ entries => 16,
+ curves => 15,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "RX Power [µW]",
+ sizex => 590,
+ sizey => 250,
+ nokey => 1,
+ buffer => 0,
+ ymin => 14.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 15.5,
+ #cbmax => "100<*<1E7",
+ #cbmin => 0,
+ noinit => 1,
+ additional => "set format y \"%02o\";set ytics (0,5,8,13,16,21,24,29);",
+ showvalues => 1, }
+ );
+
+
+HPlot::PlotInit({
+ name => "MDCSfpTx",
+ file => "files/MDCSfpTx",
+ title => "MDC SFP TX Power",
+ entries => 16,
+ curves => 15,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "TX Power [µW]",
+ sizex => 590,
+ sizey => 250,
+ nokey => 1,
+ buffer => 0,
+ ymin => 14.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 15.5,
+ #cbmax => "100<*<1E7",
+ #cbmin => 0,
+ noinit => 1,
+ additional => "set format y \"%02o\";set ytics (0,5,8,13,16,21,24,29);",
+ showvalues => 1, }
+ );
+
+HPlot::PlotInit({
+ name => "MDCSfpCurr",
+ file => "files/MDCSfpCurr",
+ title => "MDC SFP TX Current",
+ entries => 16,
+ curves => 15,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "TX Current / TX Power [a.u.]",
+ sizex => 590,
+ sizey => 250,
+ nokey => 1,
+ buffer => 0,
+ ymin => 14.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 15.5,
+ #cbmax => "100<*<1E7",
+ #cbmin => 0,
+ noinit => 1,
+ additional => "set format y \"%02o\";set ytics (0,5,8,13,16,21,24,29);",
+ showvalues => 1, }
+ );
+
+my $str = Hmon::MakeTitle(8, 16, "MDC SFP Readings",0);
+$str .= qq@<img src="%ADDPNG files/MDCSfpRx.png%" type="image/png"><br>\n@;
+$str .= qq@<img src="%ADDPNG files/MDCSfpTx.png%" type="image/png"><br>\n@;
+$str .= qq@<img src="%ADDPNG files/MDCSfpCurr.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("SfpReadingsMDC",$str);
+
+$str = Hmon::MakeTitle(6, 13, "SFP Readings",0);
+$str .= qq@<img src="%ADDPNG files/SfpRxPower.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("SfpReadings",$str);
+# sleep(5);
+
+ my $labels = 'set ytics (';
+ my $entry = 0;
+ my $regs = trb_register_read(0xfe65,0xd681) or die trb_strerror() or sleep 5 and next;
+ foreach my $b (sort {$a <=> $b} keys %$regs) {
+ $labels .= sprintf("'%04x' %i,",$b,$entry++);
+ }
+ $regs = trb_register_read(0xfe66,0xd681) or die trb_strerror() or sleep 5 and next;
+ foreach my $b (sort {$a <=> $b} keys %$regs) {
+ $labels .= sprintf("'%04x' %i,",$b,$entry++);
+ }
+
+ chomp $labels;
+ my $numboards = $entry;
+ $labels .= ') offset 0,0 font ",7";';
+
+HPlot::PlotInit({
+ name => "SfpRxPower",
+ file => "files/SfpRxPower",
+ title => "RX Power",
+ entries => 10,
+ curves => $numboards,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "RX Power [µW]",
+ sizex => 450,
+ sizey => 630,
+ nokey => 1,
+ buffer => 0,
+ ymin => $numboards-0.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 9.5,
+ #cbmax => "100<*<1E7",
+ #cbmin => 0,
+ additional => $labels,
+ noinit => 1,
+ showvalues => 1, }
+ );
+
+while (1) {
+ HPlot::PlotClear('SfpRxPower');
+
+
+ my $data; my $o;
+ for my $p (1..10) {
+ trb_register_write_mem(0xfe65,0xd681,0,[0x0101+($p << 16),0x68d1],2);
+ usleep(1000);
+ $o = trb_register_read(0xfe65,0xd684);
+
+ my $cnt = -1;
+ foreach my $b (sort keys %$o) {
+ $cnt++;
+ my $val = $o->{$b}&0xffff;
+ next if $val <= 1;
+ next if $val == 0xffff;
+ HPlot::PlotFill("SfpRxPower",$val/10.,$p-1,$cnt);
+ }
+
+ trb_register_write_mem(0xfe66,0xd681,0,[0x0101+($p << 16),0x68d1],2);
+ usleep(1000);
+ $o = trb_register_read(0xfe66,0xd684);
+
+ foreach my $b (sort keys %$o) {
+ $cnt++;
+ my $val = $o->{$b}&0xffff;
+ next if $val <= 1;
+ next if $val == 0xffff;
+ HPlot::PlotFill("SfpRxPower",$val/10.,$p-1,$cnt);
+ }
+ }
+ HPlot::PlotDraw('SfpRxPower');
+
+
+
+
+ HPlot::PlotClear('MDCSfpRx');
+ trb_register_write_mem(0xfe90,0xd681,0,[0x0101,0x68d1],2);
+ usleep(1000);
+ $o = trb_register_read(0xfe90,0xd684);
+ foreach my $b (keys %$o) {
+ my $val = $o->{$b}&0xffff;
+ next if $val <= 1;
+ next if $val == 0xffff;
+ my ($p,$s,$bb,$e) = MDC::get_position($b);
+ my $xpos = $bb;
+ my $ypos = $p*8+$s;
+
+ HPlot::PlotFill("MDCSfpRx",$val/10.,$xpos,$ypos);
+ }
+ HPlot::PlotDraw('MDCSfpRx');
+
+
+
+
+ HPlot::PlotClear('MDCSfpTx');
+ trb_register_write_mem(0xfe90,0xd681,0,[0x0101,0x66d1],2);
+ usleep(1000);
+ $o = trb_register_read(0xfe90,0xd684);
+ foreach my $b (keys %$o) {
+ my $val = $o->{$b}&0xffff;
+ next if $val <= 1;
+ next if $val == 0xffff;
+ my ($p,$s,$bb,$e) = MDC::get_position($b);
+ my $xpos = $bb;
+ my $ypos = $p*8+$s;
+
+ HPlot::PlotFill("MDCSfpTx",$val/10.,$xpos,$ypos);
+ }
+ HPlot::PlotDraw('MDCSfpTx');
+
+
+
+ HPlot::PlotClear('MDCSfpCurr');
+ trb_register_write_mem(0xfe90,0xd681,0,[0x0101,0x64d1],2);
+ usleep(1000);
+ my $oo = trb_register_read(0xfe90,0xd684);
+ foreach my $b (keys %$oo) {
+ my $val = $oo->{$b}&0xffff;
+ next if $val <= 1;
+ next if $val == 0xffff;
+ my ($p,$s,$bb,$e) = MDC::get_position($b);
+ my $xpos = $bb;
+ my $ypos = $p*8+$s;
+ $val = $val / ($o->{$b}&0xffff||1)*100;
+ HPlot::PlotFill("MDCSfpCurr",$val,$xpos,$ypos);
+ }
+ HPlot::PlotDraw('MDCSfpCurr');
+
+
+ exit;
+ }
+
}
}
- my $startdirect = sum(@{$diff->{0x5000}},@{$diff->{0x5001}},@{$diff->{0x5002}},@{$diff->{0x5003}})/2; #contains x and y!
- my $start = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79]); #sum from start
+ my $startdirect = (sum(@{$diff->{0x5000}},@{$diff->{0x5001}},@{$diff->{0x5002}},@{$diff->{0x5003}})||0)/2; #contains x and y!
+ my $start = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79])||0; #sum from start
my $m2 = $diff->{0x10}[81];
my $pt3 = $diff->{0x10}[82];
my @o = qx(ls -1 files/*.htt);
foreach my $a (@o) {
if ($a =~ m%files/(\w+).htt%) {
- print "<li><a href=\"monitor.cgi?2-window-$1\">$1</a></li>\n";</li>
+ print "<li><a href=\"monitor.cgi?2-window-$1\">$1</a></li>\n";
}
}
print "</ul><br>\n";
font-weight:bold;
}
-
+ul.optionlist {
+ columns: 3;
+ width:auto;
+}
+
ul.optionlist li {
- width:300px;
- float:left;
+/* width:300px; */
+/* float:left; */
list-style:none;
}
my $hour = strftime ("%H", localtime(time+$offset*86400+150));
$hour =~ s/\s//;
-# my $plan = get("https://hessenbox-a10.rz.uni-frankfurt.de/dl/fiUP5enanrB2pwwuBDJxGj/ExpertsPlan.csv");
-# my @plan = split("\n",$plan);
-#
-# foreach my $line (@plan) {
-# my @s = split(",",$line);
-# if (scalar @s == 5 && $s[0] eq 'contact') {
-# $store->{contact}{$s[2]}{expert}=$s[1];
-# $store->{contact}{$s[2]}{phone}=$s[3];
-# $store->{contact}{$s[2]}{alias}=$s[4];
-# $store->{alias}{$s[4]} = $s[2];
-# $store->{alias}{$s[2]} = $s[4];
-# }
-# if (scalar @s == 29 && $s[0] ne '') {
-# my $exp = $store->{contact}{$s[0]}{expert} //'';
-# if($nowmonth eq $s[2] && $nowday eq $s[3]) {
-# $store->{onshift}{$exp}{$s[0]} = $s[$hour+4];
-# }
-# }
-# }
-
-
- my $oraclecmd = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.show_shifts' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.form_select' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=FEB24&p_begin=$oracledatestart&p_end=$oracledateend&p_purpose_id=&p_responsible=&p_action=Show+Shift+Crew' -u hades:6\\\$ectors 2>/dev/null" ;
+ my $plan = get("https://hessenbox-a10.rz.uni-frankfurt.de/dl/fiUP5enanrB2pwwuBDJxGj/ExpertsPlan.csv");
+ my @plan = split("\n",$plan);
+
+ foreach my $line (@plan) {
+ my @s = split(",",$line);
+ if (scalar @s == 5 && $s[0] eq 'contact') {
+ $store->{contact}{$s[2]}{expert}=$s[1];
+ $store->{contact}{$s[2]}{phone}=$s[3];
+ $store->{contact}{$s[2]}{alias}=$s[4];
+ $store->{alias}{$s[4]} = $s[2];
+ $store->{alias}{$s[2]} = $s[4];
+ }
+ if (scalar @s == 29 && $s[0] ne '') {
+ my $exp = $store->{contact}{$s[0]}{expert} //'';
+ if($nowmonth eq $s[2] && $nowday eq $s[3]) {
+ $store->{onshift}{$exp}{$s[0]} = $s[$hour+4];
+ }
+ }
+ }
+
+
+ my $oraclecmd = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.show_shifts' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.form_select' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=APR25&p_begin=$oracledatestart&p_end=$oracledateend&p_purpose_id=&p_responsible=&p_action=Show+Shift+Crew' -u hades:6\\\$ectors 2>/dev/null" ;
my $text; my @ret;
run3($oraclecmd, \$text, \@ret);
my $cnt=0;
my $firstrun =1;
-my $command = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=APR24TEST&p_begin=&p_end=&p_num_days=&p_num_entries=5&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*' -u hades:6\\\$ectors 2>/dev/null | iconv -f ISO-8859-1 -t UTF-8";
+my $command = "echo -e \"openssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_sect\n[ssl_sect]\nsystem_default = system_default_sect\n[system_default_sect]\nOptions = UnsafeLegacyRenegotiation\" | OPENSSL_CONF=/dev/stdin curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -b /tmp/cookiefile -c /tmp/cookiefile -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=APR25&p_begin=&p_end=&p_num_days=&p_num_entries=5&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*' -u hades:6\\\$ectors 2>/dev/null | iconv -f ISO-8859-1 -t UTF-8";
my $store;
my $hash;
# system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
-
#while(1) {
my $fn = "LANG=en_US.UTF-8 larynx -v southern_english_male --length-scale 1 --interactive 2>&1";
open my $fh, "|$fn" or die "error: no larynx";
open(FTRB, "$cmd|");
while(my $a = <FTRB>) {
if ($inhibit == 0) {
- print $fh ": ".$a ;
+ my ($id,$str ) = split("\t",$a );
+ print $fh ": ".$str ;
sleep 3;
}
}
}
+
# }
# else {
# while(1) {
#pkill -f "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/pics"
fusermount -u qa
-timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp67:/home/hades-qa/online/5.34.38/feb24/pics `pwd`/qa"
-fusermount -u vertex
-timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp67:/home/hades-qa/online/5.34.38/feb24/vertex/pics `pwd`/vertex"
+timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/apr25/pics `pwd`/qa"
+fusermount -u vertex
+timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/apr25/vertex/pics `pwd`/vertex"
#pkill -f "sshfs -o allow_other hadaq@hadesp63:/home/hadaq/local/tdcmon/dabc/cal"
fusermount -u calibration
#ssh hadesp57 'cd /home/hadaq/trbsoft/daq/hmon/; PERL5LIB=. ./speakdaemon.pl 1>/dev/null 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon' &
-ssh hadesp33 'cd /home/hadaq/trbsoft/daq/hmon/; PERL5LIB=. ./speakdaemon.pl 1>/dev/null 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon' &
-ssh hadesp33 'cd /home/hadaq/trbsoft/daq/hmon/; PULSE_SINK=Virtual1 PERL5LIB=. ./speakdaemon_mdc.pl 1>/dev/null 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon_mdc' &
+ssh hadesp33 'cd /home/hadaq/trbsoft/daq/hmon/; PULSE_SINK=Virtual_DAQi PERL5LIB=. ./speakdaemon.pl 1>/dev/null 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon' &
+ssh hadesp33 'cd /home/hadaq/trbsoft/daq/hmon/; PULSE_SINK=Virtual_MDCi PERL5LIB=. ./speakdaemon_mdc.pl 1>/dev/null 2>>/home/hadaq/trbsoft/hadesdaq/hmon/logs/perlerror_speakdaemon_mdc' &
sleep 1;
# echo " <Hmon> Done."