/******************************************************************************* * 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 * %INSTRUMENT_SITE: Templates * * Instrument short description * * %Description * Instrument longer description (type, elements, usage...) * * Example: mcrun test.instr * * once your instrument is written and functional: * - replace INSTRUMENT_SITE entry above with your Institution name as a single word * - rename the instrument name after DEFINE INSTRUMENT below * - update the parameter help in the following Parameters section * - update the instrument description, and better add a usage example with a * sensible parameter set. * * %Parameters * * %Link * A reference/HTML link for more information * * %End *******************************************************************************/ DEFINE INSTRUMENT test(delay=0,phase=0,nu=1,in=1,dz=0.001,theta_0=10, nt=10, tmin=0, tmax=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 a neutron source ! */ /* Progress_bar is an Arm displaying simulation progress. */ COMPONENT Origin = Progress_bar() AT (0,0,0) ABSOLUTE COMPONENT source_simple = Source_simple( radius=0.3, focus_xw=0.3, focus_yh=0.3, lambda0=1, dlambda=0.01, target_index=1) AT (0, 0, 0) RELATIVE PREVIOUS COMPONENT circular_slit = Slit(radius=0.15) AT (0, 0, 1) RELATIVE PREVIOUS COMPONENT psd_monitor = PSD_monitor( filename="incoming", xwidth=0.35, yheight=0.35,restore_neutron=0) AT (0, 0, dz) RELATIVE PREVIOUS EXTEND %{ t=rand01(); %} COMPONENT incoming=Event_monitor_simple(nevents=1e6) AT (0,0,0) RELATIVE PREVIOUS COMPONENT diskchopper = DiskChopper( theta_0=10, radius=0.15, yheight=0.15, nu=nu, nslit=1, delay=delay, phase=phase) WHEN (in) AT (0, 0.075, dz) RELATIVE PREVIOUS COMPONENT outgoing=Event_monitor_simple(nevents=1e6) AT (0,0,0) RELATIVE PREVIOUS COMPONENT psd_tof_monitor = PSD_TOF_monitor( nt=nt, filename="slices", xwidth=0.35, yheight=0.35, tmin=tmin*1e6, // conversions tu mu-s tmax=tmax*1e6) AT (0, 0, 2*dz) RELATIVE psd_monitor /* 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