plot_write($p->{$name}->{fh},($i/$p->{$name}->{xscale})." ".$p->{$name}->{value}->[$j]->[$i]);
}
else {
- plot_write($p->{$name}->{fh},(($i-$p->{$name}->{entries})/$p->{$name}->{xscale})." ".$p->{$name}->{value}->[$j]->[$i]);
+ plot_write($p->{$name}->{fh},(($i-$p->{$name}->{entries})/($p->{$name}->{xscale}||1))." ".($p->{$name}->{value}->[$j]->[$i]||0));
}
}
plot_write($p->{$name}->{fh},"e");
use Data::Dumper;
use warnings;
use strict;
-
+use Mail::Sendmail;
use constant HMONDIR => "/home/hadaq/trbsoft/hadesdaq/hmon/";
our %hublist;
}
}
+
+sub SendEmail {
+ my ($to,$title,$msg) = @_;
+ my %mail = (
+ 'To' => $to,
+ 'From' => 'hmon@gsi.de',
+ 'Subject' => "$title",
+ 'Message' => $msg,
+ 'smtp' => "smtp.gsi.de"
+ );
+
+ sendmail(%mail) ;
+ system("logger -p local1.info -t DAQ 'Sent mail to ".$to." with content ".$msg."'");
+ print "OK. Log says:\n" . $Mail::Sendmail::log . "\n";
+
+
+ }
+
+
+
###############################################################################
# Calculate Colors
###############################################################################
our @MdcOepLimits = (372, 372-1, 372-3);
our @MdcVoltageLimits = (50, 60, 100);
our @MdcLockLimits = (0, 3, 5);
-our @MdcTempLimits = (78, 85, 90);
+our @MdcTempLimits = (75, 80, 85);
our @TrgErrLimits = (100, 1000, 10000);
our @CPULimits = (95, 100, 100);
our @TimeoutLimits = (0, 0, 1);
our $TrgCheckPolarity = 1;
our @Eventsbroken = (.5,5,10);
our @MdcTokenMissLimits = (10,50,100);
+our @MdcNominalHV = (1750,1770,1500,1700);
+our @MdcHVOffsetLimits = (5,10,20);
our @PionLvCurrLimits = (4,5,6);
</p>
<h4>Error Handling</h4>
-Check with the MDC operator if high voltage is on on all chambers.
+Check with the MDC operator if high voltage is on on all chambers (without HV there is no data...).
+Ignore, if no real data is taken and a pulser is running.
<br>Do a DAQ restart.
<br>Do a power-cycle of the corresponding MDC chamber.
my $f = fork();
if($f) {
- qx(./hmon_hadplotnew.sh -d 50 -o 20 -n 1200 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehist.700.365" eventrate);
+ qx(./hmon_hadplotnew.sh -d 50 -o 20 -n 1200 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehist.700.365" eventrate 1>/dev/null 2>/dev/null);
}
else {
my $g = fork();
if($g) {
- qx(./hmon_hadplotnew.sh -d 400 -o 5 -n 1500 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehistlong.700.315" eventrate);
+ qx(./hmon_hadplotnew.sh -d 400 -o 5 -n 1500 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehistlong.700.315" eventrate 1>/dev/null 2>/dev/null);
}
else{
- qx(./hmon_hadplotnew.sh -d 10 -o 50 -n 1000 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehistshort.700.365" eventrate);
+ qx(./hmon_hadplotnew.sh -d 10 -o 50 -n 1000 -yscale 1000 -yoverflow 65.536 -ytitle "Event Rate [kHz]" -xtitle "" -output "PNG.files/eventratehistshort.700.365" eventrate 1>/dev/null 2>/dev/null);
}
}
my $curveoption= []; #options for plot command
my $xgrid = 1;
my $ygrid = 1;
-my $ymax;
+my $ymax = '.01<*';
my $ymin;
my $xmin;
my $xmax;
'yticks!' => \$yticks,
'xgrid!' => \$xgrid,
'ygrid!' => \$ygrid,
- 'ymax=i' => \$ymax,
- 'ymin=i' => \$ymin,
- 'xmax=i' => \$xmax,
- 'xmin=i' => \$xmin,
+ 'ymax=s' => \$ymax,
+ 'ymin=s' => \$ymin,
+ 'xmax=s' => \$xmax,
+ 'xmin=s' => \$xmin,
'curvestyle=s' => \$curvestyle,
'curveoption=s'=> $curveoption,
'plotoption=s' => \$plotoption
my $total = 0;
for my $bar (0..3) {
for my $x (0..1) {
- $sum[$bar/2] += $diff->{0x5013}->[$bar*4+1+$x*16];
- $total += $diff->{0x5013}->[$bar*4+1+$x*16];
- $sum[$bar/2+2] += $diff->{0x5012}->[$bar*4+1+$x*16];
- $total += $diff->{0x5012}->[$bar*4+1+$x*16];
- $sum[$bar/2+4] += $diff->{0x5011}->[$bar*4+1+$x*16];
- $total += $diff->{0x5011}->[$bar*4+1+$x*16];
- $sum[$bar/2+6] += $diff->{0x5010}->[$bar*4+1+$x*16];
- $total += $diff->{0x5010}->[$bar*4+1+$x*16];
+ $sum[$bar/2] += ($diff->{0x5013}->[$bar*4+1+$x*16]||0);
+ $total += ($diff->{0x5013}->[$bar*4+1+$x*16]||0);
+ $sum[$bar/2+2] += ($diff->{0x5012}->[$bar*4+1+$x*16]||0);
+ $total += ($diff->{0x5012}->[$bar*4+1+$x*16]||0);
+ $sum[$bar/2+4] += ($diff->{0x5011}->[$bar*4+1+$x*16]||0);
+ $total += ($diff->{0x5011}->[$bar*4+1+$x*16]||0);
+ $sum[$bar/2+6] += ($diff->{0x5010}->[$bar*4+1+$x*16]||0);
+ $total += ($diff->{0x5010}->[$bar*4+1+$x*16]||0);
}
}
for my $i (0..7) {
for my $f (0..3) {
next if ($f == 1);
for my $s (0..15) {
- $totalstart += $diff->{0x5000+$f}->[$s*2+1];
+ $totalstart += ($diff->{0x5000+$f}->[$s*2+1]||0);
}
}
# print $totalstart;
trb_init_ports() or die trb_strerror();
+Perl2Epics::Connect("TempP2S","HAD:MDC:P2:S1:M1:temp");
while (1) {
my $rh_mdc_temp;
sleep(5);
}
} else {
- qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8900 -m 128 -w 32 -p 0 -t "Y Channels" -key -xtitle "DOWN (-5cm) UP (5cm)" -output "PNG.files/Pion1XPileup.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8900 -m 128 -w 32 -p 0 -t "X Channels" -key -xtitle "RIGHT (-5cm) LEFT (5cm)" -output "PNG.files/Pion1YPileup.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8900 -m 128 -w 32 -p 0 -t "Y Channels" -key -xtitle "DOWN (-5cm) UP (5cm)" -output "PNG.files/Pion2XPileup.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8900 -m 128 -w 32 -p 0 -t "X Channels" -key -xtitle "RIGHT (-5cm) LEFT (5cm)" -output "PNG.files/Pion2YPileup.700.265" regdiff >/dev/null &);
+ qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8900 -m 128 -w 32 -p 0 -t "Y Channels" -key -xtitle "DOWN (-5cm) UP (5cm)" -output "PNG.files/Pion1XPileup.700.265" regdiff >/dev/null 2>/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8900 -m 128 -w 32 -p 0 -t "X Channels" -key -xtitle "RIGHT (-5cm) LEFT (5cm)" -output "PNG.files/Pion1YPileup.700.265" regdiff >/dev/null 2>/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8900 -m 128 -w 32 -p 0 -t "Y Channels" -key -xtitle "DOWN (-5cm) UP (5cm)" -output "PNG.files/Pion2XPileup.700.265" regdiff >/dev/null 2>/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8900 -m 128 -w 32 -p 0 -t "X Channels" -key -xtitle "RIGHT (-5cm) LEFT (5cm)" -output "PNG.files/Pion2YPileup.700.265" regdiff >/dev/null 2>/dev/null &);
}
sleep(5);
}
} else {
- qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8c00 -m 512 -w 32 -p 0 -t "Y Timestamps" -key -output "PNG.files/Pion1YTS.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8c00 -m 512 -w 32 -p 0 -t "X Timestamps" -key -output "PNG.files/Pion1XTS.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8c00 -m 512 -w 32 -p 0 -t "Y Timestamps" -key -output "PNG.files/Pion2YTS.700.265" regdiff >/dev/null &
- ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8c00 -m 512 -w 32 -p 0 -t "X Timestamps" -key -output "PNG.files/Pion2XTS.700.265" regdiff >/dev/null &);
+ qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8c00 -m 512 -w 32 -p 0 -ymin "0" -ymax "2<*" -t "Y Timestamps" -key -output "PNG.files/Pion1YTS.700.265" regdiff 2>/dev/null >/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8c00 -m 512 -w 32 -p 0 -ymin "0" -ymax "2<*" -t "X Timestamps" -key -output "PNG.files/Pion1XTS.700.265" regdiff 2>/dev/null >/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8c00 -m 512 -w 32 -p 0 -ymin "0" -ymax "2<*" -t "Y Timestamps" -key -output "PNG.files/Pion2YTS.700.265" regdiff 2>/dev/null >/dev/null &
+ ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8c00 -m 512 -w 32 -p 0 -ymin "0" -ymax "2<*" -t "X Timestamps" -key -output "PNG.files/Pion2XTS.700.265" regdiff 2>/dev/null >/dev/null &);
}
next if ($a =~ /discarded events: (\w+)/);# && $1 < 30);
next if ($a =~ /opened connection to Data Mover/);
}
- next if ($a =~ /30 boards complain: Event not found: 3000/);
+ if ($a =~ m/(DABC)/) {
+ next if ($a =~ /Start/);
+ next if ($a =~ /Application/);
+ next if ($a =~ /Set/);
+ next if ($a =~ /CTRL/);
+ next if ($a =~ /Ctrl/);
+ next if ($a =~ /flushing/);
+ next if ($a =~ /open/);
+ next if ($a =~ /base/);
+ next if ($a =~ /plugins/);
+ next if ($a =~ /Worker/);
+ next if ($a =~ /Create/);
+ next if ($a =~ /datamover/);
+ next if ($a =~ /Transmitter/);
+ next if ($a =~ /HADAQ/);
+ next if ($a =~ /DropAllInputBuffers/);
+ }
+ next if ($a =~ /30 boards complain: Event not found: 3000/);
next if ($a =~ /30 boards complain: frontend not configured: 3000/);
next if ($a =~ /30 boards complain: error: 3000/);
next if ($a =~ /30 boards complain: serious error: 3000/);
$a =~ s/3000 3001 3002 3003 3004 3010 3011 3012 3013 3014 3020 3021 3022 3023 3024 3030 3031 3032 3033 3034 3040 3041 3042 3043 3044 3050 3051 3052 3053 3054/RICH, /;
$a =~ s/0x2000 0x2001 0x2002 0x2003 0x2004 0x2005 0x2006 0x2007 0x2008 0x2009 0x200a 0x200b 0x200c 0x200d 0x2010 0x2011 0x2012 0x2013 0x2014 0x2015 0x2016 0x2017 0x2018 0x2019 0x201a 0x201b 0x201c 0x201d 0x2020 0x2021 0x2022 0x2023 0x2024 0x2025 0x2026 0x2027 0x2028 0x2029 0x202a 0x202b 0x202c 0x202d 0x2030 0x2031 0x2032 0x2033 0x2034 0x2035 0x2036 0x2037 0x2038 0x2039 0x203a 0x203b 0x203c 0x203d 0x2040 0x2041 0x2042 0x2043 0x2044 0x2045 0x2046 0x2047 0x2048 0x2049 0x204a 0x204b 0x204c 0x204d 0x2050 0x2051 0x2052 0x2053 0x2054 0x2055 0x2056 0x2057 0x2058 0x2059 0x205a 0x205b 0x205c 0x205d 0x2100 0x2101 0x2102 0x2103 0x2104 0x2105 0x2106 0x2107 0x2108 0x2109 0x210a 0x210b 0x210c 0x210d 0x210e 0x210f 0x2110 0x2111 0x2112 0x2113 0x2114 0x2115 0x2116 0x2117 0x2118 0x2119 0x211a 0x211b 0x211c 0x211d 0x211e 0x211f 0x2120 0x2121 0x2122 0x2123 0x2124 0x2125 0x2126 0x2127 0x2128 0x2129 0x212a 0x212b 0x212c 0x212d 0x212e 0x212f 0x2130 0x2131 0x2132 0x2133 0x2134 0x2135 0x2136 0x2137 0x2138 0x2139 0x213a 0x213b/MDC missing/;
- if (($month,$day,$time,$PC,$who,$level,$message) = $a =~ m/(\w+)\s+(\d+)\s+(\d\d:\d\d:\d\d)\s+(\w+)\s+\w+.?\w?.?:\s+(\w+-?\d?\d?)\s+.(\w).\s+(.*)/) {
+ if (($month,$day,$time,$PC,$who,$level,$message) = $a =~ m/(\w+)\s+(\d+)\s+(\d\d:\d\d:\d\d)\s+(\w+)\s+\w+.?\w?.?:\s+(\w+-?\w?\w?-?\d?\d?)\s+.(\w).\s+(.*)/) {
$msg = "";
$msg .= sprintf("\n<tr><td>%s.%s. %s<td>%s<td ",$day,$month,$time,$who);
use Getopt::Long;
use Data::Dumper;
-my $magnet_on = 1;
+my $magnet_on = 0;
my %range_list = (
'Time' => {},
use FileHandle;
use Data::Dumper;
use POSIX qw/floor ceil/;
+use List::Util qw(min max);
use Hmon;
use QA;
use Perl2Epics;
die("could not connect to trbnetd");
}
+
###########
#Change 3 for-loops to include all four planes again!
############
-# my $fqa = QA::OpenQAFile();
+my $flog = QA::OpenQAFile();
my @plot;
foreach my $s (0..1) {
foreach my $p (0..3) {
}
}
}
+
+ my @mdcHvMin;
+ my @mdcHvMax;
+ my $qastate = QA::OK;
+ for my $p (1..4) {
+ for my $s (1..6) {
+ for my $i (0..1) {
+ my $volt = $data->{"$p-$s-$i-V"}->{val};
+ if(! defined $mdcHvMin[$p] || $mdcHvMin[$p] > $volt) {
+ $mdcHvMin[$p] = $volt;
+ }
+ if(! defined $mdcHvMax[$p] || $mdcHvMax[$p] < $volt) {
+ $mdcHvMax[$p] = $volt;
+ }
+ }
+ }
+ if($mdcHvMax[$p] > $QA::MdcNominalHV[$p-1] + $QA::MdcHVOffsetLimits[0]) {$qastate = max($qastate,QA::WARN);}
+ if($mdcHvMax[$p] > $QA::MdcNominalHV[$p-1] + $QA::MdcHVOffsetLimits[1]) {$qastate = max($qastate,QA::WARN_2);}
+ if($mdcHvMax[$p] > $QA::MdcNominalHV[$p-1] + $QA::MdcHVOffsetLimits[2]) {$qastate = max($qastate,QA::ERROR);}
+ if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[0]) {$qastate = max($qastate,QA::WARN);}
+ if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[1]) {$qastate = max($qastate,QA::WARN_2);}
+ if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[2]) {$qastate = max($qastate,QA::ERROR);}
+ }
+
+ my $value = sprintf("%.1f/%.1f/%.1f/%.1f",$mdcHvMin[1]/1000.,$mdcHvMin[2]/1000.,$mdcHvMin[3]/1000.,$mdcHvMin[4]/1000.);
+ my $longtext = "MDC high voltage in all four planes".
+ "<br>Minimum [V]: ".$mdcHvMin[1]." / ".$mdcHvMin[2]." / ".$mdcHvMin[3]." / ".$mdcHvMin[4].
+ "<br>Maximum [V]: ".$mdcHvMax[1]." / ".$mdcHvMax[2]." / ".$mdcHvMax[3]." / ".$mdcHvMax[4];
+ QA::WriteQALog($flog,"other","mdcinvalid",10,$qastate,"MDC HV",$value,$longtext);
$timer++;
sleep(1);
}
use HPlot;
-my @names = qw( reflowPressureAthm:average reflowPressureCompr reflowInO2 reflowRatioIsob opensysFreshARGON opensysFreshCO2 reflowFreshArgon reflowFreshIsob pipePressureIsoB );
-my @namesLABEL = qw( AtmosphericPressure reflowPressureCompressor reflow_O2_concentration reflow_Isobutane_fraction planeI_argon planeI_CO2 reflowFreshArgon reflowFreshIsobutane pipePressureIsobutane );
+my @names = qw( reflowPressureAthm:average reflowPressureCompr reflowInO2 reflowRatioIsob opensysFreshARGON
+opensysFreshCO2 reflowFreshArgon reflowFreshIsob pipePressureIsoB CO2:concentration CO2:concentration2 reflowPressureLP);
+my @namesLABEL = qw( AtmosphericPressure reflowPressureCompressor reflow_O2_concentration
+reflow_Isobutane_fraction planeI_argon_fresh planeI_CO2_frsh reflowFreshArgon reflowFreshIsobutane pipePressureIsobutane CO2-P1 CO2-P2 LP-pressure);
my @names2 = qw(waage_1_net waage_2_net);
my @names2LABEL = qw(Scale_1 Scale_2);
my @names3 = qw(targetVakPressure);
+my $presserr = 0;
+my $presserrtimer = 0;
+
+
my $plot = ();
$plot->{name} = "AtmosPress";
$plot->{file} = "files/AtmosPress";
for(my $i = 1; $i<=3; $i++) {
for(my $j = 1; $j<=6; $j++) {
my $s = sprintf("HAD:MDC:P%i:S%i:p_delta",$i,$j);
- Perl2Epics::Connect("p$i$j",$s);
+ Perl2Epics::Connect("p$i$j",$s);x
}
}
foreach my $n (@names) {
Perl2Epics::Connect($n,"HAD:".$n);
}
Perl2Epics::Connect("reflowPressureAthmaverage","HAD:MDC:GAS:reflowPressureAthm:average");
-
+Perl2Epics::Connect("p1CO2","HAD:MDC:GAS:CO2:concentration:average");
+Perl2Epics::Connect("p2CO2","HAD:MDC:GAS:CO2:concentration2:average");
print "Connected.\n";
while(1) {
}
}
}
-
+
+
+# if($data->{"p1CO2"}->{val} < 20 || $data->{"p1CO2"}->{val} > 40 ) {
+# $presserr++;
+# }
+
+ for my $i (1..3) {
+ for my $j (1..6) {
+ if($data->{"p$i$j"}->{val} > 50 ) {
+ $presserr++;
+ }
+ }
+ }
+ if($presserr >= 3) {
+ if($presserrtimer == 0) {
+ $presserr = 0;
+ my $valstr = "";
+ $valstr.="CO2 concentration Plane1: ".$data->{"p1CO2"}->{val}." % \n";
+ $valstr.="CO2 concentration Plane2: ".$data->{"p2CO2"}->{val}." % \n";
+ for my $i (1..3) {
+ for my $j (1..6) {
+ $valstr.="P$i S$j: ".$data->{"p$i$j"}->{val}."\n";
+ }
+ }
+ $presserrtimer = 90;
+ Hmon::SendEmail('c.wendisch@gsi.de',"Warning: MDC Over-Pressure","Pressures in MDC are too high: \n$valstr");
+ }
+ else {
+ $presserrtimer--;
+ }
+ }
+
+
$timer++;
sleep(10);
}
+
+
+