]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
included changes to run on several systems in parallel
authorwww@jspc55 <www@jspc55>
Tue, 7 Jan 2014 17:58:08 +0000 (18:58 +0100)
committerwww@jspc55 <www@jspc55>
Tue, 7 Jan 2014 17:58:08 +0000 (18:58 +0100)
Environment.pm
tools/preview/exec_evtbuild_t.pl
tools/preview/unpack_hld.pl
tools/run.pl
tools/start.pl
tools/startup.pl
tools/testgui.pl

index 380e67a66f8775679d83513fb009bd633b7f6667..d333e2c2ba78dc4e280b8830c2664753fffbdcd0 100644 (file)
@@ -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)
index 82d593071c3bcfc9222c915b02a0b1a27829db92..533822d4f40e0547d90e7822bfdfff0252298559 100755 (executable)
@@ -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 <id>                     : Name of the system data is read from.
+   -d|ports <portlist>                : 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);
 }
+
index 819d3f4503becbbe959b71866466e2d49e258bd1..7855fbe689e0399500262ef560980e6101a668f1 100755 (executable)
@@ -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>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";
     
       }
index bd30244ca9f8ac21b105c21ff178be596da3ac2d..557e0522f816a0f4f98087dfe1e2c138597c7f18 100755 (executable)
@@ -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/<br>/g;
 print $escapedDummy;
index c030acc280ea9d9a6607f07bbfdc11b83724fb7e..417a838820e67b34b6044690a6b6ef32dccf3a40 100755 (executable)
@@ -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);
index bce915c81e259eb734a6d363149971430504a78c..90aaa5e13c3fbcae94d75f68f054af17ddc2e4bb 100755 (executable)
@@ -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')) {
index 7c66a5b40e13495476aed8031e5ae0a3fac2bc7a..b4d0a842275b4b011a8cf1309ddc7741f9841f91 100755 (executable)
@@ -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 "<p>description: $setupDesc</p>";
   
@@ -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 "<p>description: $sensorDescription</p>";
@@ -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");