/******************************************************************************* * McStas instrument definition URL=http://www.mcstas.org * * Instrument: test (rename also the example and DEFINE lines below) * * %Identification * Written by: Your name (email) * Date: Current Date * Origin: Your institution * Release: McStas 1.6 * Version: 0.2 * %INSTRUMENT_SITE: Institution_name_as_a_single word * * Instrument short description * * %Description * Instrument longer description (type, elements, usage...) * * Example: mcrun test.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 test(Beta=0.25, CHECK=0) /* 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 a neutron source ! */ /* Progress_bar is an Arm displaying simulation progress. */ COMPONENT Origin = Progress_bar() AT (0,0,0) ABSOLUTE COMPONENT Source = Source_adapt( E0=4, dE=1, N_E = 128, xmin = -0.01, xmax = 0.01, ymin = -0.05, ymax = 0.05, dist = 10, xw = 0.1, yh = 0.1, beta=Beta) AT (0, 0, 0) RELATIVE Origin COMPONENT Emon = E_monitor( nchan = 256, filename = "Emon.dat", xwidth = 0.2, yheight = 0.2, Emin = 2, Emax=6) AT (0, 0, 10) RELATIVE Origin COMPONENT Lmon = L_monitor( nchan = 256, filename = "Lmon.dat", xwidth = 0.2, yheight = 0.2, Lmin = 3, Lmax = 6) AT (0, 0, 10.001) RELATIVE Origin COMPONENT Powder = Powder1( ) AT (0, 0, 10) RELATIVE Origin EXTEND %{ if (!SCATTERED) ABSORB; %} COMPONENT Sphere = PSD_monitor_4PI( filename = "sphere.dat", radius = 1) AT (0, 0, 0) RELATIVE Powder COMPONENT Checker = Adapt_check( source_comp = Source) WHEN (CHECK==1) AT (0, 0, 1.1) RELATIVE Sphere /* 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