]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Latest changes from Cern before end of beamtime
authorCbm Rich <richdaq@wuppertal>
Tue, 25 Nov 2014 20:24:19 +0000 (21:24 +0100)
committerCbm Rich <richdaq@wuppertal>
Tue, 25 Nov 2014 20:24:19 +0000 (21:24 +0100)
thresholds/thresholds_automatic_jan.pl
thresholds/thresholds_compare.pl
users/cern_cbmrich/dmon_config.pl
users/cern_cbmrich/startup.sh
users/cern_cbmrich/thresh/thresholds_padiwa_amps.thr

index fccd8459a978dcf41bbe36575ff3524d8af2f465..5bee92fc12c4a64878716e69247cdb6a1e86b2f9 100755 (executable)
@@ -15,12 +15,10 @@ use HADES::TrbNet;
 
 my $hitregister = 0xc001;
 
-my $interval_step = 0x0400;
-my $start_value =  0x7000;
 
 my $sleep_time = 2.0;
 my $accepted_dark_rate = 150;
-my $number_of_iterations = 40;
+my $number_of_iterations = 50;
 
 my $endpoint = 0x0303;
 my $mode = "padiwa";
@@ -72,7 +70,9 @@ if($endpoint !~ /^0x/) {
 }
 $endpoint = hex($endpoint);
 
-
+my $interval_step = 0x0400;
+my $start_value =  0x7000;
+if ($polarity == -1) {$start_value = 0xb000;}
 
 
 # go to the right position
