From a5a15b2fcf566b0a7930fd92cbb3da0fed6b8836 Mon Sep 17 00:00:00 2001 From: Cbm Rich Date: Sun, 16 Nov 2014 18:40:55 +0100 Subject: [PATCH] Latest updates from Cern CBM Rich test --- dmon/scripts/dmon_currents.pl | 10 ++++++++++ dmon/scripts/dmon_heatmaprich.pl | 5 +++-- thresholds/thresholds_automatic_jan.pl | 2 ++ thresholds/write_thresholds.pl | 15 +++++++++++---- users/cern_cbmrich/dmon_config.pl | 2 +- users/cern_cbmrich/evtbuilder_start.sh | 2 +- users/cern_cbmrich/thresh/billboard_info | 1 - users/cern_cbmrich/thresh/current_thresholds.thr | 2 +- .../thresh/thresholds_padiwa_amps.thr | 2 +- 9 files changed, 30 insertions(+), 11 deletions(-) delete mode 100644 users/cern_cbmrich/thresh/billboard_info diff --git a/dmon/scripts/dmon_currents.pl b/dmon/scripts/dmon_currents.pl index 8092154..9203da9 100755 --- a/dmon/scripts/dmon_currents.pl +++ b/dmon/scripts/dmon_currents.pl @@ -46,12 +46,16 @@ while (1) { my $data = Perl2Epics::GetAll(); my $maximum = 0; my $total = 0; + my $updatemissing = 0; for(my $i = 0; $i<16; $i++) { my $val = $data->{"C".$i}->{"val"}; $total += $val || 0; $maximum = max($maximum,$val||0); HPlot::PlotAdd('PadiwaCurrents',$val,$i); + if (time - $data->{"C".$i}->{"tme"} > 240) { + $updatemissing = 1; + } } HPlot::PlotDraw('PadiwaCurrents'); @@ -59,6 +63,12 @@ while (1) { my $value = sprintf("%.2fA / %.2fA", $maximum, $total); my $longtext = "Maximum / Total current: ". $value; my $status = Dmon::OK; + + if ($updatemissing) { + $status = Dmon::WARN; + $longtext .="
Updates missing"; + } + Dmon::WriteQALog($config{flog},"currents",30,$status,$title,$value,$longtext,'2-PadiwaCurrents'); diff --git a/dmon/scripts/dmon_heatmaprich.pl b/dmon/scripts/dmon_heatmaprich.pl index 234c55d..5b166c1 100755 --- a/dmon/scripts/dmon_heatmaprich.pl +++ b/dmon/scripts/dmon_heatmaprich.pl @@ -84,7 +84,7 @@ my $diff; while (1) { my $o = trb_register_read_mem($config{PadiwaBroadcastAddress},0xc000,0,33); - + my $sum = 0; if (defined $old) { foreach my $b (keys %$o) { for my $v (0..32) { @@ -100,13 +100,14 @@ while (1) { my $fpga = $ChannelMapping::chanmap->{fpga}->[$x]->[$y]; my $channel = $ChannelMapping::chanmap->{chan}->[$x]->[$y]; HPlot::PlotFill('HeatmapRich',$diff->{$fpga}->[$channel],$x,$y); + $sum += $diff->{$fpga}->[$channel]; } } HPlot::PlotDraw('HeatmapRich'); } my $status = Dmon::OK; my $title = "Heatmap"; - my $value = ""; + my $value = Dmon::SciNotation($sum); my $longtext = "See plot"; Dmon::WriteQALog($config{flog},"heatmaprich",5,$status,$title,$value,$longtext,'1-HeatmapRich'); $old = $o; diff --git a/thresholds/thresholds_automatic_jan.pl b/thresholds/thresholds_automatic_jan.pl index 1cc3c24..2987bc4 100755 --- a/thresholds/thresholds_automatic_jan.pl +++ b/thresholds/thresholds_automatic_jan.pl @@ -11,6 +11,7 @@ use Getopt::Long; use Time::HiRes qw(time usleep); use Log::Log4perl qw(get_logger); use List::Util qw(min max); +use POSIX qw(strftime); use HADES::TrbNet; # use IPC::ShareLite qw( :lock ); @@ -239,6 +240,7 @@ foreach my $i (reverse (0..3)) { my $str; +$logger_data->info(time); foreach my $i (0..15) { $logger_data->info(sprintf "endpoint: 0x%04x, chain: %02d, channel: %2d threshold: 0x%04x, uid: %s", $endpoint, $chain, $i, $best_thresh[$i], $uid ); } diff --git a/thresholds/write_thresholds.pl b/thresholds/write_thresholds.pl index 7b4e3ab..486d894 100755 --- a/thresholds/write_thresholds.pl +++ b/thresholds/write_thresholds.pl @@ -3,12 +3,10 @@ use strict; use warnings; use Data::Dumper; - use Dmon; - use Getopt::Long; - use HADES::TrbNet; +use POSIX qw(strftime); my $offset = 0; my $help; @@ -46,10 +44,16 @@ trb_init_ports() or die trb_strerror(); open(my $fh, "<$ARGV[0]" || die "could not open file '$ARGV[0]'"); - my @f = <$fh>; +#Put Information to logfile and timestamp to billboard information +chomp $f[0]; +system("echo ".time.' '.strftime("%Y-%m-%d %H:%M:%S",localtime()).' '." $f[0]>>threshold_log.txt"); +my ($t) = $f[0] =~ /(\d{10})/; +system("echo $t>billboard_info"); + +exit; my $count=0; foreach my $cl (@f) { (my $ep, my $chain, my $channel, my $thresh, my $uid) = @@ -143,6 +147,9 @@ has to be in the format of the output of the automatic threshold determination currently only mode "padiwa" is implemented. +The script puts a timestamp of execution and the timestamp of the thresholds file to threshold_log.txt. +The script puts the timestamp of the threshold file to billboard_info. + EOF } diff --git a/users/cern_cbmrich/dmon_config.pl b/users/cern_cbmrich/dmon_config.pl index 5091531..ad4edaf 100755 --- a/users/cern_cbmrich/dmon_config.pl +++ b/users/cern_cbmrich/dmon_config.pl @@ -4,7 +4,7 @@ #Scripts to start & order of icons in the Overview activeScripts => [['time','ping','-','-','daqop'], ['numfee','temperature','reftime','billboard','mbs'], - ['beamintensity','beammonitors','-','-','richenvironment'], + ['beamintensity','beammonitors','-','richhvres','richenvironment'], ['trgrate','datarate','deadtime','-','-'], ['heatmaprich','padiwatemp','padiwaonline','currents','pscurrents'], ['cbmnetlink','cbmnetdata','cbmnetsync','-','-']], diff --git a/users/cern_cbmrich/evtbuilder_start.sh b/users/cern_cbmrich/evtbuilder_start.sh index 77e5045..a222b62 100755 --- a/users/cern_cbmrich/evtbuilder_start.sh +++ b/users/cern_cbmrich/evtbuilder_start.sh @@ -51,7 +51,7 @@ extraopts="--online" cd $tmpdir - exec uxterm -fg black -bg khaki -geometry 120x20+0+45 -e "/home/hadaq/bin/daq_evtbuild -m 17 -o ${dest} -x ${pref} -I 1 --ebnum 1 -q 32 -S test -d file \ + exec uxterm -fg black -bg khaki -geometry 120x20+0+45 -e "/home/hadaq/bin/daq_evtbuild -m 17 -o ${dest} -x ${pref} -I 1 --ebnum 1 -q 32 -S test -d file --filesize 512 \ ${extraopts}; read; bash" & diff --git a/users/cern_cbmrich/thresh/billboard_info b/users/cern_cbmrich/thresh/billboard_info deleted file mode 100644 index 56cc36c..0000000 --- a/users/cern_cbmrich/thresh/billboard_info +++ /dev/null @@ -1 +0,0 @@ -0xdeadcode \ No newline at end of file diff --git a/users/cern_cbmrich/thresh/current_thresholds.thr b/users/cern_cbmrich/thresh/current_thresholds.thr index 2170e38..3a80386 120000 --- a/users/cern_cbmrich/thresh/current_thresholds.thr +++ b/users/cern_cbmrich/thresh/current_thresholds.thr @@ -1 +1 @@ -201411160018.thr \ No newline at end of file +201411161747.thr \ No newline at end of file diff --git a/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr b/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr index 915feb6..7581a16 100644 --- a/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr +++ b/users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr @@ -19,7 +19,7 @@ 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 01 threshold: 0x0000, uid: 0 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 02 threshold: 0xffff, uid: 0 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 03 threshold: 0x0000, uid: 0 -2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 04 threshold: 0x0942, uid: 0 +2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 04 threshold: 0x073E, uid: 0 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 05 threshold: 0xD511, uid: 0 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 06 threshold: 0xffff, uid: 0 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 07 threshold: 0x0000, uid: 0 -- 2.43.0