-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAXIV_Bloch.instr
659 lines (572 loc) · 22.2 KB
/
MAXIV_Bloch.instr
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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
/***************************************************
* Instrument: MAXIV_Bloch
*
* %I
* Written by: Kristian Aalling Soerensen and Philip Smith ([email protected])
* Date: June 2018
* Origin: DTU Physics, lyngby
* Release: McXtrace V.1.4
* Version: 1.7
* %INSTRUMENT_SITE: MAX IV synchrotron. Lund, Sverige.
*
*
* A simulation of the Bloch beamline dedicated to high resolution photoelectron spectroscopy.
*
*
* %D
* This is a simulation of the BLOCH beamline at the MAX IV synchrotron in Lund, Sweden.
*
*
*
* %P:
* E0 [keV] = The central energy to sample from source model.
* dE [keV] = Spectral width to sample from source model.
* SourceChoice [ ] = Choice of source. For easy simulation do Flat source [0],in nonzero, the undulator is used.
* undK [ ] = Undulator K parameter, overrides E0, only used if SourceChoice is non zero.
* lu [m] = magnetic period length of the undulator.
* Nper [ ] = Number of magnetic periods in the undulator.
* r_rho [l/mm] = Ruling density of the grating.
* cff [ ] = constant cff value for the grating.
* m [ ] = Diffraction order, used for monochromator angle
* b [mm] = Width of slits.
* d [mm] = Line spacing.
* N_slits [ ] = Number of slits.
* blazed [ ] = If nonzero, a blazed grating is used in the cPGM. If zero, a lamellar. Note a lamellar pr. default is used in the NIM mode.
* blazed_angle [deg] = Angle of blazed grating. Note. blazed has to be nonzero.
* yheight_ExSlit [m] = yheight of exit slit.
* Exitslit_yshift [m] = y shift of the exit slit.
* xwidth_ExSlit [m] = xwidth of exit slit.
* grating_mode [ ] = If [1] the NIM mode will be used. If [0] cPGM. Otherwise, optimum will be calculated.
* display [ ] = if nonzero, different output will be printed.
* %L
* Bloch_MAX IV description:
* https://www.maxiv.lu.se/accelerators-beamlines/beamlines/bloch/
* McXtrace component definition:
* http://www.mcxtrace.org
* Furhter reading:
* K.Soerensen and P.Smith, Simulation of the Bloch beamline at the MAX IV synchrotron in Lund
*
* %E
*
* %N
*
* %End
***************************************************/
DEFINE INSTRUMENT MAXIV_Bloch(
/**********************/
Wanted_energy=0.075,
SourceChoice=0,
E0=0.075,
dE=0.025,
undK=5.6,
Nper=187,
/*********************/
m=6,
cff=2.25,
b=0,
N_slits=0,
d=0,
r_rho=800,
blazed=1,
blazed_angle=2,
/*********************/
grating_mode=2,
xwidth_ExSlit=0.004,
yheight_ExSlit=0.0005,
Exitslit_yshift=0.0,
display=0,
perfectMirrors=0,
Error=0
/*********************/
)
/***************************************************
*
*The DECLARE section is used to define parameters or small functions than can be used within the entire instrument.
*
***************************************************/
DECLARE
%{
/* values for the undulator */
int h;
double E1st;
/*For monitor energies*/
double monitor_wl_min,monitor_wl_max, monitor_Emin, monitor_Emax;
/*Parameters for the slits*/
double slit_yshit;
/* For monochromtor, for motivation see (R. Sabkari: "ARPES beamline at MAX IV: Detailed optical design report", 2014) */
double A,B,C,D,E,F,G,X;
double mirror2_angle, angle_grating;
double grating_mode,Wanted_energy,m;
double MCAngleVariation;
/* Parameters for errors */
double Error,M2_theta_error,theta_PG1_error;
double M2_theta_error,theta_PG1_error,X_error,y_error ,pitch_error ,yaw_error ,roll_error ,X_error_PGM ,Y_error_PGM;
double Z_error_PGM, pitch_error_PGM ,yaw_error_PGM ,roll_error_PGM ,Z_error_exitSlit,Opening_error_exitslit;
/*distances, angles ect for optical element besides the monochromator:*/
double zm_mirror1,zm_mirror2,zm_mirror3,zm_mirror4,theta_mirror1,theta_mirror4,R0_M1,R0_M2,R0_M3,R0_M4,R0_PG,theta_NIM,zm_ExitSlit;
%}
/***************************************************
*
*The INITIALIZE section is used to calculate/define/run jobs once.
*You may use them as component parameter values.
*The INITIALIZE section is divided into several sub-sections. This is done for readability.
*
***************************************************/
INITIALIZE
%{
/*
Description of initialize section:
1) General values:
- distances of optical element, angles, constant reflectivities
- other
1) Error section.
2) Undulator section.
3) Distances in monochromator section.
4) Calculate wanted energy and corresponding grating order.
5) Calculating angles used in the monochromator as defined from input parameters.
6) Monitor definitions.
7) Error messages.
*/
#include <complex.h>
/***************************************************
1)
General values:
If Error=1, the error in accuracy will be implemented as a random error in the beamline.
The errors are found from R. Sankari.
These can easily be implemented.
***************************************************/
zm_mirror2=2;
R0_M2=1;
R0_PG=1;
zm_mirror1=14;
theta_mirror1=3;
R0_M1=1;
zm_mirror3=1;
R0_M3=1,
zm_mirror4=19;
theta_mirror4=3;
R0_M4=1;
R0_PG=1;
theta_NIM=75;
zm_ExitSlit=9;
/***************************************************
1)
Errors:
If Error=1, the error in accuracy will be implemented as a random error in the beamline.
The errors are found from R. Sankari.
These can easily be implemented.
***************************************************/
M2_theta_error=0;
theta_PG1_error=0;
X_error=0;
y_error=0;
pitch_error=0;
yaw_error =0;roll_error=0;
X_error_PGM =0;Y_error_PGM =0;Z_error_PGM=0;
pitch_error_PGM =0;yaw_error_PGM =0;roll_error_PGM =0;
Z_error_exitSlit=0;
Opening_error_exitslit=0;
if(Error)
{
M2_theta_error=rand01()*(0.01*(1/3600));
theta_PG1_error=rand01()*(0.02*(1/3600));
X_error = 5e-6*rand01();
y_error = 5e-6*rand01();
pitch_error =0.5e-6*rand01()*RAD2DEG;
yaw_error = 0.5e-6*rand01()*RAD2DEG;
roll_error = 5e-6*rand01()*RAD2DEG;
X_error_PGM = 1e-4*rand01();
Y_error_PGM = 1e-4*rand01();
Z_error_PGM = 1e-4*rand01();
pitch_error_PGM =2e-6*rand01()*RAD2DEG;
yaw_error_PGM = 2e-6*rand01()*RAD2DEG;
roll_error_PGM = 2e-6*rand01()*RAD2DEG;
Z_error_exitSlit = 1e-5*rand01();
Opening_error_exitslit = 1e-6*rand01();
}
/***************************************************
2)
Calculate harmonic order(h) and fundamental harmonic(E1st) of the undulator
If SourceChoice!=0 and undulator will be used.
Information on the Bloch Elliptical undualtor can be found at:
- Find general info on the undulator at:
https://www.maxiv.lu.se/accelerators-beamlines/technology/insertion-devices/
- Find general info on the 1.5 GeV storage ring at:
https://www.maxiv.lu.se/accelerators-beamlines/accelerators/accelerator-documentation/1-5-gev-storage-ring/
- Find live info on the 1.5 storage ring at:
http://status.maxiv.lu.se/status/html/
***************************************************/
h=5;
if (E0>15.757){
h=7;
} else if (E0>20.253){
h=9;
} else if (E0>24.753){
h=11;
}else if (E0>29.254){
h=13;
}else if (E0>33.755){
h=15;
}
E1st=1.0018*E0/h;
/***************************************************
3)
Distances used in the monochromator:
***************************************************/
A = 0.064819;
B = 0.000125;
C = 0.043821;
D = 0.020;
E = 0.620;
F = 0.042;
G = 0.140;
X = 0.072746;
if (!theta_NIM){
theta_NIM = (M_PI_2-atan(F/X))*RAD2DEG;
}
/***************************************************
4)
Finding wanted energy if none is given.
Finding grating mode if none is given.
***************************************************/
if (!Wanted_energy){
/* If no wanted energy is given, it is assumed the wanted energy is E0. */
printf("Warning: No wanted energy is given. Default is E0=%f keV \n",E0);
Wanted_energy = E0;
}
if(grating_mode!=1 && grating_mode!=0){
// If no grating mode is given, the grating mode will be found using the incoming energy.
if(E0>=0.01 && E0<0.025){
grating_mode=1;
printf("Exception: Cannot set range [nan, nan]. No grating mode is given. The NIM mode will be used. \n");
}
else if (E0>=0.025){
printf("No grating mode is given. The cPGM mode will be used.\n");
grating_mode=0;
}
else {
printf("Warning:Energy below 1 keV (%f keV), NIM mode is used. \n", E0);
grating_mode=0;
}
}
/***************************************************
5)
Calculating the angle for the monochromator. For motivation, see Urpelainen, Samuli 2014.
***************************************************/
MCAngleVariation=5;
/*If grating_mode=0, the cPGM will be used.*/
if (cff && blazed && !grating_mode){
double cPGM_wl,cPGM_rho, cPGM_a,cPGM_b,cPGM_c,cPGM_beta,cPGM_alpha;
cPGM_wl = (12.398/Wanted_energy)*pow(10,-10);
cPGM_rho = 1/(r_rho*1000);
cPGM_a = (1-pow(cff,2));
cPGM_b = 2*pow(cff,2)*(m*cPGM_wl/cPGM_rho);
cPGM_c = pow(cff,2)-1-pow(cff,2)*((pow(m,2)*pow(cPGM_wl,2))/pow(cPGM_rho,2));
cPGM_beta = asin((-cPGM_b+sqrt(pow(cPGM_b,2)-4*cPGM_a*cPGM_c))/(2*cPGM_a));
cPGM_alpha =acos(cos(cPGM_beta)/cff);
cPGM_beta = cPGM_beta*RAD2DEG;
cPGM_alpha = cPGM_alpha*RAD2DEG;
angle_grating = (cPGM_beta+90);
mirror2_angle = ((90+angle_grating-cPGM_alpha))/2;
} else {
printf("Error. The cPGM is used for blazed gratings only.");
exit(-1);
}
if(grating_mode){
printf("sorry.. Havent calculated the angle for the lamellar grating yet. Sorry..");
angle_grating = 25;
}
printf("Input specs: \n Wanted energy: %f keV. \n Grating order: %f. \n Wanted wavelength: %f AA. \n",Wanted_energy,m,12.398/Wanted_energy);
printf("\nMonochromator specs: \n Angle of pre-mirror=%f deg. \n Angle of grating=%f deg. \n \n",mirror2_angle,angle_grating);
//The MC angle need to be "big enough".
MCAngleVariation=angle_grating*2;
/*
If wanted:
Dispersion = (sin(alpha)+sin(beta))/(wavelength*cos(beta));
Resolving_Power = (b/wavelength)*sin(alpha)+sin(beta));
*/
/***************************************************
6)
Monitor definitions:
***************************************************/
if(E0 && dE){
monitor_Emin = (E0-dE)/4;
monitor_Emax = (E0+dE)*4;
} else if(E0 && !dE){
monitor_Emin = (E0-3e-3)/4;
monitor_Emax = (E0+3e-2)*4;
} else if (!E0){
printf("\n Error: No Energy is given! \n");
exit(-1);
}
monitor_wl_min = 12.239/monitor_Emin;
monitor_wl_max = 12.239/monitor_Emax;
/***************************************************
7)
Error messages:
***************************************************/
if (angle_grating>30 || angle_grating<0)
{
printf("Error: Grating angle is out of bounds(%f DEG). Simulation ended.\n",angle_grating);
exit(-1);
}
if (mirror2_angle>21 || mirror2_angle<0)
{
printf("Error: M2 angle is out of bounds(%f DEG). Simulation ended.\n",mirror2_angle);
exit(-1);
}
%}
/***************************************************
*
*Trace section:
*The TRACE section is where the actual components are placed.
*
***************************************************/
TRACE
COMPONENT origin = Progress_bar()
AT (0, 1.3, 0) RELATIVE ABSOLUTE
/***************************************************
Sources:
1) When SourceChoice=0 the flat source is used.
2) When SourceChoice=1 the undulator is used.
***************************************************/
COMPONENT source_flat = Source_flat(
yheight=0.001,xwidth=0.001,dist=zm_mirror1,focus_xw=0.0001,focus_yh=0.0001,E0=E0,dE=dE)
WHEN (!SourceChoice)
AT (0, 0, 0) RELATIVE origin
COMPONENT dmu = Undulator(verbose=1,E0=E0,dE=dE,Ee=1.5,dEe=((6e-9)*(60e-12))/1.5,Ie=0.5,tbunch=43,K=undK,gap=14e-3,Nper=Nper,
lu=84e-3,sigey=1.3e-5,sigex=185e-5,sigepx=32e-6,sigepy=4.6e-6,focus_xw=1.1e-4,focus_yh=1.1e-4,dist=zm_mirror1,E1st=E1st)
WHEN (SourceChoice)
AT(0,0,0) RELATIVE origin
/***************************************************
Monitors After source:
***************************************************/
COMPONENT E_source = E_monitor(filename="E_source",xwidth=5e-3,yheight=5e-3,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 1) RELATIVE PREVIOUS
COMPONENT WL_source = L_monitor(filename="WL_source",xwidth=5e-3,yheight=5e-3,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT PSD_source = PSD_monitor(filename="PSD_source",restore_xray=1,nx = 271,ny = 271,xwidth=0.03,yheight=0.03)
AT (0, 0, 0.0) RELATIVE PREVIOUS
/***************************************************
M1: toroidial mirror
1) When perfectMirrors=0, a toroidal mirror is used:
- collimates vertically
- focuses horizontally
2) When perfectMirrors=1, a plane mirror is used.
***************************************************/
COMPONENT M1_arm= Arm()
AT(0,0,zm_mirror1) RELATIVE origin
ROTATED (0,0,90) RELATIVE origin
COMPONENT Mirror_toroid = Mirror_toroid(zdepth=0.340,xwidth=0.020,radius=246.9254,radius_o=246.9254,R0=R0_M1)
WHEN (!perfectMirrors)
AT (0, 0, 0) RELATIVE M1_arm
ROTATED (-theta_mirror1, 0, 0) RELATIVE M1_arm
COMPONENT M1_perfect_mirror = Mirror(zdepth=0.34,xwidth=0.02,R0=R0_M1)
WHEN (perfectMirrors)
AT (0, 0, 0) RELATIVE M1_arm
ROTATED (-theta_mirror1,0, 0) RELATIVE M1_arm
/***************************************************
Monitors After Toroidal Mirror:
***************************************************/
COMPONENT Toroidal_Monitor_arm1= Arm()
AT(0,0,zm_mirror1) RELATIVE origin
ROTATED (0,-2*theta_mirror1,0) RELATIVE origin
COMPONENT Toroidal_Monitor_arm2= Arm()
AT(0,0,1) RELATIVE Toroidal_Monitor_arm1
ROTATED (0,90,90) RELATIVE Toroidal_Monitor_arm1
COMPONENT E_M1 = E_monitor(filename="M1_E", xwidth=0.06,yheight=0.06,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (90,0,90) RELATIVE PREVIOUS
COMPONENT WL_M1 = L_monitor(filename="M1_wl",xwidth=0.06,yheight=0.06,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT PSD_M1 = PSD_monitor(filename="M1_psd",nx = 271,ny = 271,xwidth=0.06,yheight=0.06,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
/***************************************************
cPGM mode:
1) Arms are placed to define rotation axis.
2) If perfect mirrors are used, grating will be removed,
otherwise, blazed should be used.
***************************************************/
/*Rotation arms*/
COMPONENT cPGM_arm= Arm()
AT(0,0,zm_mirror1) RELATIVE origin
ROTATED (0,-2*theta_mirror1,0) RELATIVE origin
COMPONENT PG1_arm= Arm()
AT(0,F,2) RELATIVE cPGM_arm
ROTATED (0,0,0) RELATIVE cPGM_arm
COMPONENT M2_rotation_arm1= Arm()
AT(0,A-F,B) RELATIVE PG1_arm
ROTATED (-mirror2_angle+M2_theta_error,0,0) RELATIVE PG1_arm
COMPONENT M2_rotation_arm2= Arm()
AT(0,0,-D-(E/2)) RELATIVE M2_rotation_arm1
ROTATED (0,0,0) RELATIVE M2_rotation_arm1
COMPONENT M2_rotation_arm3= Arm()
AT(0,-C,0) RELATIVE M2_rotation_arm2
ROTATED (0,0,0) RELATIVE M2_rotation_arm2
/*Mirror and grating*/
COMPONENT mirror2 = Mirror(
zdepth=0.57,xwidth=0.015,R0=R0_M2)
WHEN (!grating_mode)
AT (0, 0, 0) RELATIVE M2_rotation_arm3
ROTATED (0,0, 0) RELATIVE M2_rotation_arm3
COMPONENT Blazed_grating = MultiPurpose_grating(
blazed=blazed,blazed_angle=blazed_angle,
zdepth=0.136,xwidth=0.015,R0=R0_PG,r_rho=r_rho,b=b,N_slits=N_slits,d=d,
display=display,MCangleVariation=MCAngleVariation)
WHEN (!grating_mode)
AT (0, 0, 0) RELATIVE PG1_arm
ROTATED (-angle_grating,0, 0) RELATIVE PG1_arm
/***************************************************
NIM mode:
1) Arm for the NIM mirror is placed
2) lamellar grating is used
There is no reason for a perfect mirror in the NIM case.
***************************************************/
COMPONENT NIM_arm1= Arm()
AT(0,-A,X) RELATIVE M2_rotation_arm1
ROTATED (0,0,0) RELATIVE M2_rotation_arm1
COMPONENT NIM = Mirror(
zdepth=0.02,xwidth=0.02,R0=0)
WHEN (grating_mode)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (-75,-2*theta_mirror1, 0) RELATIVE origin
COMPONENT Laminar_Grating = MultiPurpose_grating(
MCangleVariation=40,blazed=0,display=display,blazed_angle=0,zdepth=0.136,xwidth=0.015,R0=R0_PG,r_rho=r_rho,b=b,N_slits=N_slits,d=d)
WHEN (grating_mode)
AT (0, 0, 0) RELATIVE PG1_arm
ROTATED (-angle_grating,0, 0) RELATIVE PG1_arm
/***************************************************
Monitors After Monochromator
***************************************************/
COMPONENT Monochromator_Monitor_arm= Arm()
AT(0,0,0) RELATIVE PG1_arm
ROTATED (0,0,0) RELATIVE PG1_arm
COMPONENT E_PGM = E_monitor(filename="E_PGM", xwidth=0.03,yheight=0.03,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 0.5) RELATIVE PREVIOUS
ROTATED (0,0,90) RELATIVE Monochromator_Monitor_arm
COMPONENT WL_PGM = L_monitor(filename="WL_PGM",xwidth=0.03,yheight=0.03,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0,0,90) RELATIVE Monochromator_Monitor_arm
COMPONENT PSD_PGM = PSD_monitor(filename="PSD_PGM",nx = 40,ny = 100,xwidth=0.03,yheight=0.03,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0,0,90) RELATIVE Monochromator_Monitor_arm
/***************************************************
Mirror 3:
1) M3_Arm to point in M3 location:
-Even though the monochromator is rotating, the cylindrical mirror has to stay stationary relative to M2
2) cylindrical mirror
- Deflect horizontally
***************************************************/
COMPONENT M3_arm= Arm()
AT(0,F,3) RELATIVE cPGM_arm
ROTATED (0,theta_mirror1,0) RELATIVE cPGM_arm // angles for M1 and M3 should be the same to make a horizontal beam.
COMPONENT mirror3 = Mirror(
zdepth=0.2,xwidth=0.06,R0=1)
WHEN (perfectMirrors)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (0,0,90) RELATIVE PREVIOUS
/*Note. Mirror_curved is in the yz-plane.
Thus, to be rotated as the XZ Mirror, the curved mirror is rotated about Z,
ie. it is now laying in the XZ plane, */
COMPONENT M3 = Mirror_curved(
R0=1,
radius=5e8,
length=0.2,
width=0.06)
WHEN (!perfectMirrors)
AT (0, 0, 0) RELATIVE M3_arm
ROTATED (0, 0, 0) RELATIVE M3_arm
COMPONENT Exit_slit_arm0= Arm()
AT(0,0,0) RELATIVE mirror3
ROTATED (0,0,0) RELATIVE mirror3
COMPONENT M4_arm1= Arm()
AT(0,0,0) RELATIVE Exit_slit_arm0
ROTATED (theta_mirror1,0,0) RELATIVE Exit_slit_arm0
/***************************************************
Monitors After Mirror 3
***************************************************/
COMPONENT M3_Monitor_arm= Arm()
AT(0,0,0) RELATIVE mirror3
ROTATED (0,0,0) RELATIVE mirror3
COMPONENT M3_E_monitor = E_monitor(filename="M3_E_monitor", xwidth=0.04,yheight=0.03,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
ROTATED (90,0,90) RELATIVE PREVIOUS
COMPONENT M3_wl_monitor = L_monitor(filename="M3_wl_monitor",xwidth=0.04,yheight=0.03,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT M3_psd_monitor = PSD_monitor(filename="M3_psd_monitor",nx = 171,ny = 171,xwidth=0.04,yheight=0.03,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT ExT_arm1= Arm()
AT(0,0,0) RELATIVE Exit_slit_arm0
ROTATED (theta_mirror1,0,0) RELATIVE Exit_slit_arm0
/***************************************************
Monitors just before the exit slit
***************************************************/
COMPONENT PSD_EX_Before= PSD_monitor(filename="PSD_EX_Before",restore_xray=1,nx = 60,ny = 60,xwidth=xwidth_ExSlit*3,yheight=yheight_ExSlit*3)
AT (0, 0, zm_ExitSlit-0.2) RELATIVE ExT_arm1
ROTATED (0,0,0) RELATIVE origin
COMPONENT E_EX_Before = E_monitor(nE=50,filename="E_EX_Before",xwidth=xwidth_ExSlit*3,yheight=yheight_ExSlit*3,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, zm_ExitSlit-0.2) RELATIVE ExT_arm1
ROTATED (0,0,0) RELATIVE origin
COMPONENT WL_EX_Before = L_monitor(filename="WL_EX_Before",xwidth=xwidth_ExSlit*3,yheight=yheight_ExSlit*3,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, zm_ExitSlit-0.2) RELATIVE ExT_arm1
ROTATED (0,0,0) RELATIVE origin
/***************************************************
EXIT SLIT:
1)Exit slit placed in-front of mirror 4
2) based on input parameters, different photons will be let through, i.e different wavelengths.
***************************************************/
COMPONENT ExT_arm2= Arm()
AT(0,0,zm_ExitSlit) RELATIVE ExT_arm1
ROTATED (0,0,0) RELATIVE origin
COMPONENT Exitslit = Slit(
xwidth=xwidth_ExSlit,
yheight=yheight_ExSlit)
AT (0, -Exitslit_yshift,0) RELATIVE ExT_arm2
ROTATED (0,0,0) RELATIVE origin
/***************************************************
Monitors After the exit slit
***************************************************/
COMPONENT PSD_EX_After = PSD_monitor(filename="PSD_EX_After",restore_xray=1,nx = 60,ny = 60,xwidth=xwidth_ExSlit,yheight=yheight_ExSlit)
AT (0, 0, 0.1) RELATIVE Exitslit
COMPONENT E_EX_After = E_monitor(filename="E_EX_After",xwidth=xwidth_ExSlit,yheight=yheight_ExSlit,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 0.1) RELATIVE Exitslit
COMPONENT WL_EX_After = L_monitor(filename="WL_EX_After",xwidth=xwidth_ExSlit,yheight=yheight_ExSlit,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0.1) RELATIVE Exitslit
/***************************************************
Mirror 4
1) Placing an arm
2) Placing a plane mirror instead of a ellipsoidal mirror for simplicity.
- deflect horizontally.
***************************************************/
COMPONENT M4_arm2= Arm()
AT(0,0,zm_mirror4) RELATIVE ExT_arm1
ROTATED (0,0,0) RELATIVE ExT_arm1
COMPONENT mirror4 = Mirror(
zdepth=0.2,xwidth=0.06,R0=R0_M4)
AT (0, 0, 0) RELATIVE M4_arm2
ROTATED (theta_mirror1,0, 0) RELATIVE M4_arm2
/***************************************************
Monitors After Mirror 4
***************************************************/
COMPONENT M4_Monitor_Arm= Arm()
AT(0,0,0) RELATIVE mirror4
ROTATED (theta_mirror1,0,90) RELATIVE mirror4
COMPONENT PSD_M4_After = PSD_monitor(filename="PSD_M4_After",restore_xray=1,nx = 60,ny = 60,xwidth=0.06,yheight=0.06)
AT (0, 0, 0.2) RELATIVE PREVIOUS
ROTATED (0,0,90) RELATIVE PREVIOUS
COMPONENT E_M4_After = E_monitor(nE=50,filename="E_M4_After",xwidth=0.06,yheight=0.06,Emin=monitor_Emin,Emax=monitor_Emax,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT WL_M4_After = L_monitor(filename="WL_M4_After",xwidth=0.06,yheight=0.06,Lmin=monitor_wl_min,Lmax=monitor_wl_max,restore_xray=1)
AT (0, 0, 0) RELATIVE PREVIOUS
/***************************************************
Experiment hutch:
- sample station
- monitor
- detector
- sample
ect..
***************************************************/
FINALLY
%{
%}
END