/******************************************************************************* * McXtrace instrument definition URL=http://www.mcxtrace.org * * Instrument: Test_monitors (rename also the example and DEFINE lines below) * * %Identification * Written by: Erik B Knudsen (erkn@fysik.dtu.dk) * Date: Jan 21 * Origin: DTU Physics * Version: 1,0 * %INSTRUMENT_SITE: Tests * * Unit test instrument for various monitors. * * %Description * This is a unit test instrument to test some of the McXtrace monitors. * * %Example: Test_monitors.instr monitor_no=1 Detector: epsd0_I=1.81362 * %Example: Test_monitors.instr monitor_no=2 Detector: epsd1_I=1.81367 * %Example: Test_monitors.instr monitor_no=3 Detector: div_I=1.83645 * %Example: Test_monitors.instr monitor_no=4 Detector: mnd_psd_I=1.83632 * * * %Parameters * monitor_no: [ ] Pick a monitor to test - causes the others not to write any data files. * * %Link * A reference/HTML link for more information * * %End *******************************************************************************/ /* Change name of instrument and input parameters with default values */ DEFINE INSTRUMENT Test_monitors(monitor_no=1) /* The DECLARE section allows us to declare variables or small */ /* functions in C syntax. These may be used in the whole instrument. */ DECLARE %{ %} /* The INITIALIZE section is executed when the simulation starts */ /* (C code). You may use them as component parameter values. */ INITIALIZE %{ %} /* Here comes the TRACE section, where the actual */ /* instrument is defined as a sequence of components. */ TRACE /* The Arm() class component defines reference points and orientations */ /* in 3D space. Every component instance must have a unique name. Here, */ /* Origin is used. This Arm() component is set to define the origin of */ /* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used */ /* for further RELATIVE reference, Other useful keywords are : ROTATED */ /* EXTEND GROUP PREVIOUS. Also think about adding an xray source ! */ /* Progress_bar is an Arm displaying simulation progress. */ COMPONENT Origin = Progress_bar() AT (0,0,0) ABSOLUTE COMPONENT src = Source_gaussian( sig_x = 2e-5, sig_y = 1e-5, sigPr_x = 1e-5, sigPr_y = 2e-6, dist = 1, gauss = 1, focus_xw = 1e-3, focus_yh = 1e-3, E0 = 12.5, dE = 1, dlambda = 0, phase = 1) AT (0, 0, 0) RELATIVE Origin COMPONENT epsd0= EPSD_monitor( nowritefile=(monitor_no==1?0:1),restore_xray=1,xwidth=1e-3, yheight=1e-3, filename="epsd0", Emin=10, Emax=15) WHEN(monitor_no==1) AT(0,0,10) RELATIVE src COMPONENT epsd1 =COPY(epsd0)(nowritefile=(monitor_no==2?0:1),filename="epsd1",nE=20) WHEN(monitor_no==2) AT(0,0,10) RELATIVE src COMPONENT div = Divergence_monitor(xwidth=1e-3, yheight=1e-3, filename="div0", nowritefile=(monitor_no==3?0:1)) WHEN(monitor_no==3) AT(0,0,10) RELATIVE src COMPONENT mnd_psd = Monitor_nD(xwidth=1e-3, yheight=1e-3, options="x limits -1e-3 1e-3 y limits -1e-3 1e-3", nowritefile=(monitor_no==4?0:1)) WHEN(monitor_no==4) AT(0,0,10) RELATIVE src /* This section is executed when the simulation ends (C code). Other */ /* optional sections are : SAVE */ FINALLY %{ %} /* The END token marks the instrument definition end */ END