]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
fixed to work with dirich, mt
authorMichael Traxler <M.Traxler@gsi.de>
Fri, 20 Dec 2019 18:14:49 +0000 (19:14 +0100)
committerMichael Traxler <M.Traxler@gsi.de>
Fri, 20 Dec 2019 18:14:49 +0000 (19:14 +0100)
thresholds/thresholds_automatic.pl

index 7fab87ea2a6734165504d7cb65b5ec3f808f146a..8283e08dcc141a43d3da383a28a7749405a60e12 100755 (executable)
@@ -130,11 +130,11 @@ my @crossed_thresh = (0) x 32;
 my @interval_step = ($interval_step) x 32;
 
 if (defined $opt_skip && $opt_skip < 32) {
-  $best_thresh[$opt_skip] = 0x7000;
+  $best_thresh[$opt_skip] = 0x6800;
 }
 
 if ($opt_finetune == true) {
-    my $ra_thresh = read_thresholds("padiwa", $chain);
+    my $ra_thresh = read_thresholds($mode, $chain);
     @current_thresh = @$ra_thresh;
     print Dumper \@current_thresh;
 
@@ -152,10 +152,11 @@ my $old_rh_res;
 my $outermost_channel_loop_counter = 0;
 
 #set default values
-my @zero_array = ($mode eq "dirich2") ? (0) x 32  : (0) x 16 ;
+my @zero_array = ($mode eq "dirich2") ? (0x0) x 32  : (0) x 16 ;
 
 write_thresholds($mode, $chain, \@zero_array);
 
+#$outermost_channel_loop_counter = 32;
 if($channel_by_channel == true) {
     $outermost_channel_loop_counter = ($mode eq "dirich2") ? 31 : 15 ;
 }
@@ -351,6 +352,11 @@ my $rh_res;
       $fixed_bits = 0x00300000;
       $shift_bits = 4;
     }
+    elsif ($mode eq "cbmrich") {
+      die "readout of channels in dirich2 is not implemented";
+      $fixed_bits = 0x00300000;
+      $shift_bits = 4;
+    }
 
     $command = $fixed_bits | ($current_channel << 16) ;
     my $rh_res = Dmon::PadiwaSendCmd($command,$endpoint, $chain);
@@ -372,6 +378,8 @@ my $rh_res;
 sub write_thresholds {
   (my $mode, my $chain, my $ra_thresh, my $channel_to_set) = @_;
 
+  #print "mode: $mode, chain: $chain, channel_to_set: $channel_to_set: ra_thresh:\n";
+  #print Dumper $ra_thresh;
   $share->store($chain);
 
   my $res;
@@ -410,17 +418,18 @@ sub write_thresholds {
       $channel_shift = 16;
     }
     elsif ($mode eq "dirich2") {
-      $fixed_bits = 0x8 << 20;
+      $fixed_bits = 0x8 << 20; # write command
       $shift_bits = 0;
       $channel_shift = 24;
     }
 
-    $command = $fixed_bits | ($current_channel << $channel_shift) | ($ra_thresh->[$current_channel] << $shift_bits);
-
+    $command = $fixed_bits | ( ($current_channel&0xf) << $channel_shift) | ( ( $ra_thresh->[$current_channel]&0xffff) << $shift_bits);
+    #printf "command: %x\n", $command;
     if ($mode eq "dirich2") {
       if ($current_channel<16) {
         Dmon::PadiwaSendCmd($command,$endpoint, 0);
       } else {
+        #print "second chain\n";
         Dmon::PadiwaSendCmd($command,$endpoint, 1);
       }