/*******************************************************************************
*         McStas instrument definition URL=http://mcstas.risoe.dk
*
* Instrument: ILL_H53
*
* %Identification
* Written by: FARHI Emmanuel (farhi@ill.fr)
* Date: April 7, 2004
* Origin:ILL
* Release: McStas 1.8
* Version: $Revision: 1.2 $
* %INSTRUMENT_SITE: ILL
*
* The H53 curved cold guide at the ILL
*
* %Description
* The H53 curved cold guide at the ILL feeding IN14, IN16, ADAM, EVA, PF1a
*
* Example: mcrun ILL_H53.instr lambda=10
*
* %Parameters
* m:  (1) m-value of whole guide coating
* lambda: (AA) central wavelength
* dl_percent: (%) percentage from 0 to 100 for d_lambda/lambda
*
* %Link
* The <a href="http://www.ill.fr/YellowBook/IN14">IN14 TAS</a> at the ILL
*
* %End
*******************************************************************************/

DEFINE INSTRUMENT ILL_H53(m=1.2, lambda=10, dl_percent=170)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
/* HCS (H5) source 'Measured' parameters */
double sT3=413.5,sI3=10.22e12;
double sT2=145.8,sI2=3.44e13;
double sT1=40.1 ,sI1=2.78e13;
double sLambda;
/* guide coating parameters */
double gR0          = 1;
double gQc          = 0.021;
double gAlpha       = 4.07;
double gW           = 1.0/300.0;
double gMvalue      = 1.2;
/* gaps and Al windows parameters */
double Al_Thickness = 0.002;
double gGap         = 0.001;
/* guide curvatures */
double gRh          = 4000; /* upwards */
/* guide section parameters (total length/number of elements) */
double gH =0.12;
double L_H53_COM =6.0  /4,  Rh_H53_COM =0;
double L_H53_C1  =3.5  /3,  Rh_H53_C1  =0;
double L_H53_C2  =9.5  /7,  Rh_H53_C2  =0;
double L_H53_C3  =3.0  /3,  Rh_H53_C3  =0;
double L_H53_P1  =6.0  /4, Rh_H53_P1  =0;
double L_H53_P2  =7.5  /5, Rh_H53_P2  =0;
double L_H53_P3  =7.5  /5, Rh_H53_P3  =0;
double L_H53_P4  =7.5  /5, Rh_H53_P4  =0;
double L_H53_P5  =5.5  /3, Rh_H53_P5  =0;
double L_H53_P6  =4.295/3, Rh_H53_P6  =0;
double L_H53_P7  =0.552/1, Rh_H53_P7  =0;

/* capture flux positions from moderator: 21.4    28.4    61.2 */

%}

/* The INITIALIZE section is executed when the simulation starts     */
/* (C code). You may use them as component parameter values.         */
INITIALIZE
%{
/* transfert instrument parameters for components */

if (m)  gMvalue = m;
if (lambda) sLambda = lambda;


/* Element rotations = Element length / Curvature Radius * RAD2DEG */
if (gRh) {
  Rh_H53_C2  = L_H53_C2 /gRh*RAD2DEG;
  Rh_H53_C3  = L_H53_C3 /gRh*RAD2DEG;
  Rh_H53_P1  = L_H53_P1 /gRh*RAD2DEG;
  Rh_H53_P2  = L_H53_P2 /gRh*RAD2DEG;
  Rh_H53_P3  = L_H53_P3 /gRh*RAD2DEG;
  Rh_H53_P4  = L_H53_P4 /gRh*RAD2DEG;
}

%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE

/* The Arm() class component defines reference points and orientations  */
/* in 3D space. Every component instance must have a unique name. Here, */
/* Origin is used. This Arm() component is set to define the origin of  */
/* our global coordinate system (AT (0,0,0) ABSOLUTE). It may be used   */
/* for further RELATIVE reference, and even replaced by a Progress_bar  */
/* component. Other useful keywords are : ROTATED EXTEND GROUP PREVIOUS */
/* Also think about adding a neutron source !                           */
COMPONENT Origin = Arm()
  AT (0,0,0) ABSOLUTE

COMPONENT HCS = Source_gen(
  radius   = 0.21,
  dist     = 2.155,
  xw       = 0.06,
  yh       = 0.12,
  Lmin     = sLambda*(1-dl_percent/100/2),
  Lmax     = sLambda*(1+dl_percent/100/2),
  T1       = sT1,
  I1       = sI1,
  T2       = sT2,
  I2       = sI2,
  T3       = sT3,
  I3       = sI3,
  verbose  = 1)
  AT (0, 0, 0) RELATIVE Origin

COMPONENT Al_window1 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.21) RELATIVE HCS

COMPONENT Al_window2 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.61) RELATIVE HCS

