1/*******************************************************************************
2*         McStas instrument definition URL=http://www.mcstas.org
3*
4* Instrument: ISIS_TS1_Brilliance (rename also the example and DEFINE lines below)
5*
6* %Identification
7* Written by: Peter Willendrup
8* Date: 20130425
9* Origin: DTU Fysik
10* %INSTRUMENT_SITE: ISIS
11*
12* This instrument produces brilliance curves from the ISIS TS1 facility.
13*
14* %Description
15* This instrument produces brilliance curves from the ISIS TS1 facility.
16*
17* The Brilliance_monitor is used to determine both the mean and peak brilliances, plus pulse-shapes for different wavelengths.
18*
19* Example: ISIS_brilliance Detector: Brillmon_I=3.80e+15 (First detector output)
20*
21* %Parameters
22* modfile: [string]  Name of moderator face - TS1=water, ch4, h2, merlin or instrument name eg maps, crisp etc.
23*
24* %Link
25*
26* %End
27*******************************************************************************/
28DEFINE INSTRUMENT ISIS_TS1_Brilliance(string modfile="ch4")
29
30/* The DECLARE section allows us to declare variables or  small      */
31/* functions in C syntax. These may be used in the whole instrument. */
32DECLARE
33%{
34  double lambdamin,lambdamax;
35%}
36
37/* The INITIALIZE section is executed when the simulation starts     */
38/* (C code). You may use them as component parameter values.         */
39INITIALIZE
40%{
41  lambdamin=0.5;
42  lambdamax=20;
43%}
44
45/* Here comes the TRACE section, where the actual      */
46/* instrument is defined as a sequence of components.  */
47TRACE
48
49/* The Arm() class component defines reference points and orientations  */
50/* in 3D space. Every component instance must have a unique name. Here, */
51/* Origin is used. This Arm() component is set to define the origin of  */
52/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used   */
53/* for further RELATIVE reference, Other useful keywords are : ROTATED  */
54/* EXTEND GROUP PREVIOUS. Also think about adding a neutron source !    */
55/* Progress_bar is an Arm displaying simulation progress.               */
56COMPONENT Origin = Progress_bar()
57  AT (0,0,0) ABSOLUTE
58
59COMPONENT Source = ISIS_moderator(Face = modfile, Emin = -lambdamin,Emax = -lambdamax, dist = 1.0, focus_xw = 0.01,
60   focus_yh = 0.01,  xwidth = 0.01, yheight = 0.01, CAngle = 0.0,SAC=1)
61  AT (0, 0, 0) RELATIVE Origin
62
63COMPONENT Brillmon = Brilliance_monitor(
64    nlam = 196, nt = 601, filename = "brill", t_0 = 0,
65    t_1 = 600, lambda_0 = lambdamin, lambda_1 = lambdamax,
66    Freq =40.0)
67  AT (0, 0, 0.0000001) RELATIVE Source
68
69/* This section is executed when the simulation ends (C code). Other    */
70/* optional sections are : SAVE                                         */
71FINALLY
72%{
73%}
74/* The END token marks the instrument definition end */
75END
76