% Emacs settings: -*-mode: latex; TeX-master: "manual.tex"; -*-

\section{TOF\_Res\_sample: A sample-like component for TOF resolution calculation}
\label{s:tof_res_sample}

%\component{TOF\_Res\_sample}{System}{$r_\textrm{i}$, $r_\textrm{o}$, $h$, $r_\textrm{focus}$, $x_\textrm{target}$, $y_\textrm{target}$, $z_\textrm{target}$, $t_0$, $\Delta t$ }{$x_w$, $y_h$, $z_t$, $x_\textrm{focus}$, $y_\textrm{focus}$, $a_\textrm{v, focus}$, $a_\textrm{h, focus}$, target index}{}
\mcdoccomp{misc/TOFRes_sample.parms}

The component \textbf{TOF\_Res\_sample} scatters neutron rays isotropically
in position within a specified angular range. 
As for \textbf{Res\_sample}, this component is meant
for computation of the resolution function, but in this case for one time bin in a
time-of-flight (TOF) instrument. The component selects uniformly the neutron 
energy so that neutron arrival time at the TOF detector lies within one time bin,
specified by $t_0$ and $\Delta t$.
For actual calculations of the resolution
function, \textbf{TOF\_Res\_sample} should be used
together with \textbf{Res\_monitor}, described in
section~\ref{s:res_monitor}.

The shape of \textbf{TOF\_Res\_sample} is either a hollow cylinder
or a rectangular box. 
The hollow cylinder shape is
specified with the inner and outer radius, $r_\textrm{i}$ and $r_\textrm{o}$,
respectively, and the height, $h$.
If these parameters are unspecified,
the shape is instead a box of dimensions $x_w$, $y_h$, and $z_t$.
%See figure~\ref{f:res_sample}.\par

The component only propagates neutron rays that are scattered; 
other rays are absorbed. 
As for \textbf{Res\_sample}, the scattering probability is proportional to the neutron
flight path length inside the sample.
The point of scattering in the sample is chosen uniformly
along the neutron flight path inside the sample, and the scattered
direction is chosen in a user-specified range,
either within a sphere of radius $r_\textrm{foc}$, within a rectangular
target with measures $(x_\textrm{focus}, y_\textrm{focus})$
or in the specified angular range. 
This target is positioned at the $x_{target}$, $y_{target}$, $z_{target}$ 
point in space, or using target\_index.

This component stores complete information about the scattering event in the
output parameter \textit{res\_struct}, see \textbf{Res\_Sample}. 