COMPONENT Al_window3 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.78) RELATIVE HCS

COMPONENT Al_window4 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.92) RELATIVE HCS

COMPONENT Al_window5 = Al_window(win_thick=Al_Thickness)
AT (0,0,2.15) RELATIVE HCS

/* H53-0: L=2.775 m in 1 element. no curvature */

COMPONENT NiGuide = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=2.775,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,2.155) RELATIVE HCS

COMPONENT Al_window6 = Al_window(win_thick=Al_Thickness)
AT (0,0,2.775+0.01) RELATIVE PREVIOUS

/* gap 25 mm */

COMPONENT Al_window7 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.02) RELATIVE PREVIOUS

COMPONENT H53_BOG1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=0.860,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,2.775+.025) RELATIVE NiGuide

/* this is the O.P. Gap 12 mm  */
COMPONENT H53_BOG2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=1.440,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,0.860+.012) RELATIVE PREVIOUS

COMPONENT H53_BOG3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=0.74,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,1.44+.012) RELATIVE PREVIOUS

COMPONENT Al_window8 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.74+0.01) RELATIVE PREVIOUS

/* gap 75 mm (V.S) */

COMPONENT Al_window9 = Al_window(win_thick=Al_Thickness)
AT (0,0,0.06) RELATIVE PREVIOUS

COMPONENT CarterVS1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=0.499,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,0.74+0.075) RELATIVE H53_BOG3

COMPONENT CarterVS2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=0.499,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,0.5) RELATIVE PREVIOUS

/* H53-COM: Carter COM: L=6 m in 6 elements R horiz=0 m */

COMPONENT H53_COM = Arm()
AT (0,0,0.5+0.006) RELATIVE PREVIOUS

COMPONENT Mon_COM_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_COM_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_COM_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_COM_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_COM_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_COM_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_COM,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_COM,0) RELATIVE PREVIOUS

COMPONENT H53_COM_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_COM,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_COM+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_COM,0) RELATIVE PREVIOUS

COMPONENT H53_COM_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_COM,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_COM+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_COM,0) RELATIVE PREVIOUS

COMPONENT H53_COM_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_COM,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_COM+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_COM,0) RELATIVE PREVIOUS

COMPONENT H53_COM_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_COM+gGap) RELATIVE PREVIOUS

/* H53-C1: Carter C1 L=4 m in 3 elements Rh=0 m */

COMPONENT H53_C1 = Arm()
AT (0,0,Al_Thickness+0.006) RELATIVE PREVIOUS

COMPONENT Mon_C1_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C1_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C1_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C1_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C1_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C1_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C1,0) RELATIVE PREVIOUS

COMPONENT H53_C1_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C1+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C1,0) RELATIVE PREVIOUS

COMPONENT H53_C1_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C1+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C1,0) RELATIVE PREVIOUS

COMPONENT H53_C1_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_C1+gGap) RELATIVE PREVIOUS

/* IN14: gap 450 mm */

/* H53-4: L=7.973 m in 8 elements Rh=4000 m */

COMPONENT H53_C2 = Arm()
AT (0,0,0.450+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_C2_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C2_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C2_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C2_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C2_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C2_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_5 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_6 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_7 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C2,0) RELATIVE PREVIOUS

COMPONENT H53_C2_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_C2+gGap) RELATIVE PREVIOUS

/* gap 0.0095 m */

/* H53-C3: Carter Cloison C3 L=3 m in 3 elements Rh=4000 m */

COMPONENT H53_C3 = Arm()
AT (0,0,Al_Thickness+0.0095) RELATIVE PREVIOUS

COMPONENT Mon_C3_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C3_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C3_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_C3_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C3_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_C3_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C3,0) RELATIVE PREVIOUS

COMPONENT H53_C3_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C3,0) RELATIVE PREVIOUS

COMPONENT H53_C3_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_C3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_C3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_C3,0) RELATIVE PREVIOUS

COMPONENT H53_C3_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_C3+gGap) RELATIVE PREVIOUS

/* gap .368 m (VTE) */

/* ******************** VTE position. Coming in ILL22 ******************** */

/* H53-P1: Carter Poutre1 L=6 m in 4 elements Rh=4000 m */

COMPONENT H53_P1 = Arm()
AT (0,0,0.368+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P1_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P1_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P1_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P1_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P1_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P1_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P1,0) RELATIVE PREVIOUS

COMPONENT H53_P1_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P1+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P1,0) RELATIVE PREVIOUS

COMPONENT H53_P1_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P1+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P1,0) RELATIVE PREVIOUS

COMPONENT H53_P1_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P1,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P1+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P1,0) RELATIVE PREVIOUS

COMPONENT H53_P1_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P1+gGap) RELATIVE PREVIOUS

