/*******************************************************************************
* Instrument: Test_CRL_Be
*
* %Identification
* Written by: Antoine Padovani
* Date: March 2022
* Origin: SOLEIL
* Version: 1.0
* %INSTRUMENT_SITE: Tests_optics
*
* Test of a compound refractive lenses
*
* %Description
* Test of a compound refractive lenses using the Lens_parab component.
*
* %Example: Test_CRL_Be L=14 Detector: e_monitor_I=0.341818
*
* %Parameters
* L: [m] Position of the detector for the focusing
* 
* %Link
* https://github.com/antoinepado/Corrections_School_March_2022/tree/master/DAY_2/5_Optics/1_CRLs/Be
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_CRL_Be(L=14)

TRACE

COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE

// insert components here (e.g. Insert -> Source -> ...)
COMPONENT source_gaussian = Source_gaussian(
    sig_x=48.2e-6, 
    sig_y=9.5e-6, 
    sigPr_x=100e-6, 
    sigPr_y=4.3e-6, 
    dist=31.5, 
    focus_xw=0.001,
    focus_yh=0.001,
    gauss=1, 
    E0=23.32, 
    dE=1)
AT (0, 0, 0) RELATIVE origin


COMPONENT lens_parab = Lens_parab(
    material_datafile = "Be.txt",
    r=200e-6, 
    r_ap=0.5e-3, 
    d=50e-6, 
    N=16)
AT (0, 0, 31.5) RELATIVE PREVIOUS


/*COMPONENT lens_parab = Lens_parab(
    material_datafile = "Al.txt",
    r=200e-6, 
    r_ap=0.5e-3, 
    d=20e-6, 
    N=10)
AT (0, 0, 31.5) RELATIVE PREVIOUS*/


COMPONENT slit = Slit(
    radius=0.0001)
AT (0, 0, L) RELATIVE PREVIOUS


COMPONENT psd_monitor = PSD_monitor(
    filename="psd.dat", 
    xwidth=0.001, 
    yheight=0.001)
AT (0, 0, 0.001) RELATIVE PREVIOUS

COMPONENT e_monitor = E_monitor(
    filename="energy.dat", 
    xwidth=0.001, 
    yheight=0.001, 
    Emin=23.32-1, 
    Emax=23.32+1)
AT (0, 0, 0) RELATIVE PREVIOUS

END