@@ -155,15 +155,18 @@ while ($number_of_steps < $number_of_iterations) {
       $hit_diff[$i] = $hit_diff;
 
       if($number_of_steps  > $number_of_iterations - 20 || $opt_finetune) {
-        # select best  threshold, closest from bottom
+        # select best  threshold
         if(   $hit_diff[$i] <= $accepted_dark_rate
-          && $best_thresh[$i] <= $current_thresh[$i]
+          && (   ($best_thresh[$i] <= $current_thresh[$i] && $polarity == 1) 
+              || ($best_thresh[$i] >= $current_thresh[$i] && $polarity == -1)) 
           && $static_value == (($polarity==1)?0:1)) {
           $best_thresh[$i] = $current_thresh[$i];
           }
 
         #delete bogus entries
-        if($hit_diff[$i] >= $accepted_dark_rate && $current_thresh[$i] < $best_thresh[$i]) {
+        if($hit_diff[$i] >= $accepted_dark_rate 
+           && (   ($current_thresh[$i] < $best_thresh[$i] && $polarity == 1)
+               || ($current_thresh[$i] > $best_thresh[$i] && $polarity == -1))) {
           $best_thresh[$i] = $current_thresh[$i];
           }
         }
@@ -175,11 +178,11 @@ while ($number_of_steps < $number_of_iterations) {
         } 
       elsif ($hit_diff > $accepted_dark_rate 
              && $hit_diff < 10000 ) {
-        $current_thresh[$i] -= max($interval_step * $polarity , $opt_finetune?0x2:0x10);
+        $current_thresh[$i] -= max($interval_step , $opt_finetune?0x2:0x10) * $polarity;
         $interval_step = max(int($interval_step/2),4);
         }
       elsif ($hit_diff > $accepted_dark_rate ) {
-        $current_thresh[$i] -= max($interval_step * 2 * $polarity , $opt_finetune?0x4:0x50);
+        $current_thresh[$i] -= max($interval_step * 2  , $opt_finetune?0x4:0x50)* $polarity;
         $interval_step = max(int($interval_step/2),0x10);
         if ($hit_diff > 20000) {
           $make_it_quiet[$i] = 1;
@@ -285,7 +288,7 @@ sub write_thresholds {
       $shift_bits = 4;
     }
     my $thresh = $ra_thresh->[$current_channel];
-    if($make_it_quiet[$current_channel]) {$thresh = 0x0000;}
+    if($make_it_quiet[$current_channel]) {if($polarity == 1) {$thresh = 0x0000;} else {$thresh = 0xffff;}}
     push(@commands,$fixed_bits | ($current_channel << 16) | ($thresh << $shift_bits));
   }
   Dmon::PadiwaSendCmdMultiple(\@commands,$endpoint,$chain,5E3);
index 0f0e756f051ff893dfb2a6acc2726c528c8d3a97..1c6f1bb9fff68ec4f986929a2fbef0ae79e4df67 100755 (executable)
@@ -8,6 +8,10 @@ use HPlot;
 use Data::Dumper;
 use ChannelMapping;
 
+my $fn1 = $ARGV[0] or die("usage: thresholds_compare.pl file1 [file2]. omit file2 to get abs value, include for file1-file2");
+my $fn2 = $ARGV[1];
+
+
 my $plot2 = ();
 $plot2->{name}    = "HeatmapRich";
 $plot2->{file}    = "thresh_heatmap";
@@ -24,13 +28,13 @@ $plot2->{xmin}    = 0.5;
 $plot2->{xmax}    = $ChannelMapping::chanmap->{xsize}+0.5;
 $plot2->{ymin}    = 0.5;
 $plot2->{ymax}    = $ChannelMapping::chanmap->{ysize}+0.5;
-$plot2->{cbmin}   = "-400<*";
-$plot2->{cbmax}   = "*<400";
+$plot2->{cbmin}   = "-400<*" if $fn2;
+$plot2->{cbmax}   = "*<" . ($fn2 ? '400' : '45000'); 
 $plot2->{showvalues} = 0;
 $plot2->{xlabel} = "column";
 $plot2->{ylabel} = "row";
-$plot2->{addCmd} = "set lmargin at screen 0.07\nset rmargin at screen 0.85\nset bmargin at screen 0.07\nset tmargin at screen 0.95";
-$plot2->{palette} = "defined (  0 0 0 1,  0.5 1 1 1,  1 1 0 0 )";
+$plot2->{addCmd} = "set lmargin at screen 0.07\nset rmargin at screen 0.85\nset bmargin at screen 0.07\nset tmargin at screen 0.95";# . ($fn2 ? "": "\n set logscale cb");
+$plot2->{palette} = "defined (  0 0 0 1,  0.5 1 1 1,  1 1 0 0 )" if $fn2;
 
 HPlot::PlotInit($plot2);
 
@@ -53,8 +57,6 @@ sub readSettings {
 }
 
 # load files
-  my $fn1 = $ARGV[0] or die("usage: thresholds_compare.pl file1 [file2]. omit file2 to get abs value, include for file1-file2");
-  my $fn2 = $ARGV[1];
 
   my $totalsize = ($ChannelMapping::chanmap->{xsize}*$ChannelMapping::chanmap->{ysize});
   my %threshs1 = readSettings($fn1);
@@ -64,6 +66,11 @@ sub readSettings {
   if ($fn2) {
     %threshs2 = readSettings($fn2);
     print "WARNING: Expected ".$totalsize." settings in $fn2. Got " . scalar(keys %threshs2) unless scalar(keys %threshs2) == $totalsize; 
+  } else {
+    for my $key (keys %threshs1) {
+      $threshs2{$key} = 0;
+    }
+    $fn2 = 'n/a';
   }
 
 # plot heatmap
@@ -119,7 +126,7 @@ set output "thresh_hist.png"
 
 set xrange [$min:$max]
 
-binwidth=20
+binwidth=50
 bin(x,width)=width*floor(x/width)
 
 set style line 1 lt 1 lc rgb "green"
index 095e269d15c22103048d3a64278f3ae2978e080a..5a795a2ccf241734e670f3016b85e42dfb6c0537 100755 (executable)
@@ -90,9 +90,9 @@ BeamChan => 0xc005,
 SpillThreshold => 30,
 
 #Name detectors 
-BeamDetectorsTrb  => [0x0110, 0x0110, 0x0111,0x0110,0x0111,0x0110,0x0113,0x0110],
-BeamDetectorsChan => [0xc001, 0xc003, 0xc001,0xc009,0xc005,0xc00b,0xc009,0xc005],
-BeamDetectorsName => ['Fngr_d', 'Lead_d', 'C1',  'C1_d', 'C2',  'C2_d', 'Lead', 'Hodo'],
+BeamDetectorsTrb  => [0x0110, 0x0110, 0x0111,0x0110,0x0111,0x0110,0x0113,0x0111,0x0110],
+BeamDetectorsChan => [0xc001, 0xc003, 0xc001,0xc009,0xc005,0xc00b,0xc009,0xc009,0xc005],
+BeamDetectorsName => ['Fngr_d', 'Lead_d', 'C1',  'C1_d', 'C2',  'C2_d', 'Lead1', 'Lead2', 'Hodo'],
 
 #User directory
 UserDirectory => '/home/hadaq/trbsoft/daqtools/users/cern_cbmrich/',
index 00b4e05fd5f9efc07488e0a0ca060715b5fe9c71..e89c255a5bbe3cb9019208809ff99f1e52c7fced 100755 (executable)
@@ -161,7 +161,8 @@ trbcmd w 0x7005 0xa009 0x00000011  # cts_readout_config:
 trbcmd w 0x0112 0xb01e 0  # include billboard info with e-trigger
 
 #cbmnet
-trbcmd w 0x7005 0xa800 0x400003   # Listen to DLM 6, Enable CBMNet AND GbE
+trbcmd w 0x7005 0xa800 0x3   # Listen to DLM 6, Enable CBMNet AND GbE
+trbcmd w 0x7005 0xa900 0x400000   # Listen to DLM 6, Enable CBMNet AND GbE
 trbcmd w 0x7005 0xa901 62500 # enable sync pulser with 2 khz ... prob. dont need it, but better safe thEn sorry
 
 # pulser enable
@@ -209,6 +210,13 @@ echo "Disable noisy pixel in Padiwa"
 
 # trbcmd setbit 0x7005 0xa00c 0x80000000
 
+echo "Disable leds of PMTS"
+for i in $( padiwa.pl 0xfe4c 0 time | grep "2014-11-21" | cut -d$'\t' -f1 - ); do
+  ./padiwa.pl $i 0 led 0 &
+done
+
+wait
+
 echo "Wait a sec (http://goo.gl/bdWW1g)"
 sleep 1
 trbcmd w 0x7005 0xa101 0xffff6004  # trg_channel_mask: edge=1111 1111 1111 1111, mask=0110 0000 0000 0100
index 094b00d3e78ccb69402c1b38b211ef5e65bccadd..f7b875618a95b1237dfd05eb77396c27367d56da 100644 (file)
@@ -3,11 +3,11 @@
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 01 threshold: 0xDA00, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 02 threshold: 0x0744, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 03 threshold: 0xDB10, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x0616, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x075d, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 05 threshold: 0xd170, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 06 threshold: 0x0600, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0xdf80, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 08 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0xd377, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 08 threshold: 0x0560, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 09 threshold: 0x0000, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 10 threshold: 0xffff, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 11 threshold: 0x0000, uid: 0
@@ -20,8 +20,8 @@
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 01 threshold: 0x0000, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 02 threshold: 0xffff, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 03 threshold: 0x0000, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 04 threshold: 0x050E, uid: 0
-2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 05 threshold: 0xDC50, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 04 threshold: 0x075D, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 05 threshold: 0xD168, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 06 threshold: 0xffff, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 07 threshold: 0x0000, uid: 0
 2014/10/20 00:00:00 endpoint: 0x0113, chain: 00, channel: 08 threshold: 0xffff, uid: 0