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;
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 ;
}
$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);
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;
$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);
}