/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_shellguides
*
* %Identification
* Written by: <a href="tobias.panzner@psi.ch">Tobias Panzner</a>, <a href="mailto:uwe.filges@psi.ch">Uwe Filges</a>
*
* Date: 10.07.2010
* Origin: PSI
* %INSTRUMENT_SITE: Tests_optics
*
*  This is an instrument test file for 3 components.
*
* %Description
*
* In the instrument files 3 new components are used:
*
*  - Sapphire_Filter.comp   : models a sapphire filter for suppression of a unwanted high energy part of a given source spectrum
*                             (the properties can be changed in the instrument file itself)
*
*  - Guide_four_side.comp   : models a guide with different wall properties. here it is only a ordinary linear guide with reflecting walls.
*                             (the properties can be changed in the instrument file itself)
*
*  - Guide_four_side_10_shells.comp: models a multi channel component. here it is used as a parabolic focusing lens (default values).
*                                    some of the parameters can be change in the mcgui start menu to play around with the focusing properties.
*
*
*
* Example: mcrun test.instr <parameters=values>
*
* %Parameters
* Lambda_source: [AA]         central wavelength of the used wavelength spectra
* dLambda_source: [AA]        bandgab of the used wavelength spectra ( +/- from  Lambda_source )
* Sapphire_Filter_Flag: [--]  flag to use (1) or not use (0) the high energie sapphire filter to clean the source spectrum
* lens_width: [m]             width of the central part of the focusing devise
* lens_height: [m]            height of the central part of the focusing devise
* channel_width: [m]          width of the channels of the focusing devise (NOT  for the central channel, central channel is given by lens_width)
* channel_height: [m]         height of the channels of the focusing devise (NOT  for the central channel, central channel is given by lens_height)
* m_lens: []                 m-value used for all layers of the focusing devise
* lens_focal_in_hor: [m]      distance of the focal point in front of the focusing devise to the entrance of the focusing devise for the horizontal direction
* lens_focal_in_ver: [m]      distance of the focal point in front of the focusing devise to the entrance of the focusing devise for the vertical direction
* lens_focal_out_hor: [m]     distance of the  exit of the focusing devise to the focal point behind the devise for the horizontal direction
* lens_focal_out_ver: [m]     distance of the  exit of the focusing devise to the focal point behind the devise  for the vertical direction
* lens_glass_thickness: [m]   thickness the the glass walls used  for the focusing devise
* m_lens: []                  
*
* %Link
* A reference/HTML link for more information
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_shellguides(Lambda_source=5, dLambda_source=2, Sapphire_Filter_Flag=1, lens_width = 0.004 , lens_height=0.004 , channel_width=0.002, channel_height=0.002, m_lens=5, lens_focal_in_hor = 0, lens_focal_in_ver = 0, lens_focal_out_hor= 0.5,  lens_focal_out_ver= 0.35, lens_glass_thickness=0.0002)

DECLARE
%{


%}

INITIALIZE
%{

%}

TRACE

COMPONENT armSource = Arm()
  AT (0,0,0) ABSOLUTE

COMPONENT a1 = Progress_bar()
  AT (0, 0, 0) RELATIVE armSource


COMPONENT source = Source_gen (
    xwidth = 0.104, yheight=0.15, focus_xw = 0.08, focus_yh = 0.15,
    dist = 1.14,lambda0 = Lambda_source, dlambda = dLambda_source,
    T1=289.42, I1=(3.083e12/4/PI),
    T2=120.002,I2=(3.575e12/4/PI),
    T3=24.144,I3=(7.26e12/4/PI))
  AT (0,0,0) RELATIVE armSource

COMPONENT Lmonsource1 = L_monitor(
    nL = 1050, filename = "source-Source.dat", xwidth=0.2,
    yheight = 0.21, Lmin = 0, Lmax = 11)
  AT (0, 0, 0) RELATIVE armSource


COMPONENT PSD_source = PSD_monitor(
    nx = 200, ny = 200, filename = "PSD_source.dat",
    xwidth = .10, yheight =.10)
  AT (0, 0, 1e-9) RELATIVE armSource


COMPONENT divmonsource = Divergence_monitor(
    nh = 100, nv = 100, filename = "divmonsource.dat", xmin = -0.04,
    xmax = 0.04, ymin = -0.075, ymax = 0.075, maxdiv_v = 3,
    maxdiv_h = 3)
  AT (0, 0, 1.13) RELATIVE armSource


