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
|
/*******************************************************************************
* Instrument: Test_RNG_randtriangle
*
* %I
* Written by: Peter Willendrup
* Date: Oct 2nd, 2020
* Origin: DTU
* %INSTRUMENT_SITE: Tests_RNG
*
* Instrument to get basic test output from random number generator.
*
* %D
* Instrument to get basic test output from random number generator.
*
* The instrument generates 2 randon numbers pr. particle using randpm1(),
* encoded into the particle x and y coordinates.
*
* For a low statistics, one may e.g. check that setting the seed gives
* varied output or fixing the seed gives fixed outputĀ·
*
* %Example: Ncount=1000000 Detector: PSD_I=1.0
*
* %P
* Ncount: [1] Specify statistics
* seed: [1] Specify RNG seed
*
* %L
* <reference/HTML link>
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Test_RNG_randtriangle(Ncount=1000000,int seed=0)
DECLARE
%{
double p0;
#pragma acc declare create(p0)
%}
INITIALIZE
%{
mcset_ncount(Ncount);
if (seed) mcseed = seed;
p0=1.0/mcget_ncount();
#pragma acc update device(p0)
%}
TRACE
COMPONENT Arm = Arm()
AT (0,0,0) ABSOLUTE
EXTEND %{
// position x in one of 100 bins
x = 0.9*randtriangle();
y = 0.9*randtriangle();
p = p0;
vz=1000;
%}
COMPONENT PSD = PSD_monitor(xwidth=2.0, yheight=2.0, filename="rngout", nx=1000, ny=1000)
AT (0,0,0) ABSOLUTE
FINALLY
%{
%}
END
|