File: NBI_Lab_TOMO.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 (242 lines) | stat: -rw-r--r-- 5,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
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
/*******************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: NBI_Lab_TOMO (rename also the example and DEFINE lines below)
*
* %Identification
* Written by: Erik B Knudsen and M Thomsen 
* Date: March 3rd 2014
* Origin: Your institution
* Release: McXtrace 1.5
* Version: 0.1
* %INSTRUMENT_SITE: NBI
*
* Laboratory tomography setup at NBI
*
* %Description
* Consists simply of a Mo-source, a sample, an Al-filter and a detector, all in line with each other
* The sample is a chess-king off-shape. 
*
* %Example: NBI_Lab_TOMO.instr fname="spectrumU50_th5.dat" Omega=0 detw=0.2 deth=0.2 Detector: Detector_Si_I=3.9e+13
* %Example: NBI_Lab_TOMO.instr fname="spectrumU50_th5.dat" Detector: Detector_Si_I=9.87e+11
*
* %Parameters
* fname: [] filename which contains the emission spectrum for the source
* d_sample_det: [m] distance between the sample and the detector
* d_source_sample: [m] distance between source adn sample
* Omega: [deg] rotation angle of sample (around y-axis)
* detw: [m] Detector width
* deth: [m] Height of detector
* rx: [deg] Rotation of the sample around the X-axis
* ry: [deg] Rotation of the sample around the Y-axis
* rz: [deg] Rotation of the sample around the Z-axis
*
* %End
*******************************************************************************/

/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT NBI_Lab_TOMO(string fname="spectrumU50_th5.dat",d_sample_det=.790, d_source_sample=1.1450,Omega=0,detw=.0351,deth=.0334, rx=-80, ry=0, rz=0)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
	double II;
	double K;
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
	II=0;

  /*figure out which spectrum file to use*/
%}

/* 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 photon source !    */
/* Progress_bar is an Arm displaying simulation progress.               */
COMPONENT Origin = Progress_bar()
AT (0,0,0) ABSOLUTE

COMPONENT source=Source_pt(spectrum_file=fname,E0=1,
    dist=d_source_sample+d_sample_det,focus_xw=detw,focus_yh=deth, flux=1e6)
AT (0,0,0) ABSOLUTE

/*COMPONENT filter_Be_inverse=Filter(*/
/*    material_datafile="Beryllium_inverse.dat",xwidth=detw,yheight=deth,zdepth=400e-6)*/
/*AT(0,0,1e-3) RELATIVE PREVIOUS*/


COMPONENT emon0 = E_monitor(
    nE = 1000, filename = "emon0", xwidth = detw/8, yheight = detw/8,
    Emin = 0, Emax = 120, restore_xray = 1)
  AT (0, 0, 0.5e-3) RELATIVE PREVIOUS 

COMPONENT filter_Be=Filter(
    material_datafile="Be.txt",xwidth=detw,yheight=deth,zdepth=250e-6)
AT(0,0,1e-3) RELATIVE PREVIOUS 

COMPONENT filterAl=Filter(
    material_datafile="Al.txt",xwidth=detw,yheight=deth,zdepth=0.002)
AT(0,0,3e-1) RELATIVE PREVIOUS

COMPONENT emonef = E_monitor(
    xwidth=detw/8,yheight=detw/8,Emin=0,Emax=120,nE=1000,filename="emon0ef",restore_xray=1)
AT(0,0,1e-2) RELATIVE PREVIOUS


COMPONENT sample_mnt=Arm()
AT(0,0,d_source_sample) RELATIVE Origin
ROTATED (0,Omega,0) RELATIVE Origin
  
//chess king
COMPONENT king =Filter(
    material_datafile="Glass.dat", geometry="king.off",xwidth=1.5e-2,yheight=1.5e-2,zdepth=1.5e-2)
AT(0,0,0) RELATIVE sample_mnt
ROTATED (rx,ry,rz) RELATIVE sample_mnt

COMPONENT e_mon1 = E_monitor(
    filename="emon1",xwidth=detw/8,yheight=detw/8,Emin=0,Emax=120,nE=1000,restore_xray=1
)
AT(0,0,d_sample_det-15e-3) RELATIVE sample_mnt

COMPONENT filter_air=Filter(
    material_datafile="FilterAir_1mm.dat",xwidth=detw,yheight=deth,zdepth=1e-3*10)
AT(0,0,d_sample_det-20e-3+1e-3-0.2) RELATIVE sample_mnt

COMPONENT filter_Al=Filter(
    material_datafile="Al.txt",xwidth=detw,yheight=deth,zdepth=50e-6*100)
AT(0,0,1e-3+0.1) RELATIVE PREVIOUS



COMPONENT Detector_Si=Detector_pn(
    material_datafile="Si.txt", zdepth=1000e-6,  filename="detector_Si",xwidth=detw,yheight=deth,nx=204,ny=194, restore_xray=0)
AT(0,0,d_sample_det) RELATIVE sample_mnt


COMPONENT e_mon2 = E_monitor(
    filename="emon2",xwidth=detw/8,yheight=detw/8,Emin=0,Emax=120,nE=1000,restore_xray=1
)
AT(0,0,0.5e-3) 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