File: Test_Pol_Tabled.instr

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,113,256 kB
  • sloc: ansic: 40,697; python: 25,137; yacc: 8,438; sh: 5,405; javascript: 4,596; lex: 1,632; cpp: 742; perl: 296; lisp: 273; makefile: 226; fortran: 132
file content (110 lines) | stat: -rw-r--r-- 4,028 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_Pol_Tabled (rename also the example and DEFINE lines below)
*
* %Identification
* Written by: Your name (email)
* Date: Current Date
* Origin: Your institution
* %INSTRUMENT_SITE: Tests_polarization
*
* Test the tabled magnetic field option
*
* %Description
* A test instrument to check that supplying a magnetic field as a vector field point cloud
* is working. The field referred to by the default input parameter MF is 10 \mu T along the z-axis
* at entry and flips to l0 \mu T along the negative z-axis halfway through
*
* %Example: -n1e4 interpol_method=default MF=flipfield.dat Detector: pol_6_I=1.0
* %Example: -n1e4 interpol_method=default MF=constfield.dat Detector: polx_6_I=0.05
*
* %Parameters
* MF:              [string] Field definition file
* zdepth:               [m] Z-dimension of field
* interpol_method: [string] Choice of interpolation method "kdtree" (default on CPU) / "regular" (default on GPU)
*
* %Link
* A reference/HTML link for more information
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_Pol_Tabled(string MF="flipfield.dat", zdepth=1, string interpol_method="default")

/* 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 src = Source_simple(
    radius = 0.02, dist = 5, focus_xw = 0.1, focus_yh = 0.1,
    lambda0 = 5, dlambda = 4.99)
  AT (0, 0, 0) RELATIVE Origin

COMPONENT setpol = Set_pol(
    px = 0, py = 1, pz = 0)
  AT (0, 0, 1) RELATIVE src


COMPONENT pol_0 = Pol_monitor(
    restore_neutron=1,xwidth=0.2, yheight=0.2, mx=0, my=1, mz=0)
AT(0,0,1) RELATIVE setpol

COMPONENT polx_0 = PolLambda_monitor(nL=100,npol=101,
    xwidth = 0.2, yheight = 0.2, restore_neutron = 1, mx = 1,
    my = 0, mz = 0, Lmin = 0, Lmax = 10, filename="polx_0")
AT(0,0,0) RELATIVE setpol
COMPONENT poly_0 = COPY (polx_0)(mx=0,my=1,mz=0,filename="poly_0")
AT(0,0,0) RELATIVE PREVIOUS
COMPONENT polz_0 = COPY (polx_0)(mx=0,my=0,mz=1,filename="polz_0")
AT(0,0,0) RELATIVE PREVIOUS
COMPONENT lmon_0 = L_monitor(nL=100,Lmin=0, Lmax=10,xwidth=0.2, yheight=0.2, filename="lmon_0")
AT(0,0,0) RELATIVE PREVIOUS


COMPONENT field = Pol_tabled_field(
    xwidth=0.1, yheight=0.1, zdepth=zdepth, filename=MF, interpol_method=interpol_method)
AT(0,0,0.5) RELATIVE PREVIOUS


COMPONENT polx_6 = COPY(polx_0)(filename="polx_6")
AT(0,0,1) RELATIVE field
/*COMPONENT poly_6 = COPY(poly_0)(filename="poly_6")
AT(0,0,0) RELATIVE PREVIOUS
 COMPONENT polz_6 = COPY(polz_0)(restore_neutron=0,filename="polz_6")
AT(0,0,0) RELATIVE PREVIOUS
*/
  COMPONENT pol_6 = COPY(pol_0)
AT(0,0,0) RELATIVE PREVIOUS

COMPONENT lmon_6 = COPY(lmon_0)(filename="lmon_6")
AT(0,0,0) RELATIVE PREVIOUS

/* 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