File: Monitor_4PI.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 (84 lines) | stat: -rw-r--r-- 1,555 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
/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright 1997-2002, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Component: Monitor_4PI
*
* %I
* Written by: Kim Lefmann and Kristian Nielsen
* Date: April 17, 1998
* Version: $Revision$
* Origin: Risoe
* Release: McStas 1.6
*
* Monitor that detects ALL non-absorbed neutrons.
*
* Example: Monitor_4PI()
*
* %D
* Counts ALL neutrons that propagate this far in the instrument, regardless
* of origin or direction. Mostly used for test purposes.
*
* %P
* INPUT PARAMETERS:
*
* (none)
*
* CALCULATED PARAMETERS:
*
* Nsum   : Number of neutrons hitting
* psum   : Total weight of neutrons hitting
* p2sum  : Second moment of neutron weights
*
* %E
*******************************************************************************/


DEFINE COMPONENT Monitor_4PI

SETTING PARAMETERS ()

/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */ 

DECLARE
  %{
    double Nsum;
    double psum;
    double p2sum;
  %}

INITIALIZE
  %{
    Nsum = 0;
    psum = 0;
    p2sum = 0;
  %}

TRACE
  %{
    double p2 = p*p;
    #pragma acc atomic
    Nsum = Nsum + 1;
    #pragma acc atomic
    psum = psum + p;
    #pragma acc atomic
    p2sum = p2sum + p2;
    SCATTER;
  %}

SAVE
  %{
    char full_name[1024];
    sprintf(full_name, "4PI monitor %s", NAME_CURRENT_COMP);
    DETECTOR_OUT_0D(full_name, Nsum, psum, p2sum);
  %}

MCDISPLAY
%{
  
%}

END