/*******************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: test (rename also the example and DEFINE lines below)
*
* %Identification
* Written by: <a href="mailto:duc.le@stfc.ac.uk">Duc Le</a>
* Date: Feb 2015
* Origin: ISIS
* %INSTRUMENT_SITE:Tests_samples
*
* Test instrument for the Single_crystal_inelastic component.
*
* %Description
* Simple test instrument for Single_crystal_inelastic in Horace mode
*
* Example: mcrun Test_Single_crystal_inelastic.instr
*
* once your instrument is written and functional:
* - replace INSTRUMENT_SITE entry above with your Institution name as a single word
* - rename the instrument name after DEFINE INSTRUMENT below
* - update the parameter help in the following Parameters section
* - update the instrument description, and better add a usage example with a
*     sensible parameter set.
*
* %Parameters
* E:    [meV] Mean energy produced at the source
* DE:   [meV] Energy spread produced at the source
* HDIV: [deg] Horizontal divergence from the source
* VDIV: [deg] Vertical divergence from the source
* OM:   [deg] Sample orientation around y
* TH:   [deg] Sample orientation around x
* FI:   [deg] Sample orientation around z
* SQW:  [str] 4D Sqw input file
*
* %Link
* Duc Le (2015) - duc.le@stfc.ac.uk
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT Test_Single_crystal_inelastic(E=10, DE=0.1, HDIV=0.5, VDIV=0.5, OM=0, TH=0, FI=0, string SQW="example.sqw4")
DECLARE
%{
%}

INITIALIZE
%{
%}

TRACE

COMPONENT a1 = Progress_bar()
  AT (0,0,0) ABSOLUTE

COMPONENT source = Source_gen(
    radius = 0.0775, focus_xw = HDIV, focus_yh = VDIV,
    E0 = E, dE = DE, I1 = 1e10, verbose=1)
  AT (0,0,0) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1

COMPONENT sample = Single_crystal_inelastic(sqw = SQW,
     xwidth=0.1, yheight=0.1, zdepth=0.01, delta_d_d=2e-1, mosaic = 5)
  AT (0, 0, 1.00) RELATIVE a1 ROTATED (TH,OM,FI) RELATIVE a1

/*
COMPONENT monitor = PSDE_4PI(filename="det4pi.dat",radius=0.25,nx=360,ny=180,ne=250,Emin=0,Emax=E*2,restore_neutron=0)
  AT (0, 0, 1) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
*/
COMPONENT monitoE = E_4PI(filename="e4pi.dat",ne=200,Emin=0,Emax=E*2)
  AT (0, 0, 1.01) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1


END


