File: ESS_mcpl2hist.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 (66 lines) | stat: -rw-r--r-- 2,046 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
/*******************************************************************************
* Instrument: ESS_mcpl2hist
*
* %I
* Written by: Peter Willendrup <pkwi@fysik.dtu.dk>
* Date: 2016-12-02
* Origin: ESS
* %INSTRUMENT_SITE: ESS
*
* Utility instrument that generates a set of histograms from an MCPL input file
*
* %D
* Utility instrument that generates a set of histograms from an MCPL input file.
* 
* Generates energy, wavelength, position, veloicty and time histograms via Monitor_nD.
*
* Assumes access to binary MCPL datasets in . named [sector][beamline].mcpl.gz, i.e. W8.mcpl.gz.
*
* %P
* sector:        [str]  Defines the 'sector' of your instrument position. Valid values are "N","S","E" and "W"
* beamline:      [1]    Defines the 'beamline number' of your instrument position. Valid values are 1..10 or 1..11 depending on sector
* filter:        [1]    Flag to define if the filtered or nonfiltered version of the MCPL file should be used.
* thres:         [1]    Weight threshold above which neutrons are absorbed
*
* %L
* <reference/HTML link>
* Benchmarking website available at <a href="http://ess_butterfly.mcstas.org">http://ess_butterfly.mcstas.org</a>
* %E
*******************************************************************************/
DEFINE INSTRUMENT ESS_mcpl2hist(string sector="N",int beamline=1,int filter=0,thres=0.003)

DECLARE
%{
  double WL;
  char MCPLfile[128];
%}

INITIALIZE
%{
  if (filter==0)
    sprintf(MCPLfile,"%s%i.mcpl.gz",sector,beamline);
  else
    sprintf(MCPLfile,"%s%i_filtered.mcpl.gz",sector,beamline);
  printf("MCPLfile is %s\n",MCPLfile);
%}

TRACE

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

COMPONENT vin = MCPL_input(filename=MCPLfile,verbose=1)
  AT(0,0,0) RELATIVE PREVIOUS
EXTEND %{
  SCATTER;
  p*=1.56e16;
  p/=1e5;
%}

  COMPONENT Histograms = Monitor_nD(xwidth=1,yheight=1,options="previous, multiple, omega bins=100, lambda bins=100, x bins=100, y bins=100, z bins=100, vx bins=100, vy bins=100, vz bins=100, t bins=100 auto")
  AT (0,0,0.01) RELATIVE PREVIOUS



END