File: Test_Selectors.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 (67 lines) | stat: -rw-r--r-- 2,292 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
/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_Selectors
*
* %Identification
* Written by: E. Farhi [farhi@ill.fr]
* Date: Sept 28th, 2010
* Origin: ILL
* %INSTRUMENT_SITE: Tests_optics
*
* Cross comparison of velocity selector components
*
* %Description
* Cross comparison of Selector components, using McStas and
* contributed components. It shows that all implementations are equivalent.
*
* %Example: selector=1 Detector: VS_Mon_I=0.009
* %Example: selector=2 Detector: VS_Mon_I=0.0093
*
* %Parameters
* selector: [1]   Choice of the velocity selector to test, with
*                   1=V_selector
*                   2=Selector
* lambda: [Angs]  neutron wavelength selected by the velocity selector
* phi: [deg]      velocity selector twist angle
* d_vs: [m]       velocity selector rotating drum length
* %End
************************************************************************************************/
DEFINE INSTRUMENT Test_Selectors(int selector=1, lambda=4, phi=48.3, d_vs=0.25)

INITIALIZE
%{
  printf("\nTest_Selectors: ");
  switch (selector) {
  case 1:
    printf("Using V_selector\n"); break;
  case 2:
    printf("Using Selector\n"); break;
  }
%}

TRACE

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

COMPONENT Source = Source_simple(dist=1, radius=0.03, focus_xw=0.03, focus_yh=0.05,
                                 lambda0=lambda, dlambda=lambda*0.15)
  AT (0,0,0) ABSOLUTE

COMPONENT Src_Mon= Monitor_nD(xwidth=0.064, yheight=0.05, options="wavelength limits=[0 10] bins=401")
  AT (0,0,0.1) RELATIVE Source

COMPONENT VS1   = V_selector(xwidth=0.03, yheight=0.05, zdepth=0.30, radius=0.12, alpha=phi,
           length=d_vs, d=0.0004, nu=3956*phi*DEG2RAD/(2*PI*lambda*d_vs), nslit=72)
  WHEN (selector == 1)
  AT (0, 0, 1+0.3/2) RELATIVE Source

COMPONENT VS2   = Selector(xmin=-0.015,  xmax=0.015,  ymin=-0.025, ymax=0.025, length=d_vs,
           nslit=72,d=0.0004, radius=0.12, alpha=phi, nu=3956*phi*DEG2RAD/(2*PI*lambda*d_vs))
  WHEN (selector == 2)
  AT (0, 0, 1) RELATIVE Source

COMPONENT VS_Mon= Monitor_nD(xwidth=0.064, yheight=0.05, options="wavelength limits=[0 10] bins=401")
  AT (0,0,1+d_vs+0.1) RELATIVE Source
END