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
|
/*******************************************************************************
* Instrument: Unittest_JUMP_ITERATE
*
* %I
* Written by: Peter Willendrup
* Date: Oct 28th, 2021
* Origin: DTU
* %INSTRUMENT_SITE: Tests_grammar
*
* JUMP ITERATE unittest
*
* %D
* JUMP ITERATE unittest
*
* The instrument uses JUMP ITERATE to let each particle make n='jumps' returns
* to the monitor. The particles have unit weight and hence the intensity scales
* with the simulated statistics. (Use input parameter Ncount for setting the stats).
*
* %Example: Ncount=1000 jumps=10 Detector: PSD_I=10000
* %Example: Ncount=1000 jumps=20 Detector: PSD_I=20000
* %Example: Ncount=100000 jumps=10 Detector: PSD_I=1e6
*
* %P
* Ncount: [1] Specify statistics
* jumps: [1] Number of jumps
*
* %L
* <reference/HTML link>
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Unittest_JUMP_ITERATE(Ncount=1000, int jumps=10)
DECLARE
%{
%}
INITIALIZE
%{
mcset_ncount(Ncount);
%}
TRACE
COMPONENT Arm = Arm()
AT (0,0,0) ABSOLUTE
EXTEND %{
// position x in one of 100 bins
x = rand01()-0.5;
y = rand01()-0.5;
p = 1;
vz=1000;
%}
COMPONENT Return = Arm()
AT (0,0,0) ABSOLUTE
COMPONENT PSD = PSD_monitor(xwidth=2.0, yheight=2.0, filename="rngout", nx=100, ny=100)
AT (0,0,0.1) ABSOLUTE
COMPONENT Jmp = Arm()
AT (0,0,0.1) ABSOLUTE
JUMP Return ITERATE jumps
FINALLY
%{
%}
END
|