* ***************************************************** * tracks in corrispondence of magnets and gates drawing * Laura Iannotti * ***************************************************** *========== macro usage *========== alias/create m message m exec magnet#beampipe ele gn cut m ele=0 for gates m =1 for magnets m gn =1-->15 for gates (gate number) m gn =magnet (ql,qk,qc,qb,bh,bs,bz,bt,by,bu(1,3),qr1,qr2,qr3,qr4,qs1,qs2) m gn =qs3data third qs magnet for real data m gn =qs3mc third qs magnet for mc events return *========= macro init *========= exec calib#init return *============= macro beampipe ele=0 gn=5 in=i *============= set lwid 4 blue alias/create IDUMP 1 exec create_axis_and_beam **** mess BEAMPIPE ele=[ele] gn=[gn] * Laura Iannotti 15.01.1997 * ve/del * if [ele].eq.1 then * mess exec magnet#[gn] exec magnet#[gn] [in] else * mess exec magnet#g[gn] exec magnet#g[gn] endif end: black set lwid return *========= macro ql in=i *========= xof=$eval(hc[in](1)) yof=$eval(vc[in](1)) if IDUMP > 0 then mess Element ql [in] xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(1,2)+$sigma(vci(1)))%(vpos(1,1)+$sigma(hci(1))) [mas] -100**atitle 'QL Magnet entrance x(mm)' 'y(mm)' **gb nt/plot 90.(vpos(2,2)+$sigma(vco(1)))%(vpos(2,1)+$sigma(hco(1))) [mas] -100 **atitle 'QL Magnet exit x(mm)' 'y(mm)' exec myarc [xof] [yof] 0. 0. 50. 50. 0. 360. return *========= macro qk in=i *========= **gb nt/plot 90.(vpos(3,2)+$sigma(vci(2)))%(vpos(3,1)+$sigma(hci(2))) [mas] -100 *atitle 'QK Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](2)) yof=$eval(vc[in](2)) if IDUMP > 0 then mess Element qk [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0 0 50 50 0 360 return *========= macro qc1 in=i *========= **gb nt/plot 90.(vpos(5,2)+$sigma(vci(3)))%(vpos(5,1)+$sigma(hci(3))) [mas] -100 *atitle 'QC Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](3)) yof=$eval(vc[in](3)) if IDUMP > 0 then mess Element qc1 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 30.6 0. 25.4 25.4 301.5 58.5 exec myarc [xof] [yof] -30.6 0. 25.4 25.4 121.5 238.5 exec myarc [xof] [yof] 0. 50. 84. 84. 238.5 301.5 exec myarc [xof] [yof] 0. -50. 84. 84. 58.5 121.5 return *========= macro qc2 in=i *========= **gb nt/plot 90.(vpos(7,2)+$sigma(vci(4)))%(vpos(7,1)+$sigma(hci(4))) [mas] -100 *atitle 'QC Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](4)) yof=$eval(vc[in](4)) if IDUMP > 0 then mess Element qc2 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 30.6 0. 25.4 25.4 301.5 58.5 exec myarc [xof] [yof] -30.6 0. 25.4 25.4 121.5 238.5 exec myarc [xof] [yof] 0. 50. 84. 84. 238.5 301.5 exec myarc [xof] [yof] 0. -50. 84. 84. 58.5 121.5 return *========= macro qc3 in=i *========= **gb nt/plot 90.(vpos(9,2)+$sigma(vci(5)))%(vpos(9,1)+$sigma(hci(5))) [mas] -100 *atitle 'QC Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](5)) yof=$eval(vc[in](5)) if IDUMP > 0 then mess Element qc3 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 30.6 0. 25.4 25.4 301.5 58.5 exec myarc [xof] [yof] -30.6 0. 25.4 25.4 121.5 238.5 exec myarc [xof] [yof] 0. 50. 84. 84. 238.5 301.5 exec myarc [xof] [yof] 0. -50. 84. 84. 58.5 121.5 return *========= macro qb1 in=i *========= **gb nt/plot 90.(vpos(11,2)+$sigma(vci(6)))%(vpos(11,1)+$sigma(hci(6))) [mas] -100 *atitle 'QB Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](6)) yof=$eval(vc[in](6)) if IDUMP > 0 then mess Element qb1 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 0. 70 70 0 360 return *========= macro qb2 in=i *========= xof=$eval(hc[in](7)) yof=$eval(vc[in](7)) if IDUMP > 0 then mess Element qb2 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0 0 70 70 0 360 return *======= macro qs1 in=i *======= **gb nt/plot 90.(vpos(28,2)+$sigma(vci(8)))%(vpos(28,1)+$sigma(hci(8))) [mas] -100 *atitle 'QS Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](8)) yof=$eval(vc[in](8)) if IDUMP > 0 then mess Element qs1 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -251. 0. 248. 248. 351.54 8.46 exec myarc [xof] [yof] -15.59 -35 10. 10. 214.77 351.54 exec myarc [xof] [yof] -15.59 35 10. 10. 8.46 145.23 exec myarc [xof] [yof] -78.86 78.86 67. 67. 291.52 325.23 exec myarc [xof] [yof] -78.86 -78.86 67. 67. 34.77 68.48 exec myarc [xof] [yof] -47.7 0. 17.8 17.8 111.56 248.44 return *======= macro qs2 in=i *======= **gb nt/plot 90.(vpos(30,2)+$sigma(vci(9)))%(vpos(30,1)+$sigma(hci(9))) [mas] -100 *atitle 'QS Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](9)) yof=$eval(vc[in](9)) if IDUMP > 0 then mess Element qs2 [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -251. 0. 248. 248. 351.54 8.46 exec myarc [xof] [yof] -15.59 -35 10. 10. 214.77 351.54 exec myarc [xof] [yof] -15.59 35 10. 10. 8.46 145.23 exec myarc [xof] [yof] -78.86 78.86 67. 67. 291.52 325.23 exec myarc [xof] [yof] -78.86 -78.86 67. 67. 34.77 68.48 exec myarc [xof] [yof] -47.7 0. 17.8 17.8 111.56 248.44 return *======= macro qs3data in=i *======= **gb nt/plot 90.(vpos(32,2)+$sigma(vci(10)))%(vpos(32,1)+$sigma(hci(10))-1.) [mas] -100 *atitle 'QS Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](10)) xof=[xof]-1. yof=$eval(vc[in](10)) if IDUMP > 0 then mess Element qs3data [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -251. 0. 248. 248. 351.54 8.46 exec myarc [xof] [yof] -15.59 -35 10. 10. 214.77 351.54 exec myarc [xof] [yof] -15.59 35 10. 10. 8.46 145.23 exec myarc [xof] [yof] -78.86 78.86 67. 67. 291.52 325.23 exec myarc [xof] [yof] -78.86 -78.86 67. 67. 34.77 68.48 exec myarc [xof] [yof] -47.7 0. 17.8 17.8 111.56 248.44 return *======= macro qs3mc in=i *======= **gb nt/plot 90.(vpos(32,2)+$sigma(vci(10)))%(vpos(32,1)+$sigma(hci(10))) [mas] -100 *atitle 'QS Magnet entrance x(mm)' 'y(mm)' xof=$eval(hc[in](10)) yof=$eval(vc[in](10)) if IDUMP > 0 then mess Element qs3mc [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -251. 0. 248. 248. 351.54 8.46 exec myarc [xof] [yof] -15.59 -35 10. 10. 214.77 351.54 exec myarc [xof] [yof] -15.59 35 10. 10. 8.46 145.23 exec myarc [xof] [yof] -78.86 78.86 67. 67. 291.52 325.23 exec myarc [xof] [yof] -78.86 -78.86 67. 67. 34.77 68.48 exec myarc [xof] [yof] -47.7 0. 17.8 17.8 111.56 248.44 return *======= macro qr1 in=i *======= exec qr 11 [in] return *======= macro qr2 in=i *======= exec qr 12 [in] return *======= macro qr3 in=i *======= exec qr 13 [in] return *======= macro qr4 in=i *======= exec qr 14 [in] return *=============== macro qr ind=11 in=i *=============== xof=$eval(hc[in]([ind])) yof=$eval(vc[in]([ind])) if IDUMP > 0 then mess Element qr[ind] [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 34.5 11. 11. 20. 160. exec myarc [xof] [yof] 34.5 0. 11. 11. 290. 70. exec myarc [xof] [yof] 0. -34.5 11. 11. 200. 340. exec myarc [xof] [yof] -34.5 0. 11. 11. 110. 250. exec myarc [xof] [yof] 54.09 54.09 46.5 46.5 200. 250. exec myarc [xof] [yof] 54.09 -54.09 46.5 46.5 110 160 exec myarc [xof] [yof] -54.09 -54.09 46.5 46.5 20. 70. exec myarc [xof] [yof] -54.09 54.09 46.5 46.5 290. 340. return *========= macro bs in=i *========= **gb nt/plot 90.(vpos(26,2))%(vpos(26,1)+$sigma(bh(3))) [mas] -100 if [in] = i then xof=bh(3) yof=0 elseif [in] = o then xof=bhc(3) yof=0 endif if IDUMP > 0 then mess Element bs [in] xof=[xof] yof=[yof] endif exec myellipse [xof] [yof] 0. 0. 20. 34. 0. 360. 0. *atitle 'BS Magnet entrance x(mm)' 'y(mm)' return *========= macro bz in=i *========= **gb nt/plot 90.(vpos(47,2))%(vpos(47,1)+$sigma(bh(4))) [mas] -100 *atitle 'BZ Magnet entrance x(mm)' 'y(mm)' if [in] = i then xof=bh(4) yof=0 elseif [in] = o then xof=bhc(4) yof=0 endif if IDUMP > 0 then mess Element bz [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 0. 32. 32. 0. 360. return *========= macro bt in=i *========= **gb nt/plot 90.(vpos(49,2))%(vpos(49,1)+$sigma(bh(5))) [mas] -100 *atitle 'BZ Magnet entrance x(mm)' 'y(mm)' if [in] = i then xof=bh(5) yof=0 elseif [in] = o then xof=bhc(5) yof=0 endif if IDUMP > 0 then mess Element bt [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -8. 1.5 28.5 28.5 90. 180. exec myarc [xof] [yof] 8. 1.5 28.5 28.5 0. 90. exec myarc [xof] [yof] 8. -1.5 28.5 28.5 270. 360. exec myarc [xof] [yof] -8. -1.5 28.5 28.5 180. 270 exec myline [xof] [yof] -8. 30. 8. 30. exec myline [xof] [yof] -8. -30. 8. -30. exec myline [xof] [yof] -36.5 -1.5 -36.5 1.5 exec myline [xof] [yof] 36.5 -1.5 36.5 1.5 return *========= macro by in=i *========= **gb nt/plot 90.(vpos(66,2)+$sigma(bh(6)))%(vpos(66,1)) [mas] -100 *atitle 'BY Magnet entrance x(mm)' 'y(mm)' if [in] = i then xof=0 yof=bh(6) elseif [in] = o then xof=0 yof=bhc(6) endif if IDUMP > 0 then mess Element by [in] xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -15.5 20.5 23.5 23.5 90. 180. exec myarc [xof] [yof] 15.5 20.5 23.5 23.5 0. 90. exec myarc [xof] [yof] 15.5 -20.5 23.5 23.5 270. 360. exec myarc [xof] [yof] -15.5 -20.5 23.5 23.5 180. 270. exec myline [xof] [yof] -15.5 44. 15.5 44. exec myline [xof] [yof] -15.5 -44. 15.5 -44. exec myline [xof] [yof] -39. -20.5 -39. 20.5 exec myline [xof] [yof] 39. -20.5 39. 20.5 return *========= macro bu1 in=i *========= **gb nt/plot 90.(vpos(68,2)+$sigma(bh(7)))%(vpos(68,1)) [mas] -100 if [in] = i then xof=0 yof=bh(7) elseif [in] = o then xof=0 yof=bhc(7) endif if IDUMP > 0 then mess Element bu1 [in] xof=[xof] yof=[yof] endif exec myline [xof] [yof] -45. 40. 45. 40. exec myline [xof] [yof] -45. -40. 45. -40. exec myline [xof] [yof] -45. -40. -45. 40. exec myline [xof] [yof] 45. -40. 45. 40. *atitle 'BU Magnet entrance x(mm)' 'y(mm)' return *======== macro bu2 in=i *======== **gb nt/plot 90.(vpos(70,2)+$sigma(bh(8)))%(vpos(70,1)) [mas] -100 if [in] = i then xof=0 yof=bh(8) elseif [in] = o then xof=0 yof=bhc(8) endif if IDUMP > 0 then mess Element bu2 [in] xof=[xof] yof=[yof] endif exec myline [xof] [yof] -45. 40. 45. 40. exec myline [xof] [yof] -45. -40. 45. -40. exec myline [xof] [yof] -45. -40. -45. 40. exec myline [xof] [yof] 45. -40. 45. 40. return *======== macro bu3 in=i *======== **gb nt/plot 90.(vpos(72,2)+$sigma(bh(9)))%(vpos(72,1)) [mas] -100 if [in] = i then xof=0 yof=bh(9) elseif [in] = o then xof=0 yof=bhc(9) endif if IDUMP > 0 then mess Element bu3 [in] xof=[xof] yof=[yof] endif exec myline [xof] [yof] -40. 45. 40. 45. exec myline [xof] [yof] -40. -45. 40. -45. exec myline [xof] [yof] -40. -45. -40. 45. exec myline [xof] [yof] 40. -45. 40. 45. *atitle 'BU Magnet entrance x(mm)' 'y(mm)' return *======== macro g1 *======== **gb nt/plot 90.(vpos(16,2)+$sigma(pgv(1)))%(vpos(16,1)+$sigma(pgh(1))) [mas] -100 xof=pgh(1) yof=pgv(1) exec myarc [xof] [yof] 0. 0. 55. if IDUMP > 0 then mess Element g1 xof=[xof] yof=[yof] endif *atitle 'gate 1' 'y(mm)' return *======== macro g2 *======== **gb nt/plot 90.(vpos(18,2)+$sigma(pgv(2)))%(vpos(18,1)+$sigma(pgh(2))) [mas] -100 xof=pgh(2) yof=pgv(2) if IDUMP > 0 then mess Element g2 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 0. 55. *atitle 'gate 2' 'y(mm)' return *======== macro g3 *======== **gb nt/plot 90.(vpos(20,2)+$sigma(pgv(3)))%(vpos(20,1)+$sigma(pgh(3))) [mas] -100 xof=pgh(3) yof=pgv(3) if IDUMP > 0 then mess Element g3 xof=[xof] yof=[yof] endif exec myline [xof] [yof] -65. -55. -65. 55. exec myline [xof] [yof] -65. 55. 65. 55. exec myline [xof] [yof] 65. 55. 65. -55. exec myline [xof] [yof] -65. -55. 65. -55. *atitle 'gate 3' 'y(mm)' return *======== macro g4 *======== xof=pgh(4) yof=pgv(4) if IDUMP > 0 then mess Element g4 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(22,2)+$sigma(pgv(4)))%(vpos(22,1)+$sigma(pgh(4))) [mas] -100 exec myline [xof] [yof] -65. -55. -65. 55. exec myline [xof] [yof] -65. 55. 65. 55. exec myline [xof] [yof] 65. 55. 65. -55. exec myline [xof] [yof] -65. -55. 65. -55. *atitle 'gate 4' 'y(mm)' return *======== macro g5 *======== xof=pgh(5) yof=pgv(5) if IDUMP > 0 then mess Element g5 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(26,2)+$sigma(pgv(5)))%(vpos(26,1)+$sigma(pgh(5))) [mas] -100 exec myellipse [xof] [yof] 0. 0. 15.3 29.5 0. 360. 0. return *======== macro g6 *======== xof=pgh(6) yof=pgv(6) if IDUMP > 0 then mess Element g6 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(34,2)+$sigma(pgv(6)))%(vpos(34,1)+$sigma(pgh(6))) [mas] -100 exec myarc [xof] [yof] 0. 0. 64.5 *atitle 'gate 6' 'y(mm)' return *======== macro g7 *======== xof=pgh(7) yof=pgv(7) if IDUMP > 0 then mess Element g7 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(36,2)+$sigma(pgv(7)))%(vpos(36,1)+$sigma(pgh(7))) [mas] -100 exec myarc [xof] [yof] 0. 0. 45.5 *atitle 'gate 7' 'y(mm)' return *======== macro g8 *======== xof=pgh(8) yof=pgv(8) if IDUMP > 0 then mess Element g8 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(42,2)+$sigma(pgv(8)))%(vpos(42,1)+$sigma(pgh(8))) [mas] -100 exec myarc [xof] [yof] 0. 0. 50. *atitle 'gate 8' 'y(mm)' * return *======== macro g9 *======== * **gb nt/plot 90.(vpos(46,2)+$sigma(pgv(9)))%(vpos(46,1)+$sigma(pgh(9))) [mas] -100 xof=pgh(9) yof=pgv(9) if IDUMP > 0 then mess Element g9 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 0. 31. *atitle 'gate 9' 'y(mm)' return *======== macro g10 *======== * **gb nt/plot 90.(vpos(51,2)+$sigma(pgv(10)))%(vpos(51,1)+$sigma(pgh(10))) [mas] -100 xof=pgh(10) yof=pgv(10) if IDUMP > 0 then mess Element g10 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -8. 1.5 28.5 28.5 90. 180. exec myarc [xof] [yof] 8. 1.5 28.5 28.5 0. 90. exec myarc [xof] [yof] 8. -1.5 28.5 28.5 270. 360. exec myarc [xof] [yof] -8. -1.5 28.5 28.5 180. 270. exec myline [xof] [yof] -8. 30. 8. 30. exec myline [xof] [yof] -8. -30. 8. -30. exec myline [xof] [yof] -36.5 -1.5 -36.5 1.5 exec myline [xof] [yof] 36.5 -1.5 36.5 1.5 *atitle 'gate 10' 'y(mm)' return *======== macro g11 *======== * **gb nt/plot 90.(vpos(53,2)+$sigma(pgv(11)))%(vpos(53,1)+$sigma(pgh(11))) [mas] -100 xof=pgh(11) yof=pgv(11) if IDUMP > 0 then mess Element g11 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -8. 1.5 28.5 28.5 90. 180. exec myarc [xof] [yof] 8. 1.5 28.5 28.5 0. 90. exec myarc [xof] [yof] 8. -1.5 28.5 28.5 270. 360. exec myarc [xof] [yof] -8. -1.5 28.5 28.5 180. 270. exec myline [xof] [yof] -8. 30. 8. 30. exec myline [xof] [yof] -8. -30. 8. -30. exec myline [xof] [yof] -36.5 -1.5 -36.5 1.5 exec myline [xof] [yof] 36.5 -1.5 36.5 1.5 *atitle 'gate 11' 'y(mm)' return *========= macro g12 *========= **gb nt/plot 90.(vpos(59,2)+$sigma(pgv(12)))%(vpos(59,1)+$sigma(pgh(12))) [mas] -100 xof=pgh(12) yof=pgv(12) if IDUMP > 0 then mess Element g12 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -15.5 20.5 23.5 23.5 90. 180. exec myarc [xof] [yof] 15.5 20.5 23.5 23.5 0. 90. exec myarc [xof] [yof] 15.5 -20.5 23.5 23.5 270. 360. exec myarc [xof] [yof] -15.5 -20.5 23.5 23.5 180. 270. exec myline [xof] [yof] -15.5 44. 15.5 44. exec myline [xof] [yof] -15.5 -44. 15.5 -44. exec myline [xof] [yof] -39. -20.5 -39. 20.5 exec myline [xof] [yof] 39. -20.5 39. 20.5 exec myarc [xof] [yof] 0. 34.5 11. 11. 20. 160. exec myarc [xof] [yof] 34.5 0. 11. 11. 290. 70. exec myarc [xof] [yof] 0. -34.5 11. 11. 200. 340. exec myarc [xof] [yof] -34.5 0. 11. 11. 110. 250. exec myarc [xof] [yof] 54.09 54.09 46.5 46.5 200. 250. exec myarc [xof] [yof] 54.09 -54.09 46.5 46.5 110 160 exec myarc [xof] [yof] -54.09 -54.09 46.5 46.5 20. 70. exec myarc [xof] [yof] -54.09 54.09 46.5 46.5 290. 340. **atitle 'beam pipe at 60 m ' return *========= macro g13 *========= **gb nt/plot 90.(vpos(61,2)+$sigma(pgv(13)))%(vpos(61,1)+$sigma(pgh(13))) [mas] -100 xof=pgh(13) yof=pgv(13) if IDUMP > 0 then mess Element g13 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] -15.5 20.5 23.5 23.5 90. 180. exec myarc [xof] [yof] 15.5 20.5 23.5 23.5 0. 90. exec myarc [xof] [yof] 15.5 -20.5 23.5 23.5 270. 360. exec myarc [xof] [yof] -15.5 -20.5 23.5 23.5 180. 270. exec myline [xof] [yof] -15.5 44. 15.5 44. exec myline [xof] [yof] -15.5 -44. 15.5 -44. exec myline [xof] [yof] -39. -20.5 -39. 20.5 exec myline [xof] [yof] 39. -20.5 39. 20.5 exec myarc [xof] [yof] 0. 34.5 11. 11. 20. 160. exec myarc [xof] [yof] 34.5 0. 11. 11. 290. 70. exec myarc [xof] [yof] 0. -34.5 11. 11. 200. 340. exec myarc [xof] [yof] -34.5 0. 11. 11. 110. 250. exec myarc [xof] [yof] 54.09 54.09 46.5 46.5 200. 250. exec myarc [xof] [yof] 54.09 -54.09 46.5 46.5 110 160 exec myarc [xof] [yof] -54.09 -54.09 46.5 46.5 20. 70. exec myarc [xof] [yof] -54.09 54.09 46.5 46.5 290. 340. *atitle 'gate 13' 'y(mm)' return *========= macro g14 *========= xof=pgh(14) yof=pgv(14) if IDUMP > 0 then mess Element g14 xof=[xof] yof=[yof] endif **gb nt/plot 90.(vpos(75,2)+$sigma(pgv(14)))%(vpos(65,1)+$sigma(pgh(14))) [mas] -100 exec myarc [xof] [yof] 0. 0. 50. *atitle 'gate 14' 'y(mm)' return *========= macro g15 *========= **gb nt/plot 90.(vpos(77,2)+$sigma(pgv(15)))%(vpos(77,1)+$sigma(pgh(15))) [mas] -100 xof=pgh(15) yof=pgv(15) if IDUMP > 0 then mess Element g15 xof=[xof] yof=[yof] endif exec myarc [xof] [yof] 0. 0. 100. *atitle 'gate 15' 'y(mm)' return macro myarc xof yof xa ya r1 r2=! th=! ph=! offs=0 *mess MYARC [xof] [yof] if [offs] > 0 then xa=[xa]-[xof] ya=[ya]-[yof] endif arc [xa] [ya] [r1] [r2] [th] [ph] return macro myline xof yof x1 y1 x2 y2 offs=0 *mess MYLINE [xof] [yof] if [offs] > 0 then x1=[x1]-[xof] x2=[x2]-[xof] y1=[y1]-[yof] y2=[y2]-[yof] endif line [x1] [y1] [x2] [y2] return macro myellipse xof yof xc=0. yc=0. rx=-1 ry=! phimin=! phimax=! theta=! offs=0 *mess MYELLIPSE [xof] [yof] if [offs] > 0 then xc=[xc]-[xof] yc=[yc]-[yof] endif exec ellipse [xc] [yc] [rx] [ry] [phimin] [phimax] [theta] return *------------------------------------------------------------------------- MACRO ELLIPSE XC=0. YC=0. RX=-1. RY='!' PHIMIN='!' PHIMAX='!' THETA='!' *------------------------------------------------------------------------- * mess ELLIPSE Xc=[xc] Yc=[yc] Rx=[rx] Ry=[ry] PHImin=[phimin] PHImax=[phimax] THETA=[theta] * ELLIPSE.KUMAC Draw a graphical ellipse in the current NT * * 951013 Michael Kelsey * 15.10.95 Stefan Kluth: rotation added, default assignment changed IF [1]='?' .OR. [RX]<0. THEN MESSAGE MESSAGE '* ELLIPSE xc yc rx [ ry phimin phimax theta]' MESSAGE MESSAGE ' Draws an ellipse in the current normalization transformation.' MESSAGE ' The FAREA command is used, so the ellipse may be filled by' MESSAGE ' changing the appropriate SET parameters.' MESSAGE MESSAGE ' XC R "X coord of centre"' MESSAGE ' YC R "Y coord of centre"' MESSAGE ' RX R "X radius of ellipse"' MESSAGE ' RY R "Y radius of ellipse" D=[RX]' MESSAGE ' PHIMIN R "Minimum angle (degrees)" D=0.' MESSAGE ' PHIMAX R "Maximum angle (degrees)" D=360.' MESSAGE ' THETA R "Rotation angle (degrees)" D=0.' MESSAGE EXITM ENDIF IF [RY]='!' THEN | Default Y radius for circle RY = [RX] ENDIF IF [PHIMIN]='!' THEN | Default start angle PHIMIN= 0.0 ENDIF IF [PHIMAX]='!' THEN | Default stop angle PHIMAX= 360.0 ENDIF IF [THETA]='!' THEN | Default rotation angle THETA= 0.0 ENDIF NP = INT([PHIMAX]-[PHIMIN])+1 | Put points every degree SIGMA ELL_PHI = (PI/180.)*ARRAY([NP],[PHIMIN]#[PHIMAX]) SIGMA ELL_X = [XC]+ARRAY([NP],[RX]*COS(ELL_PHI)) SIGMA ELL_Y = [YC]+ARRAY([NP],[RY]*SIN(ELL_PHI)) IF [THETA].NE.0 THEN EXEC ELLIPSE#ROTATE [XC] [YC] [THETA] ENDIF FAIS = $GRAFINFO('?FAIS') IF [NP]<361 .AND. [FAIS]<>0 THEN | If filled arc, convert to wedge NP = [NP]+2 SIGMA ELL_X = [XC]&ELL_X&[XC] SIGMA ELL_Y = [YC]&ELL_Y&[YC] ENDIF * IF [FAIS]<>0 THEN * GRAPHICS/PRIMITIVE/FAREA [NP] ELL_X ELL_Y | To get the user's fill * ENDIF GRAPHICS/PRIMITIVE/PLINE [NP] ELL_X ELL_Y | To get the user's line * VEC/DELETE ELL_PHI,ELL_X,ELL_Y,ELL_R,ELL_THET,VN,VPHI VEC/DELETE ELL_PHI,ELL_X,ELL_Y if $VEXIST(ELL_R) > 0 then v/del ell_r,ell_thet,vn,vphi endif | Clean up after yourself RETURN MACRO ROTATE XC YC PHI * Translate to origin: SIGMA ELL_X= ELL_X-[XC] SIGMA ELL_Y= ELL_Y-[YC] * Rotate: V/CREA VPHI(1) R [PHI] N= $VDIM(ELL_X,1) V/CREA VN(1) I [N] V/CREA ELL_R([N]) V/CREA ELL_THET([N]) APPL COMIS QUIT *REMOVE ROTATE SUBROUTINE ROTATE IMPLICIT NONE INTEGER I,N REAL PI,PHI VECTOR VPHI VECTOR VN VECTOR ELL_X VECTOR ELL_Y VECTOR ELL_R VECTOR ELL_THET PI= 2.0*ACOS(0.0) N= VN(1) PHI= VPHI(1)/180.0*PI DO I=1,N ELL_R(I)= SQRT(ELL_X(I)**2+ELL_Y(I)**2) IF( ELL_X(I).GE.0 .AND. ELL_Y(I).GE.0 ) THEN ELL_THET(I)= ACOS(ELL_X(I)/ELL_R(I))+PHI ELSEIF( ELL_X(I).LT.0 .AND. ELL_Y(I).GE.0 ) THEN ELL_THET(I)= PI-ACOS(ABS(ELL_X(I)/ELL_R(I)))+PHI ELSEIF( ELL_X(I).LT.0 .AND. ELL_Y(I).LT.0 ) THEN ELL_THET(I)= PI+ACOS(ABS(ELL_X(I)/ELL_R(I)))+PHI ELSEIF( ELL_X(I).GE.0 .AND. ELL_Y(I).LT.0 ) THEN ELL_THET(I)= 2.0*PI-ACOS(ELL_X(I)/ELL_R(I))+PHI ELSE PRINT*,'Something wrong, STOP now' STOP ENDIF ELL_X(I)= ELL_R(I)*COS(ELL_THET(I)) ELL_Y(I)= ELL_R(I)*SIN(ELL_THET(I)) ENDDO RETURN END QUIT CALL ROTATE * Translate back: SIGMA ELL_X= ELL_X+[XC] SIGMA ELL_Y= ELL_Y+[YC] RETURN * macro create_axis_and_beam *********************gb************************************************ if $vexist(pqa) > 0 then v/del pqa,pqb,rqa,rqb,pba,pbd,rba,rbd,hci,vci,f,al,hsi,vsi,ang,bl endif *********************gb************************************************ * magnetic axis and beam at entrance of elements ve/create pqa(28) r -5.599 -4.716 7.780 3.924 6.603 _ -4.307 3.063 21.0 19.328 18.719 _ -7.912 -15.79 -15.79 -15.79 14*0. ve/create pqb(28) r 0. -0.0194 -0.05945 -0.1308 -0.2470 _ -0.4153 -0.7070 -2.5642 -2.6940 -4.6684 _ -8.5424 -15.79 -15.79 -15.79 14*0 ve/create rqa(28) r 0.6800 0.6800 1.5999 2.0294 _ 2.0294 3.3500 3.3500 -0.3821 _ -0.3821 -0.1100 -1.1891 0. 0. 0. 14*0. ve/create rqb(28) r 0. -0.02397 -0.03947 -0.07548 _ -0.09671 -0.12962 -0.13220 0.20660 _ -0.22465 -0.64271 -1.08653 0. 0. 0. 14*0. ve/create pba(9) r 25. 40. 0. -13.17 -14.125 0. _ -2.273 8.817 19.907 ve/create pbd(9) r -0.9783 -1.5688 -2.5697 -13.3713 _ -15.7558 0. 0. 5.1785 19.527 ve/create rba(9) r 3*0.0 -1.1891 -0.5946 0. 3*2.314 ve/create rbd(9) r -0.10867 -0.19794 -0.28717 _ -1.09585 -1.09585 0. 0. 1.9144 3.8288 sigma off=pqb-pqa ve/create hci(14) ve/create vci(14) ve/copy off(1:14) hci ve/copy off(15:28) vci sigma bh=pbd-pba * magnetic axis and beam at exit of elements *quadrupoles * F for 1995 data * ve/create f(14) r 219.284 285.656 3*-240.570 2*293.076 _ * 3*-52.617 -51.704 3*51.135 * f for MC ve/create f(14) r 219.286 285.654 3*-240.566 2*293.083 _ 3*-52.586 -51.674 3*51.040 ve/create al(14) r 1.0 0.76 3*1.0 2*1.8 3*4.0 4*3.0 sigma rot=rqb-rqa ve/create hsi(14) ve/create vsi(14) ve/copy rot(1:14) hsi ve/copy rot(15:28) vsi sigma khera=abs(1./(f*al)) sigma omega=sqrt(khera) sigma hco=(hci*cos(omega*AL)+hsi*sin(omega*al)/omega) sigma vco=(vci*cosh(omega*al)+vsi*sinh(omega*al)/omega) *dipoles ve/create ang(9) r -0.08932 -0.08932 0.4938 0._ 1.0959 0. 1.9144 1.9144 1.9144 ve/create bl(9) r 2*3.358 2.66 0.3 2.8 0.6 3*4.17 sigma brot=rbd-rba sigma bhc=bh+bl*(brot+ang) if $vexist(pgv) > 0 then v/del pgv v/del pgh endif vector/create pgv(16) r 13*0. 11.59 0.09 0.09 vector/create pgh(16) r -25.95 -26.45 -41.52 -42.31 -0.50 0. _ 0. -0.41 -0.32 -0.13 0.04 -2.55 -2.55 3*0. return