/*******************************************************************************
* Instrument: Samples_Isotropic_Sqw.instr
*
* %Identification
* Written by: E. Farhi
* Date: Jan 2004
* Origin: ILL
* %INSTRUMENT_SITE: Tests_samples
*
* A test instrument for the S(q,w) sample
*
* %Description
* This instrument is a test instrument for the S(q,w) sample.
* It produces a tof-angle and angle-energy detectors and also exports the
* S(q,w) and S(q) data.
*
* %Example: lambda=3.4 Detector: M_theta_t_I=1.60949e-07
*
* %Parameters
* lambda: [Angs]     source energy
* sample_coh: [str]  name of coherent Sqw data file
* sample_inc: [str]  name of incoherent Sqw data file
*
* %Link
* The Isotropic_Sqw sample
* %End
*******************************************************************************/
DEFINE INSTRUMENT Samples_Isotropic_Sqw(lambda=3.4, string sample_coh="Rb_liq_coh.sqw", string sample_inc="Rb_liq_inc.sqw")

TRACE

COMPONENT Origin = Progress_bar(percent=5)
  AT (0,0,0) ABSOLUTE

COMPONENT Source=Source_gen(
        radius=0.01, focus_xw=0.01, focus_yh=0.02, dist=1.5, lambda0=lambda, dlambda=0.01*lambda, I1=1)
AT (0,0,0) RELATIVE Origin

COMPONENT PSD=Monitor_nD(xwidth=.011, yheight=.011, options="x, y, parallel", bins=110)
AT (0,0,0) RELATIVE PREVIOUS

/* sample position */
COMPONENT Sample_pos = Arm()
AT (0, 0, 1.5) RELATIVE Origin

COMPONENT Sample=Isotropic_Sqw(
  radius = 0.01, yheight = 0.055, p_interact=0.8,
  Sqw_coh=sample_coh, Sqw_inc=sample_inc
) AT (0, 0, 0) RELATIVE Sample_pos
EXTEND
%{
if (!SCATTERED) ABSORB;
%}

/* detectors */

COMPONENT Out = PSD_monitor_4PI(filename="out")
  AT (0,0,0) RELATIVE Sample_pos
  
COMPONENT M_theta_t = Monitor_nD(
 xwidth=2.5, yheight=0.2,
 options="time limits=[0.0017 0.0117], abs angle limits=[0 180], banana, parallel",
 bins=100)
AT (0,0,0) RELATIVE Sample_pos

COMPONENT M_aw = Monitor_nD(
 xwidth=2.5, yheight=0.4,
 options="abs angle limits=[0 180], energy limits=[0 35], banana, parallel",
 bins=100)
AT (0,0,0) RELATIVE Sample_pos

END
