File: Test_source_spectra.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 (102 lines) | stat: -rw-r--r-- 3,713 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
100
101
102
/*******************************************************************************
*         McXtrace instrument definition URL=http://www.mcxtrace.org
*
* Instrument: Test_source_spectra
*
* %Identification
* Written by: Erik B Knudsen (erkn@fysik.dtu.dk)
* Date: Aug. 10th, 2014
* Origin: DTU Physics
* Release: McXtrace 1.2
* Version: 1.0
* %INSTRUMENT_SITE: Tests_sources
*
* Test instrument for the Source_spectra component 
*
* %Description
* A unit test instrument for the Source component that can take input from a SPECTRA-simulation
* of an undulator/wiggler etc. and input it into McXtrace.
*
* %Example: Test_source_spectra.instr flag4d=0 E0=12.4 dE=0.001 stemx=sp8LU_x stemy=sp8LU_y Detector: psd2_I=1.42775e+11
* %Example: Test_source_spectra.instr flag4d=1 E0=12.4 dE=0.001 stem4d=sp8LU_xy Detector: psd2_I=3.53418e-06
*
*
* %Parameters
* E0: [keV]   Central wavelength for sampling
* dE: [keV]   Halfwidth of sampleing window (in energy)
* stemx: [ ]  Filename stem for the x-projection data files coming from SPECTRA.
* stemy: [ ]  Filename stem for the y-projection data files coming from SPECTRA
* stem4d: [ ] Filename stem for 4D-datafiles from SPECTRA.
* flag4d: [ ] If zero use projection datafiles, else use 4D.
*
* %End
*******************************************************************************/

/* Change name of instrument and input parameters with default values */
DEFINE INSTRUMENT Test_source_spectra(E0=12.5, dE=1,string stem4d="sp8LU_xy",flag4d=0, 
    string stemx="sp8LU_x", string stemy="sp8LU_y")

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

/* The Arm() class component defines reference points and orientations  */
/* in 3D space. Every component instance must have a unique name. Here, */
/* Origin is used. This Arm() component is set to define the origin of  */
/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used   */
/* for further RELATIVE reference, Other useful keywords are : ROTATED  */
/* EXTEND GROUP PREVIOUS. Also think about adding an xray source !    */
/* Progress_bar is an Arm displaying simulation progress.               */
COMPONENT origin = Progress_bar()
  AT (0,0,0) ABSOLUTE

COMPONENT ss= Source_spectra(
    spectra_stem_x=stemx,spectra_stem_y=stemy,flag4d=0,noinit=(flag4d!=0),
    E0=E0,dE=dE,Emin=6.2,Emax=18.6,nE=5,
    symmetricx=1,symmetricy=1, verbose=0)
WHEN (flag4d==0) AT(0,0,0) RELATIVE PREVIOUS

COMPONENT ss4d= Source_spectra(
    spectra_stem=stem4d,flag4d=1,noinit=(flag4d==0),
    E0=E0,dE=dE,Emin=6.2,Emax=18.6,nE=5,
    symmetricx=1,symmetricy=1, verbose=1)
WHEN (flag4d==1) AT(0,0,0) RELATIVE PREVIOUS

COMPONENT psd0 = PSD_monitor(
    filename="psd0",xwidth=1.4e-3,yheight=0.4e-3
)
AT(0,0,0.01) RELATIVE origin

COMPONENT emon0 = E_monitor(
    filename="emon0",xwidth=1.4e-3,nE=101,yheight=0.4e-3,Emin=E0-1.1*dE, Emax=E0+1.1*dE)
AT(0,0,0.01) RELATIVE origin

COMPONENT psd1 = PSD_monitor(
    filename="psd1",xwidth=1.4e-3, yheight=0.4e-3
)
AT(0,0,0.1) RELATIVE origin

COMPONENT psd2 = PSD_monitor(
    filename="psd2",xwidth=1.4e-3, yheight=0.4e-3
)
AT(0,0,1) RELATIVE origin
/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END