Added Perl library directory.
return trb_register_read($board,0xd412);
}
+sub PadiwaSendCmdMultiple {
+ my ($cmd,$board,$chain,$delay) = @_;
+ my $length = 0;
+ my $str = "";
+ for (my $i = 0; $i < 16; $i++) {
+ $length++ if defined $cmd->[$i];
+ $cmd->[$i] = $cmd->[$i] || 0;
+ $str .= sprintf("%08x\t",$cmd->[$i]);
+ }
+ push(@{$cmd},1<<$chain);
+ push(@{$cmd},0x1080 + $length);
+# print STDERR "$str\n";
+ my $errcnt = 0;
+ while(1){
+ trb_register_write_mem($board,0xd400,0,$cmd,scalar @{$cmd});
+ if (trb_strerror() =~ "no endpoint has been reached") {return -1;}
+ if (trb_strerror() ne "No Error") {
+ usleep($delay||1E5);
+ if($errcnt >= 12) {
+ return "SPI still blocked\n";
+ }
+ elsif($errcnt++ >= 10) {
+ trb_register_read($board,0xd412);
+ }
+ }
+ else {
+ last;
+ }
+ }
+ return trb_register_read($board,0xd412);
+ }
1;
__END__
use Data::Dumper;
# use Hmon;
+#Add all possible paths here...
+use lib '/home/hadaq/EPICS/base-3.14.12.3/lib/perl';
use lib '/mnt/home_cbm02/hadaq/EPICS/base-3.14.12.3/lib/perl';
use CA;
+# Address list for Epics IOCs. Don't remove unused values
+$ENV{EPICS_CA_ADDR_LIST} = "10.160.0.63 192.168.1.100";
$ENV{EPICS_CA_AUTO_ADDR_LIST} = 'YES';
-# JAM added fixed port numbers of EB epics
-$ENV{EPICS_CA_ADDR_LIST} = "10.160.0.63 cbmpi2";
-#$ENV{EPICS_CA_ADDR_LIST} = "192.168.100.11 192.168.100.12 192.168.100.13 192.168.100.14 192.168.100.15 localhost";
my $EpicsValues = {};
my $EpicsStore = {};
blinkcnt++;
}
+
+/*Some functions for PMT Heatmap plot for CBM RICH*/
function heatmapRegister() {
if (!document.getElementById('heatmap-img')) return;
document.body.appendChild(js);
}
- document.getElementById('heatmap-img').onmousemove = document.getElementById('heatmap-img').onmouseover = function(e) {
+ heatmapPlaceHint("auto");
+
+ document.getElementById('heatmap-img').onmousemove =
+ document.getElementById('heatmap-img').onmouseover =
+ document.getElementById('heatmap-img').onclick =
+ function(e) {
+ if (!e.target || e.target.id != 'heatmap-img') return;
+
+ var imgPos = document.getElementById('heatmap-img').getBoundingClientRect();
var cx = e.clientX;
var cy = e.clientY;
- if (!cx || !cy) return;
-
var ix = parseInt((cx - HeatmapDef.x) / HeatmapDef.w);
- var iy = 32- parseInt((cy - HeatmapDef.y) / HeatmapDef.h);
- if (ix < 0 || ix > 31 || iy < 0 || iy > 31) return;
-
- document.getElementById('heatmap-caption').innerHTML = HeatmapDef.labels[ix][iy];
+ var iy = 31- parseInt((cy - HeatmapDef.y) / HeatmapDef.h);
+ heatmapPlaceHint( !(ix < 0 || ix > 31 || iy < 0 || iy > 31), ix, iy );
}
}
+ var heatmapPX, heatmapPY, heatmapShow;
+ function heatmapPlaceHint(mode, ix, iy) {
+ if (mode=='auto') {
+ mode = heatmapShow;
+ ix = heatmapPX;
+ iy = heatmapPY;
+ };
+
+ heatmapShow = mode;
+ heatmapPX = ix;
+ heatmapPY = iy;
+
+ var indi = document.getElementById('heatmap-indicator');
+ if (!indi) {
+ indi = document.createElement("div");
+ indi.id = 'heatmap-indicator';
+ indi.style.border="3px solid #ff0000";
+ indi.style.width = HeatmapDef.w + "px";
+ indi.style.height = HeatmapDef.h + "px";
+ indi.style.position='absolute';
+ document.getElementById('heatmap-img').parentNode.appendChild(indi);
+ }
+
+ if (!mode) {
+ indi.style.display="none";
+ document.getElementById('heatmap-caption').innerHTML = "Hover/Click image for FPGA/Channel info";
+ return;
+ }
+
+ var pmtid = 4 - parseInt(iy / 8) + 4 * (3 - parseInt(ix / 8));
+
+ indi.style.display="block";
+ indi.style.left = parseInt(ix*HeatmapDef.w + HeatmapDef.x - 3) + "px";
+ indi.style.top = parseInt((31-iy)*HeatmapDef.h + HeatmapDef.y - 3) + "px";
+ document.getElementById('heatmap-caption').innerHTML = "cell (" + ix + ", " + iy + ") " + HeatmapDef.labels[ix][iy] + " PMT " + pmtid;
+ }
+/*END: Some functions for PMT Heatmap plot for CBM RICH*/
</script>$;
}
$out .= qq$
--- /dev/null
+/dev/shm/dmon
\ No newline at end of file
use Data::Dumper;
-my %config = do $ARGV[0];
-my $flog = Dmon::OpenQAFile();
-trb_init_ports() or die trb_strerror();
-
-
-my $value, my $longtext, my $status;
+my %config = Dmon::StartUp();
+my $old, my $value;
my $lasterrors = 0;
while(1) {
my $errors = 0;
- foreach my $b (@{$config{TdcAddress}}) {
- my $r = trb_register_read($b,0xc100);
- foreach my $c (%{$r}) {
- if ($c & 0x10000) {$errors++;}
- }
- }
- my $title = "Ref Polarity";
-
- if ($errors) { $value = $errors." errors"; }
- else { $value = "OK";}
+ my $sig = trb_register_read($config{BeamTRB},$config{BeamChan});
+ my $title = "Last Spill";
- my $longtext = "Polarity of the reference time signals on TDCs seems to be: ".$value;
- if($errors && $lasterrors) { $status = Dmon::GetQAState('below',$errors,(0,1,4));}
- else { $status = Dmon::OK;}
- Dmon::WriteQALog($flog,"reftime",20,$status,$title,$value,$longtext);
- $lasterrors = $errors;
- sleep 10;
+ my $curr = $sig->{$config{BeamTRB}} & 0xffffff;
+
+ if($curr - $old > $config{SpillThreshold}) {
+ $value += $curr - $old||0;
+ }
+ else {
+ if ($value > 0) {
+ my $longtext = "Number of signals in last spill: ".$value;
+ my $status = Dmon::OK;
+ Dmon::WriteQALog($config{flog},"beamintensity",60,$status,$title,$value,$longtext);
+ $value = 0;
+ }
+ }
+
+
+
+ $old = $curr;
+ sleep 1;
}
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
+
use HADES::TrbNet;
use Time::HiRes qw(usleep gettimeofday tv_interval);
use Dmon;
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
use HADES::TrbNet;
use Time::HiRes qw(usleep);
use HPlot;
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
use HADES::TrbNet;
use Time::HiRes qw(usleep);
use Dmon;
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
use HADES::TrbNet;
use Time::HiRes qw(usleep);
use Dmon;
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
use HADES::TrbNet;
use List::Util qw(min max);
use Time::HiRes qw(usleep);
HPlot::PlotInit({
name => "PadiwaCurrents",
file => Dmon::DMONDIR."PadiwaCurrents",
- curves => 20,
+ curves => 16,
entries => 300,
type => HPlot::TYPE_HISTORY,
output => HPlot::OUT_PNG,
$str .= Dmon::MakeFooter();
Dmon::WriteFile("PadiwaCurrents",$str);
-for(my $i = 1; $i<=20; $i++) {
- my $name = sprintf('CBM:PWRSWITCH:GetCurrent%02x',$i);
+for(my $i = 0; $i<16; $i++) {
+ my $name = sprintf('CBM:PWRSWITCH:GetCurrent%02X',$i);
Perl2Epics::Connect("C".$i,$name);
}
my $maximum = 0;
my $total = 0;
- for(my $i = 1; $i<=20; $i++) {
+ 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-1);
+ HPlot::PlotAdd('PadiwaCurrents',$val,$i);
}
-
HPlot::PlotDraw('PadiwaCurrents');
my $title = "Currents";
- my $value = sprintf("%.3fA / %.3fA", $maximum, $total);
+ my $value = sprintf("%.2fA / %.2fA", $maximum, $total);
my $longtext = "Maximum / Total current: ". $value;
my $status = Dmon::OK;
Dmon::WriteQALog($config{flog},"currents",30,$status,$title,$value,$longtext,'2-PadiwaCurrents');
use warnings;
use POSIX qw(strftime);
use FileHandle;
-use lib "./code";
-use lib "../tools";
use HADES::TrbNet;
use Time::HiRes qw(usleep);
use Dmon;
HPlot::PlotInit($plot2);
my $str = Dmon::MakeTitle(9,14,"HeatmapRich",0);
- $str .= qq@<img src="%ADDPNG HeatmapRich.png%" type="image/png" id="heatmap-img"><div id="heatmap-caption" style="margin-top: -5px;"></div>@;
+ $str .= qq@<div style="padding:0"><img src="%ADDPNG HeatmapRich.png%" type="image/png" id="heatmap-img"></div><div id="heatmap-caption" style="margin-top: -5px;"></div>@;
$str .= Dmon::MakeFooter();
Dmon::WriteFile("HeatmapRich",$str);
sub generateDef {
- my $x = 55; my $y = 50; my $w = (566-$x) / 32.0; my $h = (619-$y) / 32.0;
+ my $x = 56; my $y = 51; my $w = (564-$x) / 32.0; my $h = (619-$y) / 32.0;
$str = qq@
var HeatmapDef = {
if($readlines++ > 10000) {
$readlines = 0;
close(FLOG);
+ system "cat " . Dmon::DMONDIR . "/qalog >> " . $config{UserDirectory} . "/qalog_persist";
open(FL,">".Dmon::DMONDIR."/qalog");
close(FL);
open(FLOG, "tail -F ".Dmon::DMONDIR."/qalog|");
--- /dev/null
+../dmon/code/Dmon.pm
\ No newline at end of file
--- /dev/null
+../tools/HPlot.pm
\ No newline at end of file
--- /dev/null
+../dmon/code/Perl2Epics.pm
\ No newline at end of file
my $opt_32channel = 0;
my $opt_finetune = false;
my $opt_verb;
+my $tool = "./thresholds_automatic.pl";
GetOptions ('h|help' => \$opt_help,
'e|endpoints=s' => \@opt_endpoints,
'p|polarity=i' => \$opt_polarity,
'32|32channel' => \$opt_32channel,
'f|finetune' => \$opt_finetune,
+ 't|tool=s' => \$tool,
'v|verb' => \$opt_verb);
foreach my $endpoint (@$endpoints) {
foreach my $chain (@$chains) {
my $endpoint = sprintf("0x%04x", $endpoint);
- $command = "./thresholds_automatic.pl -e $endpoint -o $opt_offset -c $chain -p $opt_polarity $opt_32channel $opt_finetune";
+ $command = "$tool -e $endpoint -o $opt_offset -c $chain -p $opt_polarity $opt_32channel $opt_finetune";
print "command: $command\n";
my $pid = fork();
if($pid==0) { #child
my $uid;
foreach my $i (reverse (0..3)) {
#print "send command: $endpoint , i: $i\n";
- $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, 0x10000000 | $i * 0x10000);
+ $rh_res = Dmon::PadiwaSendCmd(0x10000000 | $i * 0x10000, $endpoint, $chain);
$uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff);
#print $uid;
}
}
$command = $fixed_bits | ($current_channel << 16) ;
- my $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, $command);
+ my $rh_res = Dmon::PadiwaSendCmd($command,$endpoint, $chain);
push (@thresh , $rh_res->{$endpoint});
}
}
$command = $fixed_bits | ($current_channel << 16) | ($ra_thresh->[$current_channel] << $shift_bits);
- Dmon::PadiwaSendCmd($endpoint, $chain, $command);
+ Dmon::PadiwaSendCmd($command,$endpoint, $chain);
}
use warnings;
use Data::Dumper;
-use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
use Dmon;
use Getopt::Long;
my $command= $fixed_bits | ($current_channel << 16) | ($thresh << $shift_bits);
- Dmon::PadiwaSendCmd($endpoint, $chain, $command);
+ #Dmon::PadiwaSendCmd($endpoint, $chain, $command);
+ send_command($endpoint, $chain, $command);
}
setranges($fh,'zrange',$p->{$name}->{zmin},$p->{$name}->{zmax});
setranges($fh,'cbrange',$p->{$name}->{cbmin},$p->{$name}->{cbmax});
+ if($p->{$name}->{addCmd} && $p->{$name}->{addCmd} ne "") {
+ plot_write($fh,$p->{$name}->{addCmd});
+ }
if($p->{$name}->{type} == TYPE_HISTORY) {
if($p->{$name}->{fill}) {
}
elsif($p->{$name}->{type} == TYPE_HEATMAP) {
plot_write($fh,"set view map");
- plot_write($fh,"set palette rgbformulae 22,13,-31");
+ if(defined $p->{$name}->{palette}) {
+ plot_write($fh,"set palette ".$p->{$name}->{palette});
+ }
+ else {
+ plot_write($fh,"set palette rgbformulae 22,13,-31");
+ }
if ($p->{$name}->{showvalues} == 0) {
plot_write($fh,"splot '-' matrix with image");
}
#Scripts to start & order of icons in the Overview
activeScripts => [['time','ping','-','-','daqop'],
['numfee','temperature','reftime','billboard','mbs'],
+ ['beamintensity','-','-','-','-'],
['trgrate','datarate','deadtime','-','-'],
['heatmaprich','padiwatemp','padiwaonline','currents','pscurrents'],
- ['cbmnetlink','cbmnetdata','cbmnetsync','-','-'],],
+ ['cbmnetlink','cbmnetdata','cbmnetsync','-','-']],
#Names to be shown in left column of Overview (max 4 letters!)
-qaNames => ['sys','main','rate','Pdwa','CNet','-'],
+qaNames => ['sys','main','beam','rate','Pdwa','CNet','-'],
#Expected number of FPGAs in system
NumberOfFpga => 90,
#Addresses of all TDCs. Either single or broadcast addresses
TdcAddress => [0xfe4c,0xfe4e,0x7005],
+#IPs of all devices which should react on a ping
TrbIP => ["192.168.0.29",
"192.168.0.47",
"192.168.0.56",
- "192.168.0.57",
+# "192.168.0.57",#extra TRB3
"192.168.0.59",
"192.168.0.72",
"192.168.0.73",
"192.168.0.104",
"192.168.0.105"],
+#Channel to read spill intensity from. Give limit for off-spill detection
+BeamTRB => 0x0110,
+BeamChan => 0xc005,
+SpillThreshold => 30,
+#Name detectors
+BeamDetectorsTrb => [0x0111,0x0111,0x0111,0x0110],
+BeamDetectorsChan => [0xc001,0xc005,0xc009,0xc005],
#User directory
UserDirectory => '/home/hadaq/trbsoft/daqtools/users/cern_cbmrich/',
-PowerSupScript => 'measure_powers.sh' # relative to UserDirectory
+PowerSupScript => 'measure_powers.sh' # relative to user dir
+
cd $tmpdir
- exec uxterm -fg black -bg khaki -geometry 120x20+0+45 -e "/home/hadaq/bin/daq_evtbuild -m 18 -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 \
${extraopts}; read; bash" &
sleep 1
- exec uxterm -fg black -bg tan -geometry 120x20+0+345 -e "/home/hadaq/bin/daq_netmem -m 18 -i UDP:0.0.0.0:50000 -i UDP:0.0.0.0:50001 -i UDP:0.0.0.0:50002 -i UDP:0.0.0.0:50003 -i UDP:0.0.0.0:50004 -i UDP:0.0.0.0:50005 -i UDP:0.0.0.0:50006 -i UDP:0.0.0.0:50007 -i UDP:0.0.0.0:50008 -i UDP:0.0.0.0:50009 -i UDP:0.0.0.0:50010 -i UDP:0.0.0.0:50011 -i UDP:0.0.0.0:50012 -i UDP:0.0.0.0:50013 -i UDP:0.0.0.0:50014 -i UDP:0.0.0.0:50015 -i UDP:0.0.0.0:50016 -i UDP:0.0.0.0:50017 -q 32 -d 1 -S test ; " &
+ exec uxterm -fg black -bg tan -geometry 120x20+0+345 -e "/home/hadaq/bin/daq_netmem -m 17 -i UDP:0.0.0.0:50000 -i UDP:0.0.0.0:50001 -i UDP:0.0.0.0:50002 -i UDP:0.0.0.0:50003 -i UDP:0.0.0.0:50004 -i UDP:0.0.0.0:50005 -i UDP:0.0.0.0:50006 -i UDP:0.0.0.0:50007 -i UDP:0.0.0.0:50008 -i UDP:0.0.0.0:50009 -i UDP:0.0.0.0:50010 -i UDP:0.0.0.0:50011 -i UDP:0.0.0.0:50012 -i UDP:0.0.0.0:50013 -i UDP:0.0.0.0:50014 -i UDP:0.0.0.0:50015 -i UDP:0.0.0.0:50016 -q 32 -d 1 -S test ; " &
pid=$!
echo $pid > $tmpdir/.daq_netmem.pid
0x0100 0 0xffffffff 0x00000000
0x0101 0 0xffffffff 0x00000000
0x0102 0 0xffffffff 0x00000000
- 0x0103 0 0x00000000 0x00000000
+ 0x0103 0 0xffffffff 0x00000000
0x0110 0 0x0000ffff 0x00000000 #gpin
0x0111 0 0xffffffff 0x00000000 #padiwa amps
#PATH=${HOME}/trbsoft/bin:${PATH}
#PATH=${HOME}/trbsoft/daqdata/bin:${PATH}
#PATH=${HOME}/trbsoft/trbnettools/bin:${PATH}
-export TRB3_SERVER=trb056:26000
-
-export TRBNETDPID=$(pgrep trbnetd)
-
-echo "- trbnetd pid: $TRBNETDPID"
-
-if [[ -z "$TRBNETDPID" ]]
-then
- ~/bin/trbnetd -i 56
- #~/trbsoft/trbnettools/binlocal/trbnetd -i 56
-fi
-
+#export TRB3_SERVER=trb056:26000
+
+#export TRBNETDPID=$(pgrep trbnetd)
+
+#echo "- trbnetd pid: $TRBNETDPID"
+#
+#if [[ -z "$TRBNETDPID" ]]
+#then
+# ~/bin/trbnetd -i 56
+# #~/trbsoft/trbnettools/binlocal/trbnetd -i 56
+#fi
+#
#export TRB3_SERVER=trb056
-export DAQOPSERVER=10.160.0.77:56
+#export DAQOPSERVER=10.160.0.78:56
trbcmd w 0x7005 0xa150 0x0001869f
# pulser enable
-trbcmd setbit 0x7005 0xa101 0x1
+#trbcmd setbit 0x7005 0xa101 0x1
#trbcmd clearbit 0x8000 0xa101 0x3
# divert TDC inputs to the CTS for trigger
echo "offset is ${offset} (200=1mv on input)"
../../thresholds/write_thresholds.pl $thresholdfile -o $offset
+echo "Loading Padiwa Amps Settings"
+/home/hadaq/trbsoft/daqtools/padiwa.pl 0x111 0 invert 0xaaaa
+../../thresholds/write_thresholds.pl thresh/thresholds_padiwa_amps.thr -o 0
+
+
+echo "Disable noisy pixel in Padiwa"
+/home/hadaq/trbsoft/daqtools/padiwa.pl 0x073 0 disable 0x0001
+
#8103 3
#trbcmd clearbit 0x7005 0xc0 0x7
#trbcmd clearbit 0x7005 0xc1 0x7
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 00 threshold: 0x06F6, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 01 threshold: 0xDB23, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 02 threshold: 0x077D, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 03 threshold: 0xDC50, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x0672, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 05 threshold: 0xDC50, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 06 threshold: 0xffff, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0x0000, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 00 threshold: 0x0697, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 01 threshold: 0xDA00, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 02 threshold: 0x0744, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 03 threshold: 0xDB10, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x0600, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 05 threshold: 0xD880, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 06 threshold: 0x0600, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0xdf80, uid: 0
2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 08 threshold: 0xffff, uid: 0
2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 09 threshold: 0x0000, uid: 0
2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 10 threshold: 0xffff, uid: 0
$plot2->{sizex} = 700;
$plot2->{sizey} = 650;
$plot2->{nokey} = 1;
-$plot2->{buffer} = 1;
+$plot2->{buffer} = 0;
$plot2->{xmin} = 0.5;
$plot2->{xmax} = 32.5;
$plot2->{ymin} = 0.5;
<li><a href="tools/pwr/index.html" title="Currently supported: GW-Instek PSP-405 family, HMP2020 - HMP4040 family">Control for power supplies</a>
<li><a href="tools/vxi/index.html" title="Tested with Tektronix AFG3000 function generator">Control for devices running the VXI-11 protocol</a>
<li><a href="dmon/index.pl" title="DMON">DMON DAQ Monitoring</a></li>
+<li><a href="daqi/index.html" title="DMON">DAQi Control</a></li>
</ul>
</div>
</div>