File: Test_DiskChoppers2.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 (186 lines) | stat: -rw-r--r-- 4,116 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*******************************************************************************
* Instrument: Test_DiskChoppers2
*
* %I
* Written by: Peter Willendrup <pkwi@fysik.dtu.dk>
* Date: September 2018
* Origin: DTU
* %INSTRUMENT_SITE: Tests_optics
*
* Simple test instrument that compares DiskChoppers with a simple, rotating Slit.
*
* %D
* Simple test instrument that compares DiskChoppers with a simple, rotating Slit.
* When ABSORBER is set, a slab of B4C is acts as absorbing medium.
*
* %Example: Test_DiskChoppers.instr chopper=0 Detector: Tofl_I=0.0005
* %Example: Test_DiskChoppers.instr chopper=1 Detector: Tofl_I=0.0005
* %Example: Test_DiskChoppers.instr chopper=0 ABSORBER=1 Detector: Tofl_I=0.0007
* %Example: Test_DiskChoppers.instr chopper=1 ABSORBER=1 Detector: Tofl_I=0.0007
*
* %P
* chopper:  [int] chopper=0 selects DiskChopper, chopper=1 selects a rotating Slit
* lambda:   [AA]  Mean wavelength produced from the source 
* dlambda:  [AA]  Halfwidth of wavelenghts produced from the source
* deltay:   [m]   Position of centre of rotation vs. beam in slit case
* nu:       [Hz]  Chopper frequency
* phase:    [deg] Chopper phase
* ABSORBER: [1]   Flag to indicate if slab is B4C(=1) or perfect(=0)
* tz:       [m]   Thickness of B4C slab
*
* %L
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Test_DiskChoppers2(chopper=0,lambda=10, dlambda=9.9, deltay=0.19,dx=0.016, nu=10, phase=0, int ABSORBER=0, tz=0.001)

DECLARE
%{
%}

INITIALIZE
%{
%}

TRACE

COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE

COMPONENT source_gen = Source_gen(
    flux_file="NULL", 
    xdiv_file="NULL", 
    ydiv_file="NULL", 
    radius=0.0, 
    dist=10, 
    focus_xw=dx*1.1, 
    focus_yh=0.12, 
    focus_aw=0, 
    focus_ah=0, 
    E0=0, 
    dE=0, 
    lambda0=lambda, 
    dlambda=dlambda, 
    I1=1, 
    yheight=0.1, 
    xwidth=0.1, 
    verbose=0, 
    T1=0, 
    flux_file_perAA=0, 
    flux_file_log=0, 
    Lmin=0, 
    Lmax=0, 
    Emin=0, 
    Emax=0, 
    T2=0, 
    I2=0, 
    T3=0, 
    I3=0, 
    zdepth=0, 
    target_index=+1)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0, 0, 0) RELATIVE PREVIOUS
EXTEND %{
  t=rand01();
%}
  
COMPONENT Arm0 = Arm()
  AT (0, 0, 10) RELATIVE source_gen

COMPONENT diskchopper0 = DiskChopper(
    theta_0=5, 
    radius=0.25, 
    yheight=0.12, 
    nu=nu, 
    nslit=1, 
    isfirst=0, phase=phase)
WHEN (chopper==0) AT (0, 0, 0) RELATIVE Arm0
GROUP Disks

COMPONENT Slab1 = PowderN(yheight=tz, radius=0.25, reflections="B4C.lau",p_transmit=0.8)
  WHEN (chopper==0 && ABSORBER) AT (0,-deltay,tz/2) RELATIVE Arm0
ROTATED (90,0,0) RELATIVE Arm0
GROUP Disks
EXTEND %{
  if (neutrontype==1) {
    SCATTER;
  }
%}

COMPONENT diskArm = Arm()
AT (0, 0, 0) RELATIVE Arm0
GROUP Disks
EXTEND %{
  if (INSTRUMENT_GETPAR(chopper)==1) {
    SCATTER;
  }
%}

COMPONENT SlitRotC = Arm()
AT (0, -deltay, 0) RELATIVE PREVIOUS
  
COMPONENT R=Rotator(nu=nu, phase=phase, direction=3)
WHEN (chopper==1) AT (0,0,0) RELATIVE SlitRotC

COMPONENT SlitArm = Arm()
AT (0,deltay,0) RELATIVE R

COMPONENT Slit = Slit(yheight=0.12, xwidth=dx)
WHEN (chopper==1) AT (0,0,0) RELATIVE SlitArm
GROUP Slits

COMPONENT Slab2 = COPY(Slab1)
WHEN (chopper==1 && ABSORBER) AT (0,-deltay,tz/2) RELATIVE SlitArm
ROTATED (90,0,0) RELATIVE SlitArm
GROUP Slits
EXTEND %{
  if (neutrontype==1) {
    SCATTER;
  }
%}

COMPONENT slitArm = Arm()
AT (0, 0, 0) RELATIVE Arm0
GROUP Slits
EXTEND %{
  if (INSTRUMENT_GETPAR(chopper)==0) {
    SCATTER;
  }
%}
  
COMPONENT DR=Derotator(rotator="R")
WHEN (chopper==1) AT (0,0,0) RELATIVE R


COMPONENT Tofl = TOFLambda_monitor(
    tmin=0, 
    tmax=1e6,
    nt=1000,
    filename="TOFlambda", 
    xwidth=0.05, 
    yheight=0.13, 
    Lmin=lambda-dlambda, 
    Lmax=lambda+dlambda)
AT (0, 0, tz) RELATIVE diskArm


COMPONENT Tof = TOF_monitor(
    tmin=0, 
    tmax=1e6,
    nt=1000,
    filename="TOF", 
    xwidth=0.05, 
    yheight=0.13)
AT (0, 0, 0.001) RELATIVE PREVIOUS
  
COMPONENT psd_monitor = PSD_monitor(
    xwidth=1, 
    yheight=1)
AT (0, 0, 0.001) RELATIVE PREVIOUS


FINALLY
%{
%}

END