File: PSI_Focus_shielding.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 (559 lines) | stat: -rw-r--r-- 19,768 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
/*******************************************************************************
* Instrument: PSI_Focus_shielding
*
* %Identification
* Written by: Rodion Kolevatov, IFE <rodion.kolevatov@ife.no>, derived from work by Uwe Filges, PSI
* Date: Jan 2004
* Origin: IFE
* %INSTRUMENT_SITE: PSI
*
* Special version of the FOCUS Spectrometer at PSI (Paul Scherrer Institute,Switzerland), adapted
* for illustration of the use of the "shielding-logger" components
*
* %Description
* This instrument is a model of the FOCUS Spectrometer at PSI, Villigen, CH, modified to illustrate
* the use of the "shielding-logger" components, as described in the publications <a href="https://doi.org/10.3233/JNR-190123">https://doi.org/10.3233/JNR-190123</a>, 
* <a href="https://doi.org/10.3233/JNR-180088">https://doi.org/10.3233/JNR-180088</a> and <a href="https://doi.org/10.1016/j.nima.2018.12.069">https://doi.org/10.1016/j.nima.2018.12.069</a>.
*
* An important note from the author:
* Please note that the included Shielding- and Dose- calculators will only give sensible for guides with 
* borosilicate glass substrate. If the substrate is, e.g. copper, the dose rates from neutrons transmitted 
* through the coating and captured in the substrate will overshoot the coating contribution significantly, 
* so that shielding has to be enforced by few tens of centimeters of concrete. 
*
* %Example: lambda=4.4 Detector: PSD_Fermi1_I=1.08177e+07
*
* %Parameters
* lambda: [Angs]    Central source wavelength
* dL:     [Angs]    Half-width of source wavelength distribution
* chopp_ratio: [1]  Chopper radio Fermi Chopper to Disk Chopper
* DET: [deg ]       Detector angle
*
* %Link See <a href="https://doi.org/10.3233/JNR-190123">https://doi.org/10.3233/JNR-190123</a>, 
* <a href="https://doi.org/10.3233/JNR-180088">https://doi.org/10.3233/JNR-180088</a> and <a href="https://doi.org/10.1016/j.nima.2018.12.069">https://doi.org/10.1016/j.nima.2018.12.069</a>.
* %End
*******************************************************************************/
DEFINE INSTRUMENT PSI_Focus_shielding(lambda=4.4, dL=4.0, chopp_ratio=1, DET=-69.9)

DECLARE
%{
 double lambda;
 double chopp_ratio;
 double DET;
 double PHM, TTM;
 double RV_2, RH_2;
 double FO_PHA;
 double DISC_SPEED, FERMI_SPEED;
 /* mono d-spacing */
 double monodd = 3.355;
 /* time constant [mus/A/m] */
 double c = 252.78;
 /* distance sample - detector */
 double dsd = 2.5;
 /* distance guide - monochromator */
 double dgm = 2.996;
 /* distance fermi-chopper - sample */
 double dfcs = 0.4997;
 /* distance disk chopper - monochromator */
 double ddcm = 2.944;
 /* distance  monochromator - fermi-chopper */
 double mfc = 1.002;
 /* distance  monochromator - sample */
 double dms = 1.4997;
 /* setting range of sources */
 double dL; // 0.7;
 double LMIN, LMAX;
 double EMIN, EMAX;
/********************/
//#define MaxRate 3.0   //dose rate requirement at the outer surface of the shielding
#define M1THICKNESS 1500.0
%}

INITIALIZE
%{

 /* setting theta and 2Theta */
 PHM = asin(lambda/2/monodd)*180/PI;
 TTM = 2*PHM;

 /* setting speed of Fermi chopper, Disk chopper */
 FERMI_SPEED=1.0e6/(PI*lambda*c*(1./tan(PHM*PI/180))*(dsd*pow((1),1.5)+dfcs)*(1.0-(dms/dgm)));
 DISC_SPEED = FERMI_SPEED/chopp_ratio;

 /* calculate the phase between Fermi and Disk chopper */
 FO_PHA = (c*lambda*(ddcm+mfc))/1e6;

 /* setting monochromator curvature */
 RV_2 = 2*dms*(sin(DEG2RAD*PHM));
 RH_2 = 2*dms/(sin(DEG2RAD*PHM));

 /* setting E and L monitors */
 LMIN = lambda - dL;
 LMAX = lambda + dL;
 EMIN = 81.81/(LMAX*LMAX);
 EMAX = 81.81/(LMIN*LMIN);
%}

