DEFINE COMPONENT PSD_E_monitor DEFINITION PARAMETERS (nx=90, ny=90, nE=30, restore_neutron=0) SETTING PARAMETERS (string filename=0, xmin=-0.05, xmax=0.05, ymin=-0.05, ymax=0.05, xwidth=0, yheight=0, Emin=1.0, Emax=50.0) OUTPUT PARAMETERS (PSD_N, PSD_p, PSD_p2) /* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */ DECLARE %{ double PSD_N[nE][nx][ny]; double PSD_p[nE][nx][ny]; double PSD_p2[nE][nx][ny]; %} INITIALIZE %{ int i,j,h; if (xwidth > 0) { xmax = xwidth/2; xmin = -xmax; } if (yheight > 0) { ymax = yheight/2; ymin = -ymax; } if ((xmin >= xmax) || (ymin >= ymax)) { printf("PSD_E_monitor: %s: Null detection area !\n" "ERROR (xwidth,yheight,xmin,xmax,ymin,ymax). Exiting", NAME_CURRENT_COMP); exit(0); } for (i=0; ixmin && xymin && y= 0 && h < nE ) { i = floor((x - xmin)*nx/(xmax - xmin)); j = floor((y - ymin)*ny/(ymax - ymin)); PSD_N[h][i][j]++; PSD_p[h][i][j] += p; PSD_p2[h][i][j] += p*p; SCATTER; } } if (restore_neutron) { RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); } %} SAVE %{ int h; char newfilename[255]; for(h=0; h