From ac91006ec9833e6022c9f8421059a2d75cc6be7e Mon Sep 17 00:00:00 2001 From: Hades DAQ Date: Mon, 1 Oct 2018 13:39:29 +0200 Subject: [PATCH] update hmon scripts --- hmon/QA.pm | 24 +- hmon/ecal_drawing.htm | 1858 ++++++++++++++++ hmon/hmon_eb_rate.pl | 56 +- hmon/hmon_ecalrate.pl | 51 +- hmon/hmon_endpoints.pl | 77 +- hmon/hmon_padiwatemp.pl | 64 + hmon/hmon_richInnerTemp.pl | 35 + hmon/hmon_richMagnet.pl | 78 +- hmon/hmon_richrate2.pl | 1 + hmon/hmon_spill.pl | 48 +- hmon/hmon_timeout.pl | 6 +- hmon/hmon_trgerr.pl | 91 +- hmon/index.cgi | 12 +- hmon/permanent/hmon_cpu.pl | 10 +- hmon/permanent/hmon_eb_run.pl | 326 ++- hmon/permanent/hmon_ebdiskfill.pl | 6 +- hmon/permanent/hmon_eberrbits.pl | 6 + hmon/permanent/hmon_magnet.pl | 8 +- hmon/permanent/hmon_mdchv.pl | 9 +- .../hmon_open_ssh_master_channels.pl | 4 +- hmon/permanent/hmon_qa.pl | 2 +- hmon/permanent/hmon_richhv.pl | 2 +- hmon/permanent/hmon_sequencer.pl | 2 +- hmon/rich_drawing.htm | 3 +- hmon/rich_drawing_2.htm | 1973 +++++++++++++++++ hmon/start.sh | 1 + hmon/styles.css | 9 +- 27 files changed, 4503 insertions(+), 259 deletions(-) create mode 100644 hmon/ecal_drawing.htm create mode 100755 hmon/hmon_padiwatemp.pl create mode 100755 hmon/hmon_richInnerTemp.pl create mode 100644 hmon/rich_drawing_2.htm diff --git a/hmon/QA.pm b/hmon/QA.pm index 2bfa99c..634274d 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -17,7 +17,8 @@ our $cats = {'main'=>"Main", 'other'=>"Other", 'pion'=>"Pion", 'rich'=>'RICH', - 'ecal'=>'ECal'}; + 'ecal'=>'ECal', + 'hv'=>'HV'}; # Order of categories our $entries->{'cats'} = ["main", @@ -32,7 +33,7 @@ our $entries->{'cats'} = ["main", # "pion", "rich", "ecal", - "other", + "hv", ]; @@ -45,11 +46,11 @@ $entries->{'server'} = ['fill', 'cpu', 'icinga', 'etrax', 'pwrsup']; $entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits']; $entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage']; $entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other']; -$entries->{'feeerr'} = ['mdcinvalid', 'trb', 'feeerr','trginp','trgqual']; +$entries->{'feeerr'} = ['trb', 'feeerr','trginp','trgqual','goofy']; $entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu']; -$entries->{'other'} = ['magnet','goofy','','','sequencer']; -$entries->{'rich'} = ['temp','volt','curr','bkpl','richhv']; -$entries->{'ecal'} = ['temp','','','','']; +$entries->{'rich'} = ['temp','volt','curr','bkpl','']; +$entries->{'ecal'} = ['temp','count','','','']; +$entries->{'hv'} = ['magnet','mdchv','richhv','ecalhv','sequencer']; our $QAServer = "hades33"; @@ -91,14 +92,17 @@ our @EBDeltaRateLimits = (10, 15, 25); our $TrgCheckPolarity = 1; our @Eventsbroken = (.5,5,10); our @MdcTokenMissLimits = (10,50,100); -our @MdcNominalHV = (1750,1770,1500,1700); +our @MdcNominalHV = (1750,1770,1850,2150); our @MdcHVOffsetLimits = (5,10,20); our @PionLvCurrLimits = (4,5,6); -our $MdcHvOff = 1; -our $RichHvOff = 1; -our $MagnetOff = 1; +our $MdcHvOff = 0; +our $RichHvOff = 0; +our $MagnetOff = 0; + +our $PadiwaECalNumber = 84; +our @PadiwaEcalLimits = (0, 0, 0); our @LimitTriggerPerSpill = (1000, 0, 0); our $AcceleratorCycle = 7; diff --git a/hmon/ecal_drawing.htm b/hmon/ecal_drawing.htm new file mode 100644 index 0000000..1bf3def --- /dev/null +++ b/hmon/ecal_drawing.htm @@ -0,0 +1,1858 @@ + + + + + + + + + + + + +
+

Min:

+

Max:

+ + + + + + +
+ + +

ECAL Temperatures

