From: Adrian Weber Date: Thu, 27 Dec 2018 14:39:45 +0000 (+0100) Subject: script to generate (m)RICH mapping (simple horizontal BP layout) X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=fcb6c9cc82aac8da6a17a0af57db72c085ac9220;p=daqtools.git script to generate (m)RICH mapping (simple horizontal BP layout) --- diff --git a/users/giessen_lab/createMapping.pl b/users/giessen_lab/createMapping.pl new file mode 100755 index 0000000..b268008 --- /dev/null +++ b/users/giessen_lab/createMapping.pl @@ -0,0 +1,399 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use Data::Dumper; + +my @mapp; +$mapp[0][0][0] = 18; +$mapp[0][0][1] = 1; +$mapp[0][1][0] = 17; +$mapp[0][1][1] = 2; +$mapp[0][2][0] = 21; +$mapp[0][2][1] = 9; +$mapp[0][3][0] = 19; +$mapp[0][3][1] = 10; +$mapp[0][4][0] = 22; +$mapp[0][4][1] = 17; +$mapp[0][5][0] = 20; +$mapp[0][5][1] = 18; +$mapp[0][6][0] = 25; +$mapp[0][6][1] = 25; +$mapp[0][7][0] = 23; +$mapp[0][7][1] = 26; +$mapp[0][8][0] = 26; +$mapp[0][8][1] = 33; +$mapp[0][9][0] = 24; +$mapp[0][9][1] = 34; +$mapp[0][10][0] = 28; +$mapp[0][10][1] = 41; +$mapp[0][11][0] = 27; +$mapp[0][11][1] = 42; +$mapp[0][12][0] = 29; +$mapp[0][12][1] = 49; +$mapp[0][13][0] = 30; +$mapp[0][13][1] = 50; +$mapp[0][14][0] = 32; +$mapp[0][14][1] = 57; +$mapp[0][15][0] = 31; +$mapp[0][15][1] = 58; +$mapp[0][16][0] = 2; +$mapp[0][16][1] = 3; +$mapp[0][17][0] = 1; +$mapp[0][17][1] = 4; +$mapp[0][18][0] = 4; +$mapp[0][18][1] = 11; +$mapp[0][19][0] = 3; +$mapp[0][19][1] = 12; +$mapp[0][20][0] = 6; +$mapp[0][20][1] = 19; +$mapp[0][21][0] = 5; +$mapp[0][21][1] = 20; +$mapp[0][22][0] = 8; +$mapp[0][22][1] = 27; +$mapp[0][23][0] = 7; +$mapp[0][23][1] = 28; +$mapp[0][24][0] = 10; +$mapp[0][24][1] = 35; +$mapp[0][25][0] = 9; +$mapp[0][25][1] = 36; +$mapp[0][26][0] = 12; +$mapp[0][26][1] = 43; +$mapp[0][27][0] = 11; +$mapp[0][27][1] = 44; +$mapp[0][28][0] = 14; +$mapp[0][28][1] = 51; +$mapp[0][29][0] = 13; +$mapp[0][29][1] = 52; +$mapp[0][30][0] = 16; +$mapp[0][30][1] = 59; +$mapp[0][31][0] = 15; +$mapp[0][31][1] = 60; +# +$mapp[1][0][0] = 18; +$mapp[1][0][1] = 5 ; +$mapp[1][1][0] = 17; +$mapp[1][1][1] = 6 ; +$mapp[1][2][0] = 21; +$mapp[1][2][1] = 13; +$mapp[1][3][0] = 19; +$mapp[1][3][1] = 14; +$mapp[1][4][0] = 22; +$mapp[1][4][1] = 21; +$mapp[1][5][0] = 20; +$mapp[1][5][1] = 22; +$mapp[1][6][0] = 25; +$mapp[1][6][1] = 29; +$mapp[1][7][0] = 23; +$mapp[1][7][1] = 30; +$mapp[1][8][0] = 26; +$mapp[1][8][1] = 37; +$mapp[1][9][0] = 24; +$mapp[1][9][1] = 38; +$mapp[1][10][0] = 28; +$mapp[1][10][1] = 45; +$mapp[1][11][0] = 27; +$mapp[1][11][1] = 46; +$mapp[1][12][0] = 29; +$mapp[1][12][1] = 53; +$mapp[1][13][0] = 30; +$mapp[1][13][1] = 54; +$mapp[1][14][0] = 32; +$mapp[1][14][1] = 61; +$mapp[1][15][0] = 31; +$mapp[1][15][1] = 62; +$mapp[1][16][0] = 2 ; +$mapp[1][16][1] = 7 ; +$mapp[1][17][0] = 1 ; +$mapp[1][17][1] = 8 ; +$mapp[1][18][0] = 4 ; +$mapp[1][18][1] = 15; +$mapp[1][19][0] = 3; +$mapp[1][19][1] = 16; +$mapp[1][20][0] = 6; +$mapp[1][20][1] = 23; +$mapp[1][21][0] = 5; +$mapp[1][21][1] = 24; +$mapp[1][22][0] = 8; +$mapp[1][22][1] = 31; +$mapp[1][23][0] = 7; +$mapp[1][23][1] = 32; +$mapp[1][24][0] = 10; +$mapp[1][24][1] = 39; +$mapp[1][25][0] = 9; +$mapp[1][25][1] = 40; +$mapp[1][26][0] = 12; +$mapp[1][26][1] = 47; +$mapp[1][27][0] = 11; +$mapp[1][27][1] = 48; +$mapp[1][28][0] = 14; +$mapp[1][28][1] = 55; +$mapp[1][29][0] = 13; +$mapp[1][29][1] = 56; +$mapp[1][30][0] = 16; +$mapp[1][30][1] = 63; +$mapp[1][31][0] = 15; +$mapp[1][31][1] = 64; +# + my @mapp_90; +$mapp_90[0][0][0] = 18; +$mapp_90[0][0][1] = 64; +$mapp_90[0][1][0] = 17; +$mapp_90[0][1][1] = 63; +$mapp_90[0][2][0] = 21; +$mapp_90[0][2][1] = 56; +$mapp_90[0][3][0] = 19; +$mapp_90[0][3][1] = 55; +$mapp_90[0][4][0] = 22; +$mapp_90[0][4][1] = 48; +$mapp_90[0][5][0] = 20; +$mapp_90[0][5][1] = 47; +$mapp_90[0][6][0] = 25; +$mapp_90[0][6][1] = 40; +$mapp_90[0][7][0] = 23; +$mapp_90[0][7][1] = 39; +$mapp_90[0][8][0] = 26; +$mapp_90[0][8][1] = 32; +$mapp_90[0][9][0] = 24; +$mapp_90[0][9][1] = 31; +$mapp_90[0][10][0] = 28; +$mapp_90[0][10][1] = 24; +$mapp_90[0][11][0] = 27; +$mapp_90[0][11][1] = 23; +$mapp_90[0][12][0] = 29; +$mapp_90[0][12][1] = 16; +$mapp_90[0][13][0] = 30; +$mapp_90[0][13][1] = 15; +$mapp_90[0][14][0] = 32; +$mapp_90[0][14][1] = 8; +$mapp_90[0][15][0] = 31; +$mapp_90[0][15][1] = 7; +$mapp_90[0][16][0] = 2; +$mapp_90[0][16][1] = 62; +$mapp_90[0][17][0] = 1; +$mapp_90[0][17][1] = 61; +$mapp_90[0][18][0] = 4; +$mapp_90[0][18][1] = 54; +$mapp_90[0][19][0] = 3; +$mapp_90[0][19][1] = 46; +$mapp_90[0][20][0] = 6; +$mapp_90[0][20][1] = 53; +$mapp_90[0][21][0] = 5; +$mapp_90[0][21][1] = 45; +$mapp_90[0][22][0] = 8; +$mapp_90[0][22][1] = 38; +$mapp_90[0][23][0] = 7; +$mapp_90[0][23][1] = 30; +$mapp_90[0][24][0] = 10; +$mapp_90[0][24][1] = 37; +$mapp_90[0][25][0] = 9; +$mapp_90[0][25][1] = 29; +$mapp_90[0][26][0] = 12; +$mapp_90[0][26][1] = 22; +$mapp_90[0][27][0] = 11; +$mapp_90[0][27][1] = 21; +$mapp_90[0][28][0] = 14; +$mapp_90[0][28][1] = 13; +$mapp_90[0][29][0] = 13; +$mapp_90[0][29][1] = 14; +$mapp_90[0][30][0] = 16; +$mapp_90[0][30][1] = 6; +$mapp_90[0][31][0] = 15; +$mapp_90[0][31][1] = 5; + ; +$mapp_90[1][0][0] = 18; +$mapp_90[1][0][1] = 60; +$mapp_90[1][1][0] = 17; +$mapp_90[1][1][1] = 59; +$mapp_90[1][2][0] = 21; +$mapp_90[1][2][1] = 52; +$mapp_90[1][3][0] = 19; +$mapp_90[1][3][1] = 51; +$mapp_90[1][4][0] = 22; +$mapp_90[1][4][1] = 44; +$mapp_90[1][5][0] = 20; +$mapp_90[1][5][1] = 43; +$mapp_90[1][6][0] = 25; +$mapp_90[1][6][1] = 36; +$mapp_90[1][7][0] = 23; +$mapp_90[1][7][1] = 35; +$mapp_90[1][8][0] = 26; +$mapp_90[1][8][1] = 28; +$mapp_90[1][9][0] = 24; +$mapp_90[1][9][1] = 27; +$mapp_90[1][10][0] = 28; +$mapp_90[1][10][1] = 20; +$mapp_90[1][11][0] = 27; +$mapp_90[1][11][1] = 19; +$mapp_90[1][12][0] = 29; +$mapp_90[1][12][1] = 12; +$mapp_90[1][13][0] = 30; +$mapp_90[1][13][1] = 11; +$mapp_90[1][14][0] = 32; +$mapp_90[1][14][1] = 4; +$mapp_90[1][15][0] = 31; +$mapp_90[1][15][1] = 3; +$mapp_90[1][16][0] = 2; +$mapp_90[1][16][1] = 58; +$mapp_90[1][17][0] = 1; +$mapp_90[1][17][1] = 57; +$mapp_90[1][18][0] = 4; +$mapp_90[1][18][1] = 50; +$mapp_90[1][19][0] = 3; +$mapp_90[1][19][1] = 42; +$mapp_90[1][20][0] = 6; +$mapp_90[1][20][1] = 49; +$mapp_90[1][21][0] = 5; +$mapp_90[1][21][1] = 41; +$mapp_90[1][22][0] = 8; +$mapp_90[1][22][1] = 34; +$mapp_90[1][23][0] = 7; +$mapp_90[1][23][1] = 26; +$mapp_90[1][24][0] = 10; +$mapp_90[1][24][1] = 33; +$mapp_90[1][25][0] = 9; +$mapp_90[1][25][1] = 25; +$mapp_90[1][26][0] = 12; +$mapp_90[1][26][1] = 18; +$mapp_90[1][27][0] = 11; +$mapp_90[1][27][1] = 17; +$mapp_90[1][28][0] = 14; +$mapp_90[1][28][1] = 9; +$mapp_90[1][29][0] = 13; +$mapp_90[1][29][1] = 10; +$mapp_90[1][30][0] = 16; +$mapp_90[1][30][1] = 2; +$mapp_90[1][31][0] = 15; +$mapp_90[1][31][1] = 1; + +#print Dumper @mapp; +#print Dumper @mapp_90; + +sub pmt{ + my ($dirich_1,$dirich_2,$pmt,$x_in,$y_in) = @_; + for (my $mapmtHalf = 0;$mapmtHalf<2;$mapmtHalf++){ + + for (my $i=0;$i<32;$i++){ + #my $x=144 + $mapmtHalf*4; + my $x=$x_in + $mapmtHalf*4; + my $y=$y_in; + if ($mapp[0][$i][0] > 16 ) { + #$x=; + $x += ($i%2); + $y += int(($i)/2); + } else { + $x+=2 + ($i%2); + $y += int($i/2-8); + } + my $str = $dirich_1 if ($mapmtHalf ==0); + $str = $dirich_2 if ($mapmtHalf ==1); + printf("0x%x %u %s %u %u %u\n",$str,$mapp[$mapmtHalf][$i][0], $pmt,$mapp[$mapmtHalf][$i][1],$x,$y); + + } + } +} + + +sub pmt_90{ + my ($dirich_1,$dirich_2,$pmt,$x_in,$y_in) = @_; + for (my $mapmtHalf = 0;$mapmtHalf<2;$mapmtHalf++){ + + for (my $i=0;$i<32;$i++){ + my $x=$x_in + $mapmtHalf*4; + my $y=$y_in; + if ($mapp_90[0][$i][0] > 16 ) { + #$x=; + $x += ($i%2); + $y += int(($i)/2); + } else { + if ($i == 16) { + $x += 2; + } elsif($i == 17) { + $x += 3; #$y -=; + } elsif($i == 18) { + $x += 2; $y += 1; + } elsif($i == 19) { + $x += 2; $y += 2; + } elsif($i == 20) { + $x += 3; $y += 1; + } elsif($i == 21) { + $x += 3; $y += 2; + } elsif($i == 22) { + $x += 2; $y += 3;####### 0x7405 8 305 34 129 100 + } elsif($i == 23) { + $x += 2; $y += 4; ## + } elsif($i == 24) { + $x += 3; $y += 3; + } elsif($i == 25) { + $x += 3; $y += 4;# + } elsif($i == 26) { + $x += 2; $y += 5; + } elsif($i == 27) { + $x += 3; $y += 5; + } elsif($i == 28) { + $x += 3; $y += 6; + } elsif($i == 29) { + $x += 2; $y += 6; + } elsif($i == 30) { + $x += 2; $y += 7; + } elsif($i == 31) { + $x += 3; $y += 7; + } + #$x -= 2 + ($i%2); + #$y += int($i/2-8); + } + + my $str = $dirich_1 if ($mapmtHalf ==0); + $str = $dirich_2 if ($mapmtHalf ==1); + printf("0x%x %u %s %u %u %u\n",$str,$mapp_90[$mapmtHalf][$i][0], $pmt,$mapp_90[$mapmtHalf][$i][1],$x,$y); + + } + } +} + +sub BP{ + my $BPnbr = shift(@_); + my $dirich_1 = shift(@_); + my $dirich_2 = shift(@_); + my $dirich_3 = shift(@_); + my $dirich_4 = shift(@_); + my $dirich_5 = shift(@_); + my $dirich_6 = shift(@_); + my $dirich_7 = shift(@_); + my $dirich_8 = shift(@_); + my $dirich_9 = shift(@_); + my $dirich_10 = shift(@_); + my $dirich_11 = shift(@_); + my $dirich_12 = shift(@_); + my $xstart = shift(@_); + my $ystart = shift(@_); + + pmt($dirich_1,$dirich_2,"HA00".$BPnbr."0",$xstart+0,$ystart+0); + pmt($dirich_3,$dirich_4,"HA00".$BPnbr."1",$xstart+ 8,$ystart+0); + pmt_90($dirich_5,$dirich_6,"HA00".$BPnbr."2",$xstart+16,$ystart+0); + pmt($dirich_7,$dirich_8,"HA00".$BPnbr."3",$xstart+0,$ystart+8); + pmt($dirich_9,$dirich_10,"HA00".$BPnbr."4",$xstart+8,$ystart+8); + pmt_90($dirich_11,$dirich_12,"HA00".$BPnbr."5",$xstart+16,$ystart+8); +} + +############################# +## # ## # ## # ## +## 7 # 8 ## 9 # 10## 11# 12## +## # ## # ## # ## +############################# POWER MOD +## # ## # ## # ## +## 1 # 2 ## 3 # 4 ## 5 # 6 ## +## # ## # ## # ## gedrehte auf Seite des PM ; EV; output is PhotonView +############################# +#X0|Y0 + +print "##X0|Y0 is down left; Electronic View\n"; +#BP(BPnbr, dirich_1,dirich_2, dirich_3, dirich_4, dirich_5, dirich_6, dirich_7,dirich_8, dirich_9, dirich_10, dirich_11, dirich_12); +BP(0x1,0x7000,0x7001,0x7010,0x7011,0x7020,0x7021,0x7100,0x7101,0x7110,0x7111,0x7120,0x7121,0,0); +BP(0x2,0x7030,0x7031,0x7040,0x7041,0x7050,0x7051,0x7130,0x7131,0x7140,0x7141,0x7150,0x7151,24,0); +BP(0x3,0x7060,0x7061,0x7070,0x7071,0x7080,0x7081,0x7160,0x7161,0x7170,0x7171,0x7180,0x7181,48,0); + +BP(0x4,0x7200,0x7201,0x7210,0x7211,0x7220,0x7221,0x7300,0x7301,0x7310,0x7311,0x7320,0x7321,0,8); +BP(0x5,0x7230,0x7231,0x7240,0x7241,0x7250,0x7251,0x7330,0x7331,0x7340,0x7341,0x7350,0x7351,24,8); +BP(0x6,0x7260,0x7261,0x7270,0x7271,0x7280,0x7281,0x7360,0x7361,0x7370,0x7371,0x7380,0x7381,48,8); +#pmt_90("0x7000","0x7001","HA001");