TRACE

COMPONENT a1 = Progress_bar()
  AT (0,0,0) ABSOLUTE

/* values for guide side window RNR11 */
COMPONENT csource = Source_gen(
   yheight = 0.135, xwidth = 0.08, dist=1.77, focus_xw = 0.05, focus_yh = 0.12,
   lambda0 = lambda, dlambda = dL, T1= 296.16, I1=8.5E11,
   T2=40.68, I2=5.2E11)
AT (0,0,0) RELATIVE a1  ROTATED (0,0,0) RELATIVE a1

COMPONENT EndOfModerator = Arm()
AT (0,0,0) RELATIVE a1  ROTATED (0,0,0) RELATIVE a1

/* guide segment 1, m=2, 4.66 m */
COMPONENT guide1 = Guide_shieldinglogger(w1=0.05, h1=0.12, w2=0.05, h2=0.12,
                         l=4.66, R0=0.995, Qc=0.0217, alpha = 5.76,
                         m = 2.0, W = 0.0033)
    AT (0,0,1.5) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1


/*******  Start of scatter logger. Logging scatterings and absorption in the guide system. *********/
COMPONENT log_P_start=Shielding_logger()
AT (0,0,0) RELATIVE PREVIOUS
EXTEND
%{
#ifdef scatter_logger_stop
#undef scatter_logger_stop
#endif
#define scatter_logger_stop log_P_start
%}


/* guide segment 2, curved, m=2, 24.5 m */
COMPONENT guide2 = Guide_curved_shieldinglogger(
    w = 0.05, h = 0.12, r = 1445, R0a = 0.995, Qca = 0.0217,
    alphaa = 5.76, ma = 2, Wa = 0.0033, R0i = 0.995, Qci = 0.0217,
    alphai = 5.76, mi = 2, Wi = 0.0033, R0s = 0.995, Qcs = 0.0217,
    alphas = 5.76, ms = 2, Ws = 0.0033, l = 24.5)
   AT (0,0,6.16) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1

COMPONENT a11 = Arm()
   AT (0.2077,0,30.66) RELATIVE a1 ROTATED (0,0.97149748,0) RELATIVE a1


/* bunker wall, m=2, 3.0 m */
 COMPONENT bunker = Guide_shieldinglogger(w1=0.05, h1=.12, w2=0.05, h2=.12,
        l=3.0, R0=0.99, Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033)
   // AT (0,0,30.66) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
AT (0,0,0.0) RELATIVE a11 ROTATED (0,0,0) RELATIVE a11

/* guide segment 3, m=2, 32.95 m */
 COMPONENT guide3 = Guide_shieldinglogger(w1=0.05, h1=.12, w2=0.05, h2=.12,
        l=32.95, R0=0.99,Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033)
//    AT (0,0,33.66) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
    AT (0,0,3.00) RELATIVE a11 ROTATED (0,0,0) RELATIVE a11



COMPONENT EndOfGuide= Arm()
AT(0, 0, 35.9505) RELATIVE a11 ROTATED (0,0,0) RELATIVE a11

/*Stop of scatter logger. Record scatterings in what is between start and stop, that is, parabolic feeder. */
COMPONENT log_P_stop=Shielding_logger_stop(logger=log_P_start)
AT (0,0,0) RELATIVE PREVIOUS





/**IIIIIIIIIIIIIIIIIII ITERATOR SECTION. PROCESSING STORED EVENTS  IIIIIIIIIIIIIIII***/
/* Insert this into McStas instrument file to do the costs evaluation */
COMPONENT arm_iter_P1_start=Arm()
AT(0,0,0) RELATIVE EndOfModerator

COMPONENT iter_P1_start = Shielding_log_iterator_Ni_new()
AT (0,0,0) RELATIVE EndOfModerator //ABSOLUTE
EXTEND
%{
#ifdef scatter_iterator_stop
#undef scatter_iterator_stop
#endif
#define scatter_iterator_stop iter_P1_start
%}
JUMP arm_iter_P1_stop WHEN(optics_not_hit)

/*Monitoring the tracks stored by the scatter logger*/
/*Putting dummy arm to register all neutrons to ensure that monitors_nD with shape "previous" will process them */
COMPONENT arm_iter_P1_dummy=Arm ()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT mndP01=Monitor_nD (
restore_neutron=1,   zmin=0.0,
zmax=70.0,
bins=800, options="previous no slit  z ", filename="NiCapture.dat")
AT(0,0,0) RELATIVE EndOfModerator //RELATIVE source

