94 lines
2.4 KiB
Plaintext
94 lines
2.4 KiB
Plaintext
/*******************************************************************************
|
|
*
|
|
* McStas, neutron ray-tracing package
|
|
* Copyright (C) 1997-2011, All rights reserved
|
|
* Risoe National Laboratory, Roskilde, Denmark
|
|
* Institut Laue Langevin, Grenoble, France
|
|
*
|
|
* Component: ScanningSlit
|
|
*
|
|
* %I
|
|
* Written by: Jochen Stahn, based on the Slip component by
|
|
* Kim Lefmann and Henrik M. Roennow
|
|
* Date: 15. 10. 2013
|
|
* Version: $Revision: 0.00 $
|
|
* Origin: PSI
|
|
* Release: McStas 1.12c
|
|
*
|
|
* moving rectangular slit with optional insignificance cut
|
|
*
|
|
* %D
|
|
* A simple rectangular slit, where the blades in x-direction move with time.
|
|
* No transmission around the slit is allowed.
|
|
* If cutting option is used, low-weight neutron rays are ABSORBED
|
|
*
|
|
* Example: FastSlit(height=0.1)
|
|
*
|
|
* %P
|
|
* INPUT PARAMETERS
|
|
*
|
|
* height: height of the opening in y, centered.
|
|
*
|
|
* Optional parameters:
|
|
* cut: Lower limit for allowed weight (1)
|
|
*
|
|
* %E
|
|
*******************************************************************************/
|
|
|
|
|
|
DEFINE COMPONENT ScanningSlit
|
|
DEFINITION PARAMETERS ()
|
|
SETTING PARAMETERS (xmin=0, xmax=0, ymin=0, ymax=0, height=0.1, dist=2.4, lmin=4, lmax=10, omeg=0, eps=1.25, reso=0.01, dthet=1.5, posi=33.7)
|
|
OUTPUT PARAMETERS ()
|
|
/* STATE PARAMETERS (x,y,z,vx,vy,vz,t,s1,s2,p) */
|
|
|
|
DECLARE
|
|
%{
|
|
double lact;
|
|
%}
|
|
|
|
|
|
INITIALIZE
|
|
%{
|
|
if (height > 0) { ymax=height/2; ymin=-ymax; }
|
|
lmax *= (1+reso/2) ;
|
|
lmin *= (1-reso/2) ;
|
|
eps *= PI/180 ;
|
|
omeg *= PI/180 ;
|
|
dthet *= PI/180;
|
|
%}
|
|
|
|
TRACE
|
|
%{
|
|
PROP_Z0;
|
|
lact = 3.956e3*t/posi ;
|
|
xmin = -dist * (1+reso/2)*( eps + 0.5*dthet - dthet*(lact-lmin)/(lmax-lmin) ) ;
|
|
xmax = -dist * (1-reso/2)*( eps + 0.5*dthet - dthet*(lact-lmin)/(lmax-lmin) ) ;
|
|
if ((x<xmin || x>xmax || y<ymin || y>ymax))
|
|
ABSORB;
|
|
else
|
|
SCATTER;
|
|
%}
|
|
|
|
MCDISPLAY
|
|
%{
|
|
magnify("xy");
|
|
double xw, yh;
|
|
xw = (xmax - xmin)/2.0;
|
|
yh = (ymax - ymin)/2.0;
|
|
multiline(3, xmin-xw, (double)ymax, 0.0,
|
|
(double)xmin, (double)ymax, 0.0,
|
|
(double)xmin, ymax+yh, 0.0);
|
|
multiline(3, xmax+xw, (double)ymax, 0.0,
|
|
(double)xmax, (double)ymax, 0.0,
|
|
(double)xmax, ymax+yh, 0.0);
|
|
multiline(3, xmin-xw, (double)ymin, 0.0,
|
|
(double)xmin, (double)ymin, 0.0,
|
|
(double)xmin, ymin-yh, 0.0);
|
|
multiline(3, xmax+xw, (double)ymin, 0.0,
|
|
(double)xmax, (double)ymin, 0.0,
|
|
(double)xmax, ymin-yh, 0.0);
|
|
%}
|
|
|
|
END
|