macro bad_channels trig='rsmon' run=42448 option='swap' if ([option]='no_swap') then step=2 | show only bad channels, noswaps else step=1 | show bad channels and swaps endif n=8 s1=7; l1=11 s2=7; l2=11 s3=1; l3=14 s4=1; l4=6 s5=16; l5=2 s6=16; l6=2 s7=23; l7=18 s8=23; l8=10 | goto plotting hbkfile=[trig]//'_'//[run]//'.hbk' hi/file 1 [hbkfile] ve/cre e1(456) r ve/cre e2(456) r 2d 21 'End=1 Num events in +- 100ns window' 19 0.5 19.5 24 0.5 24.5 2d 22 'End=2 Num events in +- 100ns window' 19 0.5 19.5 24 0.5 24.5 nt/pl 1.sector%layer 0.1.and.end=1.and.abs(0.5*(ds-start)+300)<100 ! -21 option=text hi/get/co 21 e1 nt/pl 1.sector%layer 0.1.and.end=2.and.abs(0.5*(ds-start)+300)<100 ! -22 option=text hi/get/co 22 e2 1d 31 'End=1 Num events in +- 100ns window' 456 0.5 456.5 1d 32 'End=2 Num events in +- 100ns window' 456 0.5 456.5 hi/put/co 31 e1 hi/put/co 32 e2 do i=1,[n],[step] do j=1,2 is=[s[i]] il=[l[i]] ie=[j] hid=100+[i]*10+[j] if ([j].eq.1) then chname=[is]//'M'//[il] else chname=[is]//'P'//[il] endif 1d [hid] [chname] 200 -400. -200. nt/pl 1.(ds-start)*0.5 layer=[il].and.sector=[is].and.end=[ie] ! -[hid] enddo enddo hi/file 22 bad_channels.hbk ! N do i=1,[n],[step] do j=1,2 hid=100+[i]*10+[j] hrout [hid] enddo enddo hrout 21,22 hrout 31,32 close 22 plotting: hi/file 22 bad_channels.hbk hrin * close 22 if ([option]='no_swap') then for/file 66 bad_channels_brief.ps ! N else for/file 66 bad_channels.ps ! N endif meta 66 -111 opt nsta if ([option]='no_swap') then title 'Candidates for bad RS TDC channels Run='//[trig]//'_'//[run] g zone 2 2 hi/pl 31,32 else title 'Candidates for bad RS TDC channels Run='//[trig]//'_'//[run] g zone 1 2 hi/pl 31,32 zone 1 1 hi/pl 21 text hi/pl 22 text endif if ([option]='no_swap') then zone 4 4 9 s else zone 2 2 endif set stat 1000100 opt sta title 'Swapping different pairs' do i=1,[n],[step] do j=1,2 hid=100+[i]*10+[j] hi/pl [hid] enddo enddo close 66