From 5b322762e6a0f346c984b88a23aa10899d1936ea Mon Sep 17 00:00:00 2001 From: Michael Traxler Date: Fri, 20 Dec 2019 19:14:49 +0100 Subject: [PATCH] fixed to work with dirich, mt --- thresholds/thresholds_automatic.pl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/thresholds/thresholds_automatic.pl b/thresholds/thresholds_automatic.pl index 7fab87e..8283e08 100755 --- a/thresholds/thresholds_automatic.pl +++ b/thresholds/thresholds_automatic.pl @@ -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); } -- 2.43.0