/*******************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Test_filter 
*
* %Identification
* Written by: Erik Knudsen (erkn@risoe.dtu.dk)
* Date: July 5th 2011
* Origin: Ris&oslash; DTU
* Version: 1.0_rc2
* %INSTRUMENT_SITE: Tests_optics
*
* Test instrument for checking the Filter.comp component 
*
* %Description
* Test instrument for checking the Filter.comp component 
*
* %Parameters
* filter_mat: []   Chemical symbol of the filter material
* thickness:  [m]  thickness of the filter block
* L0:         [AA] centre wavlength of the source
* DL:         [AA] half width of the (uniform) wavelength distribution
* F2:         [1]  add a 2nd filter component further away
*
* %Example: DL=4.9 L0=5 filter_mat="Si.txt" Detector: l_mon1_I=1.31502e-07
* %Example: DL=4.9 L0=5 filter_mat="Rh.txt" Detector: l_mon1_I=4.04921e-29
* %Example: -n5e6 DL=4.9 L0=5 filter_mat="Ti.txt" F2=1 Detector: l_mon1_I=1.14111e-08
* %Example: DL=4.9 L0=5 filter_mat="Al.txt" Detector: l_mon1_I=1.04427e-07
* %Example: DL=4.9 L0=5 filter_mat="Glass.dat" Detector: l_mon1_I=1.645e-06
* %Example: DL=4.9 L0=5 filter_mat="Be.txt" Detector: l_mon1_I=0.000412661
* %Example: DL=4.9 L0=5 filter_mat="FilterAir_1mm.dat" Detector: l_mon1_I=4.96145e-05
*
* %End
*******************************************************************************/

DEFINE INSTRUMENT Test_Filter(string filter_mat="Rh.txt",thickness=100e-6,L0=1,DL=0.1, F2=0)

DECLARE
%{
%}

INITIALIZE
%{
%}


TRACE

COMPONENT Origin = Progress_bar()
AT(0,0,0) ABSOLUTE


COMPONENT Source=Source_pt(
    lambda0=L0,dlambda=DL,  focus_xw=0.1, focus_yh=0.1, dist=1
)
AT (0,0,0) RELATIVE Origin

COMPONENT l_mon0 = L_monitor(
    filename="l_mon0",nL=200,xwidth=0.1, yheight=0.1, Lmin=L0-1.1*DL, Lmax=L0+1.1*DL
)
AT (0,0,1e-6) RELATIVE Source

COMPONENT filter = Filter(
    material_datafile=filter_mat, xwidth=0.1,yheight=0.1,zdepth=thickness
)
AT (0,0,0.5) RELATIVE Source

COMPONENT filter2 = Filter(
    material_datafile=filter_mat,xwidth=0.1, yheight=0.1, zdepth=thickness
)
WHEN(F2) AT (0,0,0.5+thickness+1e-3) RELATIVE Source

COMPONENT l_mon1 = L_monitor(
    filename="l_mon1",nL=200,xwidth=0.1, yheight=0.1, Lmin=L0-1.1*DL, Lmax=L0+1.1*DL
)
AT (0,0,1) RELATIVE Source

END

