]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
current status hades39, mt
authorHades DAQ <hadaq@hades39.gsi.de>
Wed, 18 Oct 2017 11:50:01 +0000 (13:50 +0200)
committerHades DAQ <hadaq@hades39.gsi.de>
Wed, 18 Oct 2017 11:50:01 +0000 (13:50 +0200)
tools/determine_noiseband_dirich.pl
tools/dirich_scan_backplane.pl
tools/switch_power_dirich.pl
users/gsi_dirc/README
users/gsi_ee_trb84/TdcEventBuilder.xml
users/gsi_ee_trb84/first.C

index 0e355e3f93acb8a93506a50842b16d5bf8de5b5e..4d360c8dc007330955f9f052c5bf27b15a0c2abd 100755 (executable)
@@ -5,11 +5,26 @@ use HADES::TrbNet;
 use Time::HiRes qw(usleep);
 use Data::Dumper;
 
-my $dirich = 0x1208;
+use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
+use Dmon;
+
+my $dirich = 0x1229;
+
+$dirich = $ARGV[0];
+
+unless ($ARGV[0]) {
+  print "usage: $0 <DiRICH--TrbNet-Address>\n";
+  exit;
+}
+
+$dirich = hex($dirich);
+
 my $throffset = 0xa000;
-my $monitor = 0xdfc0;
+#my $monitor = 0xdfc0;
+my $monitor = 0xc001;
 
-my $last_channel = 8;
+my $first_channel = 0;
+my $last_channel = 31;
 
 my $default_threshold = 0x3000;
 
@@ -20,6 +35,7 @@ my @res; my $res; my $rh_res;
 
 trb_init_ports() or die trb_strerror();
 
