From: www@jspc55 Date: Tue, 7 Jan 2014 17:58:08 +0000 (+0100) Subject: included changes to run on several systems in parallel X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=7778b62756d1440f9c231bf687710744e44a373e;p=mvdsensorcontrol.git included changes to run on several systems in parallel --- diff --git a/Environment.pm b/Environment.pm index 380e67a..d333e2c 100644 --- a/Environment.pm +++ b/Environment.pm @@ -14,6 +14,7 @@ use constant CONFIGPATH => $ENV{'CONFIGPATH'} || "/local.1/htdocs/mv use constant TEMPDIR => JTAGROOTPATH."temp/"; use constant SETUPDIR => JTAGROOTPATH."../mvdconfig/setup/"; +use constant SYSTEMDIR => JTAGROOTPATH."../mvdconfig/system/"; use constant CONFDIR => JTAGROOTPATH."../mvdconfig/config/"; use constant SPECDIR => JTAGROOTPATH."specs/"; use constant PICTUREPATH => TEMPDIR."prevImgs/"; #path for images on webserver (absolute path) diff --git a/tools/preview/exec_evtbuild_t.pl b/tools/preview/exec_evtbuild_t.pl index 82d5930..533822d 100755 --- a/tools/preview/exec_evtbuild_t.pl +++ b/tools/preview/exec_evtbuild_t.pl @@ -18,11 +18,14 @@ my $opt_help; my $opt_time; my $opt_path="./"; my $time; - +my $opt_system = "null"; +my $opt_ports; GetOptions ('h|help' => \$opt_help, 't|time=f' => \$opt_time, - 'p|path=s' => \$opt_path + 'p|path=s' => \$opt_path, + 's|system=s' => \$opt_system, + 'd|ports=s' => \$opt_ports ); if($opt_help) { @@ -39,6 +42,8 @@ required: [-h|--help] : Show this help. [-p|--path /path/to/dump/data/ ] : Specify the path where the data is to be written to. default: ./ + -s|system : Name of the system data is read from. + -d|ports : dash separated list of ports to listen on. " } @@ -51,11 +56,23 @@ else{ $time = 3; } +my $c; +my $portoption = ""; +if (defined($opt_ports)) { + $portoption = $opt_ports; + $c = ($portoption =~ tr/-//) + 1; + $opt_ports =~ s/-/ -i /g; + $portoption = "-i ".$opt_ports; + } +else { + die "No ports specified"; + } + chdir($opt_path); -$thr1 = threads->new(\&execute, "timeout -s SIGINT ".($time+1.5)." daq_evtbuild -m 1 -q 32 -d file -x te -Se -S mvdtest"); +$thr1 = threads->new(\&execute, "timeout -s SIGINT ".($time+1.5)." daq_evtbuild -m $c -q 32 -d file -x te -Se -S $opt_system"); sleep 1; -$thr2 = threads->new(\&execute, "timeout -s SIGINT ".$time." daq_netmem -m 1 -q 32 -i 50000 -S mvdtest"); +$thr2 = threads->new(\&execute, "timeout -s SIGINT ".$time." daq_netmem -m $c -q 32 $portoption -S $opt_system"); $thr1->join(); $thr2->join(); @@ -68,3 +85,4 @@ sub execute { my $s = shift; system($s); } + diff --git a/tools/preview/unpack_hld.pl b/tools/preview/unpack_hld.pl index 819d3f4..7855fbe 100755 --- a/tools/preview/unpack_hld.pl +++ b/tools/preview/unpack_hld.pl @@ -28,6 +28,7 @@ my $opt_picpath = "./"; my $totalevents = 1E9; my $opt_movie = 0; my $mode = ""; +my $system = "null"; GetOptions ('h|help' => \$opt_help, 'f|file=s' => \$file, @@ -36,6 +37,7 @@ GetOptions ('h|help' => \$opt_help, 'd|debug' => \$opt_debug, 'p|picpath=s' => \$opt_picpath, 'm|movie=i' => \$opt_movie, + 's|system=s' => \$system, 'e|events=i' => \$totalevents); @@ -49,6 +51,7 @@ if($opt_help) { printf("[-i|--info] Show frame information\n"); printf("[-d|--debug] More debugging output\n"); printf("[-m|--movie] Make a slideshow of frames\n"); + printf("[-s|--system] Name of the system\n"); printf("[-p|--picpath] Set where to write plots\n"); printf("\n"); exit; @@ -521,14 +524,14 @@ sub WriteResults { print $fg strftime("set label 100 \"%H:%M:%S\" at screen 0.98,0.02 right tc rgb \"#000044\" font \"monospace,8\"\n", localtime()); print $fg "set label 101 \"".$hitcount->{$id}." States, ".($Statistics->{$id}->{Valid}||0)." good, ".($Statistics->{$id}->{Broken}||0)." broken, ".($Statistics->{$id}->{RealBroken}||0)." invalid\" at screen 0.02,0.02 left tc rgb \"#000044\" font \"monospace,8\"\n" ; - print $fg "set output '$opt_picpath/image_recalibrated_$s$num.png';\n"; + print $fg "set output '$opt_picpath/".$system."_$s$num.png';\n"; print $fg "plot '-' matrix with image\n"; } else { my $s = sprintf("%04x",$id); print $fg strftime("set label 100 \"%H:%M:%S\" at screen 0.98,0.02 right tc rgb \"#000044\" font \"monospace,8\"\n", localtime()); print $fg "set label 101 \"".$hitcount->{$id}." States, ".($Statistics->{$id}->{Valid}||0)." good, ".($Statistics->{$id}->{Broken}||0)." broken, ".($Statistics->{$id}->{RealBroken}||0)." invalid\" at screen 0.02,0.02 left tc rgb \"#000044\" font \"monospace,8\"\n" ; - print $fg "set output '$opt_picpath/image_recalibrated_$s$num.png';\n"; + print $fg "set output '$opt_picpath/".$system."_$s$num.png';\n"; print $fg "replot\n"; } diff --git a/tools/run.pl b/tools/run.pl index bd30244..557e052 100755 --- a/tools/run.pl +++ b/tools/run.pl @@ -6,6 +6,7 @@ use strict; use warnings; use POSIX; +use XML::LibXML; use CGI ':standard'; # use Cwd; use CGI::Carp qw(fatalsToBrowser); @@ -19,13 +20,35 @@ use Environment; my $here = getcwd(); +my $q = CGI->new; my $runtime = 0.2; - -my $dumpPath = DUMPPATH; +my $setupFile = $q->param('setupFile'); #$ENV{'QUERY_STRING'}; # +if( $q->param('runtime') ) { + $runtime = $q->param('runtime'); + } + +#print "Loading detector setup from $setupFile\n"; +my $parser = XML::LibXML->new(line_numbers => 1); +my $db = $parser->parse_file($setupFile); +my $systemName = $db->findvalue("/DetectorSetup/readoutsystem/\@name"); +#print "Loading system description from $systemName\n"; +my $systemFile = SYSTEMDIR."/".$systemName.".xml"; +$db = $parser->parse_file($systemFile); +my @portlist; +for my $gbe ($db->findnodes("//gbe")) { + push(@portlist,$gbe->findvalue("./\@port")); + } +my $ports = join("-",@portlist); +my $daqopserver = $db->getDocumentElement->findvalue('daqopserver'); +$ENV{'DAQOPSERVER'} = $daqopserver if defined($daqopserver); + + +my $dumpPath = DUMPPATH."/".$systemName; my $picPath = PICTUREPATH; -my $q = CGI->new; + + print header; print start_html( @@ -33,11 +56,9 @@ print start_html( -style=>{'src'=>'../layout/styles.css'} ); -if( $q->param('runtime') ) { - $runtime = $q->param('runtime'); -} -my $setupFile = $q->param('setupFile'); + + # print escapeHTML("hallo<<<>>>&&&!!"),br; # print escapeHTML($here); # $ENV{'PATH'}=$ENV{'PATH'}.":/home/hadaq/bin"; @@ -60,11 +81,11 @@ my $dummy; $dummy =qx"./startup.pl $setupFile"; $dummy.=qx"rm $dumpPath/te1*.hld 2>&1"; -$dummy.=qx"./preview/exec_evtbuild_t.pl -t $runtime -p $dumpPath 2>&1"; +$dummy.=qx"./preview/exec_evtbuild_t.pl -t $runtime -p $dumpPath -s $systemName -d $ports 2>&1"; $dummy.=qx"rm $dumpPath/temp.hld 2>&1"; $dummy.=qx"mv $dumpPath/te1* $dumpPath/temp.hld 2>&1"; -$dummy.=qx"rm $picPath/*.png 2>&1"; # delete old pictures -$dummy.=qx"./preview/unpack_hld.pl -f $dumpPath/temp.hld -p $picPath 2>&1"; +$dummy.=qx"rm $picPath/$systemName*.png 2>&1"; # delete old pictures +$dummy.=qx"./preview/unpack_hld.pl -f $dumpPath/temp.hld -p $picPath -s $systemName 2>&1"; my $escapedDummy = escapeHTML($dummy); $escapedDummy =~ s/\n/
/g; print $escapedDummy; diff --git a/tools/start.pl b/tools/start.pl index c030acc..417a838 100755 --- a/tools/start.pl +++ b/tools/start.pl @@ -28,45 +28,49 @@ sub run { } -#trb_register_write(0x8000,0xa002,0xab); -#print Dumper trb_register_read(0x8000,0xa002); - -#exit; - +my $system = $ARGV[0]; +unless (defined $system) {die "No system name given\n";} +my $systemFile = SYSTEMDIR."/".$system.".xml"; +unless(-e $systemFile) {die "System file $systemFile not found\n";} +my $parser = XML::LibXML->new(line_numbers => 1); +my $db = $parser->parse_file($systemFile); + +my $ccu = hex($db->findvalue("/DaqSetup/ccu/\@address")); +my(@hub,@gbe,@roc); +for my $n ($db->findnodes("//hub")) { + push(@hub,hex($n->findvalue("./\@address"))); + } +for my $n ($db->findnodes("//gbe")) { + push(@gbe,hex($n->findvalue("./\@address"))); + } +for my $n ($db->findnodes("//roc")) { + push(@roc,hex($n->findvalue("./\@address"))); + } +printf("CCU:\t%04x\n",$ccu); +print("ROC:\t".join(", ", map {sprintf("%04x",$_)} @roc)."\n"); +print("HUB:\t".join(", ", map {sprintf("%04x",$_)} @hub)."\n"); +print("GBE:\t".join(", ", map {sprintf("%04x",$_)} @gbe)."\n"); + run("trbcmd reset"); #Set addresses run(DAQTOOLSPATH."/tools/merge_serial_address.pl ".DAQTOOLSPATH."/base/serials_trb3.db ".CONFIGPATH."/network/addresses_trb3.db"); - - -#Set GbE Configuration +#Set GbE Configuration (common for all boards) run(DAQTOOLSPATH."/tools/loadregisterdb.pl ".CONFIGPATH."/network/register_configgbe_mvd.db"); run(DAQTOOLSPATH."/tools/loadregisterdb.pl ".CONFIGPATH."/network/register_configgbe_ip_mvd.db"); -#trb_write(0x8c00,0x8000,0x8000); -#trb_write(0x8c00,0x8000,0x0000); - - trb_write(0xfffe,0x00c5,0x20ff); #Timeouts - -#trb_write(0x8c00,0x00c0,0xffff); #Enable ports of Hub2 -#trb_write(0x8c00,0x00c1,0xffff); -#trb_write(0x8c00,0x00c3,0xffff); -#trb_write(0x8c01,0x00c0,0xffff); -#trb_write(0x8c01,0x00c1,0xffff); -#trb_write(0x8c01,0x00c3,0xffff); - -trb_write(0x8000,0x00c0,0x00e1); -trb_write(0x8000,0x00c1,0x00e1); -trb_write(0x8000,0x00c3,0x00ff); #only slowcontrol for unused FPGA - - -#Set Sensor IDs -#trb_write(0xfe4d,0x00c0,0xccc1ccc0); - -#Set JTAG switches -trb_write(0xfe4d,0xb000,0x00000000); +if($system eq 'Vacuum') { + trb_write($ccu,0x00c0,0x00e1); + trb_write($ccu,0x00c1,0x00e1); + trb_write($ccu,0x00c3,0x00ff); #only slowcontrol for unused FPGA + } +if($system eq 'ELab') { + trb_write($ccu,0x00c0,0x00e4); + trb_write($ccu,0x00c1,0x00e4); + trb_write($ccu,0x00c3,0x00fc); #only slowcontrol for unused FPGA + } #Send arbiter start signal -trb_write(0x8000,0xa000,0x00000001); +trb_write($ccu,0xa000,0x00000001); diff --git a/tools/startup.pl b/tools/startup.pl index bce915c..90aaa5e 100755 --- a/tools/startup.pl +++ b/tools/startup.pl @@ -59,16 +59,12 @@ mkdir($defaultIniPath) unless (-e $defaultIniPath); ############################### my @commands; my $boardsini; +my $setupFile = $ARGV[0]; +my $systemFile = $ARGV[1]; my $parser = XML::LibXML->new(line_numbers => 1); -my $filename = $ARGV[0]; -my $db = $parser->parse_file($filename); +my $db = $parser->parse_file($setupFile); my $name = $db->getDocumentElement->getAttribute('name'); -print STDERR "Loading setup $name from file $filename\n" if $verbose; - -my $daqopserver = $db->getDocumentElement->findvalue('daqopserver'); -$ENV{'DAQOPSERVER'} = $daqopserver if defined($daqopserver); -print "DAQOPSERVER = ".$ENV{'DAQOPSERVER'}."\n" if $verbose; - +print STDERR "Loading setup $name from file $setupFile\n" if $verbose; foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { diff --git a/tools/testgui.pl b/tools/testgui.pl index 7c66a5b..b4d0a84 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -33,6 +33,7 @@ my $picPath= PICTUREPATHREL; # my $setupFile = SETUPFILE; my $setupFile; my $setupFileName; +my $systemName; # the file that tells me what fields should be printed in the quick edit area # for each sensor @@ -87,7 +88,7 @@ if( not(defined($q->param())) or $q->param('setup') ) { if ($q->param('busy') and ($q->param('busy') ne "false") ) { print img{src=>"../share/hourglass.png",title=>$sensorId}; } else { - my $imgSrc = $picPath.'/image_recalibrated_'.$sensorId.'.png'; + my $imgSrc = $picPath.'/'.$sensorId.'.png'; if (-e $imgSrc) { print img{src=>$imgSrc."?".rand(),title=>$sensorId}; } else { @@ -210,6 +211,7 @@ sub print_setupStructure { unless(defined($setup)) { die "did not find DetectorSetup node in setup file!\n";} my $setupDesc = $setup->findvalue("./description"); my $setupName = $setup->findvalue("./\@name"); + $systemName = $setup->findvalue("/DetectorSetup/readoutsystem/\@name"); print h2("Setup: $setupName"); print "

description: $setupDesc

"; @@ -233,13 +235,13 @@ sub print_setupStructure { unless(scalar(@sensors)>0) { die "no sensors attached to chain $chainName\n";} for my $sensor (@sensors) { - my $sensorId = $sensor->findvalue("./\@id"); - my $sensorName = $sensor->findvalue("./\@name"); - my $sensorConfig = $sensor->findvalue("./\@config"); - my $sensorEnabled = $sensor->findvalue("./\@enabled"); - my $sensorSerial = $sensor->findvalue("./\@serial"); - my $sensorPosition = $sensor->findnodes("./position")->shift(); - my $sensorDescription = $sensor->findvalue("./description"); +# my $sensorId = $systemName.'_'.$sensor->findvalue("./\@id"); +# my $sensorName = $sensor->findvalue("./\@name"); +# my $sensorConfig = $sensor->findvalue("./\@config"); +# my $sensorEnabled = $sensor->findvalue("./\@enabled"); +# my $sensorSerial = $sensor->findvalue("./\@serial"); +# my $sensorPosition = $sensor->findnodes("./position")->shift(); +# my $sensorDescription = $sensor->findvalue("./description"); # print h5("Sensor name:$sensorName id:$sensorId"); # print "

description: $sensorDescription

"; @@ -262,7 +264,7 @@ sub print_sensorArea { my $sensor = $_[0]; # this is an xml object that contains the sensor node # from the setup file - my $sensorId = $sensor->findvalue("./\@id"); + my $sensorId = $systemName.'_'.$sensor->findvalue("./\@id"); my $sensorName = $sensor->findvalue("./\@name"); my $sensorConfig = $sensor->findvalue("./\@config"); my $sensorEnabled = $sensor->findvalue("./\@enabled");