$entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits'];
$entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage'];
$entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other'];
-$entries->{'feeerr'} = ['feeerr','trginp','trgqual','rpc',''];
+$entries->{'feeerr'} = ['feeerr','trginp','trgqual','rpc','tof'];
$entries->{'rich'} = ['temp','LV','bkpl','isob','richthr'];
$entries->{'padiwa'} = ['ecal','start','itof','hodo','sts'];
$entries->{'hv'} = ['richhv','ecalhv','rpchv','fwhv','tofhv'];
our @TrgErrLimits = (100, 1000, 10000);
our @CPULimits = (95, 100, 100);
our @TimeoutLimits = (0, 0, 1);
-our @TimeoutLimitsOnlyRICHMDC = (0, 3, 4);
+our @TimeoutLimitsOnlyRICHMDC = (0, 5, 10);
our @LinkErrLimits = (50, 500, 1000);
-our @MdcEndpMissingLimits = (0, 2, 3); #!!! Oh dear.
+our @MdcEndpMissingLimits = (0, 5, 8); #!!! Oh dear.
our @RichEndpMissingLimits = (0, 3, 4);
our @TofEndpMissingLimits = (0, 0, 0);
our @RpcEndpMissingLimits = (0, 0, 0);
our @Eventsbroken = (.5,2,5);
our @MdcTokenMissLimits = (10,50,100);
our @MdcNominalHV = (1750,1770,1900,2150);
-our $MdcHVOffsetLimits = [[5,10,55],[5,10,55],[5,10,55],[10,110,125]];
+our $MdcHVOffsetLimits = [[5,10,255],[5,10,255],[5,10,255],[10,110,325]];
our @EcalHvLimits = (493,325,320);
our @RpcHvLimits = (12,12,12);
our @TofHvLimits = (764,760,759);
# Missing Boards
###############################################################################
-our @mdc_boards_removed =(); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
+our @mdc_boards_removed =(0x2203); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
our @mdc_chambers_removed =();
our @rich_boards_removed =();
our @tof_boards_removed =();
return sprintf("%.1fM", $v / 1000000.) if (abs($v) < 20E6) ;
return sprintf("%iM", $v / 1000000.) if (abs($v) < 1E9) ;
return sprintf("%.2fG", $v / 1E9) if (abs($v) < 20E9) ;
+ return sprintf("%.1fG", $v / 1E9) if (abs($v) < 100E9) ;
return sprintf("%i",$v);
}
else {
<h4>Additional notes</h4>
+<br><b>Note that in many cases this is not the real source of the error - </b>
+e.g. if the data transport to EB failed, the board with the smallest
+buffer and the most data gets busy first.
<ul>
<li>If the misbehaving board is from MDC and the error happens several times for the same board,
do a MDC power-cycle of the corresponding chamber.
<li>If the board is from MDC, and there is a "FEE Error" at the same time, an MDC LV power-cycle is needed.
-<li>If the board is from another system* and fails several times, try a reboot of the corresponding system.
+<li>If the board is from another system* and fails several times, try a reboot (and then a powercycle of the corresponding system.
+<li>If reboot doesn't help, do a power cycle of the corresponding system.
</ul>
-<br><b>Note that in many cases this is not the real source of the error - </b>
-e.g. if the data transport to EB failed, the board with the smallest
-buffer and the most data gets busy first.
<p>*The list of addresses can be found on the main monitoring web page.
<p>
The number of accepted events (written to disk) with errors reported by the front-ends.
<h4>Error handling</h4>
-<br>Try to do a DAQ restart
+Check the long error message for the subsystems that cause the most errors, then try to solve these.
+
+<br><b>Partially Missing</b> errors usually refer to a detector with a lot of noise, try to reload thresholds for the corresponding detector. A few errors of this type are perfectly normal.
+<br><b>TriggerNumberMismatch TriggerCodeMismatch</b> errors are usually a problem in the hubs - if a DAQ restart doesn't help, try a reboot of the corresponding hubs (in RICH: combiners, or hubs).
+<br><b>TimingTriggerError</b> A board has problems receiving the reference time for the event. Check the "Trigger" box for more details.
+<br>If the reason is unclear, try to do a DAQ restart
<br>In some cases a reload or power-cycle of the corresponding system / chamber is necessary.
+<br>Error counters are cleared at DAQ restart. If you want to clear them manually, use the Eventbuilder GUI and click the "Hist" button.
+
+
<h3>Number of discarded events</h3>
<p>
-This button gives you the number of discarded events in the Eventbuilders. Few discarded events (<1%) are fine.
+This button gives you the number of discarded events in the Eventbuilders. Few discarded events (<1%) are acceptable.
</p>
<h4>Error Handling</h4>
<dl>
<dt>Check the datarate that is delivered by DAQ</dt>
<dd> If many events are lost, the EB might be overloaded. Check that the trigger rate is about the expected value.</dd>
-<dd>Check that the number of eventbuilders can handle the intended datarate. Beam runs require at least 4 builder nodes, 8 is usual. Try to increase the number of event builders using the buttons "Set x EB" in the operator GUI</dd>
+<dd>Check that the number of eventbuilders can handle the intended datarate. Beam runs require at least 10 builder nodes. Try to increase the number of event builders using the buttons "Set x EB" in the operator GUI</dd>
<dd> Check in the EB summary that writing data to local disk and TSM/lustre is working. There might be backpressure if too much data is written to tape. Try reducing the trigger rate.</dd>
<dt>Restart the Eventbuilders</dt>
<h3>Number of running Eventbuilders</h3>
<p>
-Shown is the number of input nodes (i:5) and builder nodes (b:8) of the buider network BNET.<br>
-The input nodes are the data receivers from the detector front-ends. Their number should be always 5. <br>
+Shown is the number of input nodes (i:7) and builder nodes (b:10) of the buider network BNET.<br>
+The input nodes are the data receivers from the detector front-ends. Their number should be always 7. <br>
The builder nodes are the parallel Eventbuilders writing data to disc. Their number depends on the setup: <br>
-(Cosmics: 1 EB, Beamtime: 8 EB) Number of builders may be changed with the "Set x EB" button on operator GUI <br>
+(Cosmics: 1 EB, Beamtime: 10 EB) Number of builders may be changed with the "Set x EB" button on operator GUI <br>
Also shown is the file prefix currently written ("be"). <b>For data taking with beam this should be "be"</b>
</p>
--- /dev/null
+<h3>RPC Thresholds</h3>
+Monitors the noise level in TOF. Sometimes noise in a part of the detector gets too high because of problems with the thresholds. Problems should also be visible in the rate plots for the detector (in one of the main operator windows).
+<h4>Error Handling</h4>
+Use "Thresholds TOF" to reload the proper settings. A DAQ restart is not needed.
+<br>If the situation doesn't change, inform the TOF operator.
my $maxpercent = max(@{$diff->{0x8000}});
my $msgstr = sprintf("%3.1f%%",$maxpercent);
my $qastate = QA::OK;
- $qastate = QA::WARN if ($maxpercent > 50);
- $qastate = QA::WARN_2 if ($maxpercent > 75);
+ $qastate = QA::WARN if ($maxpercent > 70);
+ $qastate = QA::WARN_2 if ($maxpercent > 80);
$qastate = QA::ERROR if ($maxpercent > 99);
QA::WriteQALog($fqa,"daq","busy",5,$qastate,"Busy",$msgstr,"") unless ($maxpercent >= 99);
}
$store->{$k}->{$b},
$perc,
$bits[$b]);
- $longstring .= $ts;
+ $longstring .= $ts."<br>";
$brokenevents += $store->{$k}->{$b};
}
}
$longstring = "Total Events in file: ".($store->{TRB_8800}->{0} || "")." - ".
"Events with errors: ".$value." - ".
$longstring;
- chop $longstring;chop $longstring;chop $longstring;
+ chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;
print "$longstring \n" if $opt_debug;
$qastate = QA::GetQAState('below', $sumperc, @QA::Eventsbroken);
QA::WriteQALog($flog, "eb", "errbits", 10,
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use POSIX qw(strftime);
+my $fh;
+
+
+trb_init_ports() or die trb_strerror();
+my $inspill;
+while (1) {
+ do{{
+ sleep(1);
+ my $o = trb_register_read(0x10,0x905d);
+ $inspill = $o->{0x10} >> 31;
+# print ".\n";
+ }}while($inspill);
+
+ system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds.pl");
+
+# system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_sec2_sec4.pl");
+
+
+ sleep(15);
+ }
-#!/usr/bin/perl
+#!/usr/bin/perl -w
use strict;
use warnings;
use Getopt::Long;
use Data::Dumper;
use List::MoreUtils qw(uniq);
+use List::Util qw(max);
use HADES::TrbNet;
trb_init_ports() or die trb_strerror();
my @sorted_mdc_results = sort @{$mdc_results[2]};
$mdcmissingtime = 0 if $num_mdc_missing == 0;
- $mdcmissingtime += $num_mdc_missing;
+ $mdcmissingtime += max(0,$num_mdc_missing-2);
#Are two boards from the same chamber missing?
my @mdcboards = @sorted_mdc_results;
my $samechamberboards = 0;
if(scalar @mdcboards != scalar @uniqchambers) {$samechamberboards = 1;}
+ #Are two boards from the same sector missing?
+ chop(@mdcboards);
+ @uniqchambers = uniq @mdcboards;
+ my $samesectorboards = 0;
+ if(scalar @mdcboards != scalar @uniqchambers) {$samesectorboards = 1;}
+
print $fh "$num_mdc_missing\n";
$fh->autoflush(1);
seek($fh, 0, 0);
my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits);
$qastate = QA::ERROR if $samechamberboards;
+ $qastate = QA::WARN if $samesectorboards;
$qastate = QA::ERROR if $mdcmissingtime > 360;
- $longtext .= "<br>Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 1800;
+ $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 );
ymax => -0.5,
xmin => -0.5,
xmax => 15.5,
- cbmax => "100<*<1E5",
+ cbmax => "100<*<1E7",
cbmin => 0,
noinit => 1,
additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
ymax => -0.5,
xmin => -0.5,
xmax => 15.5,
-cbmax => "100<*<1E5",
+cbmax => "100<*<1E7",
cbmin => 0,
noinit => 1,
additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use POSIX qw(strftime);
+my $fh;
+
+
+trb_init_ports() or die trb_strerror();
+my $inspill;
+while (1) {
+ do{{
+ sleep(1);
+ my $o = trb_register_read(0x10,0x905d);
+ $inspill = $o->{0x10} >> 31;
+# print ".\n";
+ }}while($inspill);
+
+
+ my $o = trb_register_read_mem(0xfe47,0xdfc0,0,32);
+ sleep 1;
+ my $p = trb_register_read_mem(0xfe47,0xdfc0,0,32);
+ my @diff;
+ foreach my $b (sort keys %$p) {
+ next if ($b < 0x6800 || $b > 0x6813);
+ for my $v (0..31) {
+ my $d = ($p->{$b}[$v]&0xffffff)-($o->{$b}[$v]&0xffffff);
+ $d += 2**24 if $d < 0;
+ push(@diff, $d);
+ }
+ }
+my $day = strftime("%Y%m%d",localtime());
+
+ my $str = "";
+ $str .= strftime("%Y.%m.%d %H:%M:%S",localtime())."\t";
+ $str .= time()."\t";
+ for my $i (0..scalar @diff -1) {
+ $str .= sprintf("%u\t",$diff[$i]);
+ }
+ $str .= "\n";
+ open($fh, ">>",Hmon::HMONDIR."/archive/frpcscalerlog-$day.csv");
+ print $fh $str;
+# print $str;
+ close $fh;
+ sleep(50);
+ }
$state, 'PT3 Rate', $shorttext, $longtext);
$state = QA::OK;
+# $state = QA::WARN_2 if $offset->{0xa025} > 100;
$shorttext = QA::SciNotation($store{0xa025})." / ".getCorrected($store{0xa025},$offset->{0xa025});
$longtext = sprintf("Trigger Rate from PT2 %i Hz / %i Hz after offset correction",$store{0xa025}, getCorrectedValue($store{0xa025},$offset->{0xa025}) );
QA::WriteQALog($fqa, "rate", "pt2", 10,
HPlot::PlotDraw("EvtsPerSpill") unless $opt_debug>0;
$events = 0;
$spilllength = 0;
- } elsif ($spilllength > 20) {
+ } elsif ($spilllength > 30) {
QA::WriteQALog($fqa, "trg", "spill", 30, QA::NOTE, "Spill Sum",
"No Spills", "No Spills detected at the moment") unless $opt_debug>0;;
#print $spilllength."\n" unless $spilllength%10;
my $plot7a = {
name => "StartRateY_histbar_short",
file => "files/StartRateY_histbar_short",
- entries => 200,
+ entries => 400,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 200,
+ xmax => 400,
ymin => "0",
ymax => "100<*",
curves => 12,
my $empties_y_1 = 0;
-my($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $spillEnds_x_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
-my($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $spillEnds_y_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+my($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $spillEnds_x_0, $avgRate_x_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
+my($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $spillEnds_y_0, $avgRate_y_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
-my($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $spillEnds_x_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
-my($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $spillEnds_y_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+my($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $spillEnds_x_1, $avgRate_x_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
+my($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $spillEnds_y_1, $avgRate_y_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
my $maxTotalX;
my $maxTotalY;
$spillends = $inspill == 0 && $lastinspill == 1;
if($spillends){
- ($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $time_x_0, $empties_x_0, $spillEnds_x_0) = spillAnalysisACCSIG(\@totalDetectorHitsX_0, \@lastspills_x_0, $time_x_0, $empties_x_0);
+ ($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $time_x_0, $empties_x_0, $spillEnds_x_0, $avgRate_x_0) = spillAnalysisACCSIG(\@totalDetectorHitsX_0, \@lastspills_x_0, $time_x_0, $empties_x_0);
$maxTotalX= calculateMaximumRate(\@totalDetectorHitsX_0,\@totalDetectorHitsX_1);
$maxTotalY= calculateMaximumRate(\@totalDetectorHitsY_0,\@totalDetectorHitsY_1);
@totalDetectorHitsX_0 = ();
- ($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0,$time_y_0, $empties_y_0, $spillEnds_y_0) = spillAnalysisACCSIG(\@totalDetectorHitsY_0, \@lastspills_y_0, $time_y_0, $empties_y_0);
+ ($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $time_y_0, $empties_y_0, $spillEnds_y_0, $avgRate_y_0) = spillAnalysisACCSIG(\@totalDetectorHitsY_0, \@lastspills_y_0, $time_y_0, $empties_y_0);
@totalDetectorHitsY_0 = ();
# added W.K. 01.2.22 to include values of whole detector in plots
- ($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $time_x_1, $empties_x_1, $spillEnds_x_1) = spillAnalysisACCSIG(\@totalDetectorHitsX_1, \@lastspills_x_1, $time_x_1, $empties_x_1);
+ ($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $time_x_1, $empties_x_1, $spillEnds_x_1, $avgRate_x_1) = spillAnalysisACCSIG(\@totalDetectorHitsX_1, \@lastspills_x_1, $time_x_1, $empties_x_1);
@totalDetectorHitsX_1 = ();
- ($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1,$time_y_1, $empties_y_1, $spillEnds_y_1) = spillAnalysisACCSIG(\@totalDetectorHitsY_1, \@lastspills_y_1, $time_y_1, $empties_y_1);
+ ($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $time_y_1, $empties_y_1, $spillEnds_y_1, $avgRate_y_1) = spillAnalysisACCSIG(\@totalDetectorHitsY_1, \@lastspills_y_1, $time_y_1, $empties_y_1);
@totalDetectorHitsY_1 = ();
# HPlot::PlotAdd("StartSpillSumX_0", $total_x_0,0);
# changed W.K 01.02.22 max_x and total_x for whole detector
- HPlot::PlotAdd("StartDutyFactorX_0", $duty_x_0,0);
+ HPlot::PlotAdd("StartDutyFactorX_0", ($avgRate_x_0+$avgRate_x_1)/$maxTotalX,0);
HPlot::PlotAdd("StartSpillPeakX_0", $maxTotalX,0);
HPlot::PlotAdd("StartSpillSumX_0", $total_x_0+$total_x_1,0);
# end changed
# $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_x_0);
# changed W.K. 01.02.22 total spill sum total_x=total_x_1+total_x_0
- $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $maxTotalX);
+# $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $maxTotalX);
+ $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $total_x_0+$total_x_1);
# end changed
- $str .= "<td>Last Duty<td>".sprintf("%0.3f",$duty_x_0);
+ $str .= "<td>Last Duty<td>".sprintf("%0.3f",($avgRate_x_0+$avgRate_x_1)/$maxTotalX);
$str .= "<tr><td>Last Duration<td>".$length_x_0;
$str .= "<td>Last Break<td>".$offtime_x_0." s";
# $str .= "<tr><td>Last Max<td>".QA::SciNotation($max_x_0)." Hz (100ms)";
# HPlot::PlotAdd("StartSpillPeakY_0", $max_y_0,0);
# HPlot::PlotAdd("StartSpillSumY_0", $total_y_0,0);
# changed W.K 01.02.22
- HPlot::PlotAdd("StartDutyFactorY_0", $duty_y_0,0);
+ HPlot::PlotAdd("StartDutyFactorY_0", ($avgRate_y_0+$avgRate_y_1)/$maxTotalY,0);
HPlot::PlotAdd("StartSpillPeakY_0",$maxTotalY,0);
HPlot::PlotAdd("StartSpillSumY_0", $total_y_0+$total_y_1,0);
# end changed
# $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_x_0);
# changed W.K. 01.02.22
- $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($maxTotalY);
+# $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($maxTotalY);
+ $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_y_0+$total_y_1);
# end changed
- $str .= "<td>Last Duty<td>".sprintf("%0.3f",$duty_y_0);
+ $str .= "<td>Last Duty<td>".sprintf("%0.3f",($avgRate_y_0+$avgRate_y_1)/$maxTotalY);
$str .= "<tr><td>Last Duration<td>".$length_y_0;
$str .= "<td>Last Break<td>".$offtime_y_0." s";
# $str .= "<tr><td>Last Max<td>".QA::SciNotation($max_y_0)." Hz (100ms)";
my @totalDetectorHits = @{$totalDetectorHitsReference};
my @lastSpills = @{$lastSpillReference};
- my ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length, $spillEnds) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+ my ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length, $spillEnds, $avg) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
#end of spill signaled by last 15 readouts having an average below spillThreshold entries and the one before having more
# if($inspill == 0 && $lastinspill == 1){
$max = max(@totalDetectorHits);
my $samples = scalar @totalDetectorHits;
- my $avg = sum(@totalDetectorHits)/$samples;
+ $avg = sum(@totalDetectorHits)/$samples;
$duty = $avg/($max||1);
$total = sum(@totalDetectorHits)/$samplesPerSecond;# sum and mulitply by bin width -> Integral. Gives total hits in a spill
# @totalDetectorHits = ();
# $lastinspill = $inspill;
- return ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length,$time, $empties, 1);
+ return ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length,$time, $empties, 1, $avg);
# }
# $lastinspill = $inspill;
# return (0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
ymax => -0.5,
xmin => -0.5,
xmax => 15.5,
- cbmax => "100<*<1E5",
+ cbmax => "100<*<1E8",
cbmin => 0,
noinit => 1,
additional => "set logscale cb; unset ytics;set format cb \"_{10}{\%L}\"",
ymax => -0.5,
xmin => -0.5,
xmax => 47.5,
-cbmax => "100<*<1E5",
+cbmax => "100<*<1E7",
cbmin => 0,
noinit => 1,
additional => "set logscale cb;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5, '40' 39.5); set grid xtics front;",
use Encode qw(encode from_to);
use JSON::XS;
+my $fqa = QA::OpenQAFile();
+
my $plot1 = {
name => "TofRate",
my $diff;
my $iter = 0;
+my $lowratelimit = 200;
+my $highratelimit = 50000;
+my $lowratecount = 500;
+my $highratecount = 30;
+my $qastate = QA::OK;
+my $text = "OK";
+my $shorttext = "OK";
trb_init_ports() or die trb_strerror();
#my $data;
#my $max = 0 ;
#my $min = 5E9;
-
+ my $lowrate = 0; my $highrate = 0;
my $o = trb_register_read_mem(0xfe47,0xdfc0,0,32) or die trb_strerror() or sleep 5 and next;
if (defined $old) {
if ($vdiff < 0) { $vdiff += 2**28;}
$diff->{$b}->[$v] = $vdiff/$tdiff;
- #$ratesum += $diff->{$b}->[$v+1];
HPlot::PlotFill('TofRate',$diff->{$b}->[$v],$v,$xpos);
+
+ $highrate++ if ($diff->{$b}->[$v] > $highratelimit);
+ $lowrate++ if ($diff->{$b}->[$v] < $lowratelimit);
}
- #my $s = sprintf("0x%04x",$b);
- #$data->{$s}= int(100*($ratesum / 32) +0.5) /100;
-
- #$min = $data->{$s} if $data->{$s} < $min;
- #$max = $data->{$s} if $data->{$s}> $max;
}
HPlot::PlotDraw('TofRate');
-
-
-
- # $data->{max} = $max;
- # $data->{min} = $min;
- # $data->{symbol} = " Hits/s";
- # $data->{title} = "Mean DiRICH TDC Rate";
-
-
- # $data->{updatetime} = getTimeString;
-
- # my $fh;
- # open($fh, ">", Hmon::HMONDIR."/files/richMeanRateDiRICH.json");
- # print $fh encode_json($data);
- # close $fh;
+
}
+
+ if($lowrate > $lowratecount) {
+
+ $qastate = QA::OK;
+ $text = "OK";
+ $shorttext = "OK";
+ if ($highrate > $highratecount) {
+ $qastate = QA::ERROR;
+ $shorttext = "Problem";
+ $text = "Some TOF channels seem to have too high rates.";
+ }
+
+ QA::WriteQALog($fqa,"feeerr","tof", 60, $qastate, "TOF Thresh", $shorttext, $text);
+ }
+
+
$old = $o;
$oldtime = time();
sleep 2;
QA::WriteQALog($fqa, "trg", "source", 10, $qastate, "Trigger Source", $msg, $longmsg);
QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT3", $accmsg, $acclmsg);
- my $qastatept = QA::OK;
- my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
- if ($ptoverStattart > 100) {$ptoverStattart = 100;}
-######################################
-## QA check for PT3/Start rate
- if ($ptoverStattart > 100 || $ptoverStattart < 0) {
- $qastatept = QA::WARN;
- }
-######################################
- my $ptmsg = "";
- $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x24]),$ptoverStattart) if $ptoverStattart<=10;
- $ptmsg = sprintf("%i/s / %1.1f%%",$rStat->{3}->[0x26],$ptoverStattart) if $ptoverStattart> 10;
- my $ptlongmsg = sprintf("PT1 counts per second: %i - PT1 / Start: %1.2f%%", $rStat->{3}->[0x24], $ptoverStattart);
+# my $qastatept = QA::OK;
+# my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
+# if ($ptoverStattart > 100) {$ptoverStattart = 100;}
+# ######################################
+# ## QA check for PT3/Start rate
+# if ($ptoverStattart > 100 || $ptoverStattart < 0) {
+# $qastatept = QA::WARN;
+# }
+# ######################################
+# my $ptmsg = "";
+# $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x24]),$ptoverStattart) if $ptoverStattart<=10;
+# $ptmsg = sprintf("%i/s / %1.1f%%",$rStat->{3}->[0x26],$ptoverStattart) if $ptoverStattart> 10;
+# my $ptlongmsg = sprintf("PT1 counts per second: %i - PT1 / Start: %1.2f%%", $rStat->{3}->[0x24], $ptoverStattart);
# QA::WriteQALog($fqa, "trg", "ptrate", 10, $qastatept, "PT1 / Start", $ptmsg, $ptlongmsg);
- my $startsum = 0;
- my $qastatstart = QA::OK;
- my $startmsg = "";
- my $startlongmsg = "";
-
- foreach my $i (0..7) {
- $startsum += $rStat->{3}->[$i+0x8] ;
- }
- $spillsum += $startsum;
-
-# $startsum = $rStat->{3}->[0x29];
+# my $startsum = 0;
+# my $qastatstart = QA::OK;
+# my $startmsg = "";
+# my $startlongmsg = "";
+#
+# foreach my $i (0..7) {
+# $startsum += $rStat->{3}->[$i+0x8] ;
+# }
# $spillsum += $startsum;
-
-######################################
-## QA check for spill sum on Start
- if ($lastspillsum < 0 || $lastspillsum > 20E8) {
- $qastatstart = QA::WARN;
- }
-######################################
- if($outofspill && !$lastoutofspill ) {
- $lastspillsum = $spillsum;
- HPlot::PlotAdd("StartCountSpills",$spillsum/1E6);
- HPlot::PlotDraw("StartCountSpills");
- $spillsum = 0;
- }
- $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
- $startlongmsg = sprintf("counts per second %s/s - counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
- QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
-
-
+#
+# # $startsum = $rStat->{3}->[0x29];
+# # $spillsum += $startsum;
+#
+# ######################################
+# ## QA check for spill sum on Start
+# if ($lastspillsum < 0 || $lastspillsum > 20E8) {
+# $qastatstart = QA::WARN;
+# }
+# ######################################
+# if($outofspill && !$lastoutofspill ) {
+# $lastspillsum = $spillsum;
+# HPlot::PlotAdd("StartCountSpills",$spillsum/1E6);
+# HPlot::PlotDraw("StartCountSpills");
+# $spillsum = 0;
+# }
+# $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
+# $startlongmsg = sprintf("counts per second %s/s - counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
+# QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
+#
+#
if ($lastlongmsg ne $longmsgcheck && $longmsg ne "") {
my $STARTRATELIMIT = 50000;
my $UPPERLIMIT = 0.03;
-my $oldtb;
+my $UPPERLIMIT_PT3 = 0.004;
+my $oldtb; my $oldst;
my $diff;
my $iter = 0;
my $vdiff;
storable => 1,
});
+HPlot::PlotInit({
+ name => "Pt3StartRatio",
+ file => "files/Pt3StartRatio",
+ entries => 1000,
+ type => HPlot::TYPE_HISTORY,
+ output => HPlot::OUT_PNG,
+ xlabel => "Time",
+ ylabel => "Ratio",
+ sizex => 950,
+ sizey => 330,
+ ymin => -0.001,
+ ymax => "$UPPERLIMIT_PT3"."1",
+ xscale => 5,
+ curves => 2,
+ buffer => 1,
+ nokey => 1,
+ dots => 1,
+ storable => 1,
+ });
+
HPlot::PlotInit({
name => "M2Rate",
file => "files/M2Rate",
# dots => 1,
storable => 1,
});
+
-my $str = Hmon::MakeTitle(12, 7, "M2 / Start Ratio",0);
+HPlot::PlotInit({
+ name => "StartCountSpills",
+ file => "files/StartCountSpills",
+ entries => 100,
+ type => HPlot::TYPE_HISTORY,
+ output => HPlot::OUT_PNG,
+ xlabel => "Spill Number",
+ ylabel => "Start Counts per Spill [Mcnt]",
+ sizex => 630,
+ sizey => 220,
+ nokey => 1,
+ buffer => 1,
+ storable => 1,
+ });
+
+my $str = Hmon::MakeTitle(8,5,"Start X Counts per Spill (millions)",0);
+ $str .= qq@<img src="%ADDPNG files/StartCountSpills.png%" type="image/png">@;
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("StartCountSpill",$str);
+
+
+ $str = Hmon::MakeTitle(12, 7, "M2 / Start Ratio",0);
$str .= qq@<img src="%ADDPNG files/M2StartRatio.png%" type="image/png"><br>\n@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("M2StartRatio",$str);
-
+
+ $str = Hmon::MakeTitle(12, 7, "PT3 / Start Ratio",0);
+ $str .= qq@<img src="%ADDPNG files/Pt3StartRatio.png%" type="image/png"><br>\n@;
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("Pt3StartRatio",$str);
+
$str = Hmon::MakeTitle(12, 7, "M2 Rate",0);
$str .= qq@<img src="%ADDPNG files/M2Rate.png%" type="image/png"><br>\n@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("M2Rate",$str);
trb_init_ports() or die trb_strerror();
+my $fqa = QA::OpenQAFile();
+
+my $spillsumstart = 0;
+my $lastinspill = 0;
+my $lastspillsumstart = 0;
while (1) {
my $tb = trb_registertime_read_mem(0x10,0x9000,0,224);
-
+ my $st = trb_registertime_read_mem(0xfe76,0xdfc0,0,24);
+
my $inspill = $tb->{0x10}{value}[0x5d] >> 31;
if (defined $oldtb) {
$tdiff += 2**16 if ($tdiff <= 0);
$tdiff = ($tdiff * 16 / 1E6) || 1;
for my $v (0..223) {
- $vdiff = ($tb->{$b}{value}[$v]&0xffffff) - ($oldtb->{$b}{value}[$v]&0xffffff);
+ $vdiff = (($tb->{$b}{value}[$v]||0)&0xffffff) - (($oldtb->{$b}{value}[$v]||0)&0xffffff);
$vdiff += 2**24 if ($vdiff < 0);
$diff->{$b}->[$v] = $vdiff/$tdiff;
}
}
-
+ foreach my $b (keys %$st) {
+ next if ($b < 0x5000 || $b > 0x5003);
+ my $tdiff = $st->{$b}{time}[0] - ($oldst->{$b}{time}[0]||0);
+ $tdiff += 2**16 if ($tdiff <= 0);
+ $tdiff = ($tdiff * 16 / 1E6) || 1;
+ for my $v (0..23) {
+ $vdiff = (($st->{$b}{value}[$v]||0)&0xffffff) - (($oldst->{$b}{value}[$v]||0)&0xffffff);
+ $vdiff += 2**24 if ($vdiff < 0);
+ $diff->{$b}->[$v] = $vdiff/$tdiff;
+ }
+ }
+ my $startdirect = sum(@{$diff->{0x5000}},@{$diff->{0x5001}},@{$diff->{0x5002}},@{$diff->{0x5003}});
my $start = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79]); #sum from start
my $m2 = $diff->{0x10}[0x50];
-
+ my $pt3 = $diff->{0x10}[218];
+
+# print $startdirect." ".$start."\n";
+###Ratio M2 over Start
my $ratio = $m2/($start||1);
if ($start <= $STARTRATELIMIT || !$inspill) {
HPlot::PlotAdd("M2StartRatio",0,1);
HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1);
HPlot::PlotAdd("M2StartRatio","NaN",0)
}
-
else {
HPlot::PlotAdd("M2StartRatio","NaN",1);
HPlot::PlotAdd("M2StartRatio",$ratio,0)
}
-
+
+###Ratio PT3 over Start
+ $ratio = $pt3/($start||1);
+ if ($start <= $STARTRATELIMIT || !$inspill) {
+ HPlot::PlotAdd("Pt3StartRatio",0,1);
+ HPlot::PlotAdd("Pt3StartRatio","NaN",0)
+ }
+ elsif ($ratio >= $UPPERLIMIT_PT3) {
+ HPlot::PlotAdd("Pt3StartRatio",$UPPERLIMIT_PT3,1);
+ HPlot::PlotAdd("Pt3StartRatio","NaN",0)
+ }
+ else {
+ HPlot::PlotAdd("Pt3StartRatio","NaN",1);
+ HPlot::PlotAdd("Pt3StartRatio",$ratio,0)
+ }
+
+###M2 Rate
if (!$inspill) {
HPlot::PlotAdd("M2Rate",0,1);
HPlot::PlotAdd("M2Rate","NaN",0)
}
-# elsif ($ratio >= $UPPERLIMIT) {
-# HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1);
-# HPlot::PlotAdd("M2StartRatio","NaN",0)
-# }
else {
HPlot::PlotAdd("M2Rate","NaN",1);
HPlot::PlotAdd("M2Rate",$m2,0)
}
- if($iter++ == 5){
+ if($iter == 4){
HPlot::PlotDrawFork("M2StartRatio");
+ HPlot::PlotDrawFork("Pt3StartRatio");
HPlot::PlotDrawFork("M2Rate");
- $iter = 0;
}
+
+###Spill Sum from Start
+ if(!$inspill && $lastinspill) {
+ $lastspillsumstart = $spillsumstart / 5; #DIVIDED BY 200ms period!
+ $spillsumstart = 0;
+ HPlot::PlotAdd("StartCountSpills",$lastspillsumstart/1E6);
+ HPlot::PlotDrawFork("StartCountSpills");
+ }
+ if($inspill) {
+ $spillsumstart += $start;
+ }
+
+ if($iter==5) {
+ my $qastatstart = QA::OK;
+ my $startmsg = "";
+ my $startlongmsg = "";
+ if ($lastspillsumstart < 10000 || $lastspillsumstart > 20E8) {
+ $qastatstart = QA::WARN;
+ }
+ $startmsg = sprintf("%s / %s",QA::SciNotation($start),QA::SciNotation($lastspillsumstart));
+ $startlongmsg = sprintf("counts per second %s/s - counts per spill %s",QA::SciNotation($start),QA::SciNotation($lastspillsumstart));
+ QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
+ }
+
+
}
$oldtb = $tb;
+ $oldst = $st;
+ $lastinspill = $inspill;
+ $iter++;
+ $iter = 0 if $iter == 6;
+ print time()."\n";
usleep(200000);
}
<li><a href="../daqtools/index.pl" target="_blank">Web Tools (daqtools)</a></li>
<li><a href="../eb/?browser=fix" target="_blank">Eventbuilder Monitor</a></li>
<li><a href="../rawmon/" target="_blank">Raw Data Monitor</a></li>
-<li class="outdated"><a href="/mon/files/runstatscompare.png" target="_blank">Accumulated Run Statistics</a>
+<li><a href="http://web-docs.gsi.de/~webhades/media/logbook/feb22/hades-online.html" target="_blank">Accumulated Run Statistics</a>
</ul></div>
<div class="linkbox" style="float:right"><h4>Documents</h4><ul>
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+binmode(STDOUT, ":utf8");
+binmode(STDIN, ":utf8");
+use open qw( :encoding(UTF-8) :std );
+use LWP;
+use IPC::Run3;
+use Data::Dumper;
+use Encode qw(encode from_to);
+use JSON;
+
+
+my $firstrun =1;
+my $command = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=FEB22&p_begin=&p_end=&p_num_days=&p_num_entries=8&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*' -u hades:6\\\$ectors 2>/dev/null";
+
+my $store;
+my $hash;
+$hash->{username}='daqi';
+
+while(1) {
+ my @res = qx($command); #webserver uses iso-8859-1 -(
+
+# print Dumper @res;
+# exit;
+ my ($date,$topic,$user,$text);
+
+ my $cnt = 0;
+ my $found = 0;
+
+ foreach my $line (@res) {
+ if ($line =~ /^\s*<tr>\s*$/) {$cnt = 0;$found=1;};
+ if ($line =~ /^<td>/ && $cnt == 2) { $date = stripped($line); $found++;}
+ if ($line =~ /^<td / && $cnt == 4) { $topic = stripped($line);$found++;}
+ if ($line =~ /^<td / && $cnt == 5) { $user = stripped($line); $found++;}
+ if ($line =~ /^<td / && $cnt == 6) { $text = stripped($line); $found++;}
+
+ if($found == 5 && $cnt == 6 && !$store->{$date}==1) {
+
+ $store->{$date} = 1;
+
+ if (!$firstrun) {
+ my $cmd = "pandoc --from html --to markdown_strict";
+ run3($cmd, \$text, \@ret);
+
+ my $string = "[$topic] **$user** ($date)\n";
+ $string .= join('',@ret);
+ print $string;
+
+ $hash->{text} = $string;
+ $string = encode_json($hash);
+
+ my $ua = LWP::UserAgent->new();
+ my $req = new HTTP::Request(
+ 'POST' => "https://coop.gsi.de/mm/hooks/85pmt5r7ypf9ibujt8keyjf3xh",
+ ['Content-Type' => 'application/json'],
+ $string
+ );
+ print Dumper $ua->request($req);
+
+# exit;
+ }
+ }
+ $found = 0 if $found == 5;
+ $cnt++;
+ }
+ $firstrun=0;
+ sleep 60;
+ }
+
+sub stripped {
+ my $str = $_[0];
+ $str =~ s!^<td>!!;
+ $str =~ s!^<td class="l">!!;
+ $str =~ s!</td>$!!;
+ $str =~ s!<br/>$!!;
+ chomp $str;
+ return $str;
+ }
+
my $ch_qastate = QA::OK;
my $chamberHVmin = min($data->{"$p-$s-0-V"}->{val},$data->{"$p-$s-1-V"}->{val});
- if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][0]) {$qastate = max($qastate,QA::WARN);}
- if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][1]) {$qastate = max($qastate,QA::WARN_2);}
- if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][2]) {$qastate = max($qastate,QA::ERROR);}
+ if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][0]) {$qastate = QA::WARN;}
+ if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][1]) {$qastate = QA::WARN_2;}
+ if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][2]) {$qastate = QA::ERROR;}
if ($ch_qastate >= QA::WARN_2) {
$errortimer[$chamnum]++;
$ch_qastate = QA::ERROR if $errortimer[$chamnum] > 220 ;
- $ch_qastate = QA::WARN_2 if $errortimer[$chamnum] <= 220 ;
+ $ch_qastate = QA::WARN if $errortimer[$chamnum] <= 220 ;
$chamberswitherror++ if $errortimer[$chamnum] > 10 ;
}
else {
my $flog = QA::OpenQAFile();
-my @lim = (2.96,2.96,2.7,2.6);
+my @lim = (2.96,2.96,2.96,2.96);
while(1) {
$out .= "<table>";
- my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.jpg | tail -n 5";
+ my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.gif | tail -n 5";
my @files = qx($cmd);
@files = reverse @files;
- $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.jpg | tail -n 5";
+ $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.gif | tail -n 5";
my @files2 = qx($cmd);
@files2 = reverse @files2;