COMPONENT arm_iter_P1_stop=Arm()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT iter_P1_stop  = Shielding_log_iterator_stop(iterator=iter_P1_start)
AT(0,0,0)  RELATIVE EndOfModerator

/*Moving again to the reference point of iterator start 
when there are still some tracks stored to perform iterations with,
checked by the function MC_GETPAR */
COMPONENT a11i = Arm()
AT (0,0,0) RELATIVE EndOfGuide 
JUMP arm_iter_P1_start  WHEN(MC_GETPAR(iter_P1_stop,loop))

/*IIIIIIIIIIIIIIIIIIII  END OF PROCESSING. END OF ITERATOR  SECTION IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/




/**IIIIIIIIIIIIIIIIIII ITERATOR SECTION2. PROCESSING STORED EVENTS  IIIIIIIIIIIIIIII***/
/* Insert this into McStas instrument file to do the costs evaluation */
COMPONENT arm_iter_P2_start=Arm()
AT(0,0,0) RELATIVE EndOfModerator

COMPONENT iter_P2_start = Shielding_log_iterator_Ti_new()
AT (0,0,0) RELATIVE EndOfModerator //ABSOLUTE
EXTEND
%{
#ifdef scatter_iterator_stop
#undef scatter_iterator_stop
#endif
#define scatter_iterator_stop iter_P2_start
%}
JUMP arm_iter_P2_stop WHEN(optics_not_hit)

/*Monitoring the tracks stored by the scatter logger*/
/*Putting dummy arm to register all neutrons to ensure that monitors_nD with shape "previous" will process them */
COMPONENT arm_iter_P2_dummy=Arm ()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT mndP02=Monitor_nD (
restore_neutron=1,   zmin=0.0,
zmax=70.0,
bins=800, options="previous no slit  z ", filename="TiCapture.dat")
AT(0,0,0) RELATIVE EndOfModerator //RELATIVE source

COMPONENT arm_iter_P2_stop=Arm()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT iter_P2_stop  = Shielding_log_iterator_stop(iterator=iter_P2_start)
AT(0,0,0)  RELATIVE EndOfModerator

/*Moving again to the reference point of iterator start 
when there are still some tracks stored to perform iterations with,
checked by the function MC_GETPAR */
COMPONENT a12i = Arm()
AT (0,0,0) RELATIVE EndOfGuide 
JUMP arm_iter_P2_start  WHEN(MC_GETPAR(iter_P2_stop,loop))

/*IIIIIIIIIIIIIIIIIIII  END OF PROCESSING. END OF ITERATOR2  SECTION IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/


/**IIIIIIIIIIIIIIIIIII ITERATOR SECTION3. PROCESSING STORED EVENTS  IIIIIIIIIIIIIIII***/
/* Insert this into McStas instrument file to do the costs evaluation */
COMPONENT arm_iter_P3_start=Arm()
AT(0,0,0) RELATIVE EndOfModerator

COMPONENT iter_P3_start = Shielding_log_iterator_total()
AT (0,0,0) RELATIVE EndOfModerator //ABSOLUTE
EXTEND
%{
#ifdef scatter_iterator_stop
#undef scatter_iterator_stop
#endif
#define scatter_iterator_stop iter_P3_start
%}
JUMP arm_iter_P3_stop WHEN(optics_not_hit)

/*Monitoring the tracks stored by the scatter logger*/
/*Putting dummy arm to register all neutrons to ensure that monitors_nD with shape "previous" will process them */
COMPONENT arm_iter_P3_dummy=Arm ()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT mndP03=Monitor_nD (
restore_neutron=1,   zmin=0.0,
zmax=70.0,
bins=800, options="previous no slit  z ", filename="TotalCapture.dat")
AT(0,0,0) RELATIVE EndOfModerator //RELATIVE source

COMPONENT arm_iter_P3_stop=Arm()
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT iter_P3_stop  = Shielding_log_iterator_stop(iterator=iter_P3_start, last=1)
AT(0,0,0)  RELATIVE EndOfModerator

/*Moving again to the reference point of iterator start 
when there are still some tracks stored to perform iterations with,
checked by the function MC_GETPAR */
COMPONENT a13i = Arm()
AT (0,0,0) RELATIVE EndOfGuide 
JUMP arm_iter_P3_start  WHEN(MC_GETPAR(iter_P3_stop,loop))

