Hi all,<br><br>I've been working on a way to essentially visualize the gauge volume in a sample. I'll give a brief summary of my instrument and then the problems that I've found:<br><br>It's a simple 2-axis instrument, with such components as: a Source_Maxwell_3, a Monochromator_flat, a PowderN and a Monitor_nD. I've used a virtual_input/virtual_output to save neutron histories at the sample incident slit. I can then continue these histories through diffraction from the sample and to the detector.<br>
<br>In order to visualize the gauge volume, I thought I could do the following:<br><br>1) Use EXTEND and if(SCATTERED) in the sample component to save the x, y, z position of the scattering event in the sample and also create a flag if the neutron was scattered at the sample (example flag = 1 if SCATTERED, ELSE flag = 0)<br>
<br>2) Use EXTEND and if(flag==1 && SCATTERED) at the detector. Then printf the saved x, y, z positions of the scattering events in the sample from above. (here I am using printf for debugging, eventually I would like to use the DETECTOR OUT 3D(...) macro).<br>
<br>The problems that I'm having:<br><br>1) I cannot seem to find a variable(s) that define the location of the scattering event in the PowderN component. I have been using simple the global variables 'x' 'y' 'z', but I don't think this is working correctly.<br>
<br>2) The printf is outputting many more neutron x,y,z than actually hit the detector. My speculation is that the SCATTERED macro does not work in detectors?<br><br>3) A smaller problem. What I would like is the local x-y-z of the scattered neutron in the sample. To do this, I've tried using the POS_A_CURRENT_COMP, but I can't seem to isolate the x,y,z components of this vector. I've tried using POS_A_CURRENT_COMP.x to get the x-component, but this does not seem to work as I get the following error:<br>
<br>In function `mcraytrace':<br>87: error: structure has no member named `mcnlx'<br><br>Here is a sample of the EXTEND sections. ** indicates a comment that I've added for clarity:<br><br>COMPONENT sample = PowderN(<br>
reflections = "Ni.laz", format = Lazy, d_phi = 8,<br> radius = 0.006, yheight = 0.06, pack = 1, sigma_abs = 0,<br> sigma_inc = 0, Delta_d = 0, frac = 0, tfrac = 0, DW = 0,<br> concentric = 0, barns = 1)<br>
AT (0, 0, 0) RELATIVE sample_arm<br>EXTEND<br>%{<br>if(SCATTERED)<br> {<br>**here I'm trying to get the location of the scattering event (using the state parameters x, y, z) and then put that into the local coordinates of the sample using the POS_A_CURRENT_COMP *** <br>
xp = x - POS_A_CURRENT_COMP.x;<br> yp = y - POS_A_CURRENT_COMP.y;<br> zp = z - POS_A_CURRENT_COMP.z;<br> <br>**the flag is later used in the detector to indicate that the neutron was scattered from the sample**<br>
flag = 1;<br> }<br>else<br> {<br> flag = 0;<br> }<br>%}<br clear="all"><br>COMPONENT monitor = Monitor_nD(<br> yheight = 0.133, xwidth = 2.794,<br> options = "banana, theta limits=[88.75, 91.25], bins = 32")<br>
AT (0, 0, 0) RELATIVE sample_arm<br> ROTATED (0, 0, 0) RELATIVE origin<br>EXTEND<br>%{<br><br>**Here the xp, yp, zp from above should only be printed if the neutron was scattered from the sample and intersected the detector<br>
if(flag==1 && SCATTERED)<br> {<br> printf("%g,%g,%g\n", xp,yp,zp);<br> }<br>%}<br>-- <br>*************************************************<br>Aaron M. Percival<br>M.Sc. Candidate<br>Dept. of Physics, Engineering Physics & Astronomy<br>
Queen's University<br>Kingston, Ontario, Canada, K7L 3N6<br>Office: 613-533-6000 ext. 74789<br>Fax: 613-533-6463<br>*************************************************