From 98d3c1d7df201eaba988b345099c4f6700f3d465 Mon Sep 17 00:00:00 2001 From: "hadaq@countinghouse" Date: Tue, 15 Jul 2014 15:50:12 +0200 Subject: [PATCH] added event rate to spill summary --- hmon/hmon_hodo_hist.pl | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/hmon/hmon_hodo_hist.pl b/hmon/hmon_hodo_hist.pl index f2ddca0..60aa584 100755 --- a/hmon/hmon_hodo_hist.pl +++ b/hmon/hmon_hodo_hist.pl @@ -108,7 +108,7 @@ my $plot6 = (); $plot6->{name} = "SpillSumHist"; $plot6->{file} = "files/SpillSumHist"; $plot6->{entries} = 30; -$plot6->{curves} = 4; +$plot6->{curves} = 5; $plot6->{type} = HPlot::TYPE_HISTORY; $plot6->{output} = HPlot::OUT_PNG; $plot6->{ylabel} = "Hit Rate per spill (dark rate substracted)"; @@ -120,6 +120,7 @@ $plot6->{titles}->[0] = "Pi1 Y"; $plot6->{titles}->[1] = "Pi1 X"; $plot6->{titles}->[2] = "Start"; $plot6->{titles}->[3] = "Hodo"; +$plot6->{titles}->[4] = "Rec. Events (x20)"; $plot6->{storable} = 1; HPlot::PlotInit($plot6); @@ -202,10 +203,12 @@ Hmon::WriteFile("SpillSumHist",$str); my $timer = 0; my $old; my $old2; +my $olde; my $oldtime; my $time = 0; my $diff; my $diff2; +my $diffe; my $iter = 0; my $offset; my $histstore; @@ -222,6 +225,7 @@ $spillsum->{0x8880} = 0; $spillsum->{0x8890} = 0; $spillsum->{0x3810} = 0; $spillsum->{0x3811} = 0; +$spillsum->{0x3000} = 0; trb_init_ports() or die trb_strerror(); @@ -240,8 +244,21 @@ while (1) { $o2->{$b}->{0x8130} = $t->{$b}; } } - + $t = trb_registertime_read(0x3000,1); + if (defined $t) { + if (defined $olde) { + my $tdiff = $t->{0x3000}->{time}->[0] - ($oldtime->{0x3000}||0); + my $vdiff = ($t->{0x3000}->{value}->[0]&0xffff) - ($olde->{0x3000}&0xffff); + if ($vdiff < 0) { $vdiff += 2**16;} + if ($tdiff < 0) { $tdiff += 2**16;} + $tdiff *= 16; + $diffe->{0x3000} = $vdiff/($tdiff||1E6)*1E6; + } + $oldtime->{0x3000} = $t->{0x3000}->{time}->[0]; + $olde->{0x3000} = $t->{0x3000}->{value}->[0]; + } + if (defined $old) { foreach my $b (keys %$o) { for my $v (0..32) { @@ -314,6 +331,7 @@ while (1) { $spillsum->{0x3811} += (($diff2->{0x3811}->{0x8130}||0)-$offset->{0x3811})/5; $spillsum->{0x8880} += (($totalstart||0)-$offset->{0x8880})/5; $spillsum->{0x8890} += (($total||0)-$offset->{0x8890})/5/2; + $spillsum->{0x3000} += $diffe->{0x3000}/5; } else { HPlot::PlotAdd("HitRatioHist",0,0); @@ -338,10 +356,13 @@ while (1) { HPlot::PlotAdd('SpillSumHist',$spillsum->{0x3811},1); HPlot::PlotAdd('SpillSumHist',$spillsum->{0x8880},2); HPlot::PlotAdd('SpillSumHist',$spillsum->{0x8890},3); + HPlot::PlotAdd('SpillSumHist',$spillsum->{0x3000}*20,4); + HPlot::PlotDraw('SpillSumHist'); $spillsum->{0x8880} = 0; $spillsum->{0x8890} = 0; $spillsum->{0x3810} = 0; $spillsum->{0x3811} = 0; + $spillsum->{0x3000} = 0; } } @@ -378,7 +399,6 @@ while (1) { } if($timer %5 == 4) { HPlot::PlotDraw('HitSumHistInnerShort'); - HPlot::PlotDraw('SpillSumHist'); } $timer++; } -- 2.43.0