0 2 9 0 406
0 2 10 1 845
0 2 11 0 398
-0 2 12 1 819 ## 852
+0 2 12 1 868 ##819 ## 852
0 2 13 0 403
0 3 0 0 340
1 1 0 0 463
1 1 1 0 462
1 1 2 0 386
-1 1 3 0 383
+1 1 3 0 583 #383
1 1 4 0 307
1 1 5 0 417
1 1 6 0 461
1 1 11 0 582 ## 460
1 1 12 0 408
1 1 13 0 303
-1 1 14 1 875
-1 1 15 1 876
+1 1 14 1 095 ## 875
+1 1 15 1 101 ## 876
1 2 0 0 450
1 2 1 0 457
1 3 2 0 393
1 3 3 0 418
1 3 4 0 332
-1 3 5 0 394
+1 3 5 0 579 # 394
1 3 6 0 367
1 3 7 0 390
1 3 8 0 412
1 5 8 0 309
1 5 9 0 433
1 5 10 0 401
-1 5 11 0 318
+1 5 11 0 580 # 318
1 5 12 0 317
1 5 13 0 319
1 5 14 1 918
2 2 14 1 0
2 2 15 0 0
-2 3 0 1 0
-2 3 1 0 0
-2 3 2 0 0
-2 3 3 0 0
-2 3 4 0 0
-2 3 5 1 0
-2 3 6 1 0
-2 3 7 0 0
-2 3 8 0 0
-2 3 9 0 0
-2 3 10 0 0
-2 3 11 1 0
-2 3 12 0 0
-2 3 13 1 0
-2 3 14 1 0
-2 3 15 0 0
+2 3 0 1 919
+2 3 1 0 597
+2 3 2 0 619
+2 3 3 0 600
+2 3 4 0 605
+2 3 5 1 835
+2 3 6 1 955
+2 3 7 0 594
+2 3 8 0 620
+2 3 9 0 603
+2 3 10 0 601
+2 3 11 1 887
+2 3 12 0 482
+2 3 13 1 113
+2 3 14 1 914
+2 3 15 0 484
2 4 0 1 0
2 4 1 0 0
3 2 14 1 0
3 2 15 0 0
-3 3 0 0 0
-3 3 1 0 0
-3 3 2 0 0
-3 3 3 1 0
-3 3 4 1 0
-3 3 5 0 0
-3 3 6 0 0
-3 3 7 0 0
-3 3 8 0 0
-3 3 9 1 0
-3 3 10 1 0
-3 3 11 0 0
-3 3 12 0 0
-3 3 13 1 0
-3 3 14 1 0
-3 3 15 0 0
+3 3 0 0 612
+3 3 1 0 443
+3 3 2 0 616
+3 3 3 1 904
+3 3 4 1 905
+3 3 5 0 370
+3 3 6 0 602
+3 3 7 0 377
+3 3 8 0 613
+3 3 9 1 820
+3 3 10 1 903
+3 3 11 0 379
+3 3 12 0 531
+3 3 13 1 882
+3 3 14 1 906
+3 3 15 0 567
3 4 0 0 0
3 4 1 0 0
0 5 062
1 0 054
- 1 1 064
+ 1 1 076
1 2 072
1 3 077
1 4 055
-# Plane # Sector # inner short # outer short # inner long # outer long # inner center #
+# Plane # Sector # inner short # inner long # outer short # outer long # inner center #
#####################################################################################################################################
- 0 0 A3000001f1408528 1F000001f14F7D28 B7000001f110A428 78000001F149E028 A2000001F1194E28
- 0 1 22000001f1438f28 54000001f130e628 f7000001f12eea28 81000001f1496e28 72000001F10CD428
- 0 2 96000001f1132328 a6000001f14adc28 28000001F158ba28 AD000001F12B0228 0D000001F10B8428
- 0 3 df000001f1508528 1f000001f1449e28 d7000001f130d428 2d000001f1299428 94000001F126cf28
- 0 4 3b000001f159ad28 21000001f110ad28 1c0000028f6efa28 e4000001f12a8028 D4000001F12B2828
- 0 5 3f000001f10c6928 1e000001f12efc28 10000001f1432d28 53000001f122ed28 66000001F140D028
+ 0 0 A3000001f1408528 B7000001f110A428 1F000001f14F7D28 78000001F149E028 A2000001F1194E28
+ 0 1 22000001f1438f28 f7000001f12eea28 54000001f130e628 81000001f1496e28 72000001F10CD428
+ 0 2 96000001f1132328 28000001F158ba28 a6000001f14adc28 AD000001F12B0228 0D000001F10B8428
+ 0 3 df000001f1508528 d7000001f130d428 1f000001f1449e28 2d000001f1299428 94000001F126cf28
+ 0 4 3b000001f159ad28 1c0000028f6efa28 21000001f110ad28 e4000001f12a8028 D4000001F12B2828
+ 0 5 3f000001f10c6928 10000001f1432d28 1e000001f12efc28 53000001f122ed28 66000001F140D028
+
+ 1 0 5c000001f111b828 46000001F1325F28 0 3A000001F13F6328 70000001f14cd128
+ 1 1 4d000001f14ebd28 7e000001f12f9e28 0 0a0000028f9a8b28 87000001f12C3B28
+ 1 2 42000001f1188828 d1000001f116bc28 0 df000001f128d928 E3000001f1278528
+ 1 3 5C000001F116F728 F6000001F1162528 0 00000001F1485628 C2000001f1424928
+ 1 4 0f000001f12b9c28 70000001f1217928 0 b2000001f1284d28 D5000001f13C6B28
+ 1 5 a4000001f130a128 0c000001f14e6a28 0 a40000028f6ac728 18000001f10BBF28
+
+ 2 0 0 0 0 0 0
+ 2 1 0 0 0 0 0
+ 2 2 0 0 0 0 0
+ 2 3 0 0 0 0 0
+ 2 4 0 0 0 0 0
+ 2 5 0 0 0 0 0
+
+ 3 0 0 0 0 0 0
+ 3 1 0 0 0 0 0
+ 3 2 0 0 0 0 0
+ 3 3 0 0 0 0 0
+ 3 4 0 0 0 0 0
+ 3 5 0 0 0 0 0
- 1 0 5c000001f111b828 0 46000001F1325F28 3A000001F13F6328 70000001f14cd128
- 1 1 4d000001f14ebd28 0 7e000001f12f9e28 0a0000028f9a8b28 87000001f12C3B28
- 1 2 42000001f1188828 0 d1000001f116bc28 df000001f128d928 E3000001f1278528
- 1 3 5C000001F116F728 0 F6000001F1162528 00000001F1485628 C2000001f1424928
- 1 4 0f000001f12b9c28 0 70000001f1217928 b2000001f1284d28 D5000001f13C6B28
- 1 5 a4000001f130a128 0 0c000001f14e6a28 a40000028f6ac728 18000001f10BBF28
-
- 2 0 0 0 0 0
- 2 1 0 0 0 0
- 2 2 0 0 0 0
- 2 3 0 0 55000001f141EE28 0
- 2 4 0 0 0 0
- 2 5 0 0 0 0
-
- 3 0 0 0 0 0
- 3 1 0 0 0 0
- 3 2 0 0 0 0
- 3 3 0 0 0 0
- 3 4 0 0 0 0
- 3 5 0 0 0 0
#onoff=2 does a quick power cycle, without writing to EEPROM
###############################################################################
sub power_switch {
- my ($addr,$onoff) = @_;
+ my ($addr,$onoff,$skipoff) = @_;
my ($host,$board,$outp) = MDC::get_power_output($addr);
return -1 unless defined $host && $board >= 0 && $outp >= 0;
my $ret = 0;
+
+ if($skipoff) {
+ $ret = powerboard_command($host,$board,$outp,0,'switch');
+ return -2 if ($ret == 0);
+ }
+
if($onoff == 0 || $onoff == 2) {
$ret = powerboard_command($host,$board,$outp,0,'switch',0 + ($onoff==2?0x8000:0));
print("Errorcode $ret\n") unless $ret == 1;
use Data::Dumper;
use HADES::TrbNet;
use Pod::Usage;
-
+use List::Util qw(min max);
my $DEBUG = 0; #print debug messages
my $NO_LOAD_DIRECT = 0; #load settings and initialize
my $NO_WRITE_FILES = 0; #write configration files
-my @default_settings = (0x50010, #1:0 peaking 10ns, 3:2 gain 4mV, 4 internal bandgap
+my @default_settings = (0x50010, #1:0 peaking 10ns, 3:2 gain 4mV, 4 internal bandgap 0:10ns,1:15ns,2:20ns - +0 4mV/fc, +4 2mV, +8 1mV, +12 0.67 mV
0x5011e, #2:0 tail1 R 27k, 5:3 tail1 C 10pF
0x50215, #2:0 tail1 R 23k, 5:3 tail1 C 0.9pF
0x50302, #6:0 global threshold 5=10mV
) ;
pod2usage(1) if $help;
-$default_settings[3] = ($default_settings[3] & 0xfff00) + ($threshold & 0x7f);
+#$default_settings[3] = ($default_settings[3] & 0xfff00) + ($threshold & 0x7f);
###############################################################################
}
close FILE;
+
+###############################################################################
+#Read thresholds file and store values
+###############################################################################
+open FILE, "../settings_tdc/thresholds.db" or die $!."\nthresholds.db not found.";
+while (my $a = <FILE>) {
+ if(my @values = $a =~ /^\s*0x([\w]{4})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s*$/) {
+ my $addr = shift @values;
+ $addr = hex($addr);
+ $thresholds->{$addr}[0] = $values[0];
+ $thresholds->{$addr}[1] = $values[1];
+ $thresholds->{$addr}[2] = $values[2];
+ $thresholds->{$addr}[3] = $values[3];
+ }
+ }
+close FILE;
+print Dumper $thresholds;
+
###############################################################################
#Find available boards
###############################################################################
foreach my $i (0..15) { #copy default settings
$settings->{$a}[$pt*16+$i] = $default_settings[$i];
}
+ my $t = max($thresholds->{$a}[$pt] + $threshold,0) & 0x7f;
+ $settings->{$a}[$pt*16+3] = ($default_settings[3] & 0xfff00) + $t;
+
if(!defined $baselines->{$addresses->{$a}}{$pt}) {
printf("Baseline for FPGA %04x, serial %i, PT %i not found.\n",$a,$addresses->{$a},$pt);
}
=item B<-t N | --threshold N>
-Use defined threshold (0..127) instead of default one
+Set threshold N plus the offset defined in thresholds.db
=item B<--noload>
my $on;
my $off;
my $fullchamber;
+my $skipoff;
Getopt::Long::Configure(qw(gnu_getopt));
GetOptions(
'load|l' => \$load,
'on' => \$on,
'off' => \$off,
+# 'skipoff|x' => \$skipoff,
) ;
--on/--off switch power (power cycle if both are specified)
--chamber switch full chamber instead of individual boards
-l load settings from file
+ -x TODO: in a power cycle, skip boards that are already off
Board addressing schemes (ADDR):
* (-board|-b) 0xnnnn #using a valid OEP address
$board = $board & 0xfff0;
if ($off) {
foreach my $br (0..15) {
- my $ret = MDCPower::power_switch($board+$br,0);
+ my $ret = MDCPower::power_switch($board+$br,0,$skipoff);
die "Board not found.\n" if $ret == -1;
last if $br==13 && $plane == 0;
}
}
if ($on) {
foreach my $br (0..15) {
- my $ret = MDCPower::power_switch($board+$br,1);
+ my $ret = MDCPower::power_switch($board+$br,1,$skipoff);
die "Board not found.\n" if $ret == -1;
last if $br==13 && $plane == 0;
}
}
else {
if(defined $on && defined $off) {$on = 2;}
- my $ret = MDCPower::power_switch($board,$on//0);
+ my $ret = MDCPower::power_switch($board,$on//0,$skipoff);
die "Board not found.\n" if $ret == -1;
}
}
use Data::Dumper;
use lib '.';
use Time::HiRes qw(usleep);
+use HADES::TrbNet;
+
+
die "Run on machine with Hmon!" unless -e "/dev/shm/hmon/qalog";
-my @logfile = qx(tail -n 250 /dev/shm/hmon/qalog);
+my @logfile = qx(tail -n 1050 /dev/shm/hmon/qalog);
my %cycledboards;
+@logfile = reverse @logfile;
+
foreach my $l (@logfile) {
my @d = split("\t",$l);
- if (defined $d[2] && $d[1] eq 'endp' && $d[2] eq 'mdc') {
+ if (defined $d[2] && $d[1] eq 'endp' && $d[2] eq 'mdc12') {
next if scalar @d < 7;
+ die "Looks like too many boards missing" unless scalar @d < 50;
my @boards = split(' ',$d[7]);
-# die "Looks like too many boards missing" unless scalar @boards < 50;
+# print Dumper @boards;
+ my $bb;
foreach my $b (@boards) {
- if ($b =~ /0x8[ef]\w\w/) {
- print ("$b");
- print(" skipped\n") and next if $cycledboards{hex($b)};
- system("./mdc_voltage.pl -b $b --on --off");
+ if (($bb) = $b =~ /^(8[ef]\w\w)[,\$]/) {
+ print($bb);
+ $bb = hex($bb);
+ print(" skipped\n") and next if $cycledboards{$bb};
+ system("./mdc_voltage.pl -b $bb --on --off");
usleep(10000);
print("\n");
- $cycledboards{hex($b)}=1;
+ $cycledboards{$bb}=1;
}
- if ($b =~ /0x[ab]\w\w\w/) {
+ if (($bb) = $b =~ /^([ab]\w\w\w)[<,\$]/) {
+ print($bb);
+ $bb = 0x8e00 + ((hex($bb)>>4)-0xa00);
+ printf (" -> %04x",$bb);
+ print(" skipped\n") and next if $cycledboards{$bb};
+ system("./mdc_voltage.pl -b $bb --on --off");
+ usleep(10000);
+ print("\n");
+ $cycledboards{$bb}=1;
+ }
+ }
+
+ last;
+ }
+ }
+
+my $cnt = 0;
+foreach my $l (@logfile) {
+ my @d = split("\t",$l);
+ if (defined $d[2] && (( $d[1] eq 'daq' && $d[2] eq 'readout')
+ ||( $d[1] eq 'daq' && $d[2] eq 'outofsync'))) {
+ next if scalar @d < 7;
+ my @boards = split(' ',$d[7]);
+# die "Looks like too many boards missing" unless scalar @boards < 50;
+ foreach my $b (@boards) {
+ if ($b =~ /^[ab][0-9ab]\w\w$/) {
print($b);
$b = 0x8e00 + ((hex($b)>>4)-0xa00);
printf (" -> %04x",$b);
$cycledboards{$b}=1;
}
}
+ $cnt++;
+ last if $cnt == 2;
+ }
+ }
+
+
+ trb_init_ports() or die trb_strerror();
+
+print("Checking for SEUs\n");
+foreach my $l (@logfile) {
+ my @d = split("\t",$l);
+ if (defined $d[2] && $d[1] eq 'misc' && $d[2] eq 'seu') {
+ next if scalar @d < 7;
+ my @boards = split(' ',$d[7]);
+# die "Looks like too many boards missing" unless scalar @boards < 50;
+ foreach my $b (@boards) {
+ if ($b =~ /^[ab][0-9ab]\w\w$/) {
+ print("$b\n");
+ trb_register_write(hex($b),0x20,0x8000);
+ $cycledboards{$b}=1;
+ }
+ if ($b =~ /^8[ef]\w\w$/) {
+ print("$b\n");
+ trb_register_write(hex($b),0x20,0x8000);
+ $cycledboards{$b}=1;
+ }
+ }
last;
}
-}
+ }
+
+print("Checking for Boards with wrong design / address\n");
+foreach my $l (@logfile) {
+ my @d = split("\t",$l);
+ if (defined $d[2] && $d[1] eq 'misc2' && $d[2] eq 'boards') {
+ next if scalar @d < 7;
+ my @boards = split(' ',$d[7]);
+# die "Looks like too many boards missing" unless scalar @boards < 50;
+ foreach my $b (@boards) {
+ if ($b =~ /^[ab][0-9ab]\w\w$/) {
+ print("$b\n");
+ trb_register_write(hex($b),0x20,0x8000);
+ $cycledboards{$b}=1;
+ }
+ if ($b =~ /^8[ef]\w\w$/) {
+ print("$b\n");
+ trb_register_write(hex($b),0x20,0x8000);
+ $cycledboards{$b}=1;
+ }
+ }
+
+ last;
+ }
+ }
+
+#1739785990 daq readout 30 70 Read-out Waiting Read-out seems to be stuck.<br>Boards out of sync: a8e0 (MDC)
+#1744277578 misc2 boards 30 70 Boards Error Boards without valid addresses: ffff (Other)<br>
my $lastROM = 0;
my $direction = 0;
my $countsensors = 0;
- printf(STDERR "%04x\n",$board);
+# printf(STDERR "%04x\n",$board);
while(1) {
$currentROM = 0;
$LastZero = -1;
$LastZero = $i if ($realdir == 0 && $idbit == 0 && $notidbit == 0);
$currentROM |= ($realdir << $i);
}
- printf(STDERR "%016x %i %i\n",$currentROM,$LastZero,$LastDiscrepancy);
+# printf(STDERR "%016x %i %i\n",$currentROM,$LastZero,$LastDiscrepancy);
$LastDiscrepancy = $LastZero;
$boards->{$board}{$currentROM}=0;
$lastROM = $currentROM;
printf("%04x\t%016x\t---\n",$board,$uid) and next if $temp == 0xffff;
$temp /= 16;
printf("%04x\t%016x\t%2.2f\n",$board,$uid,$temp);
- printf(STDERR "%04x\t%016x\t%2.2f\n",$board,$uid,$temp);
+# printf(STDERR "%04x\t%016x\t%2.2f\n",$board,$uid,$temp);
$boards->{$board}{$uid} = $temp;
}
}
# Address # Voltage 1 # Voltage 2
########################################
0x8e00 4 4
- 0x8e01 3 3
+ 0x8e01 3 4
0x8e02 2 3
- 0x8e03 4 5
- 0x8e04 4 5
+ 0x8e03 4 6
+ 0x8e04 4 6
0x8e05 3 3
0x8e06 3 3
0x8e07 3 3
0x8e0c 3 4
0x8e0d 3 3
0x8e10 1 2
- 0x8e11 2 2
- 0x8e12 4 4
+ 0x8e11 2 3
+ 0x8e12 4 5
0x8e13 3 4
0x8e14 3 5
0x8e15 4 5
0x8e20 3 3
0x8e21 2 3
0x8e22 2 3
- 0x8e23 3 3
+ 0x8e23 3 4
0x8e24 3 4
0x8e25 2 3
0x8e26 3 3
0x8e2d 3 3
0x8e30 3 4
0x8e31 3 3
- 0x8e32 2 2
+ 0x8e32 2 3
0x8e33 4 4
- 0x8e34 4 5
+ 0x8e34 5 5
0x8e35 2 2
0x8e36 2 3
0x8e37 2 3
0x8e38 4 5
0x8e39 4 5
- 0x8e3a 4 4
+ 0x8e3a 5 5
0x8e3b 2 3
0x8e3c 3 4
0x8e3d 2 3
0x8e40 2 2
0x8e41 2 3
- 0x8e42 3 3
+ 0x8e42 4 3
0x8e43 4 5
0x8e44 4 5
0x8e45 3 5
0x8e46 2 3
0x8e47 2 2
- 0x8e48 4 7
+ 0x8e48 5 6
0x8e49 4 5
0x8e4a 2 3
0x8e4b 3 4
0x8e4c 2 3
- 0x8e4d 2 3
+ 0x8e4d 3 3
0x8e50 4 4
- 0x8e51 3 3
+ 0x8e51 3 4
0x8e52 3 4
0x8e53 4 4
0x8e54 4 4
0x8e57 3 4
0x8e58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1 1
- 0x8eab 2 2
+ 0x8eab 2 3
0x8eac 1 1
0x8ead 1 1
0x8eae 1 1
0x8eaf 1 1
0x8eb0 1 2
0x8eb1 2 2
- 0x8eb2 2 2
- 0x8eb3 2 2
+ 0x8eb2 2 3
+ 0x8eb3 2 3
0x8eb4 2 2
- 0x8eb5 3 4
- 0x8eb6 2 2
+ 0x8eb5 4 4
+ 0x8eb6 2 3
0x8eb7 2 2
0x8eb8 2 2
0x8eb9 2 2
0x8eba 2 2
- 0x8ebb 3 3
+ 0x8ebb 3 4
0x8ebc 2 3
0x8ebd 3 3
- 0x8ebe 1 2
- 0x8ebf 3 3
+ 0x8ebe 2 2
+ 0x8ebf 3 4
0x8f00 7 7
0x8f01 7 7
0x8f02 7 7
0xd500 0x00000001 #SEU on
-0x7111 100 #max event size 100
+0x7111 80 #max event size 80
-0xc001 0x06148301 #spike rejection 3, window -2000..+100
+0xc001 0x06148303 #window -2000..+100, spike rej 3, ext. calibration (0), write long ToT (1)
+0xc002 140 #ToT max 900 ns