File: Sapphire_Filter.comp

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 (88 lines) | stat: -rwxr-xr-x 2,818 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
/*******************************************************************************
*
* McStas, version 1.2 released February 2000
*         Maintained by Kristian Nielsen and Kim Lefmann,
*         Risoe National Laboratory, Roskilde, Denmark
*
* %IDENTIFICATION
*
* Written by: Jonas Okkels Birk (based upon Filteg_Graphite by Thomas C Hansen (2000))
* Date: 6 December 2006
* Origin: PSI
*
* Sapphire filter at 300K
*
* %DESCRIPTION
*
* This sapphire filter, defined by two identical rectangular opening apertures,
* is based upon an absorption function absorp=exp(L*A+C*(exp(-(B/L^2+D/L^4))))
* decribed by Freund (1983) Nucl. Instrum. Methods, A278, 379-401. The
* defaultvalues is for Sapphire at 300K as found by measurement by (Mildner &
* Lamaze (1998) J. Appl. Cryst. 31,835-840
* ( http://journals.iucr.org/j/issues/1998/06/00/hw0070/hw0070bdy.html#BB4)). It
* is possble to ajust the formular to other materials or temperatures by typing in
* other parameters.
* The transmission in sapphire is only lightly demependt on temperature, but
* The formular is only cheked at wavelenths between 0.5 and 14 AA (0.4 meV 0.3
* eV).
* The filter is for example used in the Eiger beamline at PSI to cut of high
* energies.
*
* %PARAMETERS
*
* INPUT PARAMETERS:
*
* xmin: [m]        Lower x bound
* xmax: [m]        Upper x bound
* ymin: [m]        Lower y bound
* ymax: [m]        Upper y bound
* len: [m]         Thickness of filter
* A: [m^-1 AA^-1]  
* B: [AA^2]        
* C: [m^-1]        
* D: [AA^4]        
*
* %LINKS
* %END
*******************************************************************************/

DEFINE COMPONENT Sapphire_Filter

SETTING PARAMETERS (xmin=-0.16, xmax=0.16, ymin=-0.16, ymax=0.16, len=0.1,A=0.8116,B=0.1618, C=21.24,D=0.1291)

/* STATE PARAMETERS (x,y,z,vx,vy,vz,t,s1,s2,p) */

TRACE
%{
  double L,L2,Filt_T;
  double dt;
  PROP_Z0;
  L = (2*PI/V2K)/sqrt(vx*vx + vy*vy + vz*vz);
    if (x<xmin || x>xmax || y<ymin || y>ymax) ABSORB;
    dt = len/vz;
    PROP_DT(dt);
    L2=L*L;
    Filt_T=(A*L+C*(1-exp(-B/L2-D/L2/L2)));
    Filt_T = exp(-Filt_T*len);
    p*=Filt_T;
%}

MCDISPLAY
%{
  
  multiline(5, (double)xmin, (double)ymin, 0.0,
               (double)xmax, (double)ymin, 0.0,
               (double)xmax, (double)ymax, 0.0,
               (double)xmin, (double)ymax, 0.0,
               (double)xmin, (double)ymin, 0.0);
  multiline(5, (double)xmin, (double)ymin, (double)len,
               (double)xmax, (double)ymin, (double)len,
               (double)xmax, (double)ymax, (double)len,
               (double)xmin, (double)ymax, (double)len,
               (double)xmin, (double)ymin, (double)len);
  line(xmin, ymin, 0.0, xmin, ymin, len);
  line(xmax, ymin, 0.0, xmax, ymin, len);
  line(xmin, ymax, 0.0, xmin, ymax, len);
  line(xmax, ymax, 0.0 , xmax, ymax, len);
%}
END