From: Hadaq Hades Date: Tue, 10 Jul 2018 12:24:23 +0000 (+0200) Subject: update Hmon files X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=fd35b2f440cc8bb30ad5090b89192d9d2d944b6e;p=hadesdaq.git update Hmon files --- diff --git a/hmon/HPlot.pm b/hmon/HPlot.pm index f57e824..6a62172 100755 --- a/hmon/HPlot.pm +++ b/hmon/HPlot.pm @@ -15,7 +15,7 @@ use constant {OUT_PNG => 1, OUT_SVG => 2, #n/a OUT_SCREEN => 3}; #n/a -my @color= ('#2222dd','#dd2222','#22dd22','#dd8822','#dd22dd','#22dddd','#dddd22','#8888dd','#8822bb','#444444'); +my @color= ('#2222dd','#dd2222','#22dd22','#dd8822','#dd22dd','#22dddd','#dddd22','#8888dd','#8822bb','#444444','#2222dd','#dd2222','#22dd22','#dd8822','#dd22dd','#22dddd','#dddd22','#8888dd','#8822bb','#444444',); sub plot_write { my ($file,$str,$no) = @_; @@ -120,6 +120,7 @@ sub PlotInit { plot_write($fh,"set xlabel \"".$p->{$name}->{xlabel}."\"") if $p->{$name}->{xlabel}; plot_write($fh,"set ylabel \"".$p->{$name}->{ylabel}."\"") if $p->{$name}->{ylabel}; + plot_write($fh,"set cblabel \"".$p->{$name}->{cblabel}."\"") if $p->{$name}->{cblabel}; setranges($fh,'xrange',$p->{$name}->{xmin},$p->{$name}->{xmax}); setranges($fh,'yrange',$p->{$name}->{ymin},$p->{$name}->{ymax}); @@ -162,11 +163,11 @@ sub PlotInit { plot_write($fh, $p->{$name}->{plot_string}); } elsif ($p->{$name}->{type} == TYPE_BARGRAPH) { - my $stacked = $p->{$name}{stacked}?' rowstacked':''; - plot_write($fh,"set style fill solid 1.00 border -1"); + my $stacked = $p->{$name}{stacked}?'rowstacked':''; + plot_write($fh,"set style fill solid 1.00 "); plot_write($fh,"set grid noxtics ytics"); plot_write($fh,"set boxwidth ".($p->{$name}->{curvewidth}||4)." absolute"); - plot_write($fh,"set style histogram gap ".($p->{$name}->{bargap}||1).' '.$stacked); + plot_write($fh,"set style histogram ".$stacked." gap ".($p->{$name}->{bargap}||1)); if (defined $p->{$name}->{bartitle} && scalar @{$p->{$name}->{bartitle}}) { plot_write($fh,"set xtics (",1); for (my $j=0; $j{$name}->{bartitle}};$j++) { @@ -175,7 +176,7 @@ sub PlotInit { } plot_write($fh,") offset ".($p->{$name}->{xtickoffset}//0).",0 scale 0"); } - plot_write($fh,"set style histogram title offset character 0, 0, 0"); +# plot_write($fh,"set style histogram title offset character 0, 0, 0"); plot_write($fh,"set style data histograms"); plot_write($fh,$p->{$name}{additional}); #plot_write($fh,"plot ",1); diff --git a/hmon/QA.pm b/hmon/QA.pm index 82590b6..bef0f60 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -76,13 +76,13 @@ our @MdcOepLimits = (372, 372-1, 372-3); our @MdcVoltageLimits = (50, 60, 100); our @MdcLockLimits = (0, 3, 5); our @MdcTempLimits = (75, 80, 85); -our @RichInnerTempLimits = (31,32,33); +our @RichInnerTempLimits = (32.5,33,34); our @TrgErrLimits = (100, 1000, 10000); our @CPULimits = (95, 100, 100); our @TimeoutLimits = (0, 0, 1); our @LinkErrLimits = (50, 500, 1000); our @MdcEndpMissingLimits = (0, 1, 2); -our @RichEndpMissingLimits = (0, 2, 4); #!!!! +our @RichEndpMissingLimits = (23, 24, 25); #!!!! our @TofEndpMissingLimits = (0, 0, 0); our @RpcEndpMissingLimits = (0, 0, 1); our @OtherEndpMissingLimits = (0, 0, 0);#!!! diff --git a/hmon/hmon_diamond.pl b/hmon/hmon_diamond.pl old mode 100755 new mode 100644 diff --git a/hmon/hmon_micro.pl b/hmon/hmon_micro.pl index 631aa96..961acea 100755 --- a/hmon/hmon_micro.pl +++ b/hmon/hmon_micro.pl @@ -34,7 +34,7 @@ trb_init_ports() or die trb_strerror(); while (1) { trb_register_setbit(0x8880,0xcf8f,1); - my $a = trb_register_read(0x8880,0xcf82); + my $a = trb_register_read(0x8800,0xcf82); my $length = $a->{0x8880}; $length = 0 if(!defined $length); if($length > 0 && $length < 1E6) { diff --git a/hmon/hmon_nxyter_status.pl b/hmon/hmon_nxyter_status.pl old mode 100755 new mode 100644 diff --git a/hmon/hmon_rate2.pl b/hmon/hmon_rate2.pl index 92fecf2..cf59a94 100755 --- a/hmon/hmon_rate2.pl +++ b/hmon/hmon_rate2.pl @@ -138,21 +138,21 @@ while (1) { $state = QA::OK; $shorttext = QA::SciNotation($store{0xa029})." / ".getCorrected($store{0xa029},$offset->{0xa029}); - $longtext = sprintf("Trigger Rate from Hodoscope %i Hz / %i Hz after offset correction",$store{0xa029}, getCorrectedValue($store{0xa029},$offset->{0xa029}) ); + $longtext = sprintf("Trigger Rate from PT6 %i Hz / %i Hz after offset correction",$store{0xa029}, getCorrectedValue($store{0xa029},$offset->{0xa029}) ); QA::WriteQALog($fqa, "rate", "hodo", 10, - $state, 'Hodo Rate', $shorttext, $longtext); + $state, 'PT6 Rate', $shorttext, $longtext); $state = QA::OK; $shorttext = QA::SciNotation($store{0xa02a})." / ".getCorrected($store{0xa02a},$offset->{0xa02a}); - $longtext = sprintf("Trigger Rate from Pion 2: %i Hz / %i Hz after offset correction",$store{0xa02a}, getCorrectedValue($store{0xa02a},$offset->{0xa02a}) ); - QA::WriteQALog($fqa, "rate", "pion2", 10, - $state, 'Pion2 Rate', $shorttext, $longtext); + $longtext = sprintf("Trigger Rate from PT7: %i Hz / %i Hz after offset correction",$store{0xa02a}, getCorrectedValue($store{0xa02a},$offset->{0xa02a}) ); + QA::WriteQALog($fqa, "rate", "pion1", 10, + $state, 'PT7 Rate', $shorttext, $longtext); $state = QA::OK; $shorttext = QA::SciNotation($store{0xa02b})." / ".getCorrected($store{0xa02b},$offset->{0xa02b}); - $longtext = sprintf("Trigger Rate from Pion 1: %i Hz / %i Hz after offset correction",$store{0xa02b}, getCorrectedValue($store{0xa02b},$offset->{0xa02b}) ); - QA::WriteQALog($fqa, "rate", "pion1", 10, - $state, 'Pion1 Rate', $shorttext, $longtext); + $longtext = sprintf("Trigger Rate from PT8: %i Hz / %i Hz after offset correction",$store{0xa02b}, getCorrectedValue($store{0xa02b},$offset->{0xa02b}) ); + QA::WriteQALog($fqa, "rate", "pion2", 10, + $state, 'PT8 Rate', $shorttext, $longtext); $state = QA::OK; $shorttext = QA::SciNotation($store{0xa024})." / ".getCorrected($store{0xa024},$offset->{0xa024}); diff --git a/hmon/hmon_richMagnet.pl b/hmon/hmon_richMagnet.pl new file mode 100755 index 0000000..79e637f --- /dev/null +++ b/hmon/hmon_richMagnet.pl @@ -0,0 +1,94 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + + +#my $flog = Hmon::OpenLogfile(); +#my $fqa = QA::OpenQAFile(); + +use HADES::TrbNet; + +my $plot1 = { +name => "RichMagnet", +file => "files/RichMagnet", +title => "RICH MagnetSensors", +entries => 6, +curves => 4, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "B [uT]", +sizex => 500, +sizey => 400, +nokey => 1, +buffer => 1, +xmin => -0.5, +xmax => 5.5, +xlabel => "RICH Arm number", +ylabel => "Sensor Number on Board", +ymin => -0.5, +ymax => 3.5, +cbmax => "100<*<1E5", +cbmin => 0, +cblabel => "B [uT]", +noinit => 1, +additional => "", +showvalues => 0, }; +HPlot::PlotInit($plot1); + +my $str = Hmon::MakeTitle(7, 9, "RICH Magnet",0); +$str .= qq@
\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("RichMagnet",$str); + + +trb_init_ports() or die trb_strerror(); + +my @calib = (((65.000,34.500,245.024),(-78.500,-20.000,-33.046),(-17.000,-33.000,-112.034),(2.5000,-24.000,43.524)),((106.000,-24.500,210.366),(-34.000,-60.500,-142.662),(114.000,-59.000,5.642),(73.000,-84.000,166.036)),((-31.000,-120.500,-156.364),(8.500,-85.000,-14.508),(54.500,-60.000,-96.790),(60.500,-108.500,-27.404)),(0,1,2,3),(0,1,2,3),(0,1,2,3)); +while(1){ + my $count = 0; + my $data; + my $rich = trb_register_read_mem(0x0110, 0xe010,0,0x60) or sleep 5 and next; + print Dumper $rich; + + foreach my $b (@{$rich->{0x0110}}) { + my $t; + my $val; + + if (($count % 4) == 0) { + $t = ($b & 0x3ffffff) / 100; + if ((($b >> 27)&0x1) == 1) {$t = $t * -1;} + $val = 0; + } else { + $t = ($b & 0x3ffffff) / 1000; + if ((($b >> 27)&0x1) == 1) {$t = $t * -1;} + $val += $t*$t; + } + printf("%.3f\n",$t); + if (($count % 4) == 3 ) { + my $sens = ($count % 16) / 4; + my $board = ($count / 16); + + my $s = sprintf("%1x%1x",$board,$sens); + $data->{$s}=sqrt($val); + + HPlot::PlotFill('RichMagnet',sqrt($val),$board,$sens);# + } + + + + $count ++; + } + + HPlot::PlotDraw('RichMagnet'); + + sleep 10; +} diff --git a/hmon/hmon_rich_temp_backplane.pl b/hmon/hmon_rich_temp_backplane.pl index 0853df2..18fbe2e 100755 --- a/hmon/hmon_rich_temp_backplane.pl +++ b/hmon/hmon_rich_temp_backplane.pl @@ -81,7 +81,7 @@ while (1) { #-------Interlock workaround-------# #var $Interlock = 0; - if ($max > 35.0 ) { + if ($max > 38.0 ) { #printf "Off\n"; #my $s = sprintf("HADES:RICH:HV:CR1:0:1000:PowerOn"); my $s = sprintf("HAD:RICH:PS:17:SETONOFF"); diff --git a/hmon/hmon_shower.pl b/hmon/hmon_shower.pl old mode 100755 new mode 100644 diff --git a/hmon/hmon_starthist.pl b/hmon/hmon_starthist.pl old mode 100644 new mode 100755 index 49bb985..4535aea --- a/hmon/hmon_starthist.pl +++ b/hmon/hmon_starthist.pl @@ -15,109 +15,108 @@ my $plots = fork(); if($plots) { my $i = 0; - $str = Hmon::MakeTitle(10,8,"Hodo Fine Histogram",0); + $str = Hmon::MakeTitle(10,8,"Mux A/B Histogram",0); $str .= qq@ @; $str .= Hmon::MakeFooter(); - Hmon::WriteFile("HodoFineHist",$str); + Hmon::WriteFile("MuxABHist",$str); -# -# while(1) { -# my $binning = trb_register_read(3,0xa0c8) or sleep 5 and next; -# my $offset = trb_register_read(3,0xa0c6) or sleep 5 and next; -# my $select = trb_register_read(3,0xa0da) or sleep 5 and next; -# -# # print $binning->{3}."\n"; -# $binning = $binning->{3}*100E-9; -# # print $binning."\n"; -# $binning = QA::SciNotation($binning); -# # print $binning."\n"; -# $offset = QA::SciNotation($offset->{3}*100E-9); -# my $selx = "err"; -# my $sely = "err"; -# $selx = "X 0-7" if ($select->{3} & 0x3) == 0; -# $selx = "X 4-11" if ($select->{3} & 0x3) == 1; -# $selx = "X 8-15" if ($select->{3} & 0x3) == 2; -# $sely = "Y 0-7" if ($select->{3} & 0xC) == 0; -# $sely = "Y 4-11" if ($select->{3} & 0xC) == 4; -# $sely = "Y 8-15" if ($select->{3} & 0xC) == 8; -# -# -# -# $str = Hmon::MakeTitle(10,16,"Start Histogram",0); -# $str .= qq@ -# Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely -#
-# -# @; -# $str .= Hmon::MakeFooter(); -# Hmon::WriteFile("Starthist",$str); -# -# $str = Hmon::MakeTitle(10,16,"Start Histogram",0); -# $str .= qq@ -# Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely -#
-# -# @; -# $str .= Hmon::MakeFooter(); -# Hmon::WriteFile("StarthistStacked",$str); -# -# sleep(5); -# } + + while(1) { + my $binning = trb_register_read(3,0xa0c8) or sleep 5 and next; + my $offset = trb_register_read(3,0xa0c6) or sleep 5 and next; + my $select = trb_register_read(3,0xa0da) or sleep 5 and next; + +# print $binning->{3}."\n"; + $binning = $binning->{3}*100E-9; +# print $binning."\n"; + $binning = QA::SciNotation($binning); +# print $binning."\n"; + $offset = QA::SciNotation($offset->{3}*100E-9); + my $selx = "err"; + my $sely = "err"; + $selx = "X 0-7" if ($select->{3} & 0x3) == 0; + $selx = "X 4-11" if ($select->{3} & 0x3) == 1; + $selx = "X 8-15" if ($select->{3} & 0x3) == 2; + $sely = "Y 0-7" if ($select->{3} & 0xC) == 0; + $sely = "Y 4-11" if ($select->{3} & 0xC) == 4; + $sely = "Y 8-15" if ($select->{3} & 0xC) == 8; + + + + $str = Hmon::MakeTitle(10,16,"Start Histogram",0); + $str .= qq@ + Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely +
+ + @; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("Starthist",$str); + + $str = Hmon::MakeTitle(10,16,"Start Histogram",0); + $str .= qq@ + Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely +
+ + @; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("StarthistStacked",$str); + + sleep(5); + } } else { - qx(./hmon_hadplot_old.sh -d 3000 \\ - -a 0x0003 -r 41216 -m 500 -p 0 -w 32 -t "MuxA" \\ - -a 0x0003 -r 41716 -m 500 -p 0 -w 32 -t "MuxB" \\ - -ytitle "Hits / bin" \\ - -output "PNG.files/hodofinehist.760.365" -curvestyle steps -key genreg 2>/dev/null & - ); + qx( + + ./hmon_hadplot.sh -d 3000 \\ + -a 0x0003 -r 42216 -m 500 -p 0 -w 32 -t "X 1" \\ + -a 0x0003 -r 42716 -m 500 -p 0 -w 32 -t "X 2" \\ + -a 0x0003 -r 43216 -m 500 -p 0 -w 32 -t "X 3" \\ + -a 0x0003 -r 43716 -m 500 -p 0 -w 32 -t "X 4" \\ + -a 0x0003 -r 44216 -m 500 -p 0 -w 32 -t "X 5" \\ + -a 0x0003 -r 44716 -m 500 -p 0 -w 32 -t "X 6" \\ + -a 0x0003 -r 45216 -m 500 -p 0 -w 32 -t "X 7" \\ + -a 0x0003 -r 45716 -m 500 -p 0 -w 32 -t "X 8" \\ + -output "PNG.files/starthistx0.760.365" -curvestyle steps -key genreg 2>/dev/null & + +./hmon_hadplot.sh -d 3000 \\ + -a 0x0003 -r 46216 -m 500 -p 0 -w 32 -t "Y 1" \\ + -a 0x0003 -r 46716 -m 500 -p 0 -w 32 -t "Y 2" \\ + -a 0x0003 -r 47216 -m 500 -p 0 -w 32 -t "Y 3" \\ + -a 0x0003 -r 47716 -m 500 -p 0 -w 32 -t "Y 4" \\ + -a 0x0003 -r 48216 -m 500 -p 0 -w 32 -t "Y 5" \\ + -a 0x0003 -r 48716 -m 500 -p 0 -w 32 -t "Y 6" \\ + -a 0x0003 -r 49216 -m 500 -p 0 -w 32 -t "Y 7" \\ + -a 0x0003 -r 49716 -m 500 -p 0 -w 32 -t "Y 8" \\ +-output "PNG.files/starthisty0.760.365" -curvestyle steps -key genreg 2>/dev/null & -# qx(./hmon_hadplot_old.sh -d 3000 \\ -# -a 0x0003 -r 42216 -m 500 -p 0 -w 32 -t "X 1" \\ -# -a 0x0003 -r 42716 -m 500 -p 0 -w 32 -t "X 2" \\ -# -a 0x0003 -r 43216 -m 500 -p 0 -w 32 -t "X 3" \\ -# -a 0x0003 -r 43716 -m 500 -p 0 -w 32 -t "X 4" \\ -# -a 0x0003 -r 44216 -m 500 -p 0 -w 32 -t "X 5" \\ -# -a 0x0003 -r 44716 -m 500 -p 0 -w 32 -t "X 6" \\ -# -a 0x0003 -r 45216 -m 500 -p 0 -w 32 -t "X 7" \\ -# -a 0x0003 -r 45716 -m 500 -p 0 -w 32 -t "X 8" \\ -# -output "PNG.files/starthistx0.760.365" -curvestyle steps -key genreg 2>/dev/null & -# -# ./hmon_hadplot_old.sh -d 3000 \\ -# -a 0x0003 -r 46216 -m 500 -p 0 -w 32 -t "Y 1" \\ -# -a 0x0003 -r 46716 -m 500 -p 0 -w 32 -t "Y 2" \\ -# -a 0x0003 -r 47216 -m 500 -p 0 -w 32 -t "Y 3" \\ -# -a 0x0003 -r 47716 -m 500 -p 0 -w 32 -t "Y 4" \\ -# -a 0x0003 -r 48216 -m 500 -p 0 -w 32 -t "Y 5" \\ -# -a 0x0003 -r 48716 -m 500 -p 0 -w 32 -t "Y 6" \\ -# -a 0x0003 -r 49216 -m 500 -p 0 -w 32 -t "Y 7" \\ -# -a 0x0003 -r 49716 -m 500 -p 0 -w 32 -t "Y 8" \\ -# -output "PNG.files/starthisty0.760.365" -curvestyle steps -key genreg 2>/dev/null & -# -# ./hmon_hadplot_old.sh -d 3000 \\ -# -a 0x0003 -r 42216 -m 500 -p 0 -w 32 -t "X 1" \\ -# -a 0x0003 -r 42716 -m 500 -p 0 -w 32 -t "X 2" \\ -# -a 0x0003 -r 43216 -m 500 -p 0 -w 32 -t "X 3" \\ -# -a 0x0003 -r 43716 -m 500 -p 0 -w 32 -t "X 4" \\ -# -a 0x0003 -r 44216 -m 500 -p 0 -w 32 -t "X 5" \\ -# -a 0x0003 -r 44716 -m 500 -p 0 -w 32 -t "X 6" \\ -# -a 0x0003 -r 45216 -m 500 -p 0 -w 32 -t "X 7" \\ -# -a 0x0003 -r 45716 -m 500 -p 0 -w 32 -t "X 8" \\ -# -output "PNG.files/starthiststackedx0.760.365" -curvestyle histostacked -key genreg 2>/dev/null & -# -# ./hmon_hadplot_old.sh -d 3000 \\ -# -a 0x0003 -r 46216 -m 500 -p 0 -w 32 -t "Y 1" \\ -# -a 0x0003 -r 46716 -m 500 -p 0 -w 32 -t "Y 2" \\ -# -a 0x0003 -r 47216 -m 500 -p 0 -w 32 -t "Y 3" \\ -# -a 0x0003 -r 47716 -m 500 -p 0 -w 32 -t "Y 4" \\ -# -a 0x0003 -r 48216 -m 500 -p 0 -w 32 -t "Y 5" \\ -# -a 0x0003 -r 48716 -m 500 -p 0 -w 32 -t "Y 6" \\ -# -a 0x0003 -r 49216 -m 500 -p 0 -w 32 -t "Y 7" \\ -# -a 0x0003 -r 49716 -m 500 -p 0 -w 32 -t "Y 8" \\ -# -output "PNG.files/starthiststackedy0.760.365" -curvestyle histostacked -key genreg 2>/dev/null & -# -# ); - } +./hmon_hadplot.sh -d 3000 \\ + -a 0x0003 -r 42216 -m 500 -p 0 -w 32 -t "X 1" \\ + -a 0x0003 -r 42716 -m 500 -p 0 -w 32 -t "X 2" \\ + -a 0x0003 -r 43216 -m 500 -p 0 -w 32 -t "X 3" \\ + -a 0x0003 -r 43716 -m 500 -p 0 -w 32 -t "X 4" \\ + -a 0x0003 -r 44216 -m 500 -p 0 -w 32 -t "X 5" \\ + -a 0x0003 -r 44716 -m 500 -p 0 -w 32 -t "X 6" \\ + -a 0x0003 -r 45216 -m 500 -p 0 -w 32 -t "X 7" \\ + -a 0x0003 -r 45716 -m 500 -p 0 -w 32 -t "X 8" \\ + -output "PNG.files/starthiststackedx0.760.365" -curvestyle histostacked -key genreg 2>/dev/null & + +./hmon_hadplot.sh -d 3000 \\ + -a 0x0003 -r 46216 -m 500 -p 0 -w 32 -t "Y 1" \\ + -a 0x0003 -r 46716 -m 500 -p 0 -w 32 -t "Y 2" \\ + -a 0x0003 -r 47216 -m 500 -p 0 -w 32 -t "Y 3" \\ + -a 0x0003 -r 47716 -m 500 -p 0 -w 32 -t "Y 4" \\ + -a 0x0003 -r 48216 -m 500 -p 0 -w 32 -t "Y 5" \\ + -a 0x0003 -r 48716 -m 500 -p 0 -w 32 -t "Y 6" \\ + -a 0x0003 -r 49216 -m 500 -p 0 -w 32 -t "Y 7" \\ + -a 0x0003 -r 49716 -m 500 -p 0 -w 32 -t "Y 8" \\ +-output "PNG.files/starthiststackedy0.760.365" -curvestyle histostacked -key genreg 2>/dev/null & + ); + } +# ./hmon_hadplot.sh -d 3000 \\ +# -a 0x0003 -r 41216 -m 500 -p 0 -w 32 -t "MuxA" \\ +# -a 0x0003 -r 41716 -m 500 -p 0 -w 32 -t "MuxB" \\ +# -ytitle "Hits / bin" \\ +# -output "PNG.files/hodofinehist.760.365" -curvestyle steps -key genreg 2>/dev/null & diff --git a/hmon/hmon_startrate.pl b/hmon/hmon_startrate.pl new file mode 100755 index 0000000..60580f9 --- /dev/null +++ b/hmon/hmon_startrate.pl @@ -0,0 +1,274 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep); +use List::Util qw[min max]; + +trb_init_ports() or die trb_strerror(); + +HPlot::PlotInit({ + name => "StartRateXhistbar", + file => "files/StartRateXhistbar", + entries => 500, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + xlabel => "Time / 200 ms", + ylabel => "Hits", + sizex => 950, + sizey => 330, + xmin => 0, + xmax => 500, + ymin => "0", + ymax => "100<*", + curves => 16, + xscale => 5, + buffer => 1, + stacked => 1, + curvewidth => .9, + }); + +HPlot::PlotInit({ + name => "StartRateYhistbar", + file => "files/StartRateYhistbar", + entries => 500, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + xlabel => "Time / 200 ms", + ylabel => "Hits", + sizex => 950, + sizey => 330, + xmin => 0, + xmax => 500, + ymin => "0", + ymax => "100<*", + curves => 16, + xscale => 5, + buffer => 1, + stacked => 1, + curvewidth => .9, + }); + +HPlot::PlotInit({ + name => "VetoRatehistbar", + file => "files/VetoRatehistbar", + entries => 500, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7"], + xlabel => "Time / 200 ms", + ylabel => "Hits", + sizex => 950, + sizey => 330, + xmin => 0, + xmax => 500, + ymin => "0", + ymax => "100<*", + curves => 8, + xscale => 5, + buffer => 1, + stacked => 1, + curvewidth => .9, + + }); + +HPlot::PlotInit({ + name => "StartRateXhist", + file => "files/StartRateXhist", + entries => 500, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + xlabel => "Seconds", + ylabel => "Hits", + sizex => 950, + sizey => 330, + ymin => "0", + ymax => "100<*", + curves => 16, + xscale => 5, + buffer => 1, + }); + +HPlot::PlotInit({ + name => "StartRateYhist", + file => "files/StartRateYhist", + entries => 500, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + xlabel => "Seconds", + ylabel => "Hits", + sizex => 950, + sizey => 330, + ymin => "0", + ymax => "100<*", + curves => 16, + xscale => 5, + buffer => 1, + }); + +HPlot::PlotInit({ + name => "VetoRatehist", + file => "files/VetoRatehist", + entries => 500, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7"], + xlabel => "Seconds", + ylabel => "Hits", + sizex => 950, + sizey => 330, + ymin => "0", + ymax => "100<*", + curves => 8, + xscale => 5, + buffer => 1, + }); + +HPlot::PlotInit({ + name => "StartXbar", + file => "files/StartXbar", + entries => 16, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + ylabel => "Hits", + nokey => 1, + sizex => 340, + sizey => 330, + xmin => -0.5, + xmax => 15.5, + ymin => "0", + ymax => "100<*", + curves => 1, + buffer => 1, + curvewidth => 2, + }); + +HPlot::PlotInit({ + name => "StartYbar", + file => "files/StartYbar", + entries => 16, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"], + ylabel => "Hits", + nokey => 1, + sizex => 340, + sizey => 330, + xmin => -0.5, + xmax => 15.5, + ymin => "0", + ymax => "100<*", + curves => 1, + buffer => 1, + curvewidth => 2, + }); + +HPlot::PlotInit({ + name => "Vetobar", + file => "files/Vetobar", + entries => 8, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7"], + ylabel => "Hits", + nokey => 1, + sizex => 340, + sizey => 330, + xmin => -0.5, + xmax => 7.5, + ymin => "0", + ymax => "100<*", + curves => 1, + buffer => 1, + curvewidth => 2, + }); + + +my $str = Hmon::MakeTitle(13, 22, "Start / Veto Rate",0); +$str .= qq@

Start X


\n@; +$str .= qq@

Start Y


\n@; +$str .= qq@

Veto


\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StartRate",$str); + +$str = Hmon::MakeTitle(13, 22, "Start / Veto Rate",0); +$str .= qq@

Start X


\n@; +$str .= qq@

Start Y


\n@; +$str .= qq@

Veto


\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StartRateBars",$str); + +$str = Hmon::MakeTitle(14, 8, "Start-X / Start-Y / Veto Rate",0); +$str .= qq@\n@; +$str .= qq@\n@; +$str .= qq@
\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StartBars",$str); + +my $old; +my $diff; +my $oldtime; +my $iter = 0; +my @chan = qw(0 0 2 4 6 8 10 12 14 15 13 11 9 7 5 3 1); +my @chanveto = qw(0 2 7 3 4 0 5 1 6); + +while(1) { + + my $o = trb_registertime_read_mem(0xfe48,0xc000,0,17); # or die trb_strerror() or sleep 5 and next; +# print Dumper $o; + if (defined $old) { + foreach my $b (keys %$o) { + my $tdiff = $o->{$b}{time}->[0] - ($oldtime->{$b}||0); + $tdiff += 2**16 if $tdiff < 0; + $tdiff *= 16; + for my $v (0..16) { + my $vdiff = ($o->{$b}{value}[$v]&0xfffffff) - ($old->{$b}{value}[$v]&0xfffffff); + $vdiff += 2**28 if $vdiff < 0; + $diff->{$b}[$v] = $vdiff/($tdiff||1E6)*1E6; + } + $oldtime->{$b} = $o->{$b}{time}[0]; + } + + for my $c (1..16) { + HPlot::PlotAdd("StartRateXhist",$diff->{0x5000}[$c],$chan[$c]); + HPlot::PlotAdd("StartRateYhist",$diff->{0x5001}[$c],$chan[$c]); + HPlot::PlotAdd("StartRateXhistbar",$diff->{0x5000}[$c],$chan[$c]); + HPlot::PlotAdd("StartRateYhistbar",$diff->{0x5001}[$c],$chan[$c]); + HPlot::PlotFill("StartXbar",$diff->{0x5000}[$c],$chan[$c]); + HPlot::PlotFill("StartYbar",$diff->{0x5001}[$c],$chan[$c]); + } + + for my $c (1..8) { + HPlot::PlotAdd("VetoRatehist",$diff->{0x5002}[$c],$chanveto[$c]); + HPlot::PlotAdd("VetoRatehistbar",$diff->{0x5002}[$c],$chanveto[$c]); + HPlot::PlotFill("Vetobar",$diff->{0x5002}[$c],$chanveto[$c]); + } + + HPlot::PlotDraw('StartRateXhist') if ($iter == 0); + HPlot::PlotDraw('StartRateYhist') if ($iter == 1); + HPlot::PlotDraw('VetoRatehist') if ($iter == 2); + HPlot::PlotDraw('StartRateXhistbar') if ($iter == 3); + HPlot::PlotDraw('StartRateYhistbar') if ($iter == 4); + HPlot::PlotDraw('VetoRatehistbar') if ($iter == 5); + HPlot::PlotDraw('StartXbar') if ($iter == 6); + HPlot::PlotDraw('StartYbar') if ($iter == 7); + HPlot::PlotDraw('Vetobar') if ($iter == 8); + $iter = 0 if ($iter++ == 8) + + } + + + $old = $o; + usleep(200000); + } \ No newline at end of file diff --git a/hmon/hmon_trgsource.pl b/hmon/hmon_trgsource.pl index 46d0f78..e8b42c2 100755 --- a/hmon/hmon_trgsource.pl +++ b/hmon/hmon_trgsource.pl @@ -260,8 +260,8 @@ my $longmsgcheck = $longmsg; $spillsum = 0; } $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); - $startlongmsg = sprintf("Start counts per second %s/s - Start counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); - QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Hodo Count", $startmsg, $startlongmsg); + $startlongmsg = sprintf("counts per second %s/s - counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum)); + QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "PT6 Count", $startmsg, $startlongmsg); diff --git a/hmon/index.cgi b/hmon/index.cgi index 3e6abe3..898ce97 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -52,24 +52,7 @@ function openwin(url) {
  • Data rate histogram
  • - - - -