buffer => 1,
curvewidth => 2,
});
-
+
+HPlot::PlotInit({
+ name => "StartPosition",
+ file => "files/StartPosition",
+ entries => 500,
+ type => HPlot::TYPE_HISTORY,
+ output => HPlot::OUT_PNG,
+ titles => ["X position","Y position"],
+ xlabel => "Seconds",
+ ylabel => "Strip",
+ sizex => 950,
+ sizey => 330,
+ ymin => "-0.5",
+ ymax => "15.5",
+ curves => 2,
+ xscale => 5,
+ buffer => 1,
+ });
my $str = Hmon::MakeTitle(13, 22, "Start / Veto Rate",0);
$str .= qq@<h3>Start X</h3><img src="%ADDPNG files/StartRateXhist.png%" type="image/png"><br>\n@;
$str .= qq@<img src="%ADDPNG files/Vetobar.png%" type="image/png"><br>\n@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("StartBars",$str);
+
+$str = Hmon::MakeTitle(13, 8, "Start Position",0);
+$str .= qq@<img src="%ADDPNG files/StartPosition.png%" type="image/png">\n@;
+Hmon::WriteFile("StartPosition",$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;
}
$oldtime->{$b} = $o->{$b}{time}[0];
}
-
+
+ my ($sumx,$sumy,$avgx,$avgy) = (0,0,0,0);
+
for my $c (1..16) {
HPlot::PlotAdd("StartRateXhist",$diff->{0x5000}[$c],$chan[$c]);
HPlot::PlotAdd("StartRateYhist",$diff->{0x5001}[$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]);
+
+ $sumx += $diff->{0x5000}[$c];
+ $sumy += $diff->{0x5001}[$c];
+
+ $avgx += $diff->{0x5000}[$c]*$chan[$c];
+ $avgy += $diff->{0x5001}[$c]*$chan[$c];
+
}
-
+ $avgx /= $sumx if($sumx !=0);
+ $avgy /= $sumy if($sumy !=0);
+
+ $avgx = "NaN" if $sumx < 50;
+ $avgy = "NaN" if $sumy < 50;
+
+ HPlot::PlotAdd("StartPosition",$avgx,0);
+ HPlot::PlotAdd("StartPosition",$avgy,1);
+
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('StartXbar') if ($iter == 6);
HPlot::PlotDraw('StartYbar') if ($iter == 7);
HPlot::PlotDraw('Vetobar') if ($iter == 8);
- $iter = 0 if ($iter++ == 8)
-
+ HPlot::PlotDraw('StartPosition') if ($iter == 9);
+ $iter = 0 if ($iter++ == 9)
+
}
-
-
+
+
$old = $o;
usleep(200000);
- }
\ No newline at end of file
+ }