From d6876bdcc60854a25017997c77f23841ad0b3e62 Mon Sep 17 00:00:00 2001 From: Michael Traxler Date: Sat, 15 Nov 2014 10:08:07 +0100 Subject: [PATCH] threshold_compare bug-fix to compare incomplete logs --- users/cern_cbmrich/thresholds_compare.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/users/cern_cbmrich/thresholds_compare.pl b/users/cern_cbmrich/thresholds_compare.pl index b9dfeb9..94d5c6c 100755 --- a/users/cern_cbmrich/thresholds_compare.pl +++ b/users/cern_cbmrich/thresholds_compare.pl @@ -38,7 +38,7 @@ HPlot::PlotInit($plot2); sub readSettings { my $fn = shift; - open(my $fh, $fn || die "could not open file '$ARGV[0]'"); + open(my $fh, $fn) || die "could not open file '$fn'"; my @f = <$fh>; close $fh; @@ -73,9 +73,18 @@ sub readSettings { my $fpga = $ChannelMapping::chanmap->{fpga}->[$x]->[$y]; my $channel = ($ChannelMapping::chanmap->{chan}->[$x]->[$y]-1)/2; - my $value = $threshs1{$fpga.":".$channel} or die(sprintf("endpoint 0x%04x, channel %d (%d:%d) not found in $fn1", $fpga, $channel, $fpga, $channel)); + unless (defined $threshs1{$fpga.":".$channel}) { + printf("endpoint 0x%04x, channel %d (%d:%d) not found in $fn1", $fpga, $channel, $fpga, $channel); + next; + } + + my $value = $threshs1{$fpga.":".$channel}; if ($fn2) { - $value -= ($threshs2{$fpga.":".$channel} or die(sprintf("endpoint 0x%04x, channel %d (%d:%d) not found in $fn2", $fpga, $channel, $fpga, $channel))); + if (defined $threshs2{$fpga.":".$channel}) { + $value -= $threshs2{$fpga.":".$channel}; + } else { + printf("endpoint 0x%04x, channel %d (%d:%d) not found in $fn2", $fpga, $channel, $fpga, $channel); + } } HPlot::PlotFill('HeatmapRich',$value,$x,$y); -- 2.43.0