updateTime:

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
0_1630_1620_1610_1600_1590_1580_1570_1560_1550_1540_1530_1520_1510_1500_1490_1480_147
0_1460_1450_1440_1430_1420_1410_1400_1390_1380_1370_1360_1350_1340_1330_1320_1310_130
0_1290_1280_1270_1260_1250_1240_1230_1220_1210_1200_1190_1180_1170_1160_115
0_1140_1130_1120_1110_1100_1090_1080_1070_1060_1050_1040_1030_1020_1010_100
0_990_980_970_960_950_940_930_920_910_900_890_880_87
0_860_850_840_830_820_810_800_790_780_770_760_750_74
0_730_720_710_700_690_680_670_660_650_640_63
0_620_610_600_590_580_570_560_550_540_530_52
0_510_500_490_480_470_460_450_440_43
0_420_410_400_390_380_370_360_350_34
0_330_320_310_300_290_280_270_260_25
0_240_230_220_210_200_190_18
0_170_160_150_140_130_120_11
0_100_90_80_70_6
0_50_40_30_20_1
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1_1631_1621_1611_1601_1591_1581_1571_1561_1551_1541_1531_1521_1511_1501_1491_1481_147
1_1461_1451_1441_1431_1421_1411_1401_1391_1381_1371_1361_1351_1341_1331_1321_1311_130
1_1291_1281_1271_1261_1251_1241_1231_1221_1211_1201_1191_1181_1171_1161_115
1_1141_1131_1121_1111_1101_1091_1081_1071_1061_1051_1041_1031_1021_1011_100
1_991_981_971_961_951_941_931_921_911_901_891_881_87
1_861_851_841_831_821_811_801_791_781_771_761_751_74
1_731_721_711_701_691_681_671_661_651_641_63
1_621_611_601_591_581_571_561_551_541_531_52
1_511_501_491_481_471_461_451_441_43
1_421_411_401_391_381_371_361_351_34
1_331_321_311_301_291_281_271_261_25
1_241_231_221_211_201_191_18
1_171_161_151_141_131_121_11
1_101_91_81_71_6
1_51_41_31_21_1
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
2_1632_1622_1612_1602_1592_1582_1572_1562_1552_1542_1532_1522_1512_1502_1492_1482_147
2_1462_1452_1442_1432_1422_1412_1402_1392_1382_1372_1362_1352_1342_1332_1322_1312_130
2_1292_1282_1272_1262_1252_1242_1232_1222_1212_1202_1192_1182_1172_1162_115
2_1142_1132_1122_1112_1102_1092_1082_1072_1062_1052_1042_1032_1022_1012_100
2_992_982_972_962_952_942_932_922_912_902_892_882_87
2_862_852_842_832_822_812_802_792_782_772_762_752_74
2_732_722_712_702_692_682_672_662_652_642_63
2_622_612_602_592_582_572_562_552_542_532_52
2_512_502_492_482_472_462_452_442_43
2_422_412_402_392_382_372_362_352_34
2_332_322_312_302_292_282_272_262_25
2_242_232_222_212_202_192_18
2_172_162_152_142_132_122_11
2_102_92_82_72_6
2_52_42_32_22_1
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
3_1633_1623_1613_1603_1593_1583_1573_1563_1553_1543_1533_1523_1513_1503_1493_1483_147
3_1463_1453_1443_1433_1423_1413_1403_1393_1383_1373_1363_1353_1343_1333_1323_1313_130
3_1293_1283_1273_1263_1253_1243_1233_1223_1213_1203_1193_1183_1173_1163_115
3_1143_1133_1123_1113_1103_1093_1083_1073_1063_1053_1043_1033_1023_1013_100
3_993_983_973_963_953_943_933_923_913_903_893_883_87
3_863_853_843_833_823_813_803_793_783_773_763_753_74
3_733_723_713_703_693_683_673_663_653_643_63
3_623_613_603_593_583_573_563_553_543_533_52
3_513_503_493_483_473_463_453_443_43
3_423_413_403_393_383_373_363_353_34
3_333_323_313_303_293_283_273_263_25
3_243_233_223_213_203_193_18
3_173_163_153_143_133_123_11
3_103_93_83_73_6
3_53_43_33_23_1
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
4_1634_1624_1614_1604_1594_1584_1574_1564_1554_1544_1534_1524_1514_1504_1494_1484_147
4_1464_1454_1444_1434_1424_1414_1404_1394_1384_1374_1364_1354_1344_1334_1324_1314_130
4_1294_1284_1274_1264_1254_1244_1234_1224_1214_1204_1194_1184_1174_1164_115
4_1144_1134_1124_1114_1104_1094_1084_1074_1064_1054_1044_1034_1024_1014_100
4_994_984_974_964_954_944_934_924_914_904_894_884_87
4_864_854_844_834_824_814_804_794_784_774_764_754_74
4_734_724_714_704_694_684_674_664_654_644_63
4_624_614_604_594_584_574_564_554_544_534_52
4_514_504_494_484_474_464_454_444_43
4_424_414_404_394_384_374_364_354_34
4_334_324_314_304_294_284_274_264_25
4_244_234_224_214_204_194_18
4_174_164_154_144_134_124_11
4_104_94_84_74_6
4_54_44_34_24_1
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
5_1635_1625_1615_1605_1595_1585_1575_1565_1555_1545_1535_1525_1515_1505_1495_1485_147
5_1465_1455_1445_1435_1425_1415_1405_1395_1385_1375_1365_1355_1345_1335_1325_1315_130
5_1295_1285_1275_1265_1255_1245_1235_1225_1215_1205_1195_1185_1175_1165_115
5_1145_1135_1125_1115_1105_1095_1085_1075_1065_1055_1045_1035_1025_1015_100
5_995_985_975_965_955_945_935_925_915_905_895_885_87
5_865_855_845_835_825_815_805_795_785_775_765_755_74
5_735_725_715_705_695_685_675_665_655_645_63
5_625_615_605_595_585_575_565_555_545_535_52
5_515_505_495_485_475_465_455_445_43
5_425_415_405_395_385_375_365_355_34
5_335_325_315_305_295_285_275_265_25
5_245_235_225_215_205_195_18
5_175_165_155_145_135_125_11
5_105_95_85_75_6
5_55_45_35_25_1
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+

max

+

min

+