COMPONENT  PS_Dsource_1 = PSD_monitor(
    nx = 128, ny = 128, filename = "PSD_source1.dat",
    xwidth = 0.1, yheight = 0.2)
  AT (0, 0, 1.2) RELATIVE armSource



/* Start of Sapphire_Filter section--------------------------------- */


COMPONENT Filter = Sapphire_Filter(
    xmin = -0.05, xmax = 0.05,
    ymin = -0.08, ymax = 0.08, len=0.1)
    WHEN (Sapphire_Filter_Flag==1)
  AT (0, 0, 0.800) RELATIVE PREVIOUS

COMPONENT Lmonfilter= L_monitor(
    nL = 100, filename = "afterFilter.dat", xmin = -0.06, xmax = 0.06,
    ymin = -0.075, ymax = 0.075, Lmin = 0.0, Lmax = 11)
  AT (0, 0, 0.1001) RELATIVE PREVIOUS

COMPONENT divmonfilter = Divergence_monitor(
    nh = 100, nv = 100, filename = "divmonfilter.dat", xmin = -0.04,
    xmax = 0.04, ymin = -0.075, ymax = 0.075, maxdiv_h = 3,
    maxdiv_v = 3)
  AT (0, 0, 0.0001) RELATIVE PREVIOUS

COMPONENT monitorFilter = PSD_monitor(
	xmin = -0.05, xmax = 0.05, ymin = -0.11, ymax = 0.11,
	nx=200, ny=200, filename="PSDmonFilter.dat")
  AT (0, 0, 0.0001) RELATIVE PREVIOUS



/* Start of Four-Side-Guide section--------------------------------- */

/* here it  is only a ordinary linear guide, it will create w2l,w2r,h2u and h2d as output values */


COMPONENT Guide = Guide_four_side(
    l = 4, R0=0.99,
    w1l = 0.02, w2l = 0.02, linwl = 0, loutwl = 0,
    w1r = 0.02, w2r = 0.02, linwr = 0, loutwr = 0,
    h1u = 0.02, h2u = 0.02, linhu = 0, louthu = 0,
    h1d = 0.02, h2d = 0.02, linhd = 0, louthd = 0,
    Qcxl = 0.0219, Qcxr = 0.0219, Qcyu = 0.0219, Qcyd = 0.0219,
    alphaxl = 6.07, alphaxr = 6.07, alphayu = 6.07, alphayd = 6.07,
    Wxr = 0.003, Wxl = 0.003, Wyu = 0.003, Wyd = 0.003,
    mxr = 5, mxl = 5, myu = 5, myd = 5,
    QcxrOW = 0.0219, QcxlOW = 0.0219, QcyuOW = 0.0219, QcydOW = 0.0219,
    alphaxlOW = 6.07, alphaxrOW = 6.07, alphayuOW = 6.07, alphaydOW = 6.07,
    WxrOW = 0.003, WxlOW = 0.003, WyuOW = 0.003, WydOW = 0.003,
    mxrOW = 4,mxlOW = 4, myuOW = 4, mydOW = 4,
    rwallthick = 0.01, lwallthick = 0.01, uwallthick = 0.01, dwallthick = 0.01)
  AT (0, 0, 0.01) RELATIVE PREVIOUS


COMPONENT Lmonsource4= L_monitor(
    nL = 100, filename = "afterguide.dat", xmin = -0.06, xmax = 0.06,
    ymin = -0.075, ymax = 0.075, Lmin = 0.0, Lmax = 11)
  AT (0, 0,4.001) RELATIVE PREVIOUS

COMPONENT divmonGuide = Divergence_monitor(
    nh = 100, nv = 100, filename = "divmonGuide.dat", xmin = -0.04,
    xmax = 0.04, ymin = -0.075, ymax = 0.075, maxdiv_h = 3,
    maxdiv_v = 3)
  AT (0, 0, 0.0001) RELATIVE PREVIOUS

COMPONENT monitorGuide = PSD_monitor(
	xmin = -0.045, xmax = 0.045, ymin = -0.11, ymax = 0.11,
	nx=200, ny=200, filename="PSDmonGuide.dat")
  AT (0, 0, 0.0001) RELATIVE PREVIOUS


/* Start of Four-Side-Guide LENS section--------------------------------- */
/* the given default values models a parabolic focusing lens , all together you can change 52 (one shell)* 11 (1 central part and 10 shells) Parameters */