/*IIIIIIIIIIIIIIIIIIII  END OF PROCESSING. END OF ITERATOR3  SECTION IIIIIIIIIIIIIIIIIIIIIIIIIIIII*/

/* guide exit at 66.61 m - measured flux 2.53 10e8 cm-2 s-1 mA-1 */

COMPONENT lambdaGuideExit = L_monitor(
	xwidth = 0.05, yheight = 0.12,
	Lmin = LMIN, Lmax = LMAX, nL = 60,
	filename = "lambdaguide.dat")
//  AT(0, 0, 66.611) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
  AT(0, 0, 35.951) RELATIVE a11 ROTATED (0,0,0) RELATIVE a11

COMPONENT DivMonGuideExit = Divergence_monitor(
          nh=60, nv=60, filename="divguide.dat",
          xwidth = 0.05, yheight = 0.12,
          maxdiv_h=2, maxdiv_v=2)
 // AT (0, 0, 66.612) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
 AT (0, 0, 35.952) RELATIVE a11  ROTATED (0, 0, 0) RELATIVE a11

COMPONENT PSDGuideExit = PSD_monitor(
    xwidth = 0.05, yheight = 0.12,
    nx=60, ny=60, filename="psdguide.dat")
//  AT (0, 0, 66.613) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
  AT (0, 0, 35.953) RELATIVE a11  ROTATED (0, 0, 0) RELATIVE a11

/* Shutter position - distance neutron guide to FOCUS trumpet 0.06 m */

COMPONENT FOCUSguide = Guide_channeled_shieldinglogger(
     w1 = 0.05, h1 = 0.12,
     w2 = 0.05, h2 = 0.095,
     l = 2.95, R0 = 0.995, Qcx = 0.0217, Qcy = 0.0217,
     alphax = 5.76, alphay = 5.64, W = 0.0033,
     nslit = 1, d = 0.002, mx = 2.4, my = 3)
//  AT (0, 0, 66.67) RELATIVE a1 ROTATED (0, 0, 0) RELATIVE a1
  AT (0, 0, 36.01) RELATIVE a11 ROTATED (0, 0, 0) RELATIVE a11


/* distance guide exit to chopper center 0.054 m */

COMPONENT FirstChopper = DiskChopper(theta_0=0, abs_out=0, verbose=1,
				     radius = 0.70, yheight=0.70, xwidth = 0.07, nu = DISC_SPEED/2/PI, nslit = 2, delay = FO_PHA, isfirst = 1)
//  AT (0, 0, 69.674) RELATIVE a1
  AT (0, 0, 39.014) RELATIVE a11

