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
|
/*******************************************************************************
* Instrument: ESS_butterfly_MCPL_test
*
* %I
* Written by: Peter Willendrup <pkwi@fysik.dtu.dk>
* Date: 2017-04
* Origin: DTU
* %INSTRUMENT_SITE: Tools
*
* Flexible histogramming instrument file for processing MCPL input files using Monitor_nD
*
* %D
* Flexible histogramming instrument file for processing MCPL input files using Monitor_nD.
*
* Example1: Multiple 1D histograms of position, velocity, divergence, time and wavelength, use
* NDoptions=1 defines options="previous, multiple, auto, x, y, z, vx, vy, vz, hdiv, vdiv, tof, lambda"
*
* Example2: 2D x-y plot of beam cross section:
* NDoptions=2 defines options="previous, auto, x, y"
*
* Example3: 2D TOF-lambda plot of beam:
* NDoptions=3 defines options="previous, auto, tof, lambda"
*
* %P
* MCPLfile: [str] Defines the MCPL input file to process
* NDoptions: [int] Defines what Monitor_nD measures, see example list
*
* %L
* <reference/HTML link>
* MCPL website at <a href="https://mctools.github.io/mcpl/">https://mctools.github.io/mcpl/</a>
* %E
*******************************************************************************/
DEFINE INSTRUMENT MCPL2hist(string MCPLfile="my.mcpl.gz", int NDoptions=1)
DECLARE
%{
char monopts[128];
%}
INITIALIZE
%{
if (NDoptions == 1) {
sprintf(monopts,"previous, multiple, auto, x, y, z, vx, vy, vz, hdiv, vdiv, tof, lambda");
} else if (NDoptions == 2) {
sprintf(monopts,"previous, auto, x, y");
} else if (NDoptions == 3) {
sprintf(monopts,"previous, auto, tof, lambda");
} else {
printf("\n%s: Warning: NDoptions=%i is undefined. Your MonitorND will likely give no output.\n\n", NAME_INSTRUMENT, NDoptions);
}
printf("\n%s: Running with Monitor_nD options \"%s\"\n\n", NAME_INSTRUMENT, monopts);
%}
TRACE
COMPONENT Origin = Progress_bar()
AT (0, 0, 0) ABSOLUTE
/* read neutrons from an mcpl file*/
COMPONENT MCPLinput = MCPL_input(filename=MCPLfile,verbose=1)
AT(0,0,0) RELATIVE PREVIOUS
COMPONENT MonND1 = Monitor_nD(options=monopts)
AT (0,0,0) RELATIVE PREVIOUS
FINALLY
%{
%}
END
|