File: templateSANS_Mantid.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 (116 lines) | stat: -rw-r--r-- 3,446 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
/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright (C) 1997-2008, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Instrument: templateSANS
*
* %Identification
* Written by: <a href="mailto:kim.lefmann@risoe.dk">Kim Lefmann</a>
* Date: 19th Dec 2003.
* Origin: <a href="http://www.risoe.dk">Risoe</a>
* %INSTRUMENT_SITE: Mantid
*
* Test instrument for the Sans_spheres component. No guide / velocity selector
* etc. Will be developed further at later time.
*
* %Description
* Very simple test instrument for the Sans_spheres componen
*
* Modified to show a proof of concept method for storing a 'Mantid friendly' type of NeXus file.
*
* Needed steps:
* 1) Compile your instrument with NeXus library support
* 2) Generate an IDF using mcdisplay templateSANS_Mantid --format=Mantid -n0
* 3) mcrun templateSANS_Mantid -n1e6 --format=NeXus
*
* %Example: lambda=6 Detector: PSDrad_I=7.55196e+06
* %Example: lambda=6 --format=NeXus Detector: PSDrad_I=7.55196e+06
*
* %Parameters
* lambda: [AA]          Mean wavelength of neutrons
* dlambda: [AA]         Wavelength spread of neutrons
* r: [AA]               Radius of scattering hard spheres
* PHI: [1]              Particle volume fraction
* Delta_Rho: [fm/AA^3]  Excess scattering length density
* sigma_abs: [barns]    Absorption cross section at 2200 m/s
*
* %Link
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT templateSANS_Mantid(lambda=6, dlambda=0.05, r=150, PHI=1e-3, Delta_Rho=0.6, sigma_abs=0.0)
DEPENDENCY " @NEXUSFLAGS@ "

DECLARE %{
%}

INITIALIZE %{
%}

TRACE

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

COMPONENT arm = Arm()
  AT (0, 0, 0) ABSOLUTE

COMPONENT sourceMantid = Source_simple(
    radius = 0.02, dist = 3, focus_xw = 0.01, focus_yh = 0.01,
    lambda0 = lambda, dlambda = dlambda, flux = 1e16)
  AT (0, 0, 0) RELATIVE arm

COMPONENT coll1 = Slit(
    radius = 0.005)
  AT (0, 0, 3) RELATIVE arm

COMPONENT coll2 = Slit(
    radius = 0.005)
  AT (0, 0, 6) RELATIVE arm

COMPONENT LdetectorPRE = L_monitor(
    nL = 1000, filename = "Edet0.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3, Lmin = 5.5,
    Lmax = 6.5)
AT (0,0,0.05) RELATIVE coll2


SPLIT COMPONENT sampleMantid = Sans_spheres(
  R=r, Phi=PHI, Delta_rho=Delta_Rho, sigma_abs=sigma_abs,
  xwidth=0.01, yheight=0.01, zdepth=0.005)
   AT (0,0,0.2) RELATIVE coll2
EXTEND %{
        if (!SCATTERED) ABSORB;
%}


COMPONENT detector = PSD_monitor(
    nx = 128, ny = 128, filename = "PSD.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3)
  AT (0, 0, 3) RELATIVE sampleMantid

COMPONENT Ldetector = L_monitor(
    nL = 1000, filename = "Edet.dat", xmin = -0.3,
    xmax = 0.3, ymin = -0.3, ymax = 0.3, Lmin = 5.5,
    Lmax = 6.5)
  AT (0, 0, 3.01) RELATIVE sampleMantid


COMPONENT PSDrad = PSD_monitor_rad(
    filename = "psd2.dat", filename_av = "psd2_av.dat", rmax = 0.3)
  AT (0, 0, 3.02) RELATIVE sampleMantid

COMPONENT nD_Mantid_1 = Monitor_nD(
    options ="mantid square x limits=[-0.3 0.3] bins=128 y limits=[-0.3 0.3] bins=128, neutron pixel min=0 t, list all neutrons",
    xmin = -0.3,
    xmax = 0.3,
    ymin = -0.3,
    ymax = 0.3,
    restore_neutron = 1,
    filename = "bank01_events.dat")
  AT (0, 0, 3.2) RELATIVE sampleMantid

END