COMPONENT  DISCTOF = Monitor_nD(
    bins = 30, filename = "DISC_TOF.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
//  AT (0, 0, 69.718) RELATIVE a11
  AT (0, 0, 39.058) RELATIVE a11

COMPONENT PSDmon1Chopper = PSD_monitor(
    xwidth = 0.1, yheight = 0.2,
    nx=60, ny=60, filename="psdchopper.dat")
//  AT (0, 0, 69.719) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
  AT (0, 0, 39.059) RELATIVE a11  ROTATED (0, 0, 0) RELATIVE a11

/* Be-filter optinal; distance chopper center to Be-Filter entry 0.06 m,
   Filter length 0.17 m */

/*
COMPONENT BeFilter = Filter(
    xmin = -0.035, xmax = 0.035, ymin = -0.06, ymax = 0.06,
    len = 0.17, T0 = 0.9, T1 = 0.1, Emin = 0.5, Emax = 20.0)
//  AT (0, 0, 69.717) RELATIVE a1
  AT (0, 0, 39.057) RELATIVE a1

*/

/* distance chopper center to vacuum tube entry 0.398 m */

/* vacuum tube part 1,  0.535 m */

COMPONENT VacuumTube1entry = Slit(radius = 0.085)
 // AT (0, 0, 70.072) RELATIVE a1
 AT (0, 0, 39.412) RELATIVE a11

COMPONENT VacuumTube1exit = Slit(radius = 0.085)
//  AT (0, 0, 70.607) RELATIVE a1
  AT (0, 0, 39.947) RELATIVE a11

/* vacuum tube part 2,  0.795 m */

COMPONENT VacuumTube2entry = Slit(radius = 0.1)
//  AT (0, 0, 70.607) RELATIVE a1
  AT (0, 0, 39.947) RELATIVE a11

COMPONENT VacuumTube2exit = Slit(radius = 0.1)
//  AT (0, 0, 71.402) RELATIVE a1
  AT (0, 0, 40.472) RELATIVE a11

/* vacuum tube part 3,  0.605 m */

COMPONENT VacuumTube3entry = Slit(radius = 0.1335)
//  AT (0, 0, 71.402) RELATIVE a1
  AT (0, 0, 40.472) RELATIVE a11

COMPONENT VacuumTube3exit = Slit(radius = 0.1335)
//  AT (0, 0, 72.007) RELATIVE a11
  AT (0, 0, 41.347) RELATIVE a11

/* distance vakuum tube exit to monochromator center 0.610 m */

COMPONENT PSDmonMono = PSD_monitor(
    xwidth = 0.1, yheight = 0.2,
    nx=60, ny=60, filename="psdmono.dat")
//  AT (0, 0, 72.4) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
  AT (0, 0, 41.74) RELATIVE a11  ROTATED (0, 0, 0) RELATIVE a11

COMPONENT  MONOTOF = Monitor_nD(
    bins = 30, filename = "MONO_TOF.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
//  AT (0, 0, 72.41) RELATIVE a1
  AT (0, 0, 41.75) RELATIVE a11

COMPONENT DivMonMono = Divergence_monitor(
          nh=60, nv=60, filename="divmono.dat",
          xwidth = 0.1, yheight = 0.2,
          maxdiv_h=3, maxdiv_v=3)
//  AT (0, 0, 72.42) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
  AT (0, 0, 41.76) RELATIVE a11  ROTATED (0, 0, 0) RELATIVE a11


COMPONENT focus_mono = Arm()
  // AT (0, 0, 72.617) RELATIVE a1 ROTATED (0, PHM, 0) RELATIVE a1
 AT (0, 0, 41.957) RELATIVE a11 ROTATED (0, PHM, 0) RELATIVE a11

/* PG002=3.355 AA */

SPLIT COMPONENT mono = Monochromator_2foc(
          zwidth = 0.019, yheight = 0.025, gap = 0.001,
          NH = 9, NV =  7,
          mosaich = 48, mosaicv = 48,
          r0 = 0.99,
          Q = 1.873,
          RV = RV_2, RH = RH_2)
  AT (0, 0, 0) RELATIVE focus_mono

COMPONENT a2 = Arm()
//  AT (0,0,0) RELATIVE focus_mono ROTATED (0, TTM, 0) RELATIVE a1
  AT (0,0,0) RELATIVE focus_mono ROTATED (0, TTM, 0) RELATIVE a11

COMPONENT  FERMITOF_before = Monitor_nD(
    bins = 30, filename = "FERMI_TOF_before.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
  AT (0, 0, 0.9) RELATIVE a2

COMPONENT lambdaFermi = L_monitor(
	xwidth=0.1, yheight=0.2,
	Lmin = LMIN, Lmax = LMAX, nL = 60,
	filename = "lambdafermi.dat")
  AT(0, 0, 0.901) RELATIVE a2

COMPONENT EMON_Fermi = E_monitor(
	xwidth=0.06, yheight=0.1,
	Emin = EMIN, Emax = EMAX, nE = 60,
	filename = "emon_fermi.dat")
  AT(0, 0, 0.9397) RELATIVE a2 ROTATED (0,0,0) RELATIVE a2

COMPONENT DivMonfermi1 = Divergence_monitor(
          nh=30, nv=30, filename="divfermi1.dat",
          xwidth=0.06, yheight=0.1,
          maxdiv_h=2, maxdiv_v=2)
  AT (0, 0, 0.9398) RELATIVE a2

COMPONENT PSD_Fermi1 = PSD_monitor(
    xwidth=0.06, yheight=0.11,
    nx=30, ny=30, filename="psdfermi1.dat")
  AT (0, 0, 0.9399) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2

COMPONENT FoChopper = FermiChopper(
    radius = 0.06, nu = -FERMI_SPEED, yheight = 0.11,
    w = 0.0005, nslit = 120, alpha = 0,
    Qc = 0 , m = 0, W = 0.0001, R0 = 0, length = 0.012)
  AT (0, 0, 1.002) RELATIVE a2

COMPONENT PSD_Fermi2 = PSD_monitor(
    xwidth=0.06, yheight=0.11,
    nx=30, ny=30, filename="psdfermi2.dat")
  AT (0, 0, 1.063) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2

COMPONENT DivMonfermi2 = Divergence_monitor(
          nh=30, nv=30, filename="divfermi2.dat",
          xwidth=0.06, yheight=0.1,
          maxdiv_h=2, maxdiv_v=2)
  AT (0, 0, 1.064) RELATIVE a2

COMPONENT  FERMITOF1 = Monitor_nD(
    bins = 30, filename = "FERMI_TOF1.dat.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
  AT (0, 0, 1.154) RELATIVE a2

COMPONENT SAMPLE_SLIT = Slit(
    xwidth=0.02, yheight=0.06)
  AT (0, 0, 1.155) RELATIVE a2

COMPONENT  FERMITOF2 = Monitor_nD(
    bins = 30, filename = "FERMI_TOF2.dat.dat", xmin = -0.05,
    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
  AT (0, 0, 1.2) RELATIVE a2

COMPONENT PSD_SAMPLE = PSD_monitor(
    xwidth=0.02, yheight=0.1,
    nx=30, ny=30, filename="psdsample.dat")
  AT (0, 0, 1.45) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2

COMPONENT DivMon_Sample = Divergence_monitor(
          nh=30, nv=30, filename="div2.dat",
          xwidth=0.01, yheight=0.06,
          maxdiv_h=3, maxdiv_v=3)
  AT (0, 0, 1.451) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2

COMPONENT EMON_SAMPLE = E_monitor(
	xwidth=0.01, yheight=0.06,
	Emin = EMIN, Emax = EMAX, nE = 60,
	filename = "emon_sample.dat")
  AT(0, 0, 1.452) RELATIVE a2 ROTATED (0,0,0) RELATIVE a2

/* sample position */

COMPONENT a3 = Arm()
  AT (0, 0, 1.5) RELATIVE a2

SPLIT COMPONENT Sample = V_sample(
    radius = 0.008, yheight = 0.055, focus_xw=0.336, focus_yh=0.4, pack=1,
    target_index=+3)
  AT (0, 0, 0) RELATIVE PREVIOUS

COMPONENT TOF_Det = Monitor_nD(
 xwidth=1.5, yheight=0.2,
 options="auto time, abs angle limits=[10 180], banana, parallel",
 bins=100)
AT(0, 0, 0) RELATIVE PREVIOUS

COMPONENT FoDet = Monitor_nD(
  xwidth = 0.336, yheight = 0.4,
  options="t auto file=TofDet.dat")
AT (0, 0, 2.5) RELATIVE a3 ROTATED (0,DET,0) RELATIVE a3

COMPONENT EMON_DET = E_monitor(
	xwidth=0.4, yheight=0.4,
	Emin = EMIN, Emax = EMAX, nE = 80, filename = "emon_det.dat")
  AT(0, 0, 2.501) RELATIVE a3 ROTATED (0,DET,0) RELATIVE a3

/*Calculating shielding requirements to assure 5 microSivert/hour at the outer shielding surface*/
/*Inner space in the shieling is 30 cm wide, gamma radiation and lost neutron information is taken from the files of the corresponding Monitor_nD output.*/
/*Number of bins in the monitors should match each other*/
COMPONENT SCalc=Shielding_calculator(MaxRate=5.0,Innerspace=0.3, NiCaptureFile="NiCapture.dat",TiCaptureFile="TiCapture.dat",TotalCaptureFile="TotalCapture.dat", OutputFile="Shielding.dat")
AT (0,0,0) RELATIVE PREVIOUS

/*Calculating dose rates at the surface of lateral shielding along the guide. 12 cm steel and 50 cm concrete.*/
/*Inner space in the shielding is assumed 30 cm wide, the guide is in the middle of the shielding housing.*/
COMPONENT DoseFe=Dose_calculator(Innerspace=0.3, Thickness=0.12, Material="Fe", NiCaptureFile="NiCapture.dat",TiCaptureFile="TiCapture.dat",TotalCaptureFile="TotalCapture.dat", OutputFile="DoseFe.dat")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT DoseConc=Dose_calculator(Innerspace=0.3, Thickness=0.5, Material="Concrete", NiCaptureFile="NiCapture.dat",TiCaptureFile="TiCapture.dat",TotalCaptureFile="TotalCapture.dat", OutputFile="DoseConc.dat")
AT (0,0,0) RELATIVE PREVIOUS


SAVE
%{
%}
FINALLY
%{
%}
END