COMPONENT lens = Guide_four_side_10_shells(
    l = 1.0, R0 = .99,
    w1l = lens_width/2, w2l = lens_width/2, linwl = lens_focal_in_hor, loutwl = lens_focal_out_hor,
    w1r = lens_width/2 , w2r = lens_width/2, linwr = lens_focal_in_hor, loutwr = lens_focal_out_hor,
    h1u = lens_height/2 , h2u = lens_height/2 , linhu = lens_focal_in_ver, louthu = lens_focal_out_ver,
    h1d = lens_height/2 , h2d = lens_height/2 , linhd = lens_focal_in_ver, louthd = lens_focal_out_ver,
    Qcxl = 0.0219, Qcxr = 0.0219, Qcyu = 0.0219, Qcyd = 0.0219,
    alphaxl = 6.07, alphaxr = 6.07, alphayu = 6.07, alphayd = 6.07,
    Wxr = 0.003, Wxl = 0.003, Wyu = 0.003, Wyd = 0.003,
    mxr = m_lens, mxl = m_lens, myu = m_lens, myd = m_lens,
    QcxrOW = 0.0219, QcxlOW = 0.0219, QcyuOW = 0.0219, QcydOW = 0.0219,
    alphaxlOW = 6.07, alphaxrOW = 6.07, alphayuOW = 6.07, alphaydOW = 6.07,
    WxrOW = 0.003, WxlOW = 0.003, WyuOW = 0.003, WydOW = 0.003,
    mxrOW = m_lens, mxlOW = m_lens, myuOW = m_lens, mydOW = m_lens,
    rwallthick =lens_glass_thickness, lwallthick = lens_glass_thickness, uwallthick = lens_glass_thickness, dwallthick = lens_glass_thickness,

    w1l1 = lens_width/2 + channel_width + lens_glass_thickness, w2l1 = lens_width/2 + channel_width +lens_glass_thickness,
    linwl1 = lens_focal_in_hor, loutwl1 = lens_focal_out_hor,
    w1r1 = lens_width/2 + channel_width + lens_glass_thickness, w2r1 = lens_width/2 + channel_width + lens_glass_thickness,
    linwr1 = lens_focal_in_hor, loutwr1 = lens_focal_out_hor,
    h1u1 = lens_height/2 + channel_height + lens_glass_thickness, h2u1 = lens_height/2 + channel_height + lens_glass_thickness,
    linhu1 = lens_focal_in_ver, louthu1 = lens_focal_out_ver,
    h1d1 = lens_height/2 + channel_height + lens_glass_thickness, h2d1 = lens_height/2 + channel_height + lens_glass_thickness,
    linhd1 = lens_focal_in_ver, louthd1 = lens_focal_out_ver,
    Qcxl1 = 0.0219, Qcxr1 = 0.0219, Qcyu1 = 0.0219, Qcyd1 = 0.0219,
    alphaxl1 = 6.07, alphaxr1 = 6.07, alphayu1 = 6.07, alphayd1 = 6.07,
    Wxr1 = 0.003, Wxl1 = 0.003, Wyu1 = 0.003, Wyd1 = 0.003,
    mxr1 = m_lens, mxl1 = m_lens, myu1 = m_lens, myd1 = m_lens,
    QcxrOW1 = 0.0219, QcxlOW1 = 0.0219, QcyuOW1 = 0.0219, QcydOW1 = 0.0219,
    alphaxlOW1 = 6.07, alphaxrOW1 = 6.07, alphayuOW1 = 6.07, alphaydOW1 = 6.07,
    WxrOW1 = 0.003, WxlOW1 = 0.003, WyuOW1 = 0.003, WydOW1 = 0.003,
    mxrOW1 = m_lens, mxlOW1 = m_lens, myuOW1 = m_lens, mydOW1 = m_lens,
    rwallthick1 =lens_glass_thickness, lwallthick1 = lens_glass_thickness, uwallthick1 = lens_glass_thickness, dwallthick1 = lens_glass_thickness,

    w1l2 = lens_width/2 + 2*channel_width + 2*lens_glass_thickness, w2l2 = lens_width/2 + 2*channel_width + 2*lens_glass_thickness,
    linwl2 = lens_focal_in_hor, loutwl2 = lens_focal_out_hor,
    w1r2 = lens_width/2 + 2*channel_width + 2*lens_glass_thickness , w2r2 = lens_width/2 + 2*channel_width + 2*lens_glass_thickness ,
    linwr2 = lens_focal_in_hor, loutwr2 = lens_focal_out_hor,
    h1u2 = lens_height/2 + 2*channel_height + 2*lens_glass_thickness, h2u2 = lens_height/2 + 2*channel_height + 2*lens_glass_thickness,
    linhu2 = lens_focal_in_ver, louthu2 = lens_focal_out_ver,
    h1d2 = lens_height/2 + 2*channel_height + 2*lens_glass_thickness, h2d2 = lens_height/2 + 2*channel_height + 2*lens_glass_thickness,
    linhd2 = lens_focal_in_ver, louthd2 = lens_focal_out_ver,
    Qcxl2 = 0.0219, Qcxr2 = 0.0219, Qcyu2 = 0.0219, Qcyd2 = 0.0219,
    alphaxl2 = 6.07, alphaxr2 = 6.07, alphayu2 = 6.07, alphayd2 = 6.07,
    Wxr2 = 0.003, Wxl2 = 0.003, Wyu2 = 0.003, Wyd2 = 0.003,
    mxr2 = m_lens, mxl2 = m_lens, myu2 = m_lens, myd2 = m_lens,
    QcxrOW2 = 0.0219, QcxlOW2 = 0.0219, QcyuOW2 = 0.0219, QcydOW2 = 0.0219,
    alphaxlOW2 = 6.07, alphaxrOW2 = 6.07, alphayuOW2 = 6.07, alphaydOW2 = 6.07,
    WxrOW2 = 0.003, WxlOW2 = 0.003, WyuOW2 = 0.003, WydOW2 = 0.003,
    mxrOW2 = m_lens, mxlOW2 = m_lens, myuOW2 = m_lens, mydOW2 = m_lens,
    rwallthick2 = lens_glass_thickness, lwallthick2 = lens_glass_thickness, uwallthick2 = lens_glass_thickness, dwallthick2 = lens_glass_thickness,

    w1l3 = lens_width/2 + 3*channel_width + 3*lens_glass_thickness, w2l3 = lens_width/2 + 3*channel_width + 3*lens_glass_thickness,
    linwl3 = lens_focal_in_hor, loutwl3 = lens_focal_out_hor,
    w1r3 = lens_width/2 + 3*channel_width + 3*lens_glass_thickness, w2r3 = lens_width/2 + 3*channel_width + 3*lens_glass_thickness,
    linwr3 = lens_focal_in_hor, loutwr3 = lens_focal_out_hor,
    h1u3 = lens_height/2 + 3*channel_height + 3*lens_glass_thickness, h2u3 = lens_height/2 + 3*channel_height + 3*lens_glass_thickness,
    linhu3 = lens_focal_in_ver, louthu3 = lens_focal_out_ver,
    h1d3 = lens_height/2 + 3*channel_height + 3*lens_glass_thickness, h2d3 = lens_height/2 + 3*channel_height + 3*lens_glass_thickness,
    linhd3 = lens_focal_in_ver, louthd3 = lens_focal_out_ver,
    Qcxl3 = 0.0219, Qcxr3 = 0.0219, Qcyu3 = 0.0219, Qcyd3 = 0.0219,
    alphaxl3 = 6.07, alphaxr3 = 6.07, alphayu3 = 6.07, alphayd3 = 6.07,
    Wxr3 = 0.003, Wxl3 = 0.003, Wyu3 = 0.003, Wyd3 = 0.003,
    mxr3 = m_lens, mxl3 = m_lens, myu3 = m_lens, myd3 = m_lens,
    QcxrOW3 = 0.0219, QcxlOW3 = 0.0219, QcyuOW3 = 0.0219, QcydOW3 = 0.0219,
    alphaxlOW3 = 6.07, alphaxrOW3 = 6.07, alphayuOW3 = 6.07, alphaydOW3 = 6.07,
    WxrOW3 = 0.003, WxlOW3 = 0.003, WyuOW3 = 0.003, WydOW3 = 0.003,
    mxrOW3 = m_lens, mxlOW3 = m_lens, myuOW3 = m_lens, mydOW3 = m_lens,
    rwallthick3 = lens_glass_thickness, lwallthick3 = lens_glass_thickness, uwallthick3 = lens_glass_thickness, dwallthick3 = lens_glass_thickness,

    w1l4 = lens_width/2 + 4*channel_width + 4*lens_glass_thickness, w2l4 = lens_width/2 + 4*channel_width + 4*lens_glass_thickness,
    linwl4 = lens_focal_in_hor, loutwl4 = lens_focal_out_hor,
    w1r4 = lens_width/2 + 4*channel_width + 4*lens_glass_thickness, w2r4 = lens_width/2 + 4*channel_width +4*lens_glass_thickness,
    linwr4 = lens_focal_in_hor, loutwr4 = lens_focal_out_hor,
    h1u4 = lens_height/2 + 4*channel_height + 4*lens_glass_thickness, h2u4 = lens_height/2 + 4*channel_height + 4*lens_glass_thickness,
    linhu4 = lens_focal_in_ver, louthu4 = lens_focal_out_ver,
    h1d4 = lens_height/2 + 4*channel_height + 4*lens_glass_thickness, h2d4 = lens_height/2 + 4*channel_height + 4*lens_glass_thickness,
    linhd4 = lens_focal_in_ver, louthd4 = lens_focal_out_ver,
    Qcxl4 = 0.0219, Qcxr4 = 0.0219, Qcyu4 = 0.0219, Qcyd4 = 0.0219,
    alphaxl4 = 6.07, alphaxr4 = 6.07, alphayu4 = 6.07, alphayd4 = 6.07,
    Wxr4 = 0.003, Wxl4 = 0.003, Wyu4 = 0.003, Wyd4 = 0.003,
    mxr4 = m_lens, mxl4 = m_lens, myu4 = m_lens, myd4 = m_lens,
    QcxrOW4 = 0.0219, QcxlOW4 = 0.0219, QcyuOW4 = 0.0219, QcydOW4 = 0.0219,
    alphaxlOW4 = 6.07, alphaxrOW4 = 6.07, alphayuOW4 = 6.07, alphaydOW4 = 6.07,
    WxrOW4 = 0.003, WxlOW4 = 0.003, WyuOW4 = 0.003, WydOW4 = 0.003,
    mxrOW4 = m_lens, mxlOW4 = m_lens, myuOW4 = m_lens, mydOW4 = m_lens,
    rwallthick4 =lens_glass_thickness, lwallthick4 = lens_glass_thickness, uwallthick4 = lens_glass_thickness, dwallthick4 =lens_glass_thickness,

    w1l5 = lens_width/2 + 5*channel_width + 5*lens_glass_thickness, w2l5 = lens_width/2 + 5*channel_width + 5*lens_glass_thickness,
    linwl5 = lens_focal_in_hor, loutwl5 = lens_focal_out_hor,
    w1r5 = lens_width/2 + 5*channel_width + 5*lens_glass_thickness, w2r5 = lens_width/2 + 5*channel_width + 5*lens_glass_thickness,
    linwr5 = lens_focal_in_hor, loutwr5 = lens_focal_out_hor,
    h1u5 = lens_height/2 + 5*channel_height + 5*lens_glass_thickness, h2u5 = lens_height/2 + 5*channel_height + 5*lens_glass_thickness,
    linhu5 = lens_focal_in_ver, louthu5 = lens_focal_out_ver,
    h1d5 = lens_height/2 + 5*channel_height + 5*lens_glass_thickness, h2d5 = lens_height/2 + 5*channel_height + 5*lens_glass_thickness,
    linhd5 = lens_focal_in_ver, louthd5 = lens_focal_out_ver,
    Qcxl5 = 0.0219, Qcxr5 = 0.0219, Qcyu5 = 0.0219, Qcyd5 = 0.0219,
    alphaxl5 = 6.07, alphaxr5 = 6.07, alphayu5 = 6.07, alphayd5 = 6.07,
    Wxr5 = 0.003, Wxl5 = 0.003, Wyu5 = 0.003, Wyd5 = 0.003,
    mxr5 = m_lens, mxl5 = m_lens, myu5 = m_lens, myd5 = m_lens,
    QcxrOW5 = 0.0219, QcxlOW5 = 0.0219, QcyuOW5 = 0.0219, QcydOW5 = 0.0219,
    alphaxlOW5 = 6.07, alphaxrOW5 = 6.07, alphayuOW5 = 6.07, alphaydOW5 = 6.07,
    WxrOW5 = 0.003, WxlOW5 = 0.003, WyuOW5 = 0.003, WydOW5 = 0.003,
    mxrOW5 = m_lens, mxlOW5 = m_lens, myuOW5 = m_lens, mydOW5 = m_lens,
    rwallthick5 = lens_glass_thickness, lwallthick5 = lens_glass_thickness, uwallthick5 = lens_glass_thickness, dwallthick5 = lens_glass_thickness,

    w1l6 = lens_width/2 + 6*channel_width + 6*lens_glass_thickness, w2l6 = lens_width/2 + 6*channel_width + 6*lens_glass_thickness,
    linwl6 = lens_focal_in_hor, loutwl6 = lens_focal_out_hor,
    w1r6 = lens_width/2 + 6*channel_width + 6*lens_glass_thickness, w2r6 = lens_width/2 + 6*channel_width + 6*lens_glass_thickness,
    linwr6 = lens_focal_in_hor, loutwr6 = lens_focal_out_hor,
    h1u6 = lens_height/2 + 6*channel_height +6*lens_glass_thickness, h2u6 = lens_height/2 + 6*channel_height +6*lens_glass_thickness,
    linhu6 = lens_focal_in_ver, louthu6 = lens_focal_out_ver,
    h1d6 = lens_height/2 + 6*channel_height + 6*lens_glass_thickness, h2d6 = lens_height/2 + 6*channel_height +6* lens_glass_thickness,
    linhd6 = lens_focal_in_ver, louthd6 = lens_focal_out_ver,
    Qcxl6 = 0.0219, Qcxr6 = 0.0219, Qcyu6 = 0.0219, Qcyd6 = 0.0219,
    alphaxl6 = 6.07, alphaxr6 = 6.07, alphayu6 = 6.07, alphayd6 = 6.07,
    Wxr6 = 0.003, Wxl6 = 0.003, Wyu6 = 0.003, Wyd6 = 0.003,
    mxr6 = m_lens, mxl6 = m_lens, myu6 = m_lens, myd6 = m_lens,
    QcxrOW6 = 0.0219, QcxlOW6 = 0.0219, QcyuOW6 = 0.0219, QcydOW6 = 0.0219,
    alphaxlOW6 = 6.07, alphaxrOW6 = 6.07, alphayuOW6 = 6.07, alphaydOW6 = 6.07,
    WxrOW6 = 0.003, WxlOW6 = 0.003, WyuOW6 = 0.003, WydOW6 = 0.003,
    mxrOW6 = m_lens, mxlOW6 = m_lens, myuOW6 = m_lens, mydOW6 = m_lens,
    rwallthick6 = lens_glass_thickness, lwallthick6 = lens_glass_thickness, uwallthick6 = lens_glass_thickness, dwallthick6 = lens_glass_thickness,

    w1l7 = lens_width/2 + 7*channel_width + 7*lens_glass_thickness, w2l7 = lens_width/2 + 7*channel_width+7*lens_glass_thickness,
    linwl7 = lens_focal_in_hor, loutwl7 = lens_focal_out_hor,
    w1r7 = lens_width/2 + 7*channel_width +7*lens_glass_thickness, w2r7 = lens_width/2 + 7*channel_width +7*lens_glass_thickness,
    linwr7 = lens_focal_in_hor, loutwr7 = lens_focal_out_hor,
    h1u7 = lens_height/2 + 7*channel_height + 7*lens_glass_thickness, h2u7 = lens_height/2 + 7*channel_height + 7*lens_glass_thickness,
    linhu7 = lens_focal_in_ver, louthu7 = lens_focal_out_ver,
    h1d7 = lens_height/2 + 7*channel_height + 7*lens_glass_thickness, h2d7 = lens_height/2 + 7*channel_height + 7*lens_glass_thickness,
    linhd7 = lens_focal_in_ver, louthd7 = lens_focal_out_ver,
    Qcxl7 = 0.0219, Qcxr7 = 0.0219, Qcyu7 = 0.0219, Qcyd7 = 0.0219,
    alphaxl7 = 6.07, alphaxr7 = 6.07, alphayu7 = 6.07, alphayd7 = 6.07,
    Wxr7 = 0.003, Wxl7 = 0.003, Wyu7 = 0.003, Wyd7 = 0.003,
    mxr7 = m_lens, mxl7 = m_lens, myu7 = m_lens, myd7 = m_lens,
    QcxrOW7 = 0.0219, QcxlOW7 = 0.0219, QcyuOW7 = 0.0219, QcydOW7 = 0.0219,
    alphaxlOW7 = 6.07, alphaxrOW7 = 6.07, alphayuOW7 = 6.07, alphaydOW7 = 6.07,
    WxrOW7 = 0.003, WxlOW7 = 0.003, WyuOW7 = 0.003, WydOW7 = 0.003,
    mxrOW7 = m_lens, mxlOW7 = m_lens, myuOW7 = m_lens, mydOW7 = m_lens,
    rwallthick7 = lens_glass_thickness, lwallthick7 = lens_glass_thickness, uwallthick7 = lens_glass_thickness, dwallthick7 = lens_glass_thickness,

    w1l8 = lens_width/2 + 8*channel_width + 8*lens_glass_thickness, w2l8 = lens_width/2 + 8*channel_width + 8*lens_glass_thickness,
    linwl8 = lens_focal_in_hor, loutwl8 = lens_focal_out_hor,
    w1r8 = lens_width/2 + 8*channel_width + 8*lens_glass_thickness, w2r8 = lens_width/2 + 8*channel_width + 8*lens_glass_thickness,
    linwr8 = lens_focal_in_hor, loutwr8 = lens_focal_out_hor,
    h1u8 = lens_height/2 + 8*channel_height + 8*lens_glass_thickness, h2u8 = lens_height/2 + 8*channel_height + 8*lens_glass_thickness,
    linhu8 = lens_focal_in_ver, louthu8 = lens_focal_out_ver,
    h1d8 = lens_height/2 + 8*channel_height + 8*lens_glass_thickness, h2d8 = lens_height/2 + 8*channel_height + 8*lens_glass_thickness,
    linhd8 = lens_focal_in_ver, louthd8 = lens_focal_out_ver,
    Qcxl8 = 0.0219, Qcxr8 = 0.0219, Qcyu8 = 0.0219, Qcyd8 = 0.0219,
    alphaxl8 = 6.07, alphaxr8 = 6.07, alphayu8 = 6.07, alphayd8 = 6.07,
    Wxr8 = 0.003, Wxl8 = 0.003, Wyu8 = 0.003, Wyd8 = 0.003,
    mxr8 = m_lens, mxl8 = m_lens, myu8 = m_lens, myd8 = m_lens,
    QcxrOW8 = 0.0219, QcxlOW8 = 0.0219, QcyuOW8 = 0.0219, QcydOW8 = 0.0219,
    alphaxlOW8 = 6.07, alphaxrOW8 = 6.07, alphayuOW8 = 6.07, alphaydOW8 = 6.07,
    WxrOW8 = 0.003, WxlOW8 = 0.003, WyuOW8 = 0.003, WydOW8 = 0.003,
    mxrOW8 = m_lens, mxlOW8 = m_lens, myuOW8 = m_lens, mydOW8 = m_lens,
    rwallthick8 = lens_glass_thickness, lwallthick8 = lens_glass_thickness, uwallthick8 = lens_glass_thickness, dwallthick8 = lens_glass_thickness,

    w1l9 = lens_width/2 + 9*channel_width + 9*lens_glass_thickness, w2l9 = lens_width/2 + 9*channel_width + 9*lens_glass_thickness,
    linwl9 = lens_focal_in_hor, loutwl9 = lens_focal_out_hor,
    w1r9 = lens_width/2 + 9*channel_width + 9*lens_glass_thickness, w2r9 = lens_width/2 + 9*channel_width + 9*lens_glass_thickness,
    linwr9 = lens_focal_in_hor, loutwr9 = lens_focal_out_hor,
    h1u9 = lens_height/2 + 9*channel_height + 9*lens_glass_thickness, h2u9 = lens_height/2 + 9*channel_height + 9*lens_glass_thickness,
    linhu9 = lens_focal_in_ver, louthu9 = lens_focal_out_ver,
    h1d9 = lens_height/2 + 9*channel_height + 9*lens_glass_thickness, h2d9 = lens_height/2 + 9*channel_height + 9*lens_glass_thickness,
    linhd9 = lens_focal_in_ver, louthd9 = lens_focal_out_ver,
    Qcxl9 = 0.0219, Qcxr9 = 0.0219, Qcyu9 = 0.0219, Qcyd9 = 0.0219,
    alphaxl9 = 6.07, alphaxr9 = 6.07, alphayu9 = 6.07, alphayd9 = 6.07,
    Wxr9 = 0.003, Wxl9 = 0.003, Wyu9 = 0.003, Wyd9 = 0.003,
    mxr9 = m_lens, mxl9 = m_lens, myu9 = m_lens, myd9 = m_lens,
    QcxrOW9 = 0.0219, QcxlOW9 = 0.0219, QcyuOW9 = 0.0219, QcydOW9 = 0.0219,
    alphaxlOW9 = 6.07, alphaxrOW9 = 6.07, alphayuOW9 = 6.07, alphaydOW9 = 6.07,
    WxrOW9 = 0.003, WxlOW9 = 0.003, WyuOW9 = 0.003, WydOW9 = 0.003,
    mxrOW9 = m_lens, mxlOW9 = m_lens, myuOW9 = m_lens, mydOW9 = m_lens,
    rwallthick9 = lens_glass_thickness, lwallthick9 = lens_glass_thickness, uwallthick9 = lens_glass_thickness, dwallthick9 = lens_glass_thickness,

    w1l10 = lens_width/2 + 10*channel_width + 10*lens_glass_thickness, w2l10 = lens_width/2 + 10*channel_width + 10*lens_glass_thickness,
    linwl10 = lens_focal_in_hor, loutwl10 = lens_focal_out_hor,
    w1r10 = lens_width/2 + 10*channel_width + 10*lens_glass_thickness, w2r10 = lens_width/2 + 10*channel_width + 10*lens_glass_thickness,
    linwr10 = lens_focal_in_hor, loutwr10 = lens_focal_out_hor,
    h1u10 = lens_height/2 + 10*channel_height + 10*lens_glass_thickness, h2u10 = lens_height/2 + 10*channel_height + 10*lens_glass_thickness,
    linhu10 = lens_focal_in_ver, louthu10 = lens_focal_out_ver,
    h1d10 = lens_height/2 + 10*channel_height + 10*lens_glass_thickness, h2d10 = lens_height/2 + 10*channel_height + 10*lens_glass_thickness,
    linhd10 = lens_focal_in_ver, louthd10 = lens_focal_out_ver,
    Qcxl10 = 0.0219, Qcxr10 = 0.0219, Qcyu10 = 0.0219, Qcyd10 = 0.0219,
    alphaxl10 = 6.07, alphaxr10 = 6.07, alphayu10 = 6.07, alphayd10 = 6.07,
    Wxr10 = 0.003, Wxl10 = 0.003, Wyu10 = 0.003, Wyd10 = 0.003,
    mxr10 = m_lens, mxl10 = m_lens, myu10 = m_lens, myd10 = m_lens,
    QcxrOW10 = 0.0219, QcxlOW10 = 0.0219, QcyuOW10 = 0.0219, QcydOW10 = 0.0219,
    alphaxlOW10 = 6.07, alphaxrOW10 = 6.07, alphayuOW10 = 6.07, alphaydOW10 = 6.07,
    WxrOW10 = 0.003, WxlOW10 = 0.003, WyuOW10 = 0.003, WydOW10 = 0.003,
    mxrOW10 = m_lens, mxlOW10 = m_lens, myuOW10 = m_lens, mydOW10 = m_lens,
    rwallthick10 = lens_glass_thickness, lwallthick10 = lens_glass_thickness, uwallthick10 = lens_glass_thickness, dwallthick10 = lens_glass_thickness

 )
  AT (0, 0, 0.2) RELATIVE PREVIOUS

COMPONENT Lmonsource5= L_monitor(
    nL = 100, filename = "afterlens.dat", xmin = -0.06, xmax = 0.06,
    ymin = -0.075, ymax = 0.075, Lmin = 0.0, Lmax = 11)
  AT (0, 0,1.0001+lens_focal_out_hor) RELATIVE lens

COMPONENT divmonlens = Divergence_monitor(
    nh = 100, nv = 100, filename = "divmonlens.dat", xmin = -0.04,
    xmax = 0.04, ymin = -0.075, ymax = 0.075, maxdiv_h = 3,
    maxdiv_v = 3)
  AT (0, 0, 1.0002+lens_focal_out_hor) RELATIVE lens

COMPONENT PSDmonLens = PSD_monitor(
	xmin = -0.045, xmax = 0.045, ymin = -0.045, ymax = 0.045,
	nx=200, ny=200, filename="PSDmonlens.dat")
  AT (0, 0, 1.0003+lens_focal_out_hor) RELATIVE lens



END