/* H53-P2: Carter Poutre2 L=7.5 m in 5 elements Rh=4000 m */

COMPONENT H53_P2 = Arm()
AT (0,0,0.006+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P2_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P2_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P2_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P2_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P2_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P2_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P2,0) RELATIVE PREVIOUS

COMPONENT H53_P2_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P2,0) RELATIVE PREVIOUS

COMPONENT H53_P2_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P2,0) RELATIVE PREVIOUS

COMPONENT H53_P2_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P2,0) RELATIVE PREVIOUS

COMPONENT H53_P2_5 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P2,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P2+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P2,0) RELATIVE PREVIOUS

COMPONENT H53_P2_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P2+gGap) RELATIVE PREVIOUS

/* H53-P3: Carter Poutre3 L=7.5 m in 5 elements Rh=4000 m */

COMPONENT H53_P3 = Arm()
AT (0,0,0.0075+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P3_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P3_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P3_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P3_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P3_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P3_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P3,0) RELATIVE PREVIOUS

COMPONENT H53_P3_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P3,0) RELATIVE PREVIOUS

COMPONENT H53_P3_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P3,0) RELATIVE PREVIOUS

COMPONENT H53_P3_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P3,0) RELATIVE PREVIOUS

COMPONENT H53_P3_5 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P3,0) RELATIVE PREVIOUS

COMPONENT H53_P3_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P3+gGap) RELATIVE PREVIOUS

/* H53-P4: Carter Poutre4 L=7.5 m in 5 elements Rh=4000 m */

COMPONENT H53_P4 = Arm()
AT (0,0,0.0075+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P4_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P4_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P4_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P4_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P4_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P4_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P4,0) RELATIVE PREVIOUS

COMPONENT H53_P4_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P4,0) RELATIVE PREVIOUS

COMPONENT H53_P4_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P4,0) RELATIVE PREVIOUS

COMPONENT H53_P4_4 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P4,0) RELATIVE PREVIOUS

COMPONENT H53_P4_5 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P4,0) RELATIVE PREVIOUS

COMPONENT H53_P4_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P4+gGap) RELATIVE PREVIOUS

/* End of H53. Begining of H53B *************************************** */

/* IN16 position. Gap .500 */

/* H53-P5: Carter Poutre5 L=5 m in 3 elements Rh=0 m */

COMPONENT H53_P5 = Arm()
AT (0,0,0.5+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P5_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P5_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P5_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P5_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P5_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P5_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P5,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P5,0) RELATIVE PREVIOUS

COMPONENT H53_P5_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P5,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P5,0) RELATIVE PREVIOUS

COMPONENT H53_P5_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P5,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P5,0) RELATIVE PREVIOUS

COMPONENT H53_P5_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P5+gGap) RELATIVE PREVIOUS

/* EVA position. Gap .200 */

/* H53-P6: Carter Poutre6 L=4.3 m in 3 elements Rh=0 m */

COMPONENT H53_P6 = Arm()
AT (0,0,0.2+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P6_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P6_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P6_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P6_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P6_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P6_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P6,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P6,0) RELATIVE PREVIOUS

COMPONENT H53_P6_2 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P6,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P6,0) RELATIVE PREVIOUS

COMPONENT H53_P6_3 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P6,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,L_H53_P6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P6,0) RELATIVE PREVIOUS

COMPONENT H53_P6_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P6+gGap) RELATIVE PREVIOUS

/* ADAM position. gap .524 */

/* H53-P6: Carter Poutre7 L=.552 m in 3 elements Rh=0 m */

COMPONENT H53_P7 = Arm()
AT (0,0,0.524+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P7_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P7_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P7_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P7_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P7_In = Al_window(win_thick=Al_Thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H53_P7_1 = Guide_gravity(
  w1=0.06, h1=0.12, w2=0.06, h2=0.12, l=L_H53_P7,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=gMvalue, W=gW)
AT (0,0,Al_Thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H53_P7,0) RELATIVE PREVIOUS

COMPONENT H53_P7_Out = Al_window(win_thick=Al_Thickness)
AT (0,0,L_H53_P7+gGap) RELATIVE PREVIOUS

/* PF1a position. gap .156 */

COMPONENT H53_P8 = Arm()
AT (0,0,0.156+Al_Thickness) RELATIVE PREVIOUS

COMPONENT Mon_P8_xy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P8_dxdy = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="dx dy, all auto, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P8_Phic = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="x y dx dy, all auto, parallel, per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT Mon_P8_L = Monitor_nD(
  xwidth=0.06, yheight=0.12,
  options="lambda, limits=[1 21] bins=20, parallel, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS


/* This section is executed when the simulation ends (C code). Other    */
/* optional sections are : SAVE                                         */
FINALLY
%{
%}
/* The END token marks the instrument definition end */
END

