/***************************************************************************
*         McStas instrument definition URL=http://www.mcstas.org
*
* Instrument: Test_Pol_MSF
*
* %Identification
* Written by: Peter Christiansen
* Date: July 2006
* Origin: RISOE
* %INSTRUMENT_SITE: Tests_polarization
*
* This instrument demonstrates how to use the Pol_constBfield
* component.
*
* %Description
* This instrument demonstrates how to use the component
* Pol_constBfield to make a Mezei Spin flipper.
*
* %Example: Test_Pol_MSF.instr Detector: pollambdaMonitor2z_I=0.136736
*
* %Parameters
*
* %Link
*
* %End
****************************************************************************/
DEFINE INSTRUMENT Test_Pol_MSF()

DECLARE
%{
%}

INITIALIZE
%{
%}

TRACE

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

COMPONENT source =
Source_simple(radius = 0.01, dist = 1.0, focus_xw = 0.1, focus_yh = 0.1, lambda0 = 5,
	      dlambda = 4.9, flux = 1)
     AT (0, 0, 0) RELATIVE Origin

COMPONENT polSetter =
Set_pol(px=1)
     AT (0, 0, 0.5) RELATIVE Origin

COMPONENT pollambdaMonitor1x =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=1, my=0, mz=0, filename="pollambdaMon1x.data")
     AT (0, 0, 0.7) RELATIVE Origin

COMPONENT pollambdaMonitor1y =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=0, my=1, mz=0, filename="pollambdaMon1y.data")
     AT (0, 0, 0.75) RELATIVE Origin

COMPONENT pollambdaMonitor1z =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=0, my=0, mz=1, filename="pollambdaMon1z.data")
     AT (0, 0, 0.8) RELATIVE Origin

COMPONENT armMSF = Arm()
     AT (0,0,1) RELATIVE Origin

COMPONENT msf =
Pol_constBfield(xwidth=0.08, yheight=0.08, zdepth=0.2, fliplambda=5.0)
     AT (0, 0, 0) RELATIVE armMSF

COMPONENT pollambdaMonitor2x =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=1, my=0, mz=0, filename="pollambdaMon2x.data")
     AT (0, 0, 0.3) RELATIVE armMSF

COMPONENT pollambdaMonitor2y =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=0, my=1, mz=0, filename="pollambdaMon2y.data")
     AT (0, 0, 0.3) RELATIVE armMSF

COMPONENT pollambdaMonitor2z =
PolLambda_monitor(xwidth=0.1, yheight=0.1,
		  nL=100, Lmin = 0.0, Lmax = 10.0, npol=21,
		  mx=0, my=0, mz=1, filename="pollambdaMon2z.data")
     AT (0, 0, 0.3) RELATIVE armMSF

COMPONENT mpollambdaMonitor2x =
MeanPolLambda_monitor(xwidth=0.1, yheight=0.1,
		      nL=100, Lmin = 0.0, Lmax = 10.0,
		      mx=1, my=0, mz=0, filename="mpollambdaMon2x.data")
     AT (0, 0, 0.3) RELATIVE armMSF

COMPONENT mpollambdaMonitor2y =
MeanPolLambda_monitor(xwidth=0.1, yheight=0.1,
		      nL=100, Lmin = 0.0, Lmax = 10.0,
		      mx=0, my=1, mz=0, filename="mpollambdaMon2y.data")
     AT (0, 0, 0.3) RELATIVE armMSF

COMPONENT mpollambdaMonitor2z =
MeanPolLambda_monitor(xwidth=0.1, yheight=0.1,
		      nL=100, Lmin = 0.0, Lmax = 10.0,
		      mx=0, my=0, mz=1, filename="mpollambdaMon2z.data")
     AT (0, 0, 0.3) RELATIVE armMSF

FINALLY
%{
%}
END
