/******************************************************************************* * McXtrace instrument definition URL=http://www.mcxtrace.org * * Instrument: test (rename also the example and DEFINE lines below) * * %Identification * Written by: Erik B Knudsen (erkn@fysik.dtu.dk) * Date: End of the World * Origin: DTU Fysik * Release: McXtrace 1.1 * Version: 1.0 * %INSTRUMENT_SITE: None * * * %Description * Instrument longer description (type, elements, usage...) * * Example: ex4_DCM.instr * * %Parameters * Par1: [unit] Parameter1 description * * %Link * A reference/HTML link for more information * * %End *******************************************************************************/ /* Change name of instrument and input parameters with default values */ DEFINE INSTRUMENT ex4_DCM() /* The DECLARE section allows us to declare variables or small */ /* functions in C syntax. These may be used in the whole instrument. */ DECLARE %{ double gap=6e-3; double offset=1e-2; %} /* 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 */ /* 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 /*primary optics SASE1, collimators, offset-mirror,deflector etc.*/ COMPONENT src = Source_gaussian( sig_x = 2e-6, sig_y = 1e-6, sigPr_x = 1e-6, sigPr_y = 1e-6, E0=12.5, dE = 1, phase = 0, focus_xw=3e-3,focus_yh=3e-3,dist=100) AT (0, 0, 0) RELATIVE Origin COMPONENT emon = E_monitor( Emin=10.0, Emax=15.0, nE=501, xwidth=1e-2, yheight=1e-2, filename="emon_src") AT(0,0,80) RELATIVE src COMPONENT mono1 = Perfect_crystal(h=1, k=1, l=1, material="Si.txt",alpha=0,length=2e-2, width=1e-2) AT(0,0,100) RELATIVE src ROTATED (-9.1,0,0) RELATIVE src COMPONENT mono2 = COPY(mono1)(length=1e-1) AT(0,gap,offset*4) RELATIVE mono1 ROTATED (0,0,0) RELATIVE mono1 COMPONENT mono_out = Arm() AT(0,0,0) RELATIVE PREVIOUS ROTATED (9.1,0,0) RELATIVE PREVIOUS COMPONENT emon_post_mono = E_monitor( Emin=10.0, Emax=15.0, nE=501, xwidth=1e-1, yheight=1e-1, filename="emon_post_mono") AT(0,0,120) RELATIVE src COMPONENT psd_post_mono = PSD_monitor( nx=201,ny=201, xwidth=1e-1, yheight=1e-1, filename="psd_post_mono") AT(0,0,0.01) RELATIVE emon_post_mono /* 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