+
+ + + + + + + + \ No newline at end of file diff --git a/hmon/hmon_eb_rate.pl b/hmon/hmon_eb_rate.pl index 3912a47..e88c39a 100755 --- a/hmon/hmon_eb_rate.pl +++ b/hmon/hmon_eb_rate.pl @@ -1,15 +1,19 @@ #!/usr/bin/perl -w +# changed from epics to web/json readout of eventbuilder rates 28-sep-2018 JAM + use warnings; use strict; use Time::HiRes qw( gettimeofday usleep time ); use Data::Dumper; use Hmon; use QA; -use Perl2Epics; +use LWP::Simple; +use JSON qw( decode_json ); + use HADES::TrbNet; -my $SLEEP_TIME = 1; # in seconds +my $SLEEP_TIME = .5; # in seconds my $NUM_AVERAGES = 5; my $offset = 2; my $last_rate_endp = 0; @@ -17,16 +21,17 @@ my $opt_addr = 3; #CTS my $error_ctr = 0; my $error_limit = 3; +my $opt_debug =0; + trb_init_ports() or die trb_strerror(); my $flog = QA::OpenQAFile(); -for (my $i = 0; $i <= 15; $i++) { - my $s = sprintf("HAD:eb%02i", $i + 1); - Perl2Epics::Connect("ebrate$i", $s.":evtCRate"); - Perl2Epics::Connect("ebstat$i", $s.":status"); -} -#Perl2Epics::Connect("totalEvts","HAD:eb:totalEvtsComp"); + +my $masterurl = 'http://lxhadeb07:8099/'; + +my $url_erate = $masterurl . 'Master/BNET/EventsRate/get.json?field="value"'; +my $url_builders = $masterurl . 'Master/BNET/Builders/get.json?field="value"'; while (1) { @@ -55,14 +60,19 @@ while (1) { : ($rate_endp + 2**16) - $last_rate_endp; } if ($ctr >= $offset) { - $data = Perl2Epics::GetAll(); - my $i = 0; - for ($i = 0; $i <= 15; $i++) { - $evtrate_eb_tot += $data->{"ebrate$i"}->{val} || 0; - if ($data->{"ebstat$i"}->{val}) { - $actmask |= (1 << $i); - } - } + # JAM2018: direct access to dabc http server instead of epics now: + $evtrate_eb_tot += get ($url_erate); + $evtrate_eb_tot += 0 unless defined $evtrate_eb_tot; + #print Dumper $evtrate_eb_tot; + my $builders = get ($url_builders); + #print Dumper $builders; + if (defined $builders) + { + my $builder_array = decode_json($builders); + $actmask = scalar @$builder_array; + # not exactly the bitmask, but this is not used here anyway JAM + } + } $last_rate_endp = $rate_endp; @@ -90,9 +100,8 @@ while (1) { my $limit = $diff / sqrt($rate_endp || 1); my $status = QA::GetQAState('inside', $limit, @QA::EBDeltaRateLimits); - if ($rate_endp < 50) { - $status = QA::OK; - } + $status = QA::OK if $rate_endp < 50; + if (! $actmask) { $status = QA::WARN_2; $diff_p_str = "---"; @@ -104,15 +113,20 @@ while (1) { } else { $error_ctr = 0; } + $status = QA::ERROR if ($diff > 2000 || $diff < -2000); + my $title = "ΔRate EB-CTS"; my $shorttext = "$diff_str ($diff_p_str%)"; my $longtext = "CurrentRate CTS: $rate_endp_str - Rate Eventbuilders: $rate_eb_str - ΔRate: $diff_str ($diff_p_str%)"; $longtext = " $longtext ErrorCtr: $error_ctr" if ($error_ctr > 0); QA::WriteQALog($flog, "eb", "rate", $SLEEP_TIME * $ctr * 2, - $status, $title, $shorttext, $longtext); + $status, $title, $shorttext, $longtext) unless $opt_debug>0; + print "status:$status title:$title short:$shorttext long: $longtext \n" unless $opt_debug<1; + if ($status >= QA::ERROR) { my $speakermsg = "CTS and Eventbuilder rate differ by "; my $pmesg = sprintf "%d", abs($diff_p); - Hmon::Speak('dataloss', "Eventbuilder and CTS rate differ by $pmesg per cent") + Hmon::Speak('dataloss', "Eventbuilder and CTS rate differ by $pmesg per cent") unless $opt_debug>0; + print "dataloss: Eventbuilder and CTS rate differ by $pmesg per cent\n" unless $opt_debug<1; } } diff --git a/hmon/hmon_ecalrate.pl b/hmon/hmon_ecalrate.pl index b77407a..cf59b9c 100755 --- a/hmon/hmon_ecalrate.pl +++ b/hmon/hmon_ecalrate.pl @@ -6,6 +6,7 @@ use Data::Dumper; use Data::TreeDumper; use Hmon; use QA; +use JSON::XS; use HADES::TrbNet; use HPlot; use Time::HiRes qw(usleep time); @@ -99,15 +100,18 @@ my $oldtime = time(); my $time = time(); my $diff; my $iter = 0; +my $fh; trb_init_ports() or die trb_strerror(); while(1) { + my $data; my $max; my $slowmax = 0; my $fastmax = 0; my $ratiomax = 0; + my $o = trb_register_read_mem(0xfe71,0xc000,0,49) or die trb_strerror() or sleep 5 and next; if (defined $old) { - my $tdiff = time() - $oldtime; + my $tdiff = (time() - $oldtime||0) || 1; foreach my $b (keys %$o) { my $sec = ($b>>4) & 0x7; for my $v (0..23) { @@ -115,13 +119,20 @@ while(1) { my $vdiff = ($o->{$b}->[$v*2+1]&0xffffff) - ($old->{$b}->[$v*2+1]&0xffffff); if ($vdiff < 0) { $vdiff += 2**24;} - $diff->{$b}->[$v*2+1] = $vdiff/($tdiff|1); + $diff->{$b}->[$v*2+1] = $vdiff/$tdiff; $vdiff = ($o->{$b}->[$v*2+2]&0xffffff) - ($old->{$b}->[$v*2+2]&0xffffff); if ($vdiff < 0) { $vdiff += 2**24;} - $diff->{$b}->[$v*2+2] = $vdiff/($tdiff|1); + $diff->{$b}->[$v*2+2] = $vdiff/$tdiff; - my $ratio = ($diff->{$b}->[$v*2+1]||0) / ($diff->{$b}->[$v*2+2]||1); + my $ratio = ($diff->{$b}->[$v*2+2]||0) / ($diff->{$b}->[$v*2+1]||1); + my $sb = sprintf("0x%04x",$b); + $data->{fast}{$sb}{$v} = sprintf('%.2f',$diff->{$b}->[$v*2+1]); + $data->{slow}{$sb}{$v} = sprintf('%.2f',$diff->{$b}->[$v*2+2]); + $data->{ratio}{$sb}{$v} = sprintf('%.2f',$ratio); + $fastmax = $data->{fast}{$sb}{$v} if $data->{fast}{$sb}{$v} > $fastmax; + $slowmax = $data->{slow}{$sb}{$v} if $data->{slow}{$sb}{$v} > $slowmax; + $ratiomax = $data->{ratio}{$sb}{$v} if $data->{ratio}{$sb}{$v} > $ratiomax; HPlot::PlotFill('EcalRateFast'.$sec,$diff->{$b}->[$v*2+1],$xpos,$v % 8); HPlot::PlotFill('EcalRateSlow'.$sec,$diff->{$b}->[$v*2+2],$xpos,$v % 8); @@ -136,5 +147,37 @@ while(1) { } $old = $o; $oldtime = time(); + + $data->{fast}{min} = 0; + $data->{fast}{max} = $fastmax; + $data->{fast}{symbol} = 'Hz'; + $data->{fast}{title} = 'ECal rate fast chan'; + + $data->{slow}{min} = 0; + $data->{slow}{max} = $slowmax; + $data->{slow}{symbol} = 'Hz'; + $data->{slow}{title} = 'ECal rate slow chan'; + + $data->{ratio}{min} = 0; + $data->{ratio}{max} = $ratiomax; + $data->{ratio}{symbol} = 'Hz'; + $data->{ratio}{title} = 'ECal rate ratio'; + + my $timeStamp = localtime(); + my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); + my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun); + my ($sec,$minute,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); + my $updatetime = sprintf("%03s, %02d %s %04d - %02d:%02d:%02d",$days[$wday], $mday, $months[$mon], 1900 + $year, $hour, $minute, $sec); + + $data->{slow}{updatetime} = $updatetime; + $data->{fast}{updatetime} = $updatetime; + $data->{ratio}{updatetime} = $updatetime; + + open($fh, ">", Hmon::HMONDIR."/files/ecalrate.json"); + print $fh encode_json($data); + close $fh; + + + sleep 2; } diff --git a/hmon/hmon_endpoints.pl b/hmon/hmon_endpoints.pl index d878a04..8fb4fdc 100755 --- a/hmon/hmon_endpoints.pl +++ b/hmon/hmon_endpoints.pl @@ -24,33 +24,33 @@ while(1) { my @all_boards =(); my @mdc_boards =(0x8015,0x8016, ###OEPS - 0x2010,0x2011,0x2012,0x2013,0x2014,0x2015,0x2016,0x2017,0x2018,0x2019,0x201a, - 0x201b,0x201c,0x201d,0x2020,0x2021,0x2022,0x2023,0x2024,0x2025,0x2026,0x2027, - 0x2028,0x2029,0x202a,0x202b,0x202c,0x202d,0x2030,0x2031,0x2032,0x2033,0x2034, - 0x2035,0x2036,0x2037,0x2038,0x2039,0x203a,0x203b,0x203c,0x203d,0x2040,0x2041, - 0x2042,0x2043,0x2044,0x2045,0x2046,0x2047,0x2048,0x2049,0x204a,0x204b,0x204c, - 0x204d,0x2050,0x2051,0x2052,0x2053,0x2054,0x2055,0x2056,0x2057,0x2058,0x2059, - 0x205a,0x205b,0x205c,0x205d,0x2100,0x2101,0x2102,0x2103,0x2104,0x2105,0x2106, - 0x2107,0x2108,0x2109,0x210a,0x210b,0x210c,0x210d,0x210e,0x210f,0x2110,0x2111, - 0x2112,0x2113,0x2114,0x2115,0x2116,0x2117,0x2118,0x2119,0x211a,0x211b,0x211c, - 0x211d,0x211e,0x211f,0x2120,0x2121,0x2122,0x2123,0x2124,0x2125,0x2126,0x2127, - 0x2128,0x2129,0x212a,0x212b,0x212c,0x212d,0x212e,0x212f,0x2130,0x2131,0x2132, - 0x2133,0x2134,0x2135,0x2136,0x2137,0x2139,0x213a,0x213b,0x213c,0x213d,0x213e, - 0x213f,0x2140,0x2141,0x2142,0x2143,0x2144,0x2145,0x2146,0x2147,0x2148,0x2149, - 0x214a,0x214b,0x214c,0x214d,0x214e,0x214f,0x2150,0x2151,0x2152,0x2153,0x2154, - 0x2155,0x2156,0x2157,0x2158,0x2159,0x215a,0x215b,0x215c,0x215d,0x215e,0x215f, - 0x2200,0x2201,0x2202,0x2203,0x2204,0x2205,0x2206,0x2207,0x2208,0x2209,0x220a, - 0x220b,0x220c,0x220d,0x220e,0x220f,0x2220,0x2221,0x2222,0x2223,0x2224,0x2225, - 0x2226,0x2227,0x2228,0x2229,0x222a,0x222b,0x222c,0x222d,0x222e,0x222f,0x2240, - 0x2241,0x2242,0x2243,0x2244,0x2245,0x2246,0x2247,0x2248,0x2249,0x224a,0x224b, - 0x224c,0x224d,0x224e,0x224f,0x2250,0x2251,0x2252,0x2253,0x2254,0x2255,0x2256, - 0x2257,0x2258,0x2259,0x225a,0x225b,0x225c,0x225d,0x225e,0x225f,0x2300,0x2301, - 0x2302,0x2303,0x2304,0x2305,0x2306,0x2307,0x2308,0x2309,0x230a,0x230b,0x230c, - 0x230d,0x230e,0x230f,0x2320,0x2321,0x2322,0x2323,0x2324,0x2325,0x2326,0x2327, - 0x2328,0x2329,0x232a,0x232b,0x232c,0x232d,0x232e,0x232f,0x2340,0x2341,0x2342, - 0x2343,0x2344,0x2345,0x2346,0x2347,0x2348,0x2349,0x234a,0x234c,0x234d,0x234e, - 0x234f,0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358,0x2359, - 0x235a,0x235b,0x235c,0x235d,0x235e,0x235f, +# 0x2010,0x2011,0x2012,0x2013,0x2014,0x2015,0x2016,0x2017,0x2018,0x2019,0x201a, +# 0x201b,0x201c,0x201d,0x2020,0x2021,0x2022,0x2023,0x2024,0x2025,0x2026,0x2027, +# 0x2028,0x2029,0x202a,0x202b,0x202c,0x202d,0x2030,0x2031,0x2032,0x2033,0x2034, +# 0x2035,0x2036,0x2037,0x2038,0x2039,0x203a,0x203b,0x203c,0x203d,0x2040,0x2041, +# 0x2042,0x2043,0x2044,0x2045,0x2046,0x2047,0x2048,0x2049,0x204a,0x204b,0x204c, +# 0x204d,0x2050,0x2051,0x2052,0x2053,0x2054,0x2055,0x2056,0x2057,0x2058,0x2059, +# 0x205a,0x205b,0x205c,0x205d,0x2100,0x2101,0x2102,0x2103,0x2104,0x2105,0x2106, +# 0x2107,0x2108,0x2109,0x210a,0x210b,0x210c,0x210d,0x210e,0x210f,0x2110,0x2111, +# 0x2112,0x2113,0x2114,0x2115,0x2116,0x2117,0x2118,0x2119,0x211a,0x211b,0x211c, +# 0x211d,0x211e,0x211f,0x2120,0x2121,0x2122,0x2123,0x2124,0x2125,0x2126,0x2127, +# 0x2128,0x2129,0x212a,0x212b,0x212c,0x212d,0x212e,0x212f,0x2130,0x2131,0x2132, +# 0x2133,0x2134,0x2135,0x2136,0x2137,0x2139,0x213a,0x213b,0x213c,0x213d,0x213e, +# 0x213f,0x2140,0x2141,0x2142,0x2143,0x2144,0x2145,0x2146,0x2147,0x2148,0x2149, +# 0x214a,0x214b,0x214c,0x214d,0x214e,0x214f,0x2150,0x2151,0x2152,0x2153,0x2154, +# 0x2155,0x2156,0x2157,0x2158,0x2159,0x215a,0x215b,0x215c,0x215d,0x215e,0x215f, +# 0x2200,0x2201,0x2202,0x2203,0x2204,0x2205,0x2206,0x2207,0x2208,0x2209,0x220a, +# 0x220b,0x220c,0x220d,0x220e,0x220f,0x2220,0x2221,0x2222,0x2223,0x2224,0x2225, +# 0x2226,0x2227,0x2228,0x2229,0x222a,0x222b,0x222c,0x222d,0x222e,0x222f,0x2240, +# 0x2241,0x2242,0x2243,0x2244,0x2245,0x2246,0x2247,0x2248,0x2249,0x224a,0x224b, +# 0x224c,0x224d,0x224e,0x224f,0x2250,0x2251,0x2252,0x2253,0x2254,0x2255,0x2256, +# 0x2257,0x2258,0x2259,0x225a,0x225b,0x225c,0x225d,0x225e,0x225f,0x2300,0x2301, +# 0x2302,0x2303,0x2304,0x2305,0x2306,0x2307,0x2308,0x2309,0x230a,0x230b,0x230c, +# 0x230d,0x230e,0x230f,0x2320,0x2321,0x2322,0x2323,0x2324,0x2325,0x2326,0x2327, +# 0x2328,0x2329,0x232a,0x232b,0x232c,0x232d,0x232e,0x232f,0x2340,0x2341,0x2342, +# 0x2343,0x2344,0x2345,0x2346,0x2347,0x2348,0x2349,0x234a,0x234c,0x234d,0x234e, +# 0x234f,0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358,0x2359, +# 0x235a,0x235b,0x235c,0x235d,0x235e,0x235f, # ###MDC Concentrator 0x1000,0x1001,0x1002,0x1003,0x1004,0x1010,0x1011,0x1012,0x1013,0x1014,0x1020, 0x1021,0x1022,0x1023,0x1024,0x1030,0x1031,0x1032,0x1033,0x1034,0x1040,0x1041, @@ -211,14 +211,13 @@ while(1) { my @sorted_mdc_results = sort @{$mdc_results[2]}; my $title = "MDC"; - my $value = "OK"; + my $value = "OK ".(scalar @mdc_boards); if ($num_mdc_missing > 0) {$value = "$num_mdc_missing missing";} if ($num_mdc_mistake > 0) {$value = "Check Script";} - my $longtext = ""; + my $longtext = (scalar @mdc_boards). " boards. "; if ($num_mdc_missing > 0) {$longtext = "Endp @sorted_mdc_results missing"}; if ($num_mdc_mistake > 0) {$longtext .= " Endp @{$mdc_results[4]} not known";} - - + my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits); Hmon::Speak('mdcmiss',"$num_mdc_missing MDC Frontends missing") if($qastate > 60); QA::WriteQALog($flog,"endp","mdc",$waittime,$qastate,$title,$value,$longtext); @@ -243,10 +242,10 @@ while(1) { my @sorted_rich_results = sort @{$rich_results[2]}; my $rich_title = "RICH"; - my $rich_value = "OK"; + my $rich_value = "OK ".(scalar @rich_boards); if ($num_rich_missing > 0) {$rich_value = "$num_rich_missing missing";} if ($num_rich_mistake > 0) {$rich_value = "Check Script";} - my $rich_longtext = ""; + my $rich_longtext = (scalar @rich_boards). " boards. "; if ($num_rich_missing > 0) {$rich_longtext = "Endp @sorted_rich_results missing"}; if ($num_rich_mistake > 0) {$rich_longtext .= " Endp @{$rich_results[4]} not known";} @@ -276,10 +275,10 @@ while(1) { my @sorted_tof_results = sort @{$tof_results[2]}; my $tof_title = "TOF/RPC/FW"; - my $tof_value = "OK"; + my $tof_value = "OK ".(scalar @tof_boards); if ($num_tof_missing > 0) {$tof_value = "$num_tof_missing missing";} if ($num_tof_mistake > 0) {$tof_value = "Check Script";} - my $tof_longtext = ""; + my $tof_longtext = (scalar @tof_boards). " boards. "; #if ($num_tof_missing > 0) {$tof_longtext = "Endp @{$tof_results[2]} missing"}; if ($num_tof_missing > 0) {$tof_longtext = "Endp @sorted_tof_results missing"}; if ($num_tof_mistake > 0) {$tof_longtext .= " Endp @{$tof_results[4]} not known";} @@ -310,10 +309,10 @@ while(1) { my @sorted_rpc_results = sort @{$rpc_results[2]}; my $rpc_title = "ECal"; - my $rpc_value = "OK"; + my $rpc_value = "OK ".(scalar @rpc_boards); if ($num_rpc_missing > 0) {$rpc_value = "$num_rpc_missing missing";} if ($num_rpc_mistake > 0) {$rpc_value = "Check Script";} - my $rpc_longtext = ""; + 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";} @@ -341,10 +340,10 @@ while(1) { my @sorted_other_results = sort @{$other_results[2]}; my $other_title = "Hub/St/CTS"; - my $other_value = "OK"; + my $other_value = "OK ".(scalar @other_boards); if ($num_other_missing > 0) {$other_value = "$num_other_missing missing";} if ($num_other_mistake > 0) {$other_value = "Check Script";} - my $other_longtext = ""; + my $other_longtext = (scalar @other_boards). " boards. "; if ($num_other_missing > 0) {$other_longtext = "Endp @sorted_other_results missing"}; if ($num_other_mistake > 0) {$other_longtext .= " Endp @{$other_results[4]} not known";} diff --git a/hmon/hmon_padiwatemp.pl b/hmon/hmon_padiwatemp.pl new file mode 100755 index 0000000..b9a3f8c --- /dev/null +++ b/hmon/hmon_padiwatemp.pl @@ -0,0 +1,64 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Dmon; +use Time::HiRes qw(usleep); +use List::Util qw[min max]; + +trb_init_ports() or die trb_strerror(); +my $flog = Hmon::OpenLogfile(); +my $fqa = QA::OpenQAFile(); + +while(1) { + my @r; + $r[0] = Dmon::PadiwaSendCmd(0x14 << 24,0xfe71,0) or sleep 1 and next; + $r[1] = Dmon::PadiwaSendCmd(0x14 << 24,0xfe71,1) or sleep 1 and next; + $r[2] = Dmon::PadiwaSendCmd(0x14 << 24,0xfe71,2) or sleep 1 and next; + + my $min = 1000; + my $max = 0; + my $count = 0; + my $missing = ""; + my $c = -1; + foreach my $r (@r) { + $c++; + foreach my $b (keys %{$r}) { + last if $r->{$b} =~ /SPI/; + my $t = ($r->{$b} & 0xfff)/16; + $count++ unless $t > 90; + $missing .= sprintf("%04x-%i ",$c,$b) if $t > 90; + + next if $t < 10 || $t > 90; + $min = $t if $t < $min; + $max = $t if $t > $max; + } + } + + my $qastate = QA::GetQAState('below', $max, @QA::EcalTempLimits); + + my $str = sprintf("%i - %i", $min, $max); + QA::WriteQALog($fqa,"ecal","temp", 40, $qastate, "Temperature", $str, + "Min/Max temperature in Ecal " . $str); + + + + if ($count == $QA::PadiwaECalNumber) { + $str = sprintf("OK %i",$count) ; + } + else { + $str = sprintf("%i / %i",$count,$QA::PadiwaECalNumber) ; + } + + $qastate = QA::GetQAState('below', $QA::PadiwaECalNumber-$count, @QA::PadiwaEcalLimits); + QA::WriteQALog($fqa,"ecal","count", 40, $qastate, "Padiwa", $str, + $missing); + + sleep(10); + } diff --git a/hmon/hmon_richInnerTemp.pl b/hmon/hmon_richInnerTemp.pl new file mode 100755 index 0000000..ccc8247 --- /dev/null +++ b/hmon/hmon_richInnerTemp.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + + +#my $flog = Hmon::OpenLogfile(); +#my $fqa = QA::OpenQAFile(); + +#use HADES::TrbNet; + + + +my $str = Hmon::MakeTitle(12, 17, "RICH Inner Temperature",0); +$str .= qq@
\n@; +$str .= qq@
\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("RichInnerTemp",$str); + + +#trb_init_ports() or die trb_strerror(); + + + +while(1){ + sleep 10; +} diff --git a/hmon/hmon_richMagnet.pl b/hmon/hmon_richMagnet.pl index 2074492..e09b32f 100755 --- a/hmon/hmon_richMagnet.pl +++ b/hmon/hmon_richMagnet.pl @@ -44,6 +44,59 @@ additional => "", showvalues => 1, }; HPlot::PlotInit($plot1); +my @colors = ("#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd"); + +my $plot = { + name => "RichInnerTempHist", + file => "files/RichInnerTempHist", + entries => 1200, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + titles => ["M_0_0","M_0_1","M_0_2","M_0_3","M_1_0","M_1_1","M_1_2","M_1_3","M_2_0","M_2_1","M_2_2","M_2_3","M_3_0","M_3_1","M_3_2","M_3_3","M_4_0","M_4_1","M_4_2","M_4_3","M_5_0","M_5_1","M_5_2","M_5_3"], + #titles => ['min','max','mean'], + xlabel => "Minutes", + ylabel => "Temperature [°C]", + sizex => 950, + sizey => 360, + #ymin => "*<15", + #ymax => "40<*", + curves => 24, + xscale => 6, + storable=> 1, + buffer => 1, + colors => ["#333333","#00ff00","#ff0000","#0022ff","#9a176d","#b844b8","#555555","#22ff22","#ffaaaa","#2222ff","#2d9c94","#777777","#55ff77","#ff7755","#7575ff","#aadd47","#aa0033","#316022","#09b9df","#777777","#55ff77","#ff7755","#7575ff","#aadd47","#aa0033","#316022","#09b9df"], + additional => "set offsets 0,0,1.5,1.5" +# colors => ["#333333","#00ff00","#ff0000"] + }; +HPlot::PlotInit($plot); + +my $plot2 = { +name => "RichInnerTemp", +file => "files/RichInnerTemp", +title => "RICH RichInnerTemp", +entries => 6, +curves => 4, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "°C", +sizex => 500, +sizey => 400, +nokey => 1, +buffer => 1, +xmin => -0.5, +xmax => 5.5, +xlabel => "RICH Arm number", +ylabel => "Sensor Number on Board", +ymin => -0.5, +ymax => 3.5, +cbmax => "",#"40<*<1E5", +cbmin => 0.0, +cblabel => "Temperature [°C]", +noinit => 1, +additional => "", +showvalues => 1, }; +HPlot::PlotInit($plot2); + my $str = Hmon::MakeTitle(7, 9, "RICH Magnet",0); $str .= qq@
\n@; $str .= Hmon::MakeFooter(); @@ -52,8 +105,8 @@ Hmon::WriteFile("RichMagnet",$str); trb_init_ports() or die trb_strerror(); -my $calib = [[[65.000,34.500,245.024],[-78.500,-20.000,-33.046],[-17.000,-33.000,-112.034],[2.5000,-24.000,43.524]],[[106.000,-24.500,210.366],[-34.000,-60.500,-142.662],[114.000,-59.000,5.642],[-29.500,-26.500,-131.378]],[[73.00,-84.000,166.036],[-31.000,-120.500,-156.364],[8.500,-85.000,-14.508],[54.500,-60.000,-96.790]],[[60.500,-108.500,-27.404],[-90.000,-49.000,169.260],[174.000,-55.500,-149.110],[-13.500,-33.500,-83.018]],[[-19.000,45.500,37.076],[95.500,10.00,211.978],[89.500,2.000,197.470],[13.000,6.500,-214.396]],[[-114.500,-19.500,157.170],[-11.500,-1.000,-58.032],[-1.500,-15.000,28.210],[41.000,15.500,155.558]]]; - +my $calib = [[[70.000,1.083,235.889],[-73.417,-29.833,-36.539],[-13.833,-34.333,-115.930],[5.667,-21.333,39.494]],[[101.333,-75.167,204.321],[-39.700,-77.800,-149.271],[109.700,-63.300,-2.418],[-36.400,-25.300,-139.438]],[[75.100,-144.200,154.107],[-34.500,-149.000,-166.520],[1.400,-91.500,-25.631],[49.100,-65.000,-106.553]],[[63.400,-155.100,-26.114],[-93.000,-72.600,164.908],[167.600,-68.200,-152.495],[-14.200,-39.600,-87.854]],[[-26.800,-8.100,35.625],[93.600,-14.800,208.109],[86.000,-6.500,197.309],[12.200,1.500,-215.041]],[[-116.500,-41.200,161.361],[-15.100,-11.000,-55.936],[-4.300,-17.400,26.598],[37.900,14.100,151.850]]]; +my $cnt=0; while(1){ my $count = 0; my $data; @@ -65,9 +118,19 @@ while(1){ my $t=0; #printf("%u \n", ($magActive->{0x0110}[$count % 4] >> 8)); - if (($count % 4) == 0) { - #$t = ($b & 0x7ffffff) / 100; - #if ((($b >> 27)&0x1) == 1) {$t = $t * -1;} + if (($count % 4) == 0) { #Temperature + $t = ($b & 0x7ffffff) / 100; + if ((($b >> 27)&0x1) == 1) {$t = $t * -1;} + my $sensT = ($count % 16) / 4; + my $boardT = int($count / 16); + if (($magActive->{0x0110}[$boardT] >> 8) == 0 ) { + #print "$boardT $sensT $t\n"; + HPlot::PlotFill('RichInnerTemp',$t,$boardT,$sensT);# + my $reg = 4*$boardT+$sensT; + #print "$reg $t\n"; + if ($cnt > 7) {$cnt =0;} else {$cnt++;} + HPlot::PlotAdd('RichInnerTempHist',$t,$reg);#HPlot::PlotFill('RichInnerTempHist',15,1); + } $val = 0; } else { $t = int (($b & 0x7ffffff) / 1000); @@ -77,7 +140,7 @@ while(1){ } if (($count % 4) == 3 ) { my $sens = ($count % 16) / 4; - my $board = ($count / 16); + my $board = int($count / 16); if (($magActive->{0x0110}[$board] >> 8) == 0 ) { HPlot::PlotFill('RichMagnet',sqrt($val),$board,$sens);# @@ -89,6 +152,7 @@ while(1){ } #print Dumper \@calib; HPlot::PlotDraw('RichMagnet'); - + HPlot::PlotDraw('RichInnerTemp'); + HPlot::PlotDraw('RichInnerTempHist'); sleep 10; } diff --git a/hmon/hmon_richrate2.pl b/hmon/hmon_richrate2.pl index 7e02f4a..f2abfae 100755 --- a/hmon/hmon_richrate2.pl +++ b/hmon/hmon_richrate2.pl @@ -57,6 +57,7 @@ my $iter = 0; trb_init_ports() or die trb_strerror(); my $filename = 'rich_pmt_parameters_xy.geo'; + open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open file '$filename' $!"; diff --git a/hmon/hmon_spill.pl b/hmon/hmon_spill.pl index 677a7a9..5399ebe 100755 --- a/hmon/hmon_spill.pl +++ b/hmon/hmon_spill.pl @@ -9,7 +9,10 @@ use Hmon; use QA; use HADES::TrbNet; use HPlot; -use Perl2Epics; +#use Perl2Epics; +use LWP::Simple; + +my $opt_debug = 0; my $lastspill = 1; my $evtrate = 0; @@ -38,7 +41,7 @@ $plot->{sizex} = 630; $plot->{sizey} = 220; $plot->{nokey} = 1; $plot->{storable} = 1; -HPlot::PlotInit($plot); +HPlot::PlotInit($plot) unless $opt_debug; my $str = Hmon::MakeTitle(8,5,"Recorded Events per Spill (1000)",0); $str .= qq@@; $str .= Hmon::MakeFooter(); @@ -49,7 +52,12 @@ my $lastqa = 0; trb_init_ports() or die trb_strerror(); -Perl2Epics::Connect("prefix", "HAD:eb01:prefix",'DBR_TIME_STRING'); +#Perl2Epics::Connect("prefix", "HAD:eb01:prefix",'DBR_TIME_STRING'); +# JAM28-9-2018 replace epics by dabc url access +my $masterurl = 'http://lxhadeb07:8099/'; +my $url_prefix = $masterurl . 'Master/BNET/RunPrefix/get.json?field="value"'; + + while (1) { my $trbneterr = 0; @@ -114,21 +122,28 @@ while (1) { QA::SciNotation($spillavglong), $spilllength); QA::WriteQALog($fqa,"trg", "spill", 30, $qastate, "Spill Sum", - $qashort, $qalong); - HPlot::PlotAdd("EvtsPerSpill",$events/1E3); - HPlot::PlotDraw("EvtsPerSpill"); + $qashort, $qalong) unless $opt_debug>0; + HPlot::PlotAdd("EvtsPerSpill",$events/1E3) unless $opt_debug>0; + HPlot::PlotDraw("EvtsPerSpill") unless $opt_debug>0; $events = 0; $spilllength = 0; } elsif ($spilllength > 20) { QA::WriteQALog($fqa, "trg", "spill", 30, QA::NOTE, "Spill Sum", - "No Spills", "No Spills detected at the moment"); + "No Spills", "No Spills detected at the moment") unless $opt_debug>0;; #print $spilllength."\n" unless $spilllength%10; if($spilllength >= 25 && ($spilllength%25 == 0)) { - my $data = Perl2Epics::GetAll(); - print STDERR $data->{'prefix'}->{val}."\n"; - if(($data->{'prefix'}->{val} eq '-1') || ($data->{'prefix'}->{val} eq 'be')) { - Hmon::Speak('nobeam', "No beam"); + # my $data = Perl2Epics::GetAll(); + # print STDERR $data->{'prefix'}->{val}."\n"; +# if(($data->{'prefix'}->{val} eq '-1') || ($data->{'prefix'}->{val} eq 'be')) { +# Hmon::Speak('nobeam', "No beam"); +# } + my $prefix = get ($url_prefix); + print Dumper $prefix; + $prefix = "--" unless defined $prefix; + if(($prefix eq '-1') || ($prefix eq 'be')) { + Hmon::Speak('nobeam', "No beam") unless $opt_debug>0; } + } } @@ -150,12 +165,12 @@ while (1) { $qalong = sprintf("current: %i Events/second", $evtrate); QA::WriteQALog($fqa, "main", "rate", 5, $qastate, "Current Rate", - $qashort, $qalong); + $qashort, $qalong) unless $opt_debug>0; my $spillcountstate = QA::OK; if ($countnochange > 15) {$spillcountstate = QA::WARN;} QA::WriteQALog($fqa, "daq", "spillcount", 5, $spillcountstate, "Spill Count", - $spillcount,"Number of spills: $spillcount" ); + $spillcount,"Number of spills: $spillcount" ) unless $opt_debug>0; if($lastspillcount == $spillcount) { $countnochange++; } @@ -164,12 +179,15 @@ while (1) { } $lastspillcount = $spillcount; $lastres = $res; + print "debug: short:$qashort long:$qalong, spillcount:$spillcount\n" unless $opt_debug==0; usleep(500000); + } else { - QA::WriteQALog($fqa, "main", "rate", 30, QA::ERROR, "Current Rate", "N/A", "N/A"); - QA::WriteQALog($fqa,"trg", "spill", 30, QA::ERROR, "Spill Sum","N/A", "N/A"); + QA::WriteQALog($fqa, "main", "rate", 30, QA::ERROR, "Current Rate", "N/A", "N/A") unless $opt_debug>0; + QA::WriteQALog($fqa,"trg", "spill", 30, QA::ERROR, "Spill Sum","N/A", "N/A") unless $opt_debug>0; $events = 0; $spilllength = 0; + print "debug: spill and rate N/At\n" unless $opt_debug==0; sleep(10); } } diff --git a/hmon/hmon_timeout.pl b/hmon/hmon_timeout.pl index fc0878d..43ad3d3 100755 --- a/hmon/hmon_timeout.pl +++ b/hmon/hmon_timeout.pl @@ -36,7 +36,7 @@ while (1) { $msg .= ")"; $cnt++; } - if ((($rh_hubs->{$board}>>16) & 0xffff) != 0x0000 && $board > 0x1000 && $board < 0x1200 && $board%16) { + if ((($rh_hubs->{$board}>>16) & 0xffff) != 0x0000 && (($board > 0x1000 && $board < 0x1200 && $board%16) || ($board&0xff00 == 0x8a00) || ($board&0xff00 == 0x8200))) { $msg2 .= ", " if $msg2 ne ""; $msg2 .= sprintf("%04x-%04x (",$board,$rh_hubs->{$board}>>16 & 0xffff); foreach my $i (1..8) { @@ -54,8 +54,8 @@ while (1) { $boardlist2 =~ s/(\w)(\w)/$1 $2 /gi; - $msg =~ s/\s+\)/\)/; $msg =~ s/\(\s+/\(/; - $msg2 =~ s/\s+\)/\)/; $msg2 =~ s/\(\s+/\(/; + $msg =~ s/\s+\)/\)/g; $msg =~ s/\(\s+/\(/g; + $msg2 =~ s/\s+\)/\)/g; $msg2 =~ s/\(\s+/\(/g; my $status = "on ".($cnt+$cnt2)." boards"; my $qastate = QA::GetQAState('below', $cnt+$cnt2, @QA::TimeoutLimits); if($boardlist1 ne "") { diff --git a/hmon/hmon_trgerr.pl b/hmon/hmon_trgerr.pl index ba04e08..b5d92ff 100755 --- a/hmon/hmon_trgerr.pl +++ b/hmon/hmon_trgerr.pl @@ -8,18 +8,26 @@ use QA; use HADES::TrbNet; my %laststore2; -my $allboards; + my $fqa = QA::OpenQAFile(); trb_init_ports() or die trb_strerror(); +my %store; +my %store2; +my $boards = {}; +my $allboards = {}; +my @boards_history; +my $seconds = 0; + while (1) { my $rh_trigErr = trb_register_read(0xffff, 0x06) or sleep 5 and next; my $rh_trigErr2 = trb_register_read(0xffff, 0x07) or sleep 5 and next; - - my %store; - my %store2; - my $boards = {}; + + + #print Dumper $rh_trigErr; + #print Dumper $rh_trigErr2; + my $boardstring = ""; foreach my $board (sort {$a <=> $b} keys %$rh_trigErr) { next if $board < 0x1000; @@ -31,7 +39,7 @@ while (1) { my $val = ((($rh_trigErr->{$board} >> 16) & 0xffff) + ($rh_trigErr->{$board} & 0xffff)); if ($id_0 == 0x2) { - $store{$id_1}->{$id_2}->{$id_3} += $val; + $store{$id_1}->{$id_2}->{$id_3} = $val; } $boards->{$board} = $val; $store2{$id} += $val; @@ -49,18 +57,16 @@ while (1) { if ($id_0 == 0x2) { $store{$id_1}->{$id_2}->{$id_3} += $val; } -# $boards->{$board} += $val if $val && defined $laststore2{$id}; +# $boards->{$board} += $val if $val && defined $laststore2{$id}; $boards->{$board} += $val; $store2{$id} += $val; } - #Clean-up by compare to former values - foreach my $b (keys %$boards) { - if(! defined $allboards->{$b} || ($boards->{$b} == $allboards->{$b})) { - $boards->{$b} = 0; - } - } - +# if ($seconds>=5) { +# $boards->{0x7466} = 10; +# } + + #print "boards " . scalar %$boards . "\n"; my @str; my %color; my %raw; @@ -86,35 +92,68 @@ while (1) { my $sum = 0; my $totalsum = 0; - if (%laststore2) { - foreach my $c (keys %store2) { - my $diff = $store2{$c} - ($laststore2{$c} || 0); - while ($diff < 0) { - $diff += 2**16; + #print Dumper $boards; + if ($seconds>0 && exists $boards->{0xfc00}) { + #print "in check\n"; + # foreach my $c (keys %store2) { + # my $diff = $store2{$c} - ($laststore2{$c} || 0); + # while ($diff < 0) { + # $diff += 2**16; + # } + # $sum += $diff; + # $totalsum += $store2{$c}; + # } + + #print Dumper $boards; print Dumper $allboards; + foreach my $c (keys %$boards) { + my $diff = 0; + $diff = $boards->{$c} - $allboards->{$c} if (defined $allboards->{$c}); + my $diff_10sec = 0; + $diff_10sec = $boards->{$c} - $boards_history[9]->{$c} if (defined $boards_history[9]->{$c}); + while ($diff < 0) { $diff += 2**16; } + while ($diff_10sec < 0) { $diff_10sec += 2**16; } + $totalsum += $boards->{$c}; + + if ( $diff != 0 || $diff_10sec !=0 ) { + $boardstring .= sprintf("0x%04x, ",$c); } - $sum += $diff; - $totalsum += $store2{$c}; } - foreach my $c (sort keys %$boards) { - $boardstring .= sprintf("0x%04x, ",$c) if ($boards->{$c}); - } + #print "\n"; chop $boardstring; chop $boardstring; + #print $boardstring . "\n"; + my $qastate = QA::GetQAState('below', $sum, @QA::TrgErrLimits); my $qash = ""; $qash = sprintf("%u Errors", $sum) if $sum; my $qalg = sprintf("%u errors in last second - %u errors in total", $sum, $totalsum); QA::WriteQALog($fqa, "feeerr", "trgqual", 20, $qastate, - "Trigger", $qash, $qalg." - Boards: ".$boardstring); + "Trigger", $qash, $qalg." - Boards (in last 10 seconds): ".$boardstring); } Hmon::WriteFile("MDCTriggerError", $str[0][4]."

".$str[1][0].$str[1][1]."

". $str[1][2]."

".$str[1][3].$str[2][0]); + + + #Clean-up by compare to former values +# foreach my $b (keys %$boards) { +# #if((!exists $allboards->{$b}) || ($boards->{$b} == $allboards->{$b})) { +# if(exists $allboards->{$b} && ($boards->{$b} == $allboards->{$b})) { +# $boards->{$b} = 0; +# } +# } + %laststore2 = %store2; - $allboards = $boards; + %$allboards = %$boards; sleep 1; + $seconds++; + my %temp_boards = %$boards; + push (@boards_history, \%temp_boards); + if ($seconds >10) { + shift @boards_history; + } } diff --git a/hmon/index.cgi b/hmon/index.cgi index 843603c..4eaeee6 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -31,8 +31,8 @@ function openwin(url) {

  • Tactical Overview (the central screen)
  • Logfile (most important messages)
  • Chat Log
  • -
  • Web Tools
  • -
  • Eventbuilder Monitor and control
  • +
  • Web Tools
  • +
  • Eventbuilder Monitor