File: PreMonitor_nD.comp

package info (click to toggle)
mccode 3.5.19%2Bds5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, 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 (99 lines) | stat: -rw-r--r-- 2,815 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
/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright 1997-2002, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Component: PreMonitor_nD
*
* %Identification
* Written by: <a href="mailto:farhi@ill.fr">Emmanuel Farhi</a>
* Date: 01st Feb 2001.
* Origin: <a href="http://www.ill.fr">ILL (France)</a>
*
* Neutron parameters spatial cross-correlation monitor.
*
* %Description
* Neutron parameters are stored when entering in the PreMonitor.
* If this neutron then reaches the associated Monitor_nD, this latter
* component measures the previously stored parameters. This enables to study
* correlations between a given parameter in one place of the instrument
* and an other detection position in the instrument.
*
* The  neutron state is monitored at the previous component location.
*
* <b>EXAMPLES:</b>
* Here follows a Phase-Space correlation diagram detector
* (used for guides for instance)
*
*  MyPreMonitor = PreMonitor_nD(
*   monitor_comp = MyMonitor)
*
* (... for instance a Guide ...)
*
* MyMonitor = Monitor_nD(
*   xmin = -0.1, xmax = 0.1,
*   ymin = -0.1, ymax = 0.1,
*   options = "hdiv x, auto, use premonitor");
*
* %Parameters
* INPUT PARAMETERS:
*
* monitor_comp: [no quotes]  name of the associated Monitor_nD where the detection should take place
*
* CALCULATED PARAMETERS:
*
* %Link
* <a href="Monitor_nD.html">Monitor_nD</a>
*
* %End
*******************************************************************************/

DEFINE COMPONENT PreMonitor_nD
SETTING PARAMETERS (string monitor_comp)
/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */

/* Flag will be set to 1 automatically */
/* unset by user in Monitor_nD if required (with 'not') */
/* Monitor_nD with premonitor should check that a PreMonitor exists */
/* if Flag==0 in option parsing -> no pre monitor -> warning, normal monitor */

INITIALIZE
%{
  struct MonitornD_Variables *Vars = COMP_GETPAR3(Monitor_nD, monitor_comp, Vars);
  Vars->Flag_UsePreMonitor = 1;
  strncpy(Vars->UserName1, NAME_CURRENT_COMP, 64);
%}

TRACE
%{
    struct MonitornD_Variables *Vars = COMP_GETPAR3(Monitor_nD, monitor_comp, Vars);
    /* directly act on MonitornD_Variables pointer, do not need to update */
    if (Vars->Flag_UsePreMonitor == 1)
    {
/*        Vars->cp = p;
        Vars->cx = x;
        Vars->cvx = vx;
        Vars->csx = sx;
        Vars->cy = y;
        Vars->cvy = vy;
        Vars->csy = sy;
        Vars->cz = z;
        Vars->cvz = vz;
        Vars->csz = sz;
        Vars->ct = t; */
        SCATTER;
    }
%}

MCDISPLAY
%{
  /* A bit ugly; hard-coded dimensions. 0.1 m */

  line(0,0,0,0.1,0,0);
  line(0,0,0,0,0.1,0);
  line(0,0,0,0,0,0.1);
%}

END