1/*******************************************************************************
2*
3* Instrument: ISIS_IMAT_proto
4* %Identification
5* Written by: Genoveva Burca (Genoveva.Burca@stfc.ac.uk)
6* Date: October 2017
7* Version: 2017_01
8* Origin: ISIS
9* %INSTRUMENT_SITE: ISIS
10*
11* IMAT: McStas instrument file of the imaging and diffraction parts of the IMAT instrument.
12*
13* %Description
14*
15* McStas instrument for simulating the IMAT - imaging and diffraction
16* New McStas moderator file (G. Skoro, ISIS Facility) was added
17* \\ISIS\Shares\NeutronicsTeam\TS-2\HydroMod_Upgrade\McStas_TS2_HydroMod_Base_newVirtMod_350mm\Let_Base.mcstas
18* Components positions were extracted from IMAT final design (March 2016)
19* Choppers were not added to this model
20* Diffraction detectors are
21*
22* IMPORTANT NOTES:
23* 1. For reference use G. Burca et al., Modelling of an imaging beamline at the ISIS pulsed neutron source,
24* Journal of Instrumentation, 8 (2013), no 10, http://dx.doi.org/10.1088/1748-0221/8/10/P10001
25* 2. Results from calculations published in the previous paper were obtained using McStas ISIS_moderator component (Face="W5")
26*
27*
28* %Parameters
29* INPUT PARAMETERS:
30* l_min: [AA]   Low wavelength sampled.
31* l_max: [AA]   High wavelength sampled.
32* t_min: [t]    Low detector time limit.
33* t_max: [t]    High detector time limit.
34* theta: [deg]  Angle that the detector banks are set at.
35*
36* %Link
37* <a href="http://www.isis.stfc.ac.uk/instruments/imat">
38* %End
39
40*******************************************************************************/
41
42DEFINE INSTRUMENT ISIS_IMAT(src=0, l_min=1, l_max=10, t_min=0, t_max=0.2, theta=90)
43
44DECLARE
45%{
46	double e_min, e_max, SDD,SDI;
47%}
48
49INITIALIZE
50%{
51	e_min=81.799/l_max/l_max;
52	e_max=81.799/l_min/l_min;
53        /*sample-detector distance diffraction= 2 m.*/
54        SDD=2;
55%}
56
57TRACE
58
59COMPONENT Origin =Arm ()
60  AT (0,0,0) ABSOLUTE
61
62/* New McStas IMAT moderator component (L-H2)*/
63
64COMPONENT moderator=ViewModISIS(Face="TS2.imat", E0 = e_min, E1 = e_max,
65  modPosition=0, xw=0.004, yh = 0.01, dist = 56)
66AT (0.0, 0.0, 0.0) RELATIVE Origin
67
68/*define the source_position for mantid*/
69COMPONENT sourceMantid = Arm()
70AT(0,0,0) RELATIVE moderator
71
72/* Old version of McStas IMAT moderator L-H2/S-Ch4 (W5 port on TS-2) */
73/*COMPONENT moderator = ISIS_moderator(Face ="w5", Emin = e_min, Emax = e_max, dist = 1.688,
74    focus_xw = 0.11, focus_yh = 0.11, xwidth=0.11, yheight=0.11, CAngle = 0, SAC = 1, Lmin=l_min, Lmax=l_max)
75  AT (0.0, 0.0, 0.00) RELATIVE Origin*/
76
77COMPONENT lmon_s = L_monitor(xwidth=0.1, yheight=0.1, filename="lmon_s",Lmin=l_min, Lmax=l_max, nL=100)
78AT(0,0,1e-3) RELATIVE Origin
79
80COMPONENT shutter = Guide(
81    w1 = 0.10, h1 = 0.10, w2 = 0.10, h2 = 0.10, l = 1.948, m = 3)
82  AT (0.0, 0.0, 1.688) RELATIVE Origin
83COMPONENT lmon1 = COPY(lmon_s)(filename="lmon1")
84AT(0,0,1.948+1e-3) RELATIVE PREVIOUS
85
86COMPONENT guide1 = Guide(
87    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l = 7.8125, m = 3)
88  AT (0.0, 0.0, 3.7222) RELATIVE Origin
89
90/* 2nd piece of guide before the 1st double disk chopper */
91COMPONENT guide2 = Guide(
92    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l = 0.4866, m = 3)
93  AT (0.0, 0.0, 11.6797) RELATIVE Origin
94
95/* 3rd piece of guide before T0 chopper */
96COMPONENT guide3 = Guide(
97    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l = 0.4556, m = 3)
98  AT (0.0, 0.0, 12.2333) RELATIVE Origin
99
100COMPONENT guide4 = Guide(
101    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l =6.757, m = 3)
102  AT (0.0, 0.0, 13.0259) RELATIVE Origin
103
104/* 5th piece of guide before the 2nd double disk chopper */
105COMPONENT guide5 = Guide(
106    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l =0.52, m = 3)
107  AT (0.0, 0.0, 19.8459) RELATIVE Origin
108
109COMPONENT guide6 = Guide(
110    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l =0.428, m = 3)
111  AT (0.0, 0.0, 20.4339) RELATIVE Origin
112
113COMPONENT guide7 = Guide(
114    w1 = 0.095, h1 = 0.095, w2 = 0.095, h2 = 0.095, l =24.582, m = 3)
115  AT (0.0, 0.0, 21.0069) RELATIVE Origin
116
117/* Pinhole selector could be one of 5, 10, 20, 40 or 80 mm for imaging or fully open position (e.g. 100mm) for diffraction*/
118COMPONENT pinhole = Slit(radius = 0.05)
119  AT (0.0, 0.0, 46) RELATIVE Origin
120
121/* Five pairs of jaws for shaping and defining the beam size */
122
123COMPONENT slit1 = Slit(xwidth = 0.089882, yheight = 0.089882)
124  AT (0.0, 0.0, 1.55731) RELATIVE pinhole
125
126COMPONENT slit2 = Slit(xwidth = 0.08088, yheight = 0.08088)
127  AT (0.0, 0.0, 2.94097) RELATIVE pinhole
128
129COMPONENT slit3 = Slit(xwidth = 0.07168, yheight = 0.07168)
130  AT (0.0, 0.0, 4.3562) RELATIVE pinhole
131
132COMPONENT slit4 = Slit(xwidth = 0.06012, yheight = 0.06012)
133  AT (0.0, 0.0, 6.13597) RELATIVE pinhole
134
135COMPONENT slit5 = Slit(xwidth = 0.048549, yheight = 0.048549)
136  AT (0.0, 0.0, 7.91614) RELATIVE pinhole
137
138/* Slit 6 is used for diffraction measurements being possible to move it close to the sample */
139
140COMPONENT slit6 = Slit(xwidth = 0.004, yheight = 0.15)
141AT (0.0, 0.0, 55.996) RELATIVE Origin
142
143/* Sample placed at 10m after the pinhole */
144
145COMPONENT PSDpre = PSD_monitor(nx = 1024, ny = 1024, filename = "PSDpre.dat", xmin =-0.1, xmax =0.1, ymin = -0.1, ymax =0.1, restore_neutron=1)
146AT (0.0, 0.0, 10.00) RELATIVE pinhole
147
148COMPONENT sample = PowderN(reflections="Na2Ca3Al2F14.laz", radius = 0.002, yheight = 0.01,
149        Vc = 1079.1, sigma_abs = 2.9464e-3, sigma_inc = 3.4176, d_phi=60, format=Lazy)
150AT (0.0, 0.0, 56) RELATIVE Origin
151EXTEND
152%{
153    if(!SCATTERED) ABSORB;
154%}
155
156/*define mantid sample point*/
157COMPONENT sampleMantid = Arm()
158AT(0,0,0) RELATIVE sample
159
160
161/* Position sensitive detector for imaging setup; maximum field-of-view of 200 x 200 mm2 */
162COMPONENT PSDdet = PSD_monitor(nx = 1024, ny = 1024, filename = "PSD.dat", xmin =-0.1, xmax =0.1, ymin = -0.1, ymax =0.1, restore_neutron=1)
163AT (0.0, 0.0, 10.01) RELATIVE pinhole
164GROUP imaging
165
166COMPONENT catchall_PSDdet = Arm()
167AT(0,0,0) RELATIVE PREVIOUS
168GROUP imaging
169EXTEND
170%{
171    SCATTER;
172%}
173
174COMPONENT psd4pi = PSD_monitor_4PI(radius=0.5, restore_neutron=1, filename="psd4pi")
175AT(0,0,0) RELATIVE sample
176
177COMPONENT north_a = Arm()
178AT(0,0,0) RELATIVE sample
179ROTATED (0, theta, 0) RELATIVE sample
180
181COMPONENT south_a = Arm()
182AT(0,0,0) RELATIVE sample
183ROTATED (0,-theta,0) RELATIVE sample
184
185/* Diffraction setup; pixel size of 4mm width x 100 mm height */
186/*north bank - 2 flat detector modules*/
187COMPONENT nD_Mantid_1 = Monitor_nD(
188	xwidth=400e-3, yheight=100e-3, filename="north_1.dat",restore_neutron=1,
189	options="mantid square x limits=[-200e-3,200e-3] bins=100, y limits=[-50e-3,50e-3] bins=2 neutron pixel t, list all neutrons")
190AT(0,-(5e-3+50e-3),SDD) RELATIVE north_a
191GROUP detectors
192
193COMPONENT nD_Mantid_2 = COPY(nD_Mantid_1)(filename="north_2.dat",
194	options="mantid square x limits=[-200e-3,200e-3] bins=100, y limits=[-50e-3,50e-3] bins=2 neutron pixel min 200 t, list all neutrons")
195AT(0,+(5e-3+50e-3),SDD) RELATIVE north_a
196GROUP detectors
197
198/*south bank - 2 flat detector modules*/
199COMPONENT nD_Mantid_3 = Monitor_nD(
200	xwidth=400e-3, yheight=100e-3, filename="south_1.dat",restore_neutron=1,
201	options="mantid square x limits=[-200e-3,200e-3] bins=100, y limits=[-50e-3,50e-3] bins=2 neutron pixel min 400 t, list all neutrons")
202AT(0,-(5e-3+50e-3),SDD) RELATIVE south_a
203GROUP detectors
204
205COMPONENT nD_Mantid_4 = COPY(nD_Mantid_1)(filename="south_2.dat",
206	options="mantid square x limits=[-200e-3,200e-3] bins=100, y limits=[-50e-3,50e-3] bins=2 neutron pixel min 600 t, list all neutrons")
207AT(0,+(5e-3+50e-3),SDD) RELATIVE south_a
208GROUP detectors
209
210END
211