From 0d94ad6004062331ddcdb28a7ac6527046ce7ea9 Mon Sep 17 00:00:00 2001 From: hadaq Date: Thu, 13 Aug 2015 17:25:39 +0200 Subject: [PATCH] added positive pulses to automatism, mt --- thresholds/thresholds_automatic.pl | 31 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/thresholds/thresholds_automatic.pl b/thresholds/thresholds_automatic.pl index 8088d18..b837882 100755 --- a/thresholds/thresholds_automatic.pl +++ b/thresholds/thresholds_automatic.pl @@ -44,6 +44,7 @@ my $help = ""; my $offset = 0; my $opt_skip = 99; my $polarity = 1; +my $default_direction = 1; my @channels = (); my $channel_to_set = undef; my $channel_by_channel = false; @@ -60,6 +61,7 @@ my $result = GetOptions ( "e|endpoint=s" => \$endpoint, "m|mode=s" => \$mode, "p|polarity=i" => \$polarity, + "d|direction=i" => \$default_direction, "o|offset=s" => \$offset, "32|32channel" => \$channel32, "s|skip=i" => \$opt_skip, @@ -231,18 +233,16 @@ while ($number_of_steps < $number_of_iterations || $best_thresh[$i] = $current_thresh[$i]; } - my $direction = 1; - if ( - #$crossed_thresh[$i]==1 && - $static_value == ($polarity ? 0 : 1)) { - $interval_step = int($interval_step/1.2); - $direction = -1; - } elsif ($hit_diff > $accepted_dark_rate ) { - $interval_step = int($interval_step/1.2); - $direction = -1; - } else { - $interval_step = int($interval_step/1.2); - } + my $direction = $default_direction; + if ($static_value == ($polarity ? 0 : 1)) { + $interval_step = int($interval_step/1.2); + $direction = -1; + } elsif ($hit_diff > $accepted_dark_rate ) { + $interval_step = int($interval_step/1.2); + $direction = -1; + } else { + $interval_step = int($interval_step/1.2); + } $interval_step = 2 if($interval_step < 2); $interval_step = 3 if($interval_step == 1 && $direction ==- 1); @@ -466,7 +466,12 @@ thresholds_automatic.pl -e 0x303 -o 0x10 -c 0 currently only mode "padiwa" is implemented. -polarity: tells what the status of bit 32 is, when the thresholds are set to 0 +polarity: tells what the status of bit 32 is in the TDC, when the thresholds are set to 0 + this is needed just for the convention, that an inactive channel shows up in the TDC registers + as green fields and therefore the padiwas need an invert of the outputs for negative signals +direction: what do you want to detect: + negative pulses: direction = 1 (default) + positive pulses: direction = 0 32channel: when set the tool assums a TDC with 32 channels, leading and trailing channels use two channels finetune: tries to optimize the thresholds beginning with the current ones -- 2.43.0