# Modification of 8.Feb2022 P2S3 supplied by different HV channels, so taken out here:
our $MdcNominalHV = [[1750,1750,1750,1750,1750,1750],[1770,1790,0,1770,1770,1770],[1900,1900,1900,1900,1900,1900],[2150,2150,2150,2150,2150,2150]];
our $MdcHVOffsetLimits = [[5,10,255],[5,30,255],[5,10,255],[10,110,325]];
-our @EcalHvLimits = (493,325,320);
+our @EcalHvLimits = (1000,990,950);
our @RpcHvLimits = (12,12,12);
our @TofHvLimits = (764,760,759);
our @FwHvLimits = (280,250,200);
our $PadiwaEcalNumber = 126;
-our @PadiwaEcalLimits = (3, 5, 8);
+our @PadiwaEcalLimits = (0, 5, 8);
our $PadiwaItofNumber = 18;
our @PadiwaItofLimits = (0, 0, 0);
<h4>Error Handling</h4>
<ul>
<li>Do a DAQ restart.
-<li>If the same board shows an error after DAQ restart several times, do a power-cycle of the corresponding sector
+<li>If the same board shows an error directly after DAQ restart several times, do a power-cycle of the corresponding sector
<li>If this doesn't help, use "Reboot MdcHub" plus 2 DAQ restarts.
<li>If the missing boards include a hub (0x1___) and a restart doesn't help, a power cycle of MDC Hubs might be needed.
<li>If 14/16 boards show an error after a power-cycle, click "MDC LV Turn On ALL Relais". You can
+Monitor for the vacuum in the beam pipe and the status of the valve separating HADES from the accelerator.
+If the valve fails (closes) it will be a very good target for the beam - beam abort should might trigger.
+<p>Problems with the vacuum and the valve need to be solved manually inside the cave.
while(1) {
my $ret;
-# my $EPICS_data = Perl2Epics::GetAll();
- my $EPICS_data;
+ my $EPICS_data = Perl2Epics::GetAll(5);
+# my $EPICS_data;
# foreach my $a (@{$config{AdcTrb3sc}}) {
# $ret->[0] = measure($a,0);
close $fh;
- sleep 10;
+ sleep 5;
}
use POSIX qw(strftime);
my $fh;
-
+#set thresholds after every other spill
trb_init_ports() or die trb_strerror();
my $inspill;
while (1) {
system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds.pl");
-# system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_sec2_sec4.pl");
+ system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_sec2_sec4.pl");
sleep(15);
0x8700,0x8701,0x8702,
0x6700,0x6701,0x6702,0x6703,
0x6710,0x6711,0x6712,0x6713,
-0x6720,0x6721,0x6722,0x6723,
+0x6720,0x6722,0x6723, #0x6721
);
# 0x8910,0x3810,0x3811,
#Start TRB3sc
0x8880,
-# 0x5000,0x5001,0x5002,0x5003,0x5004,0x5005,0x5006,0x5007,
+ 0x5000,0x5001,0x5002,0x5003,0x5004, #0x5005,0x5006,0x5007,
#Hodo TRB3
# 0x8890,0x5010,0x5011, #0x5012,
#Trigger
$longtext .= "<br>Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 360;
- Hmon::Speak('mdcmissonce',"$num_mdc_missing MDC Frontends missing") if($qastate > 60 && $qastate < QA::ERROR );
- Hmon::Speak('mdcmiss',"$num_mdc_missing MDC Frontends missing") if($qastate >= QA::ERROR );
+ 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;
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 Tof, Rpc Frontends missing") if($qastate > 60);
+ Hmon::Speak('tofmiss',"$num_tof_missing toff, R-P-C frontends missing") if($qastate > 60);
QA::WriteQALog($flog,"endp","tof",$waittime,$qastate,
$tof_title,$tof_value,$tof_longtext);
if($qastate > 60) {
my @y = (0,
16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,12,12,12,12,12,12,12,12,12,12,14,14,14,14,14,14,14,14,14,14,16,16,16,16,18,18,18,18,20,20,20,20,22,22,22,22,24,24,24,24,26,26,26,26,28,28,28,28,28,28,28,28,28,28,30,30,30,30,30,30,30,30,30,30,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,8,8,8,8,8,8,8,8,8,8,8,12,12,12,12,12,12,16,16,16,16,16,16,20,20,20,20,20,20,24,24,24,24,24,24,28,28,28,28,28,28,32,32,32,32,32,32,32,32,32,32,32,36,36,36,36,36,36,36,36,36,36,36,40,40,40,40,40,40,40,40,40);
-my @bo = (0,0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6702, 0, 0, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0, 0, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6703, 0x6703, 0x6703, 0x6703, 0x6722, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6723, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6712, 0x6712, 0x6712, 0x6712, 0x6723, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0, 0, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0, 0, 0, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0, 0x6712, 0x6712, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0, 0, 0, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722);
+my @bo = (0,0x6700 ,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6723,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6720,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6702,0,0,0x6702,0x6720,0x6702,0x6720,0x6723,0x6723,0x6723,0x6702,0x6702,0x6702,0,0,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6703,0x6703,0x6703,0x6703,0x6722,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6723,0x6723,0x6723,0x6723,0x6703,0x6703,0x6703,0x6710,0x6710,0x6710,0x6710,0x6710,0x6723,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6712,0x6712,0x6712,0x6712,0x6723,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0,0,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0x6712,0x6712,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0,0,0,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0,0);
-my @ch = (0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 15, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 0, 1, 2, 3, 4, 30, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 1, 2, 3, 31, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 30, 31, 0, 1, 2, 3, 4, 5, 7, 9, 10, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 31, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 9, 10, 11, 12, 13, 14, 31);
+my @ch = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,30,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,24,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,0,0,2,31,4,30,13,14,15,9,10,11,0,0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,16, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,9,10,11,12,30,31,32,1,2,3,4,5,31,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,32,6,7,8,9,10,11,12,13,14,0,0,15,16,17,18,19,20,21,0,0,0,22,23,24,25,26,27,28,29,30,0,31,32,1,2,3,4,5,6,8,10,11,13,14,15,17,18,19,20,21,22,17,18,19,20,21,22,23,24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,32,0,1,2,3,4,5,6,7,8,9,0,0,0,10,11,12,13,14,15,32,0,0);
HPlot::PlotInit({
name => "FwRate",
file => "files/FwRateSimple",
title => "FW Rate",
entries => 32,
- curves => 15,
+ curves => 11,
type => HPlot::TYPE_HEATMAP,
output => HPlot::OUT_PNG,
zlabel => "Hitrate",
sizey => 310,
nokey => 1,
buffer => 1,
- ymin => 14.5,
+ ymin => 10.5,
ymax => -0.5,
xmin => -0.5,
xmax => 31.5,
if ($vdiff < 0) { $vdiff += 2**28;}
$diff->{$b}->[$v] = $vdiff/$tdiff;
- HPlot::PlotFill('FwRateSimple',$diff->{$b}->[$v],$v,($b%4)+((($b>>4)%4)*5));
+ HPlot::PlotFill('FwRateSimple',$diff->{$b}->[$v],$v,($b%4)+((($b>>4)%4)*4-($b>=0x6722?1:0)));
# my $val = $diff->{$b}->[$v];
next if ($i == 209 || $i == 210);
next if ($i == 218 || $i == 219 || $i == 220 || $i == 230);
next if ($i == 283 || $i == 293 || $i == 294 || $i == 295);
- my $val = $diff->{$bo[$i]}->[$ch[$i]];
+ my $val = $diff->{$bo[$i]}->[$ch[$i]-1];
# $val = $i; #TODO
HPlot::PlotFill('FwRate',$val,$x[$i], 43-$y[$i]);
if ($qastate > 60 && !($timecnt++ % 20)) {
# system("logger -p local1.info -t DAQ 'Hmon <E> Online QA Server not found'");
- Hmon::Speak("qa","QA server crashed.");
+ Hmon::Speak("qa","Q-A server crashed.");
$qastate = QA::WARN_2;
$timecnt = -4;
}
$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;
+ $r[3] = Dmon::PadiwaSendCmd(0x13 << 24,0xfe71,0) or sleep 1 and next;
+ $r[4] = Dmon::PadiwaSendCmd(0x13 << 24,0xfe71,1) or sleep 1 and next;
+ $r[5] = Dmon::PadiwaSendCmd(0x13 << 24,0xfe71,2) or sleep 1 and next;
my $min = 1000;
my $max = 0;
my $count = 0;
+ my $count_notemp = 0;
my @missing = ();
my $c = -1;
if (!defined $r[0] || $r[0] == -1 || scalar %{$r[0]} < 1) {sleep 10; next;}
- foreach my $r (@r) {
+ for (my $i = 0; $i < 3; $i++) {
$c++;
- foreach my $b (keys %{$r}) {
- last if $r->{$b} =~ /SPI/;
- my $t = ($r->{$b} & 0xfff)/16;
- $count++ unless $t > 90;
- push @missing, sprintf("%04x-%i ",$b,$c) if $t > 90;
+ foreach my $b (keys %{$r[$i]}) {
+ last if $r[$i]->{$b} =~ /SPI/;
+ my $t = ($r[$i]->{$b} & 0xfff)/16;
+ if ($t > 90 && ($r[$i+3]->{$b}&0xff) != 0x1c) {
+ push @missing, sprintf("%04x-%i ",$b,$c);
+ }
+ else {
+ $count++
+ }
# $missing .= sprintf("%04x-%i ",$b,$c) if $t > 90;
next if $t < 10 || $t > 90;
+ $count_notemp++;
$min = $t if $t < $min;
$max = $t if $t > $max;
}
my $tempStr = sprintf("%i-%i", $min, $max);
my $tempStr2;
if ($qastateTemp == QA::OK) {
- $tempStr2 = sprintf("<b>Temperature OK</b><br>");
+ $tempStr2 = sprintf("<b>Temperature OK</b> :");
}
else {
- $tempStr2 = sprintf("<b>Temperature Bad</b><br>");
+ $tempStr2 = sprintf("<b>Temperature Bad</b> :");
}
my $nofStr = sprintf("%i/%i",$count,$QA::PadiwaEcalNumber);
$worstQaState = QA::OK;
}
- QA::WriteQALog($fqa,"misc2","ecal", 45, $worstQaState, "ECAL", $nofStr . " | " . $tempStr,
- $tempStr2. "Temperature in ECAL " . $tempStr . "°C.<br>" . $nofStr2 . $nofStr . " PADIWAs<br>" . " Missing are: " . $missing_str);
+ QA::WriteQALog($fqa,"misc2","ecal", 45, $worstQaState, "ECal Padiwa", $nofStr . " | " . $tempStr,
+ $tempStr2 . $tempStr . "°C.<br>" . $nofStr2 . $nofStr . " PADIWAs<br>" . " Missing are: " . $missing_str."<br>No temperature from ".($count-$count_notemp)." boards");
sleep(10);
}
if (isFeeHub($h)) {
for (my $i=0; $i<12; $i++) {
if ($rh_hubs->{$h} & (1<<$i)) {
- $boardlist .= sprintf("%04x (%04x-%i), ",Hmon::TraceDBGet($h,$i-1),$h,($i-1));#
+ my $failedboard = Hmon::TraceDBGet($h,$i-1);
+ $boardlist .= sprintf("%04x (%s %04x-%i), ",$failedboard,Hmon::getsystem($failedboard),$h,($i-1));#
}
}
}
if ($max > $interlockTemperature ) {
my $s = sprintf("HAD:RICH:PS:17:SETONOFF");
+ my $s2 = sprintf("HAD:RICH:PS:poweroff.PROC");
Perl2Epics::Connect("PS_RICH_3_3V",$s);
- Perl2Epics::Put("PS_RICH_3_3V",0);
+ Perl2Epics::Put("PS_RICH_3_3V","OFF");
+ Perl2Epics::Connect("PS_RICH_LV",$s2);
+ Perl2Epics::Put("PS_RICH_LV",1);
+ Perl2Epics::Update(1);
$InterlockActive = "Shutting down RICH ...";
}
name => "StartRateSimple",
file => "files/StartRateSimple",
title => "Start Rate",
- entries => 16,
- curves => 32,
+ entries => 8,
+ curves => 8,
type => HPlot::TYPE_HEATMAP,
output => HPlot::OUT_PNG,
zlabel => "Hitrate",
sizey => 310,
nokey => 1,
buffer => 1,
- ymin => 31.5,
+ ymin => 7.5,
ymax => -0.5,
xmin => -0.5,
- xmax => 15.5,
+ xmax => 7.5,
cbmax => "100<*<1E8",
cbmin => 0,
noinit => 1,
#my $max = 0 ;
#my $min = 5E9;
- my $current = trb_register_read_mem(0xfe76,0xdfc0,0,48) or die trb_strerror() or sleep 5 and next;
+ my $current = trb_register_read_mem(0xfe58,0xc001,0,8) or die trb_strerror() or sleep 5 and next;
#print Dumper $o;
if (defined $old) {
next unless ($endpoint>=0x5000 && $endpoint<=0x5007);
my $fpga = ($endpoint&0xF);
- for my $channel_nr (0..23) {
+ for my $channel_nr (0..7) {
my $vdiff = ($current->{$endpoint}->[$channel_nr] & 0xfffffff) - ($old->{$endpoint}->[$channel_nr]&0xfffffff);
if ($vdiff < 0) {
$diff->{$endpoint}->[$channel_nr] = $vdiff/$tdiff;
#$ratesum += $diff->{$endpoint}->[$channel_nr+1];
#HPlot::PlotFill('StartRateSimple',$diff->{$endpoint}->[$channel_nr],$channel_nr,);
- HPlot::PlotFill('StartRateSimple',$diff->{$endpoint}->[$channel_nr],$channel_nr%16,$fpga*4+$channel_nr/16);
+ HPlot::PlotFill('StartRateSimple',$diff->{$endpoint}->[$channel_nr],$channel_nr,$fpga);
# my $ypos = 0;
# my $side = 0;
$msg .= sprintf("%04x-%04x (",$board,$rh_hubs->{$board} & 0xffff);
foreach my $i (1..12) {
if ($rh_hubs->{$board} & (1<<$i)) {
- $msg .= sprintf("0x%04x ",Hmon::TraceDBGet($board,$i));
- $boardlist1 .= sprintf("%04X, ",Hmon::TraceDBGet($board,$i));
+ my $failedboard = Hmon::TraceDBGet($board,$i);
+ $msg .= sprintf("0x%04x ",$failedboard,Hmon::getsystem($failedboard));
+ $boardlist1 .= sprintf("%04X, ",$failedboard);
$cnt++;
}
}
$msg2 .= sprintf("%04x-%04x (",$board,$rh_hubs->{$board}>>16 & 0xffff);
foreach my $i (1..12) {
if ($rh_hubs->{$board} & (1<<($i+16))) {
- $msg2 .= sprintf(" %04x",Hmon::TraceDBGet($board,$i));
+ my $failedboard = Hmon::TraceDBGet($board,$i);
+ $msg2 .= sprintf("%04x %s",$failedboard,Hmon::getsystem($failedboard));
if (!( (((Hmon::TraceDBGet($board,$i)) >>12) == 2) || (((Hmon::TraceDBGet($board,$i)) >>12) == 7))) {
# MDC or RICH board
# } else {
$MDCRICH_fail++;
}
$cnt2++;
- $boardlist2 .= sprintf("%04X, ",Hmon::TraceDBGet($board,$i));
+ $boardlist2 .= sprintf("%04X, ",$failedboard);
}
}
$msg2 .= " )";
if($boardlist1 ne "") {
Hmon::Speak('timeout'.(($qastate<QA::ERROR)?'once':''),"$cnt Frontend had a timeout: $boardlist1 ") if $cnt < 3;
- Hmon::Speak('timeout',"$cnt Frontend had a timeout ") if $cnt >= 3;
+ Hmon::Speak('timeout',"$cnt Frontends had a timeout ") if $cnt >= 3;
}
if($boardlist2 ne "" && $boardlist1 eq "" ) {
Hmon::Speak("timeout".(($qastate<QA::ERROR)?'once':''),"$cnt2 Frontend disabled after a timeout: $boardlist2") if $cnt2 < 3;
- Hmon::Speak('timeout',"$cnt2 Frontend had a timeout ") if $cnt2 >= 3;
+ Hmon::Speak('timeout',"$cnt2 Frontends had a timeout ") if $cnt2 >= 3;
}
QA::WriteQALog($fqa, "daq", "timeouts", 20, $qastate, "Timeouts",
while (1) {
my $tb = trb_registertime_read_mem(0x10,0x9000,0,224);
- my $st = trb_registertime_read_mem(0xfe76,0xdfc0,0,24);
+ my $st = trb_registertime_read_mem(0xfe58,0xc001,0,8);
my $inspill = $tb->{0x10}{value}[0x5d] >> 31;
print "Content-type: text/html\r\n\r\n";
+#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
print qq$
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Monitoring Main Control Interface</title>
<div class="linkbox" style="float:right"><h4>Documents</h4><ul>
<li><a href="https://hessenbox-a10.rz.uni-frankfurt.de/getlink/fiFyuhGJXrwV1dPs5RebuW/HadesOperatorManual.pdf" style="color:#d33">Operator manual</a>
<li><a href="https://hessenbox-a10.rz.uni-frankfurt.de/getlink/fiRhk3zAKorCqtPgXk7hpa/">Document Repository</a>
-<li><a href="https://jspc29.x-matter.uni-frankfurt.de/docu/networkaddresses.pdf">DAQ FEE Addresses</a>
-<li><a href="phonenumbers.jpg">Phone Numbers</a>
+<li><a href="https://hessenbox-a10.rz.uni-frankfurt.de/getlink/fiHTFzB5jN8CgPNMjvzn83/networkaddresses.pdf">DAQ FEE Addresses</a>
+<li><a href="https://hessenbox-a10.rz.uni-frankfurt.de/getlink/fiGgg6c7AhGjD2rnVAxfD7/PhoneNumbers.jpg">Phone Numbers</a>
<li><a href="https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection">Beamtime Logbook</a></li>
<li><a href="https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.form_select">Shift Crew</a></li>
<li class="outdated"><a href="https://jspc29.x-matter.uni-frankfurt.de/docu/qadocu.pdf">QA manual</a>
<li style="width:600px;"><a href="monitor.cgi?1-window8x26-busy-DutyFactor-Pt3AcceptRatio-EvtsPerSpill-StartCountSpill">Main Screen 2</a> Spill Info
<li style="width:600px;"><a href="monitor.cgi?1-window14x8-EBSummary-hldlast">Main Screen 3</a> EBs</li>
<!--<li style="width:600px;"><a href="monitor.cgi?2-window19x16-EcalSimpleRate-RpcRate-StsRate-TofRate-ItofRate-StartRateSimple-FrpcRate">Main Screen 4</a> Tof Rpc STS Ecal iTOF fRPC Start rates</li>-->
-<li style="width:600px;"><a href="monitor.cgi?2-window13x16-EcalSimpleRate-RpcRate-TofRate-StartRateSimple-FwRateSimple">Main Screen 4</a> Tof Rpc FW Ecal Start rates</li>
-<li style="width:600px;"><a href="monitor.cgi?2-window13x23-StartFalls-ItofRateNumbers-TriggerRatesPerSector-CTSRates">Main Screen 5</a> Positional map for Start and iTOF, Trigger Rates</li>
+<li style="width:600px;"><a href="monitor.cgi?2-window12x16-EcalSimpleRate-RpcRate-TofRate-StartRateSimple-FwRateSimple">Main Screen 4</a> Tof Rpc FW Ecal Start rates</li>
+<li style="width:600px;"><a href="monitor.cgi?2-window12x21-StartFalls-ItofRateNumbers-TriggerRatesPerSector-CTSRates">Main Screen 5</a> Positional map for Start and iTOF, Trigger Rates</li>
<li class="outdated" style="width:600px;"><a href="monitor.cgi?2-window12x21-RpcTofSectorRate_highres-StartRateX_histbar-StartRateY_histbar">Main Screen 6</a> Beam Intensities</li>
</ul></div>
<div class="linkbox" style="clear:both;width:730px;"><h4>Other Ressources</h4><ul>
-<li class="outdated"><a href="/qaweb">QA Plots (web-based)</a>
-<li class="outdated"><a href="files/qa.htm">QA Plots (updated every 5 minutes)</a></li>
-<li class="outdated"><a href="files/vertex.htm">Vertex Plots (updated after each file)</a></li>
+<li><a href="/qaweb/?layout=tabs&monitoring=2000" target="_blank">QA Plots (web-based)</a>
+<li><a href="files/qa.htm">QA Plots (updated every 5 minutes)</a></li>
+<li><a href="files/vertex.htm">Vertex Plots (updated after each file)</a></li>
<!--<li class="outdated"><a href="../spillmon/?browser=no&monitoring=1000&layout=grid4x4&items=[%22EventBuilder/Run/HLD/HLD_HitsFast%22,%22EventBuilder/Run/HLD/HLD_HitsSlow%22,%22EventBuilder/Run/HLD/HLD_TrendX%22,%22EventBuilder/Run/HLD/HLD_TrendY%22,%22EventBuilder/Run/HLD/HLD_BeamX%22,%22EventBuilder/Run/HLD/HLD_BeamY%22,%22EventBuilder/Run/HLD/HLD_VETO_Patt%22,%22EventBuilder/Run/HLD/HLD_QSlow%22,%22EventBuilder/Run/HLD/HLD_HALO_Patt%22,%22EventBuilder/Run/HLD/HLD_XHALOSlow%22,%22EventBuilder/Run/HLD/HLD_YHALOSlow%22,%22EventBuilder/Run/HLD/HLD_LastSpill_Q_factor%22]">Beam Properties</a></li>-->
<!-- <li class="outdated"><a href="http://lxhadeb06/icinga">Icinga Server Monitoring (local access only)</a> -->
<!--<li class="outdated"><a href="http://hades63/icingaweb2/dashboard">Icinga Server Monitoring (local access only)</a>-->
<div class="linkbox" style="clear:both"><h4>DAQ Network</h4><ul>
+<li><a href="monitor.cgi?1-window-busy">Busy times (current)</a></li>
+<li><a href="monitor.cgi?2-window-busyhist">Busy times (last 25 seconds)</a></li>
+<li><a href="monitor.cgi?1-window-eventrateshort">Eventrate (10 seconds)</a></li>
+<li><a href="monitor.cgi?1-window-eventrate">Eventrate (1 minute)</a></li>
+<li><a href="monitor.cgi?5-window-eventratelong">Eventrate (10 minutes)</a></li>
+<li><a href="monitor.cgi?2-window-GbeRate">Data rate (current)</a></li>
+<li><a href="monitor.cgi?2-window-datarate">Data rate (last minutes)</a></li>
<li><a href="monitor.cgi?1-window-hubmon">Hub Monitor</a></li>
-<li><a href="monitor.cgi?1-window-busy">Busy times of subsystems</a></li>
-<li><a href="monitor.cgi?2-window-busyhist">Histogram of busy times</a></li>
-<li><a href="monitor.cgi?2-window-GbeRate">Data amount on GbE</a></li>
-<li><a href="monitor.cgi?2-window-datarate">Data rate histogram</a></li>
</ul></div>
<div class="linkbox" style="float:right"><h4>Trigger</h4><ul>
<li><a href="monitor.cgi?1-window-CTSRates">Rates on CTS Trigger I/O</a></li>
-<li><a href="monitor.cgi?1-window-Triggerbox">Trigger rates by sector and detector</a></li>
-<li><a href="monitor.cgi?1-window-eventrateshort">Eventrate histogram (10s)</a></li>
-<li><a href="monitor.cgi?1-window-eventrate">Eventrate histogram (60s)</a></li>
-<li><a href="monitor.cgi?5-window-eventratelong">Eventrate histogram (10m)</a></li>
-<li class="outdated"><a href="monitor.cgi?10-window-StartCountSpill">Start counts per spill</a></li>
+<li class="outdated"><a href="monitor.cgi?1-window-Triggerbox">Trigger rates by sector and detector</a></li>
<li><a href="monitor.cgi?10-window-Pt3AcceptRatio">Ratio of accepted PT3 per spill</a></li>
<li><a href="monitor.cgi?10-window-EvtsPerSpill">Recorded events per spill</a></li>
<!--<li><a href="monitor.cgi?5-window-Vetohist">Veto hit count histograms</a></li>-->
<li><a href="monitor.cgi?5-window-Muxhist">CTS mux output histograms</a></li>
<li><a href="monitor.cgi?5-window-CtsMuxRatio">CTS mux output ratio histo.</a></li>
+<li><a href="/daqtools/network/triggerbox.pl">Triggerbox</a></li>
+</ul></div>
+
+<div class="linkbox" style="float:right"><h4>Beam</h4><ul>
+<li class="outdated"><a href="monitor.cgi?10-window-StartCountSpill">Start counts per spill</a></li>
+<li><a href="monitor.cgi?2-window13x21-QFactor-MicroSpillStructure">QFactor & Micro Structure</a></li>
+<li><a href="monitor.cgi?1-StartRateNumbers-StartPosition-ItofRateNumbers-StartPositionRMS-HodoRate-QFactor-CTSRates-MicroSpillStructure-StartSpillShapeAnalysisY_0">Beam plots collection similar to HKR</a></li>
+<li><a href="/daqtools/tools/beamabort.pl">Beam Abort</a></li>
+<li><a href="/spillmonitor/tools/spillmonitor.pl">Spill Monitor Control</a></li>
</ul></div>
<!-- <div class="linkbox" style="float:right"><h4>Pion</h4><ul>
<!-- <li class="outdated"><a href="monitor.cgi?1-StartRateBars-StartBars-StartPosition-VetoHalo-ForwardQuartz">Beam Summary</a></li> -->
</ul></div>
-<div class="linkbox" style="float:right"><h4>ECal</h4><ul>
-<li><a href="monitor.cgi?1-window-ECalRate">Rate Summary for ECal</a></li>
-<li><a href="ecal_drawing.htm#ecalrate_slow">Rate for ECal</a></li>
-<li><a href="monitor.cgi?2-window-EcalHVVMap">ECAL HV Voltage Map</a></li>
-<li><a href="monitor.cgi?2-window-EcalHVCMap">ECAL HV Current Map</a></li>
+<div class="linkbox" style="float:left"><h4>ECal</h4><ul>
+<li><a href="monitor.cgi?1-window-ECalRate">Rate Summary</a></li>
+<li><a href="ecal_drawing.htm#ecalrate_slow">Rates / Threshold Map</a></li>
+<li><a href="monitor.cgi?2-window-EcalHVVMap">HV Voltage Map</a></li>
+<li><a href="monitor.cgi?2-window-EcalHVCMap">HV Current Map</a></li>
</ul></div>
-<div class="linkbox" style="float:left"><h4>RICH</h4><ul>
+<div class="linkbox" style="float:right"><h4>RICH</h4><ul>
+<li><a target="_blank" href="monitor.cgi?2-RichRatev2">Rates</a></li>
+<li><a target="_blank" href="rich_drawing_2.htm#custom-0xfe51-0xc001-0-30-0.03125-ratesum32">Mean rate per DiRICH</a></li>
<li><a target="_blank" href="rich_drawing_2.htm#richTemperature">Temperature</a></li>
<li><a target="_blank" href="rich_drawing_bkpl.htm#richTemperatureBackplane">Temperature Backplane</a></li>
<li><a target="_blank" href="monitor.cgi?10-window-RichTempHistoDiRICH">Temperature Backplane Histo</a></li>
<li><a target="_blank" href="rich_drawing_2.htm#rich2V5">DiRich 2.5V</a></li>
<li><a target="_blank" href="monitor.cgi?10-richvolt">Voltage & Current</a></li>
<li><a target="_blank" href="monitor.cgi?2-window-RichHV">High Voltage</a></li>
-<li><a target="_blank" href="monitor.cgi?2-RichRatev2">Rates on all channels</a></li>
-<li><a target="_blank" href="rich_drawing_2.htm#custom-0xfe51-0xc001-0-30-0.03125-ratesum32">Mean rate per DiRICH</a></li>
<li><a target="_blank" href="monitor.cgi?10-window-RichMagnet">Rich Inner Magnet fields</a></li>
<li><a target="_blank" href="monitor.cgi?10-window-RichInnerTemp">Rich Inner Temperatures</a></li>
<li><a target="_blank" href="monitor.cgi?10-window-RichGas">Rich Gas Information</a></li>
</ul></div>
-<div class="linkbox" style="float:right"><h4>MDC</h4><ul>
+<div class="linkbox" style="float:left"><h4>MDC</h4><ul>
<li><a href="monitor.cgi?10-MDCRates-MDCBusy-MDCTemperature-MDCRetransmission-MDCTriggerError-MDCTokenMiss">MDC Overview</a></li>
<li><a href="monitor.cgi?1-window-MDCHV">HV settings</a></li>
-<li><a href="monitor.cgi?15-window-mdchvV0-mdchvV1-mdchvV2-mdchvV3">HV voltage trend plots</a></li>
-<li><a href="monitor.cgi?15-window-mdchvC0-mdchvC1-mdchvC2-mdchvC3">HV current trend plots</a></li>
+<li><a href="monitor.cgi?15-window18x21-mdchvV0-mdchvV1-mdchvV2-mdchvV3">HV voltage trend plots</a></li>
+<li><a href="monitor.cgi?15-window18x21-mdchvC0-mdchvC1-mdchvC2-mdchvC3">HV current trend plots</a></li>
<li><a href="monitor.cgi?2-window-MDCBusy">Busy Times</a></li>
<li><a href="monitor.cgi?2-window-MDCRates">Data Rates</a></li>
<li><a href="monitor.cgi?2-window-MDCTokenMiss">Missing Tokens</a></li>
-<div class="linkbox" style="float:left"><h4>Eventbuilder</h4><ul>
-<li><a href="monitor.cgi?30-window-EBDisks">Fill-level of disks</a></li>
-<li><a href="monitor.cgi?10-window-EBCPU">Server CPU load</a></li>
-<li><a href="monitor.cgi?10-window-hldlast">Last hld files written</a></li>
-<li><a href="/calib">Calibration Monitor </a>
-<li><a href="monitor.cgi?60-window-TdcCalMon">Calibration Test Plots</a></li>
-</ul></div>
-
-
-<div class="linkbox" style="float:right"><h4>Trigger</h4><ul>
-<li><a href="/daqtools/network/triggerbox.pl">Triggerbox</a></li>
-<li><a href="/daqtools/tools/beamabort.pl">Beam Abort</a></li>
-</ul></div>
-<div class="linkbox" style="float:left"><h4>Wall</h4><ul>
-<li><a href="monitor.cgi?2-window-FwRates">Forward Wall Rates</a></li>
-<li><a href="monitor.cgi?10-window-FwHV">Forward Wall HV</a></li>
-<li><a href="monitor.cgi?10-window-FwHVCurrent">Forward Wall HV Currents</a></li>
+<div class="linkbox" style="float:right"><h4>Wall</h4><ul>
+<li><a href="monitor.cgi?2-window-FwRates">FW Rates</a></li>
+<li><a href="monitor.cgi?10-window-FwHV">FW HV Voltage</a></li>
+<li><a href="monitor.cgi?10-window-FwHVCurrent">FW HV Current</a></li>
</ul></div>
-<div class="linkbox" style="float:right"><h4>Beam</h4><ul>
-<li><a href="monitor.cgi?2-window13x21-QFactor-MicroSpillStructure">QFactor & Micro Structure</a></li>
-<li><a href="monitor.cgi?2-window-StarX_spill">Spill Macro Structure</a></li>
-<li><a href="monitor.cgi?1-StartRateNumbers-StartPosition-ItofRateNumbers-StartPositionRMS-HodoRate-QFactor-CTSRates-MicroSpillStructure-StartSpillShapeAnalysisY_0">Beam plots collection similar to HKR</a></li>
-</ul></div>
-<div class="linkbox" style="float:left"><h4>Environment</h4><ul>
+<div class="linkbox" style="float:right"><h4>Environment</h4><ul>
<li><a href="monitor.cgi?2-window-CaveTemp">Cave and Cooling Temperature</a></li>
<li><a href="monitor.cgi?2-window-Environment">Temperature, Humidity and Pressure</a></li>
</ul></div>
+<div class="linkbox" style="float:left"><h4>Eventbuilder</h4><ul>
+<li><a href="monitor.cgi?30-window-EBDisks">Fill-level of disks</a></li>
+<li><a href="monitor.cgi?10-window-EBCPU">Server CPU load</a></li>
+<!--<li><a href="monitor.cgi?10-window-hldlast">Last hld files written</a></li>-->
+<li><a href="/calib">Calibration Monitor </a>
+<li><a href="monitor.cgi?60-window-TdcCalMon">Calibration Test Plots</a></li>
+</ul></div>
+
$;
print "<h3 style=\"clear:both;padding-top:30px;\">All available options</h3><ul class=\"optionlist\">\n";
+print "<p>Please prefer the links above, use this only if there is no proper link in the lists above.";
my @o = qx(ls -1 files/*.htt);
foreach my $a (@o) {
if ($a =~ m%files/(\w+).htt%) {
$newurl =~ /(-|^|\?)(\w+)$/;
my $width; my $height;
- print $geom;
+ #print $geom;
if($geom && $geom ne '' && $geom =~ /(\d+)x(\d+)/) {
$width = 80*$1-8;
$height = 50*$2-8;
my $str = <$MYF>;
close($MYF);
$str =~ /width(\d+)\sheight(\d+)/;
- $width = 80*$1-6;
+ $width = 80*$1-4;
$height = 50*$2+2;
}
- $out = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+# $out = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+$out = qq$<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
-<title>Hmon</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
+<title>Hmon</title>
<link href="files/styles.css" rel="stylesheet" type="text/css"/>
<link rel="alternate stylesheet" href="files/styles-lcars.css" type="text/css" title="LCARS"/>
</head>
-<body >
+<body>
<script type="text/javascript">
document.write("Opening Window...<br>");
- win = window.open("$.$newurl.qq$","Hmon$.$newurl.qq$","name=Hmon,innerwidth=$.$width.qq$,innerheight=$.$height.qq$,scrollbars=no,status=no,location=no,menubar=no,resizable=no,titlebar=no,dialog=no");
+ win = window.open("$.$newurl.qq$","Hmon$.$newurl.qq$","name=Hmon,innerWidth=$.$width.qq$,innerHeight=$.$height.qq$,scrollbars=no,status=no,location=no,menubar=no,resizable=no,titlebar=no,dialog=no");
if(win) {
win.focus();
win.document.title="Hmon $.$newurl.qq#";
} else {
- $out = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+# $out = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+$out = qq$<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class="monitor">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!--<meta http-equiv="refresh" content="$.$delay.qq$"/> -->
blinking = setInterval("blink()",490);
currentzoom = 1;
-function zoom() {
+/*function zoom() {
var zoomstep = 1.5;
if (currentzoom == 1) {
currentzoom = 1.5;
window.innerHeight/= zoomstep;
document.getElementById("big").innerHTML = "bigger";
}
- }
+ }*/
function reload() {
xmlhttp=new XMLHttpRequest();
if(!document.getElementById("footer") && !document.getElementById('logbox')) {
document.getElementById("content").style.opacity="0";
document.getElementById("content").innerHTML=xmlhttp.responseText;
+ //document.getElementById('content').style.transform="scale("+myscale+","+myscale+")";
setTimeout('document.getElementById("content").style.opacity="1"',100);
setTimeout('document.getElementById("contentback").innerHTML=document.getElementById("content").innerHTML',200);
}
blinkcnt++;
}
+/*var myscale =1 ;
+function resize() {
+ if (document.getElementById('content').scrollWidth*myscale > window.innerWidth ||
+ document.getElementById('content').scrollHeight*myscale > window.innerHeight) {
+ myscale = myscale*0.9;
+ document.getElementById('content').style.transform="scale("+myscale+","+myscale+")";
+ //document.getElementById('contentback').style.transform="scale("+myscale+","+myscale+")";
+ }
+ if (document.getElementById('content').scrollWidth*myscale < window.innerWidth*0.9 ||
+ document.getElementById('content').scrollHeight*myscale < window.innerHeight*0.9) {
+ myscale = myscale/0.9;
+ document.getElementById('content').style.transform="scale("+myscale+","+myscale+")";
+ //document.getElementById('contentback').style.transform="scale("+myscale+","+myscale+")";
+ }
+ console.log(myscale);
+ console.log(document.getElementById('content').scrollWidth, document.getElementById('content').scrollHeight );
+ }
+
+setInterval("resize()",1000);*/
+
</script>$;
}
$out .= qq$
use POSIX qw/floor ceil/;
use Hmon;
use QA;
-use Perl2Epics;
+use Perl2Epics2;
+#JAM 22-nov-23- use local perl2epics installation on hades33 instead of lxhadesdaq installation
my $fqa = QA::OpenQAFile();
my @res;
my @oldres= ("R22222222 #20", "R22222222 #21", "R22222222 #30", "R22222222 #22");
-my $cmd = 'ssh hadaq@hadeswrp02 "~/bin/readreg.sh"';
+#my $cmd = 'ssh hadaq@hadeswrp02 "~/bin/readreg.sh"';
+# JAM 22-11-23: enable above line if spare machine is used
+my $cmd = 'ssh hadaq@hadeswrp01 "~/bin/readreg.sh"';
my $longtext;
my $value = "";
my $qastate;
my $laststate = QA::ERROR;
my $iterator = 0;
-Perl2Epics::Connect("fpga", "HAD:BEAM:beamAbort:status:FPGA");
-Perl2Epics::Connect("soft", "HAD:BEAM:beamAbort:status:soft");
-Perl2Epics::Connect("hard", "HAD:BEAM:beamAbort:status:hard");
-Perl2Epics::Connect("latch", "HAD:BEAM:beamAbort:status:latch");
-Perl2Epics::Connect("iterator", "HAD:BEAM:beamAbort:status:filler");
+Perl2Epics2::Connect("fpga", "HAD:BEAM:beamAbort:status:FPGA");
+Perl2Epics2::Connect("soft", "HAD:BEAM:beamAbort:status:soft");
+Perl2Epics2::Connect("hard", "HAD:BEAM:beamAbort:status:hard");
+Perl2Epics2::Connect("latch", "HAD:BEAM:beamAbort:status:latch");
+Perl2Epics2::Connect("iterator", "HAD:BEAM:beamAbort:status:filler");
while (1) {
$longtext .= "none" if (substr($res[3],3,1) ne "1");
$longtext .= "ABORTED" if (substr($res[3],3,1) eq "1");
- $value = "inactive" if $longtext =~ /inactive/;
$value = "ABORT" if $longtext =~ /ABORT/;
$value = "ABORTED" if $longtext =~ /ABORTED/;
+ $value = "inactive" if $longtext =~ /inactive/;
$qastate = QA::WARN if $longtext =~ /inactive/;
- $qastate = QA::WARN_2 if $longtext =~ /Soft\sOverride:\sinactive/;
$qastate = QA::FATAL if $longtext =~ /ABORT/;
$qastate = QA::ERROR if $longtext =~ /ABORTED/;
+ $qastate = QA::WARN_2 if $longtext =~ /Soft\sOverride:\sinactive/;
# EPICS part
# || substr($res[3],3,1) ne substr($oldres[3],3,1)
# ) {
# print substr($res[0],5,2)." ".substr($res[2],7,2)." ".substr($res[0],7,2)." ".substr($res[3],3,1);
- Perl2Epics::Put("fpga",0) if substr($res[0],5,2) eq "11";
- Perl2Epics::Put("fpga",1) if substr($res[0],5,2) eq "01" || substr($res[0],5,2) eq "10";
- Perl2Epics::Put("fpga",2) if substr($res[0],5,2) eq "00";
+ Perl2Epics2::Put("fpga",0) if substr($res[0],5,2) eq "11";
+ Perl2Epics2::Put("fpga",1) if substr($res[0],5,2) eq "01" || substr($res[0],5,2) eq "10";
+ Perl2Epics2::Put("fpga",2) if substr($res[0],5,2) eq "00";
- Perl2Epics::Put("soft",0) if substr($res[2],7,2) eq "10";
- Perl2Epics::Put("soft",1) if substr($res[2],7,2) eq "00";
- Perl2Epics::Put("soft",2) if substr($res[2],8,1) eq "1";
+ Perl2Epics2::Put("soft",0) if substr($res[2],7,2) eq "10";
+ Perl2Epics2::Put("soft",1) if substr($res[2],7,2) eq "00";
+ Perl2Epics2::Put("soft",2) if substr($res[2],8,1) eq "1";
- Perl2Epics::Put("hard",0) if substr($res[0],7,2) eq "10";
- Perl2Epics::Put("hard",1) if substr($res[0],7,2) eq "00";
- Perl2Epics::Put("hard",2) if substr($res[0],8,1) eq "1";
+ Perl2Epics2::Put("hard",0) if substr($res[0],7,2) eq "10";
+ Perl2Epics2::Put("hard",1) if substr($res[0],7,2) eq "00";
+ Perl2Epics2::Put("hard",2) if substr($res[0],8,1) eq "1";
- Perl2Epics::Put("latch",1) if substr($res[3],3,1) ne "1";
- Perl2Epics::Put("latch",2) if substr($res[3],3,1) eq "1";
- Perl2Epics::Update(0.2);
+ Perl2Epics2::Put("latch",1) if substr($res[3],3,1) ne "1";
+ Perl2Epics2::Put("latch",2) if substr($res[3],3,1) eq "1";
+ Perl2Epics2::Update(0.2);
# }
}
if($iterator == 1) {
- my $curr_it = Perl2Epics::Get("iterator");
- Perl2Epics::Put("iterator",$curr_it+1);
+ my $curr_it = Perl2Epics2::Get("iterator");
+ Perl2Epics2::Put("iterator",$curr_it+1);
$iterator = 0;
}
xlabel => "Minutes",
ylabel => "Temperature / °C",
sizex => 950,
- sizey => 360,
- ymin => "15",
- ymax => "25<*",
+ sizey => 340,
+ # ymin => "15",
+ ymax => "25<*<35",
curves => 3,
xscale => 60/10,
storable=> 1,
xlabel => "Hours",
ylabel => "Temperature / °C",
sizex => 950,
- sizey => 360,
- ymin => "15",
- ymax => "25<*",
+ sizey => 340,
+ # ymin => "15",
+ ymax => "25<*<35",
curves => 3,
xscale => 60,
storable=> 1,
# JAM 6.1.2020 - for the moment exlude hosts depcp418 and lxhaddcs03 not available
# MT 2022.02.09 - all to internal HADES-VLAN CPU-names
-my @srv = qw( lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb14p lxhadeb15p lxhadeb16p lxhadeb17p lxhadeb18p lxhadesdaqp lxhadeb13p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p hadesdaqp03 hadesdaqp04 hadesp30 hadesp57 hadesp31 hadesp33 hadesp63 hadesp66 hadesp70);
+my @srv = qw( lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb14p lxhadeb15p lxhadeb16p lxhadeb17p lxhadeb18p lxhadesdaqp lxhadeb13p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p hadesdaqp03 hadesdaqp04 hadesp57 hadesp31 hadesp33 hadesp63 hadesp66 hadesp67 hadesp69 hadesp70);
my $template .= "\n<table class=\"colorfields cpu\">\n<tr><th>";
for(my $d=1;$d<=32;$d++) {
$laststore = clone($store);
$store = {};
for(my $n=0;$n< scalar @srv;$n++) {
- print "$srv[$n]\n";
- my @out = Hmon::qxtimeout("ssh $srv[$n] \"cat /proc/stat \" </dev/null",10);
+ #print "$srv[$n]\n";
+ my @out;
+ if($srv[$n] eq 'lxhadeb13p') {
+ @out = Hmon::qxtimeout("ssh hades-qa\@$srv[$n] \"cat /proc/stat \" </dev/null",10);
+ }
+ else {
+ @out = Hmon::qxtimeout("ssh hadaq\@$srv[$n] \"cat /proc/stat \" </dev/null",10);
+ }
foreach my $a (@out) {
if($a =~ /cpu(\d+)/) {
my @s = split(/\s/,$a);
my $maxstr = "";
my $busystr = "";
if (defined $laststore->{0}->{0}->{'idle'}) {
- $str = Hmon::MakeTitle(9,14,"Server CPU Usage");
+ $str = Hmon::MakeTitle(9,15,"Server CPU Usage");
$str .= $template;
for(my $s = 0; $s < scalar @srv; $s++) {
$str .= "\n<tr><th class=\"title\">$srv[$s]";
if ($opt_debug<1) {
- Hmon::Speak('ebrun',"Eventbuilder Error") if $qastate > 60;
+ Hmon::Speak('ebrun',"Event builder Error") if $qastate > 60;
QA::WriteQALog($fqa, "eb", "run", 10, $qastate, $qatitle,
"i:$num_act_ins, b:$num_act_build ($prefix)", $qamsg);
} else {
if($speak_counter>20)
{
$speak_counter=-20;
- Hmon::Speak('ebfiles', "event builders do not write files to disk.") unless $opt_debug>0 ||($masterstate =~ /NoNodes/);
+ Hmon::Speak('ebfiles', "Event building not writing files to disk.") unless $opt_debug>0 ||($masterstate =~ /NoNodes/);
print "No files are written by eventbuilders.\n" unless $opt_debug<1;
}
}
my $str;
while (1) {
$maxqa = 0;
- $str = Hmon::MakeTitle(8,6,"Eventbuilder Disk Fill Level");
+ $str = Hmon::MakeTitle(2,6,"Eventbuilder Disk Fill Level");
$str .= "<table class=\"colorfields\">\n<tr><th>";
- for (my $d=1;$d<=15;$d++) {
+ for (my $d=1;$d<=1;$d++) {
$str .= "<th>$d";
}
for (my $n=8;$n<=18;$n++) {
}
}
$str .= "\n<tr><th> $hostn";
- for (my $d=1;$d<=15;$d++) {
+ for (my $d=1;$d<=1;$d++) {
my $id = $d;
$id = '0'.$d if $d<10;
$store->{$n}->{$id} = 0 unless exists $store->{$n}->{$id};
my $flog = QA::OpenQAFile();
my @colors = ("#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd");
-my $TOTALCHANS = 815;
+my $TOTALCHANS = 1008;
for my $i (0..5) {
HPlot::PlotInit( {
my $min_i = -1E5;
my $max_i = 1E5;
my $ChnlsOn = 0;
- my $data = Perl2Epics::GetAll();
+ my $data = Perl2Epics::GetAll(3);
for(my $i = 0; $i <=5; $i++) {
for(my $j = 0; $j<=167; $j++) {
}
}
- usleep(2500000);
+# usleep(2500000);
}
$longtext .= "<br>".$str;
$qastate = QA::GetQAState('above', $ChnlsOn, @QA::FwHvLimits);
- if ($ChnlsOn == 0){ $qastate = QA::WARN_2; $value = "OFF";}
if ($ChnlsOld >= 0) { $qastate = QA::WARN_2;}
+ if ($ChnlsOn <= 2){ $qastate = QA::ERROR; $value = "OFF";}
if ($QA::FwHvOff == 1) { $qastate = QA::OK;}
use HPlot;
my $fqa = QA::OpenQAFile();
+$ENV{EPICS_CA_AUTO_ADDR_LIST} = 'YES';
my @names = qw( reflowPressureAthm:average reflowPressureCompr reflowInO2 opensysFreshARGON opensysFreshCO2 reflowFreshArgon reflowFreshIsob CO2:concentration CO2:concentration2 reflowPressureLP );
my @namesLABEL = qw( AtmosphericPressure reflowPressureCompressor reflow_O2_concentration planeI_argon_fresh planeI_CO2_frsh reflowFreshArgon reflowFreshCO2 CO2-P1 CO2-P2 LP-pressure );
print "Connected.\n";
while(1) {
- my $data = Perl2Epics::GetAll();
+ my $data = Perl2Epics::GetAll(10);
$str = Hmon::MakeTitle(8, 22, "MDC Gas Pressure", 1, "");
$str .= "<h4>Chamber differential pressure [Pa]</h4>\n";
$str .= "<table class=\"rates \">\n"; #<div id=\"logbox\" class=\"textbox\" >
HPlot::PlotDraw("VacuumLow");
HPlot::PlotDraw("VacuumHigh");
- $str = Hmon::MakeTitle(8,12,"Vacuum",0);
+ $str = Hmon::MakeTitle(8,12,"Vacuum",1);
$str .= qq@<img src="%ADDPNG files/VacuumHigh.png%" type="image/png">\n@;
$str .= qq@<img src="%ADDPNG files/VacuumLow.png%" type="image/png"><br>@;
$str .= sprintf("Low Vacuum %.2fE-7 mbar</br>",$data->{"Vaclow"}->{val}*1E7);
if ($data->{"Gate"}->{tme}==-1) {
$msg="ERROR";
$longmsg.="<br>No Data";
- $qastat = QA::WARN_2;
+ $qastat = QA::ERROR;
}
elsif ($data->{"Gate"}->{val}!=1) {
$msg="ERROR";
$qastat = QA::ERROR;
}
- QA::WriteQALog($fqa, "hv2", "valve", 60, $qastat, "Vacuum", $msg, $longmsg);
+ QA::WriteQALog($fqa, "misc", "valve", 60, $qastat, "Vacuum", $msg, $longmsg);
$timer++;
- sleep(10);
}
my @cpus = qw |
-hades30 hades33 hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp28 hadesp30 hadesp31 hadesp33 hadesp57 hadesp63 hadesp66 hadesp70 lxhaddcs05p lxhaddcs06p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhadesdaqp
+hades30 hades33 hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp28 hadesp30 hadesp31 hadesp33 hadesp57 hadesp63 hadesp66 hadesp70 lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhadesdaqp lxhadeb18p lxhadeb17p
|;
#lxhadeb07 lxhadeb08 lxhadeb09 lxhadeb10 lxhadeb11 lxhadeb12 lxhadeb13 lxhadeb14 lxhadeb15 lxhadeb16 lxhaddcs05 lxhaddcs06 lxhaddcs11 lxhadesdaq hadesdaq01 hades30 ha#desp31 hades33 lxhadeb07p lxhadeb08p lxhadeb09p lxhadeb10p lxhadeb11p lxhadeb12p lxhadeb13p lxhadeb14p lxhadeb15p lxhadeb16p lxhaddcs05p lxhaddcs06p lxhaddcs11p lxhad#esdaqp hadesdaqp02 hadesdaqp03 hadesdaqp04 hadesp30 hadesp33 hadesp57 hadesp70
for my $cpu (@cpus) {
- my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh hadaq\@$cpu -N -f </dev/null >/dev/null&";
+ my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh $cpu -N -f </dev/null >/dev/null&";
if ($cpu =~ /hadesp28/) {
$c=~s/hadaq\@/magnet\@/;
}
+ if ($cpu =~ /hades13p/) {
+ $c=~s/hadaq\@/hades-qa\@/;
+ }
#my $c = "~/trbsoft/hadesdaq/hmon/hmon_ssh hadaq\@$cpu -N -f";
print "command: $c\n";
system($c);
# $files-> { "PionTrackerRaw" } = [ "Mult" , "TS" , "Strip" , "Pileup" , "Overflow" , "ADCStrip" , "TSStrip" , "XY" , "RawPTHodoDt" ];
# $files-> { "PionTrackerCal" } = [ "CalTS" , "CalADCStrip" , "CalTSStrip" , "CalPTHodoDt" ];
$files-> { "Start" } = [ "StartMain", "StartTestEfficiency", "StartTestRawStripToT", "StartTestTDIFFvsTOTmod0", "StartTestTDIFFvsTOTmod1" ];
-$files-> { "InnerTOF" } = [ "InnerTofMultiplicity", "InnerTofRawHitPattern", "InnerTofRawHitPatternWithSum"];
+#$files-> { "InnerTOF" } = [ "InnerTofMultiplicity", "InnerTofRawHitPattern", "InnerTofRawHitPatternWithSum"];
-$files-> { "Hodo" } = [ "HODOMain" ];
-$files-> { "ForwardDet" } = [ "StrawCounts", "StrawToT", "StrawLeadTime", "ToT", "DriftTime", "Multiplicity"];
+#$files-> { "Hodo" } = [ "HODOMain" ];
+#$files-> { "ForwardDet" } = [ "StrawCounts", "StrawToT", "StrawLeadTime", "ToT", "DriftTime", "Multiplicity"];
-$files-> { "RICH" } = [ "RICHMult" , "RICHCharge" , "RICHColRow" , "RICHHitMult" , "RICHDirClus" ];
+$files-> { "RICH" } = [ "RICHMult" , "RICHCharge" , "RICHColRow" , "RICHHitMult" , "RICHDirClus", "Cals", "CalsXY", "EdgeInfo", "LaserMult" , "NofPerEvent", "RawHits", "RawMult", "SecLaserTrend","SecMultCals","SecMultRings","SingleEvent" ];
$files-> { "MDCMon" } = [ "MDCMain" , "Errors" ];
$files-> { "MDCTimes" } = [ "potato" ];
$files-> { "MDCExpert" } = [ "Hits" , "MDCL0" , "MDCL1" , "MDCL2" , "MDCL3" , "MDCMboNoise" , "MDCT0" , "MDCT1" , "MDCT2" , "MDCT3" , "MDCMb" , "MDCMboTrend" , "MDCMbTCal0" , "MDCMbTCal1" , "MDCMbTCal2" , "MDCMbTCal3" , "MDCCalStat" , "MDCErrStat" ];
$files-> { "TOFMon" } = [ "TOFMain" , "TOFADC" , "TOFTDC" , "TOFHIT" ];
$files-> { "RPC" } = [ "RPCMain" , "RPCRawRPCMult" , "RPCRawSecMult" , "RPCRawColCellMult" , "RPCRawColCellMult2" , "RPCRawHitsTrend" , "RPCRawChargeDiff" , "RPCFeeTrbMbo" , "RPCFeeMboDbo" , "RPCFeeTrbChannel" , "RPCRpcHit" , "RPCRpcShower" ];
$files-> { "WALLMon" } = [ "WALLMain" , "WALLHit" , "WALLControl" , "WALLControlLATCH" ];
-# $files-> { "SHOWERMon" } = [ "SHOWERMain" , "SHOWERMults" , "SHOWERSUMS" , "SHOWERCAL" , "SHOWERSUMTREND" ];
$files-> { "Physics" } = [ "PhysMultCand" , "PhysMatch" , "PhysMultDist" , "PhysBetaMomSys0" , "PhysBetaMomSys1" , "PhysVertex" , "PhysToTmips" ];
$files-> { "EcalMon"} = ["RawMult", "SlowTot"];
+$files->{"Trigger"} = qw(MainPTScaler MainTrigger MainTriggerTrend );
# while(1) {
}
$qastate = QA::WARN_2 if ($ChnlsOn < 74);
-$qastate = QA::ERROR_2 if ($ChnlsOn == 0);
+$qastate = QA::ERROR if ($ChnlsOn == 0);
$qastate = QA::NOTE if ($QA::RichHvOff == 1);
if( $timer % (4*$OVERCURRENT_period) == 0) {
$longtxt = "All sequencers running" if $longtxt eq "";
my $value = ((scalar @names)-$count)."/".(scalar @names);
- QA::WriteQALog($flog,"misc","sequencer",50,$qastate,"HV Sequencer",$value,$longtxt);
+ QA::WriteQALog($flog,"hv2","sequencer",50,$qastate,"HV Sequencer",$value,$longtxt);
if($qastate == QA::FATAL) {
if(!($errorcounter%15)){
Hmon::Speak('nobeam', "High Voltage Control is not working");
});
+HPlot::PlotInit({
+ name => "StartMap",
+ file => "files/StartMap",
+ title => "Start Coincidence Rate",
+ entries => 16,
+ curves => 16,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ zlabel => "Hitrate",
+ sizex => 310,
+ sizey => 310,
+ nokey => 1,
+ buffer => 1,
+ ymin => 15.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 15.5,
+ cbmax => "100<*<1E5",
+ cbmin => 1,
+ noinit => 1,
+ additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
+ showvalues => 0,
+ });
my $str = Hmon::MakeTitle(12, 6, "Beam QFactor",0);
$str .= Hmon::MakeFooter();
Hmon::WriteFile("MicroSpillStructure",$str);
+$str = Hmon::MakeTitle(4, 7, "StartMap",0);
+$str .= qq@<img src="%ADDPNG files/StartMap.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("StartMap",$str);
+
-trb_init_ports() or die trb_strerror();
+trb_init_ports() or die trb_strerror();
+my $old;
+my $oldtime = time();
+my $time = time();
+my $diff;
my $round = 0;
while(1) {
- my $o = trb_register_read_mem(0xf3c0,0xb810,1,500) or print trb_strerror() or sleep 5 and next;
+ my $o = trb_register_read_mem(0xffff,0xb810,1,500) or print trb_strerror() or sleep 5 and next;
foreach my $b (keys %$o) {
my $time = 0;
# if($round == 8) {
# trb_register_write(0xf3c0,0xb801,0x80000000);
# }
- $o = trb_register_read(0xf3c0,0xb806);
- if($o->{0xf3c0} == 3) {
- $o = trb_register_read_mem(0xf3c0,0xb811,1,6000) or print trb_strerror() or sleep 5 and next;
+ $o = trb_register_read(0xffff,0xb806);
+ if($o->{0xffff} == 3) {
+ $o = trb_register_read_mem(0xffff,0xb811,1,6000) or print trb_strerror() or sleep 5 and next;
- trb_register_write(0xffff,0xb805,200000); #50000 = 1s offset to spill start
- trb_register_write(0xffff,0xb804,0x00003559); #Only 5000/5001 as source
+# trb_register_write(0xffff,0xb805,200000); #50000 = 1s offset to spill start
+# trb_register_write(0xffff,0xb804,0x00003559); #Only 5000/5001 as source
foreach my $b (keys %$o) {
HPlot::PlotDraw('MicroRate');
HPlot::PlotDraw('MicroRate10ms');
}
-
+
+ $o = trb_register_read_mem(0xffff,0xba00,0,256) or print trb_strerror() or sleep 5 and next;
+
+ if (defined $old) {
+ my $tdiff = (time() - $oldtime)|1;
+ foreach my $b (keys %$o) {
+
+ for my $v (0..255) {
+ my $vdiff = ($o->{$b}->[$v]&0xfffff) - ($old->{$b}->[$v]&0xfffff);
+
+ if ($vdiff < 0) { $vdiff += 2**20;}
+ $diff->{$b}->[$v] = $vdiff/$tdiff;
+ #$ratesum += $diff->{$b}->[$v+1];
+# print "$v $diff->{$b}->[$v]\n";
+ HPlot::PlotFill('StartMap',$diff->{$b}->[$v],$v%16,$v/16);
+ }
+
+ }
+
+ HPlot::PlotDrawFork('StartMap');
+
+
+
+ }
+
+ $old = $o;
+ $oldtime = time();
+
$round++;
sleep 1;
}
trb_init_ports() or die trb_strerror();
my $data;
-my $NUMPLOTS = 9;
+my $NUMPLOTS = 10;
my $SERVER = 'calib'; #calib or calibtest
my $numboards = $entry;
$labels .= ') rotate by 90 offset 0,-1.4 font ",6";';
- my @names = qw(LeadingAverage[ns] LeadingSigma[ps] IgnoredOutliers IgnoredHits ToTAverage[ns] ToTSigma[ps] IgnoredToTOutliers IgnoredToT CorrectedHits);
+ my @names = qw(LeadingAverage[ns] LeadingSigma[ps] IgnoredOutliers IgnoredHits ToTAverage[ns] ToTSigma[ps] IgnoredToTOutliers IgnoredToT CorrectedHits ToTShifts[ns]);
HPlot::PlotInit({
name => "TdcCalMon0",
additional => $labels,#."set logscale cb;",
showvalues => 0, });
-while(1){
+HPlot::PlotInit({
+ name => "TdcCalMon9",
+ file => "files/TdcCalMon9",
+ cblabel => "TdcCalMon ".$names[9],
+ entries => $numboards,
+ curves => 49,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ sizex => 10000,
+ sizey => 500,
+ nokey => 1,
+ buffer => 0,
+ xmin => -0.5,
+ xmax => $numboards-0.5,
+ ymin => -0.5,
+ ymax => 48.5,
+ noinit => 1,
+ cbmin => 0,
+ cbmax => 50,
+ palette => 'defined (0 "#33ff00", 0.000001 "#ff0000", 21 "#ff0000", 21.6 "#ff5500", 22 "#00ff00", 43 "yellow", 44 "red", 50 "red")',
+ additional => $labels,#."set logscale cb;",
+ showvalues => 0, });
+
+# while(1){
###################################################################################################
#loop until run is finished
print "Wait for end of analysis run\n";
$evnum = $eventhist->{bins}[13];
print "run".$evnum."\n";
sleep 10;
- }while($evnum == 0 || $evnum != $oldevnum);
+ }while(($oldevnum == 0 || $evnum == 0 || $evnum != $oldevnum));
###################################################################################################
print "End detected. Start to work\n";
-
+ Hmon::Speak('caltest',"Calibration Test: Root analysis finished.");
+
my $str = Hmon::MakeTitle(200, 110, "TDC Cal Mon",1);
$str .= '<p>'.QA::getTimeString().'</p>';
$str .= '<p> Working</p>';
$p = $datahistlist->{'_allnames'}{$p};
my $corr = getroothist($SERVER,$p) if($p) ;
next unless $corr;
-
+
+ $p = sprintf("TDC_%04X_TotShifts",$b);
+ $p = $datahistlist->{'_allnames'}{$p};
+ my $shifts = getroothist($SERVER,$p) if($p) ;
+ next unless $shifts;
+
for(my $i=1;$i<=48;$i++) {
next unless $activechannels & (1<<($i-1));
- next if($b >= 0x5000 && $b < 0x5008 && !($i&1));
+# next if($b >= 0x5000 && $b < 0x5008 && !($i&1));
my $avg = ($corr->{bins}[$i]//0) / ($hits->{bins}[$i*2]||1);
HPlot::PlotFill("TdcCalMon8",$avg,$entry,$i);
+ HPlot::PlotFill("TdcCalMon9",$shifts->{bins}[$i]//0,$entry,$i);
+
}
}
for(my $i=1;$i<=48;$i++) {
next unless $activechannels & (1<<($i-1));
- next if($b < 0x5008 && $b >= 0x5000 && !($i&1));
+# next if($b < 0x5008 && $b >= 0x5000 && !($i&1));
my ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i]);
for(my $i=1;$i<=48;$i++) {
next unless $activechannels & (1<<($i-1));
- next if($b >= 0x5000 && $b < 0x5008 && !($i&1));
+# next if($b >= 0x5000 && $b < 0x5008 && !($i&1));
- my ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],1460,1540) if ($b < 0x7000);
+ my ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],1460,1540) if ($b < 0x7000 && $b >= 0x5100);
($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],960,1040) if ($b >= 0x7000);
+ ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],960,1040) if ($b >= 0x5000 && $b <= 0x50ff);
$avg = ($avg/50);
$sigma = ($sigma*20);
}
$str .= Hmon::MakeFooter();
Hmon::WriteFile("TdcCalMon",$str);
+ Hmon::Speak('caltest2',"Calibration Test: H-mon analysis finished.");
- do{
- $oldevnum = $evnum;
- $eventhist = getroothist($SERVER,"/HADES/Run/HLD/HLD_EvType");
- $evnum = $eventhist->{bins}[13];
- print "wait".$evnum."\n";
- sleep 5;
- }while($evnum == $oldevnum);
-}
+# do{
+# $oldevnum = $evnum;
+# $eventhist = getroothist($SERVER,"/HADES/Run/HLD/HLD_EvType");
+# $evnum = $eventhist->{bins}[13];
+# print "wait".$evnum."\n";
+# sleep 5;
+# }while($evnum == $oldevnum);
+# }
use QA;
my $inhibit = 0;
-$SIG{USR1} = sub { $inhibit = 1; };
-$SIG{USR2} = sub { $inhibit = 0; system("killall espeak");}; #system("espeak -ven-male2 -s 130 -g 1 \"Speech daemon is online\" 2>/dev/null");
+$SIG{USR1} = sub { $inhibit = 1; }; #system("killall larynx");};
+$SIG{USR2} = sub { $inhibit = 0; }; #system("espeak -ven-male2 -s 130 -g 1 \"Speech daemon is online\" 2>/dev/null");
# my $fq = QA::OpenQAFile();
-my $cmd = "ssh hades33 /home/hadaq/trbsoft/daq/hmon/hmon_tail -n 0 -F /home/hadaq/trbsoft/hadesdaq/hmon/files/speaklog";
+my $cmd = "LANG=en_US.UTF-8 ssh hadesp33 /home/hadaq/trbsoft/daq/hmon/hmon_tail -n 0 -F /home/hadaq/trbsoft/hadesdaq/hmon/files/speaklog";
# my $fq = "remote";
# my $cmd = "./hmon_ssh -T $QA::QAServer \"tail -n 0 -F /home/hadaq/trbsoft/daq/tools/hmon/files/speaklog\" </dev/null";
-my $f = fork();
+# my $f = fork();
+# system("espeak -vus-mbrola-1 -s125 \"$a\" 2>/dev/null #-ven+m2 -s 130 -g 1 "); -ven-us+f2 -p50 -s120
+# system("espeak -ven-us+f2 -p60 -s150 -g 1 \"oh-oh -- $a\" 2>/dev/null");
+# system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
+# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
-if($f) {
+
+#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";
+ $fh->autoflush(1);
+
while(1) {
- open(FTRB, "$cmd|");
+ open(FTRB, "$cmd|");
while(my $a = <FTRB>) {
if ($inhibit == 0) {
-# system("espeak -vus-mbrola-1 -s125 \"$a\" 2>/dev/null #-ven+m2 -s 130 -g 1 "); -ven-us+f2 -p50 -s120
-# system("espeak -ven-us+f2 -p60 -s150 -g 1 \"oh-oh -- $a\" 2>/dev/null");
- system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
-# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
+ print $fh ": ".$a ;
+ sleep 3;
}
}
}
- }
-else {
- while(1) {
- if($inhibit == 0) {
-# QA::WriteQALog($fq, "main", "speech", 120, QA::OK,
-# "Speech Output", "running", "The speech daemon is running.");
- }
- else {
-# QA::WriteQALog($fq, "main", "speech", 120, QA::WARN,
-# "Speech Output", "muted", "The speech daemon is muted.");
- }
- sleep 60;
- }
- }
+# }
+# else {
+# while(1) {
+# if($inhibit == 0) {
+# # QA::WriteQALog($fq, "main", "speech", 120, QA::OK,
+# # "Speech Output", "running", "The speech daemon is running.");
+# }
+# else {
+# # QA::WriteQALog($fq, "main", "speech", 120, QA::WARN,
+# # "Speech Output", "muted", "The speech daemon is muted.");
+# }
+# sleep 60;
+# }
+# }
my $inhibit = 0;
$SIG{USR1} = sub { $inhibit = 1; };
-$SIG{USR2} = sub { $inhibit = 0; system("killall espeak");}; #system("espeak -ven-male2 -s 130 -g 1 \"Speech daemon is online\" 2>/dev/null");
+$SIG{USR2} = sub { $inhibit = 0; system("killall larynx");}; #system("espeak -ven-male2 -s 130 -g 1 \"Speech daemon is online\" 2>/dev/null");
# my $fq = QA::OpenQAFile();
my $cmd = "ssh hades33 /home/hadaq/trbsoft/daq/hmon/hmon_tail -n 0 -F /home/hadaq/trbsoft/hadesdaq/hmon/files/speaklog_mdc";
# my $fq = "remote";
# my $cmd = "./hmon_ssh -T $QA::QAServer \"tail -n 0 -F /home/hadaq/trbsoft/daq/tools/hmon/files/speaklog\" </dev/null";
-my $f = fork();
+# my $f = fork();
+
+# system("espeak -vus-mbrola-1 -s125 \"$a\" 2>/dev/null #-ven+m2 -s 130 -g 1 "); -ven-us+f2 -p50 -s120
+# system("espeak -ven-us+f2 -p60 -s150 -g 1 \"oh-oh -- $a\" 2>/dev/null");
+# system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
+# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
-if($f) {
+# if($f) {
+ my $fn = "larynx -v southern_english_male --length-scale 1.2 --interactive 2>&1";
+ open my $fh, "|$fn" or die "error: no larynx";
+ $fh->autoflush(1);
+
while(1) {
- open(FTRB, "$cmd|");
+ open(FTRB, "$cmd|");
while(my $a = <FTRB>) {
if ($inhibit == 0) {
-# system("espeak -vus-mbrola-1 -s125 \"$a\" 2>/dev/null #-ven+m2 -s 130 -g 1 "); -ven-us+f2 -p50 -s120
-# system("espeak -ven-us+f2 -p60 -s150 -g 1 \"$a\" 2>/dev/null");
- system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
-# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
+ print $fh $a ;
}
}
}
- }
-else {
- while(1) {
- if($inhibit == 0) {
-# QA::WriteQALog($fq, "main", "speech", 120, QA::OK,
-# "Speech Output", "running", "The speech daemon is running.");
- }
- else {
-# QA::WriteQALog($fq, "main", "speech", 120, QA::WARN,
-# "Speech Output", "muted", "The speech daemon is muted.");
- }
- sleep 60;
- }
- }
+# }
+# else {
+# while(1) {
+# if($inhibit == 0) {
+# # QA::WriteQALog($fq, "main", "speech", 120, QA::OK,
+# # "Speech Output", "running", "The speech daemon is running.");
+# }
+# else {
+# # QA::WriteQALog($fq, "main", "speech", 120, QA::WARN,
+# # "Speech Output", "muted", "The speech daemon is muted.");
+# }
+# sleep 60;
+# }
+# }
#Mount RAM file system
#mount -t tmpfs none /var/spool/ramdisk -o size=256m
-export PERL5LIB="./"
+source ~/.bashrc
+
+#export PERL5LIB="./:/home/hadaq/soft/EPICS/EPICS-7.0.7/base/lib/perl/"
mkdir /dev/shm/hmon
#Kill old tunnel, make new one. Better: Check if tunnel still exists, if not restart.
#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@hadesp66:/home/hades-qa/online/5.34.38/pics `pwd`/qa"
+timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/feb24/pics `pwd`/qa"
fusermount -u vertex
-timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/feb22/vertex/pics `pwd`/vertex"
+timeout 2 bash -c "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/feb24/vertex/pics `pwd`/vertex"
#pkill -f "sshfs -o allow_other hadaq@hadesp63:/home/hadaq/local/tdcmon/dabc/cal"
fusermount -u calibration
ln -fs `pwd`/background.png /srv/www/htdocs/mon/files/
ln -fs `pwd`/QA.pm /srv/www/htdocs/mon/
ln -fs `pwd`/styles.css files/
+ln -fs `pwd`/stylesmonitor.css files/
#ln -fs `pwd`/indexstyles.css files/
ln -fs `pwd`/ecal_drawing.htm /srv/www/htdocs/mon/
ln -fs `pwd`/rich_drawing.htm /srv/www/htdocs/mon/
#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' &
sleep 1;
# echo " <Hmon> Done."
pkill -f "\./hmon_.+\.pl" 2>/dev/null 1>/dev/null
pkill -f "sh -c \./hmon_.*\.sh"
pkill -f "/usr/bin/perl -w \./speakdaemon.pl"
+pkill -f "/usr/bin/perl -w \./speakdaemon_mdc.pl"
pkill -f "/usr/bin/perl -w \./hmon_.*\.sh"
pkill -f "hmon_tail -n"
#pkill -f "hmon_ssh" # don't do that for a normal daq-restart
#!/bin/bash
-
+source ~/.bashrc
killall hmon_permanent_tail
cd permanent
killall hmon*.pl 2>/dev/null 1>/dev/null
+pkill -f "/usr/bin/perl -w \./speakdaemon.pl"
+pkill -f "/usr/bin/perl -w \./speakdaemon_mdc.pl"
cd ../
pkill -f "sshfs -o allow_other hadaq@hadesp66:/home/hades-qa/online/5.34.38/pics"
+.monitor{
+ scrollbar-width:none;
+ }
+
body {
font-family:sans-serif;
background:#346;/*#def;*/
}
body>div>div {
- float:left;
+/* float:left; */
margin: 0px 2px 0px 0;
padding: 0 0 10px 0 ;
border: 1px solid #777;
div#content {
- -moz-transform-origin:0 0;
- -moz-transform:scale(1);
+ //-moz-transform-origin:0 0;
+ //-moz-transform:scale(1);
}
div#contentback {
z-index : -1;
+}
+
+
+div#content, div#contentback {
+ justify-content: space-evenly;
+ display:flex;
+ flex-wrap:wrap;
+/* width:100%; */
position:absolute;
+
}
-
+div#contentinner {
+ justify-content: space-evenly;
+ display:flex;
+ flex-wrap:wrap;
+}
+
+
/*
//plus 24 in width, plus 29 in height for each size step.
//base is 70x40, 80x50 with border
# use lib '/home/hadaq/soft/EPICS/EPICS-3.16.1/base/' . '/lib/perl';
# use lib '/home/epics/EPICS/EPICS-3.16.1/base/' . '/lib/perl';
# use lib '/home/hadaq/soft/EPICS/EPICS-7.0.1.1/base/' . '/lib/perl';
-use lib '/home/hadaq/soft/EPICS/EPICS-7.0.7/base/lib/perl/';
-use CA;
+# use lib '/home/hadaq/soft/EPICS/EPICS-7.0.7/base/lib/perl/';
+
+
+#my $find_epics_command =q|bash -c '. /home/hadaq/local/bin/epics'|;
+my $find_epics_command =q|bash -c '. epics'|;
+my @find_epics_result = qx($find_epics_command);
+#print Dumper @find_epics_result;
+my ($EPICS_BASE)= grep(/^EPICS_BASE /, @find_epics_result);
+#print Dumper $EPICS_BASE;
+my @temp_split=split /\s+/, $EPICS_BASE;
+$EPICS_BASE = $temp_split[3];
+
+#print "found EPICS_BASE: $EPICS_BASE\n";
+my $ca_lib_path = $EPICS_BASE . '/lib/perl/';
+#print "ca_lib_path: $ca_lib_path\n";
+#use lib $ca_lib_path;
+#use lib '/home/hadaq/EPICS/EPICS-3.15.6/base/lib/perl/';
+#use CA;
+require "$ca_lib_path/CA.pm";
+CA->import;
#JAM 2020: back to default after EBs are done with epics
# $ENV{EPICS_CA_AUTO_ADDR_LIST} = 'YES';
$ENV{EPICS_CA_AUTO_ADDR_LIST} = 'NO';
#JoF2022: updated during beamtime
-$ENV{EPICS_CA_ADDR_LIST} = "cryo1.hades.gsi.de lxhadeb07p frpcpid1 lxhaddcs05p lxhaddcs06p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p gas.hades.gsi.de richhvcrate";
-# $ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255";
+$ENV{EPICS_CA_ADDR_LIST} = "cryo1.hades.gsi.de frpcpid1 lxhaddcs10p lxhaddcs11 lxhaddcs12p lxhaddcs13p gas.hades.gsi.de richhvcrate";
+# $ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255"; lxhadeb07p lxhaddcs05p lxhaddcs06p
#$ENV{EPICS_CA_ADDR_LIST} = "192.168.103.182 192.168.100.235 192.168.100.236 192.168.97.10 192.168.97.11 192.168.97.14 192.168.97.15 192.168.100.17 192.168.97.4 192.168.100.216";
#JAM2018: updated after network mask redefinition:
sub callback {
my ($chan, $status, $data) = @_;
-# print Dumper $data;
+# print Dumper $data;
if ($status) {
printf "%-30s %s\n", $chan->name, $status;
}
my ($title, $varname, $type, $wait) = @_;
# push(@EpicsChans,CA->new($name));
# $EpicsChans[-1]->create_subscription('v', \&callback, 'DBR_TIME_DOUBLE');
- ## print $varname."\n";
+# print $varname."\n";
$type = 'DBR_TIME_DOUBLE' unless defined $type;
$EpicsStore->{$varname}->{tme} = [];
$EpicsStore->{$varname}->{val} = [];
sub GetAll {
+ my ($delay) = @_;
my $store = {};
my $time;
my $val;
+ my $diffflag = -1;#undefined difference
#Update(0.001);
- Update(0.2);
+ Update($delay || 0.2);
foreach my $el (keys %{$EpicsNames}) {
my $varname = $EpicsNames->{$el};
if(!$success) {
$time = -1;
$val = 0;
- } elsif (scalar @{$EpicsStore->{$varname}->{tme}} > 0) {
+ } elsif (scalar @{$EpicsStore->{$varname}->{tme}} == 1) {
$time = (@{$EpicsStore->{$varname}->{tme}})[-1];
$val = (@{$EpicsStore->{$varname}->{val}})[-1];
+ } elsif (scalar @{$EpicsStore->{$varname}->{tme}} > 1) {
+ $time = (@{$EpicsStore->{$varname}->{tme}})[-1];
+ $val = (@{$EpicsStore->{$varname}->{val}})[-1];
+ my $oldval = (@{$EpicsStore->{$varname}->{val}})[-2];
+ $diffflag = ( ($val - $oldval) == 0 ) ? 0 : 1;
} else {
$time = $EpicsStore->{$varname}->{lasttime};
$val = $EpicsStore->{$varname}->{lastval};
}
- $store->{$el}->{tme} = $time;
- $store->{$el}->{val} = $val;
+ $store->{$el}->{tme} = $time;
+ $store->{$el}->{val} = $val;
+ $store->{$el}->{diffflag} = $diffflag;
$EpicsStore->{$varname}->{lasttime} = $time;
$EpicsStore->{$varname}->{lastval} = $val;
}
--- /dev/null
+package Perl2Epics2;
+use warnings;
+use strict;
+use Data::Dumper;
+# use Hmon;
+
+# use lib '/home/scs/EPICS/EPICS-3.14.12.4/base/' . '/lib/perl';
+# use lib '/home/hadaq/EPICS/EPICS-3.15.6/base' . '/lib/perl';
+# use lib '/home/hadaq/soft/EPICS/EPICS-3.16.1/base/' . '/lib/perl';
+# use lib '/home/epics/EPICS/EPICS-3.16.1/base/' . '/lib/perl';
+# use lib '/home/hadaq/soft/EPICS/EPICS-7.0.1.1/base/' . '/lib/perl';
+use lib '/home/hadaq/soft/EPICS/EPICS-7.0.7/base/lib/perl/';
+use CA;
+
+#JAM 2020: back to default after EBs are done with epics
+# $ENV{EPICS_CA_AUTO_ADDR_LIST} = 'YES';
+$ENV{EPICS_CA_AUTO_ADDR_LIST} = 'NO';
+
+#JoF2022: updated during beamtime
+$ENV{EPICS_CA_ADDR_LIST} = "cryo1.hades.gsi.de lxhadeb07p frpcpid1 lxhaddcs05p lxhaddcs06p lxhaddcs10p lxhaddcs11p lxhaddcs12p lxhaddcs13p gas.hades.gsi.de richhvcrate";
+# $ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255";
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.103.182 192.168.100.235 192.168.100.236 192.168.97.10 192.168.97.11 192.168.97.14 192.168.97.15 192.168.100.17 192.168.97.4 192.168.100.216";
+
+#JAM2018: updated after network mask redefinition:
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255 192.168.111.255:10012 192.168.111.255:10008 192.168.111.255:10003 192.168.111.255:10002 192.168.111.255:10001 192.168.111.255:10014 192.168.111.255:10007 192.168.111.255:10004 192.168.111.255:10010 192.168.111.255:10013 192.168.111.255:10015 192.168.111.255:10016 192.168.111.255:10009 192.168.111.255:10005 192.168.103.83:10011 192.168.111.255:10006 localhost";
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255:10006 192.168.111.255:10010 192.168.111.255:10011 192.168.111.255:10012 192.168.111.255:10013 192.168.111.255:10014 192.168.111.255:10015 192.168.111.255:10016 192.168.111.255:10017 192.168.111.255:10018 192.168.111.255:10019";
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.103.83:10000 192.168.103.83:10008 192.168.103.83:10003 192.168.103.83:10002 192.168.111.255:10001";
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.103.83 192.168.103.83:10012 192.168.103.83:10008 192.168.103.83:10003 192.168.103.83:10002 192.168.103.83:10001 192.168.103.83:10014 192.168.103.83:10007 192.168.103.83:10004 192.168.103.83:10010 192.168.103.83:10013 192.168.103.83:10015 192.168.103.83:10016 192.168.103.83:10009 192.168.103.83:10005 192.168.103.83:10011 192.168.103.83:10006 localhost";
+
+#hotfix PZ 2022-02-14
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.111.255";
+#$ENV{EPICS_CA_AUTO_ADDR_LIST} = 'NO';
+
+#
+# JAM added fixed port numbers of EB epics
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.103.255 192.168.103.255:10012 192.168.103.255:10008 192.168.103.255:10003 192.168.103.255:10002 192.168.103.255:10001 192.168.103.255:10014 192.168.103.255:10007 192.168.103.255:10004 192.168.103.255:10010 192.168.103.255:10013 192.168.103.255:10015 192.168.103.255:10016 192.168.103.255:10009 192.168.103.255:10005 192.168.103.255:10011 192.168.103.255:10006 localhost";
+#$ENV{EPICS_CA_ADDR_LIST} = "192.168.100.11 192.168.100.12 192.168.100.13 192.168.100.14 192.168.100.15 localhost";
+
+my $EpicsStore = {};
+my $EpicsNames = {};
+my $errcnt = {};
+
+sub callback {
+ my ($chan, $status, $data) = @_;
+ # print("callback\n");
+ # print $chan->name."\n";
+ # print Dumper $data;
+ if ($status) {
+ printf "%-30s %s\n", $chan->name, $status;
+ }
+ else {
+# print $chan->name . ": $data->{value}\n";
+# print scalar @{$EpicsStore->{$chan->name}->{tme}}."\n";
+ if(scalar @{$EpicsStore->{$chan->name}->{tme}} > 10) {
+ shift @{$EpicsStore->{$chan->name}->{tme}};
+ shift @{$EpicsStore->{$chan->name}->{val}};
+ }
+ push(@{$EpicsStore->{$chan->name}->{tme}}, $data->{stamp});
+ push(@{$EpicsStore->{$chan->name}->{val}}, $data->{value});
+ $EpicsStore->{$chan->name}->{status} = $data->{status};
+ }
+}
+
+sub callbackStatusUpdate {
+ my ($chan, $status, $data) = @_;
+ # print("callbackStatusUpdate\n");
+ # print($chan." ") if $chan;
+ # print($status." ") if $status;
+ # print($data." ") if $data;
+ if ($status) {
+ printf "%-30s %s\n", $chan->name, $status;
+ }
+ else {
+ $EpicsStore->{$chan->name}->{status} = $data->{status};
+ }
+}
+
+sub Connect {
+ my ($title, $varname, $type, $delay) = @_;
+ $type = 'DBR_TIME_DOUBLE' unless defined $type;
+ $EpicsStore->{$varname}->{tme} = [];
+ $EpicsStore->{$varname}->{val} = [];
+ $EpicsStore->{$varname}->{delay} = $delay || 0.05;
+ $EpicsNames->{$title} = $varname;
+ $errcnt->{$varname} = 0;
+ my $success;
+ eval {
+ my $c = CA->new($varname);
+ # print("0 ".$title." ".$varname." ".$c->is_connected()." ".$c->state."\n");
+ CA->pend_io($EpicsStore->{$varname}->{delay});
+ # print("1 ".$title." ".$varname." ".$c->is_connected()." ".$c->state."\n");
+ $c->create_subscription('v', \&callback, $type);
+ # print("2 ".$title." ".$varname." ".$c->is_connected()." ".$c->state."\n");
+ $c->get_callback(\&callbackStatusUpdate, $type, 1);
+ # print("3 ".$title." ".$varname." ".$c->is_connected()." ".$c->state."\n");
+ $EpicsStore->{$varname}->{ca} = $c;
+ $success = $c->is_connected();
+ };
+ return ($success);
+}
+
+sub Update {
+ CA->pend_event($_[0]);
+}
+
+
+sub GetAll {
+ my ($delay) = @_;
+ my $store = {};
+ my $time;
+ my $val;
+ my $status;
+
+ #Update(0.001);
+ Update($delay || 0.2);
+
+ foreach my $el (keys %{$EpicsNames}) {
+ my $varname = $EpicsNames->{$el};
+ my $ca = $EpicsStore->{$varname}->{ca};
+ my $r = $ca->is_connected() if(defined $ca);
+ my $success = 1;
+ if(!$r && (!defined $errcnt->{$el} || $errcnt->{$el} < 2000)) {
+ $success = Connect($el, $varname);
+ $errcnt->{$el}++;
+ }
+ $status = $EpicsStore->{$varname}->{status};
+
+ if(!$success) {
+ $time = -1;
+ $val = 0;
+ $status = "NOCONN";
+ # print($el." ".$errcnt->{$el}."\n");
+ } elsif (scalar @{$EpicsStore->{$varname}->{tme}} >= 1) {
+ $time = (@{$EpicsStore->{$varname}->{tme}})[-1];
+ $val = (@{$EpicsStore->{$varname}->{val}})[-1];
+ } else {
+ $time = $EpicsStore->{$varname}->{lasttime};
+ $val = $EpicsStore->{$varname}->{lastval};
+ }
+ # print($time."\n");
+ # print("curr:".time."\n");
+ $store->{$el}->{tme} = $time;
+ $store->{$el}->{val} = $val;
+ $store->{$el}->{status} = $status;
+ $EpicsStore->{$varname}->{lasttime} = $time;
+ $EpicsStore->{$varname}->{lastval} = $val;
+ }
+
+
+ return $store;
+}
+
+sub Get {
+ my ($title,$latest) = @_;
+ my $varname = $EpicsNames->{$title};
+ my $time;
+ my $val;
+# print $varname;
+
+ my $c = $EpicsStore->{$varname}->{ca};
+ my $r = $c->is_connected() if(defined $c);
+
+ my $success = 1;
+ if(!$r) {
+ $success = Connect($title, $varname);
+ }
+
+ if(!$success) {
+ return (-1, 0);
+ }
+
+ #Update(0.00001);
+ Update(0.2);
+
+ if (scalar @{$EpicsStore->{$varname}->{tme}} > 0) {
+ if(defined $latest && $latest == 1) {
+ $time = (@{$EpicsStore->{$varname}->{tme}})[-1];
+ $val = (@{$EpicsStore->{$varname}->{val}})[-1];
+ }
+ else { #if (scalar @{$EpicsStore->{$varname}->{tme}} > 1)
+ $time = shift (@{$EpicsStore->{$varname}->{tme}});
+ $val = shift (@{$EpicsStore->{$varname}->{val}});
+ }
+ }
+ else {
+ $time = $EpicsStore->{$varname}->{lasttime};
+ $val = $EpicsStore->{$varname}->{lastval};
+ }
+ $EpicsStore->{$varname}->{lasttime} = $time;
+ $EpicsStore->{$varname}->{lastval} = $val;
+ $time = $time || -1;
+ $val = $val || 0;
+ return ($time,$val);
+}
+
+sub Put {
+ my ($title, $value) = @_;
+ my $varname = $EpicsNames->{$title};
+ if (!defined $varname) {
+ return -1;
+ }
+
+ my $c = $EpicsStore->{$varname}->{ca};
+ my $r = $c->is_connected() if(defined $c);
+
+ my $success = 1;
+ if(!$r) {
+ $success = Connect($title, $varname);
+ }
+
+ if(!$success) {
+ return -2;
+ }
+
+ if (!$c || ($c->element_count()) != 1) {
+ print "5\n";
+ return -3;
+ }
+
+ my $type = $c->field_type;
+ my @values;
+ if ($type !~ m/ ^DBR_STRING$ | ^DBR_ENUM$ /x) {
+ # Make @ARGV strings numeric
+ push (@values, (map { +$_; } $value));
+ } else {
+ # Use strings
+ push (@values, $value);
+ }
+ $c->put(@values);
+
+ return 0;
+}
+
+sub TimeSinceLastDataChange {
+ my ($name, $print) = @_;
+ die if !$name or !$EpicsNames->{$name};
+ my @this_vals = @{$EpicsStore->{$EpicsNames->{$name}}->{val}};
+ my @this_times = @{$EpicsStore->{$EpicsNames->{$name}}->{tme}};
+ my $lastval = $this_vals[-1];
+ for (my $i = 2; $i <= scalar @this_vals; $i++) {
+ print("checking -".$i." where ".$this_vals[-$i]." compsto ".$lastval."\n") if defined $print;
+ return (time-$this_times[-$i]) if($this_vals[-$i] != $lastval);
+ }
+ return time-$this_times[-(scalar @this_vals)];
+}
+
+sub IsDataStatusGood {
+ my ($data, $ignoreLOHI) = @_;
+ if( $data->{status} ) {
+ if($ignoreLOHI) {
+ return 1 if $data->{status} eq "LO";
+ return 1 if $data->{status} eq "LOLO";
+ return 1 if $data->{status} eq "HI";
+ return 1 if $data->{status} eq "HIHI";
+ }
+ return 0 if $data->{status}; #NOCONN and LINK are definite errors but there also exists e.g. LO or LOLO
+ }
+
+ return 1;
+}
+
+sub ForceCheckIsDataStatusGood {
+ my ($name, $ignoreLOHI) = @_;
+ my $this_epics = $EpicsStore->{$EpicsNames->{$name}};
+ if( $this_epics
+ && $this_epics->{ca}
+ && $this_epics->{ca}->is_connected()
+ ) {
+ eval{
+ my $this_epics = $EpicsStore->{$EpicsNames->{$name}};
+ $this_epics->{ca}->get();
+ CA->pend_io($this_epics->{delay});
+ return IsDataStatusGood($this_epics->{status}, $ignoreLOHI);
+ };
+ if ($@){
+ $this_epics->{status} = "NOCONN";
+ return 0;
+ }
+ }
+ else {
+ print("EPICS variable $name does not exist");
+ return 0;
+ }
+
+ return 1;
+}
+
+sub GetDataStatus {
+ my ($name) = @_; #if name is provided, an update of the data status is pulled (caget)
+ my $this_epics = $EpicsStore->{$EpicsNames->{$name}};
+ if( $name
+ && $this_epics
+ ) {
+ return $this_epics->{status};
+ }
+ else {
+ return "EPICS variable $name does not exist";
+ }
+}
+
+1;
+__END__