+# enable monitor counters
 $res = trb_register_write($dirich, 0xdf80 , 0xffffffff);
 if(!defined $res) {
     $res = trb_strerror();
@@ -27,42 +43,60 @@ if(!defined $res) {
 }
 
 
+my $fixed_bits = 0x00800000;
+my $shift_bits = 0;
+my $channel_shift = 24;
+my $command;
+my $chain=0;
+
+
+
 for my $channel (0 .. 31) {
-    trb_register_write($dirich, $throffset + $channel , $default_threshold);
-    #$rh_res = trb_register_read($dirich, $throffset + $channel);
+  $chain = ($channel <16) ? 0 : 1;
+  $command = $fixed_bits | ($channel << $channel_shift) | ($default_threshold << $shift_bits);
+  Dmon::PadiwaSendCmd($command,$dirich, $chain);
+  #trb_register_write($dirich, $throffset + $channel , $default_threshold);
+  #$rh_res = trb_register_read($dirich, $throffset + $channel);
 }
 
 usleep (1E5);
 
 my $boundaries = {};
 
-#for my $channel (0 .. $last_channel) {
-for my $channel (28 .. 31) {
+for my $channel ($first_channel .. $last_channel) {
+#for my $channel (30 .. 31) {
 
     my $hit_zero_diff_flag = 0;
 
-    my $lower_threshold = 0x6e00;
+    my $lower_threshold = 0x6a80;
     my $upper_threshold = 0xd000;
     my $reasonable_upper_threshold = 0x8000;
-    my $thresh_increment = 0x04;
-    
+    my $thresh_increment = 0x8;
+
   THRESH_LOOP:    for (my $thresh = $lower_threshold ; $thresh <= $upper_threshold; $thresh += $thresh_increment) {
-      trb_register_write($dirich, $throffset + $channel , $thresh);
+      $chain = ($channel <16) ? 0 : 1;
+      $command = $fixed_bits | ($channel << $channel_shift) | ($thresh << $shift_bits);
+      Dmon::PadiwaSendCmd($command,$dirich, $chain);
+      ##trb_register_write($dirich, $throffset + $channel , $thresh);
       undef $rh_res;
       my @hits = ();
       foreach (1..2) {
-         usleep(50E3);
          $rh_res = trb_register_read($dirich, $monitor + $channel);
          #$res = trb_strerror();
          #print "error output: $res\n";
          #print Dumper $rh_res;
          push @hits ,$rh_res->{$dirich};
-      }
-      
+          #if ($_==1) {
+            usleep(40E3);
+          #}
+        }
+
       my $diff = $hits[1] - $hits[0];
+      #printf "cur thresh: %.4x diff: $diff\n",$thresh ;
+      #sleep 0.2;
       $hit_zero_diff_flag = 1 if($diff == 0);
-      
-      if($diff > 1 && !$hit_zero_diff_flag ) {
+
+      if($diff != 0 && !$hit_zero_diff_flag ) {
          print "channel: $channel, backup threshold a bit (by 0x800)..., thresh: "; printf "0x%x\n",$thresh;
          if($thresh <= $absolute_min_threshold) {
              print "reached abs min threshold\n";
@@ -78,33 +112,38 @@ for my $channel (28 .. 31) {
       }
 
       $thresh_increment *= 4 if($thresh_increment <= 0x100 && $thresh >= $reasonable_upper_threshold );
-      
+
       #my $thrstr = sprintf("0x%x", $thresh);
       #print "channel: $channel: thresh: $thrstr : diff: $diff, a=$hits[0] b=$hits[1]\n";
 
       my $thrstr = sprintf("0x%x", $thresh);
-      if($diff > 1) {
+      if($diff >= 50) {
          if( ! exists $boundaries->{$channel}->{'lower'} ) {
              print "channel: $channel, lower thresh: $thrstr\n";
              $boundaries->{$channel}->{'lower'} = $thresh;
          }
       }
-      elsif ($diff == 0 && exists $boundaries->{$channel}->{'lower'}) {
+      elsif ($diff == 0 && exists $boundaries->{$channel}->{'lower'} && ($thresh - $boundaries->{$channel}->{'lower'} ) > 0x40  ) {
          print "channel: $channel, upper thresh: $thrstr\n";
          $boundaries->{$channel}->{'upper'} = $thresh;
          last THRESH_LOOP;
       }
-      
-  }
+
+    }
+
     if ( ! exists $boundaries->{$channel}->{'upper'}) {
-       $boundaries->{$channel}->{'upper'} = $upper_threshold;
+      $boundaries->{$channel}->{'upper'} = $upper_threshold;
+      print "strange setting of upper thresh.\n";
     }
-    
-    trb_register_write($dirich, $throffset + $channel , $default_threshold);
+
+    $chain = ($channel <16) ? 0 : 1;
+    $command = $fixed_bits | ($channel << $channel_shift) | ($default_threshold << $shift_bits);
+    Dmon::PadiwaSendCmd($command,$dirich, $chain);
+    #trb_register_write($dirich, $throffset + $channel , $default_threshold);
 }
 
 
-print "\nresult:\n";
+printf "\nresult for 0x%.4x:\n",$dirich;
 #print Dumper $boundaries;
 print "channel | noiseband [mV]\n";
 print "------------------------\n";
@@ -114,12 +153,11 @@ foreach my $cur_channel (sort {$a <=> $b} keys %$boundaries) {
     printf "%2d      | %02.0f\n", $cur_channel , $width;
 }
 
-print "\nsummary:\n";
+printf "\nsummary for 0x%.4x:\n", $dirich;
 foreach my $cur_channel (sort {$a <=> $b} keys %$boundaries) {
     my $diff = $boundaries->{$cur_channel}->{upper} - $boundaries->{$cur_channel}->{lower};
     my $width = $diff * 38E-6 * 1000;
-    printf "%2d ", $width;
+    printf "%02.0f ", $width;
 }
 print "\n";
-       
 
index aef8c03744fed5e56bccac59d88e19c46005979d..d5519bc12dd977d43b6fe920372076c795e2d6b2 100755 (executable)
@@ -5,6 +5,11 @@ use Data::Dumper;
 
 my $dirich_concentrator_address = $ARGV[0];
 
+unless ($ARGV[0]) {
+  print "usage: dirich_scan_backplane.pl <DiRICH-Concentrator-TrbNet-Address>\n";
+  exit;
+}
+
 my $c;
 
 #($dirich_concentrator_address) = $dirich_concentrator_address =~ /0x([\w\d]+)/;
index 1b650e3cc59616bf4b6caaa2476e08baf0583287..9bc893e51871169f7fe61f2af3c9b2e301c20819 100755 (executable)
@@ -10,7 +10,8 @@ my $dirich_power_module_offset = 0xd580;
 
 my @res; my $res; my $rh_res;
 
-my @dirich_powerbit_mapping = (1, 23, 17, 24, 18, 26, 20, 25, 19, 28, 22, 27,21);
+#my @dirich_powerbit_mapping = (1, 23, 17, 24, 18, 26, 20, 25, 19, 28, 22, 27,21);
+my @dirich_powerbit_mapping = (1, 17 .. 28);
 
 my $dirich_concentrator_address = $ARGV[0];
 my $position = $ARGV[1];
index aa2ed72bbc99493dd5c5d762fa02ee3c11f76a1a..36d567bb02808e6f8a26040ffab123461c737367 100644 (file)
@@ -1,5 +1,5 @@
 #to start deamon
-TRB3_SERVER=trb056 ~/trbsoft/trbnettools/binlocal/trbnetd -i 56
+TRB3_SERVER=trb056 ~/trbsoft/trbnettools/bin/trbnetd -i 56
 
 #set environment
 export DAQOPSERVER=localhost:56
index 9bb7a8ae9462aa67dc822d770b655f5c4b7b2993..004e19d0ad1e71e71db58b930fc7850f5fbd5ba9 100644 (file)
@@ -69,8 +69,8 @@ When starting analysis from the go4 gui, one should specify stream server with p
     <!-- Thread name="*" publ="true" prof="true"/ -->
     
     <MemoryPool name="Pool">
-       <BufferSize value="2000000"/>
-       <NumBuffers value="1000"/>
+       <BufferSize value="400000"/>
+       <NumBuffers value="400"/>
     </MemoryPool>
     
     <!-- these are default parameters for TDC calibration modules -->
index 66418bfde1a9c986f5de404ef2a32eed7a8abe60..eb6e22a4301547e62eabc07761083164d1825c90 100644 (file)
@@ -103,10 +103,11 @@ extern "C" void after_create(hadaq::HldProcessor* hld)
       //  tdc->SetRefChannel(nch, nch-1, 0xffff, 10000,  -90., 90.);
       //}
 
-      for (unsigned j=0; j<33; j++) {
+      for (unsigned j=10; j<33; j++) {
         tdc->SetRefChannel(j, 1, 0xffff, 10000,  -40., 40.);
       }
 
+      tdc->SetRefChannel(6, 0, 0xffff, 10000,  -100.,100.);
       //tdc->SetRefChannel(0, 0, 0x1202, 10000,  -20., 20.);
       //tdc->SetRefChannel(4, 2, 0xffff, 10000,  -20., 20.);
       //tdc->SetRefChannel(1, tdc->NumChannels() -1 , 0xffff, 20000,  -10., 10.);