/*******************************************************************************
*         McStas instrument definition URL=http://mcstas.risoe.dk
*
* Instrument: ILL_H22
*
* %Identification
* Written by: FARHI Emmanuel (farhi@ill.fr)
* Date: April 7, 2004
* Origin:ILL
* %INSTRUMENT_SITE: ILL
*
* The H22 curved thermal guide at the ILL
*
* %Description
* The H22 curved thermal guide at the ILL feeding D1A/D1B, SALSA and VIVALDI
*
* %Example: m=2 mip=0 Detector: GuideOut_Phic_I=2.75e+09
*
* %Parameters
* m: [1]         m-value of whole guide coating. 0 absorbing, 1 for Ni, 1.2 for Ni58, 2-4 for SM
* lambda: [AA]   central wavelength
* dlambda: [AA]  wavelength half width. Use e.g. 0.8*lambda for white beam.
* mip: [1]       m-value of in-pile guide coating
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT ILL_H22(m=2, lambda=4, dlambda=3.9, mip=2)

/* The DECLARE section allows us to declare variables or  small      */
/* functions in C syntax. These may be used in the whole instrument. */
DECLARE
%{
  /* Thermal (H2x) source parameters */
  /* guide coating parameters */
  double gR0          = 1;
  double gQc          = 0.021;
  double gAlpha       = 4.07;
  double gW           = 1.0/300.0;
  /* gaps and Al windows parameters */
  double Al_thickness = 0.002;
  double gGap         = 0.001;
  /* guide curvatures */
  double gRh          = -27000; /* clockwise */
  /* guide section parameters (total length/number of elements) */
  double L_H22_3 =7.5/7,    Rh_H22_3 =0;
  double L_H22_4 =15/15,    Rh_H22_4 =0;
  double L_H22_5 =4.75 /5,  Rh_H22_5 =0;
  double L_H22_6 =60/60,    Rh_H22_6 =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
%{
  /* Element rotations = Element length / Curvature Radius * RAD2DEG */
  if (gRh) {
    Rh_H22_3  = L_H22_3 /gRh*RAD2DEG;
    Rh_H22_4  = L_H22_4 /gRh*RAD2DEG;
    Rh_H22_5  = L_H22_5 /gRh*RAD2DEG;
    Rh_H22_6  = L_H22_6 /gRh*RAD2DEG;
  }
  printf("Instrument: ILL_H22 (H22@ILL thermal guide).\n");
%}

/* Here comes the TRACE section, where the actual      */
/* instrument is defined as a sequence of components.  */
TRACE
/* Source description */
COMPONENT Origin = Progress_bar(percent=5)
  AT (0,0,0) ABSOLUTE

/* H22 Guide description */
COMPONENT Thermal = Source_gen(
  yheight  = 0.22,
  xwidth   = 0.14,
  dist     = 2.38+0.8,
  focus_xw = 0.038,
  focus_yh = 0.2,
  lambda0  = lambda,
  dlambda  = dlambda,
  T1=683.7,I1=0.5874e+13,T2=257.7,I2=2.5099e+13,T3=16.7 ,I3=1.0343e+12,
  verbose  = 1)
  AT (0, 0, 0) RELATIVE Origin

/* L=3.3 m in 2 elements. 'Pink Carter'.  starts at about 2.5 m from core center */
COMPONENT PinkCarter = Guide_gravity(
  w1=0.038, h1=0.2, w2=0.032, h2=0.2, l=0.8,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=mip, W=gW)
AT (0,0,2.38) RELATIVE Thermal
/* core to glass SM elements=3.182 m */
COMPONENT PinkCarterSM = Guide_gravity(
  w1=0.038, h1=0.2, w2=0.032, h2=0.2, l=2.5,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=mip, W=gW)
AT (0,0,0.8+gGap) RELATIVE PREVIOUS

/* Lead Shutter */
COMPONENT LeadShutter = Guide_gravity(
  w1=0.031, h1=0.2, w2=0.031, h2=0.2, l=0.228,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=m, W=gW)
AT (0,0,0.8+2.5+gGap) RELATIVE PinkCarter

/* ******************** swiming pool guide ******************** */

/* H22-3: L=7.5 m in 7 elements Rh=-14000 m. */

COMPONENT H22_3 = Arm()
AT (0,0,0.2281) RELATIVE PREVIOUS

COMPONENT H22_3_In = Al_window(thickness=Al_thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H22_3_1 = Guide_gravity(
  w1=0.03, h1=0.2, l=L_H22_3,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=m, W=gW)
AT (0,0,Al_thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_2 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_3 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_4 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_5 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_6 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_7 = COPY(PREVIOUS)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_3,0) RELATIVE PREVIOUS

COMPONENT H22_3_Out = Al_window(thickness=Al_thickness)
AT (0,0,L_H22_3+gGap) RELATIVE PREVIOUS

/* gap 0.148 m (VS) */

/* H22-4: L=15 m in 15 elements Rh=-27000 m. */

COMPONENT H22_4 = Arm()
AT (0,0,0.148) RELATIVE H22_3_Out

COMPONENT H22_4_In = Al_window(thickness=Al_thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H22_4_1 = Guide_gravity(
  w1=0.03, h1=0.2, l=L_H22_4,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=m, W=gW)
AT (0,0,Al_thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_2 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_3 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_4 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_5 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_6 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_7 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_8 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_9 = COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_10= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_11= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_12= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_13= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_14= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_15= COPY(PREVIOUS)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_4,0) RELATIVE PREVIOUS

COMPONENT H22_4_Out = Al_window(thickness=Al_thickness)
AT (0,0,L_H22_4+gGap) RELATIVE PREVIOUS

/* gap 0.03 m */

/* H22-5: L=4.75 m in 5 elements Rh=-27000 m. */

COMPONENT H22_5 = Arm()
AT (0,0,0.03) RELATIVE H22_4_Out

COMPONENT H22_5_In = Al_window(thickness=Al_thickness)
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT H22_5_1 = Guide_gravity(
  w1=0.03, h1=0.2, l=L_H22_5,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=m, W=gW)
AT (0,0,Al_thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_5,0) RELATIVE PREVIOUS

COMPONENT H22_5_2 = COPY(PREVIOUS)
AT (0,0,L_H22_5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_5,0) RELATIVE PREVIOUS

COMPONENT H22_5_3 = COPY(PREVIOUS)
AT (0,0,L_H22_5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_5,0) RELATIVE PREVIOUS

COMPONENT H22_5_4 = COPY(PREVIOUS)
AT (0,0,L_H22_5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_5,0) RELATIVE PREVIOUS

COMPONENT H22_5_5 = COPY(PREVIOUS)
AT (0,0,L_H22_5+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_5,0) RELATIVE PREVIOUS

COMPONENT H22_5_Out = Al_window(thickness=Al_thickness)
AT (0,0,L_H22_5+gGap) RELATIVE PREVIOUS

/* gap .130 m (OT1 H22) */

/* ******************** after the VTE ******************** */

/* H22-6: L=60 m in 60 elements Rh=-27000 m */

COMPONENT H22_6 = Arm()
AT (0,0,0.130) RELATIVE H22_5_Out

COMPONENT H22_6_In = Al_window(thickness=Al_thickness)
AT (0,0,0) RELATIVE PREVIOUS
/* H22-6 A */
COMPONENT H22_6_1 = Guide_gravity(
  w1=0.03, h1=0.2, l=L_H22_6,
  R0=gR0, Qc=gQc, alpha=gAlpha, m=m, W=gW)
AT (0,0,Al_thickness+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
/* H22-6 B */
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
/* H22-6 C */
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
/* H22-6 D */
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
/* H22-6 E */
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
/* H22-6 F */
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS
COMPONENT COPY(H22_6_1) = COPY(PREVIOUS)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS ROTATED (0,Rh_H22_6,0) RELATIVE PREVIOUS

COMPONENT H22_6_Out = Al_window(thickness=Al_thickness)
AT (0,0,L_H22_6+gGap) RELATIVE PREVIOUS

/* position of D1A/D1B */
COMPONENT GuideOut = Arm() AT (0,0,0.01) RELATIVE PREVIOUS

COMPONENT GuideOut_xy = Monitor_nD(
  xwidth=0.03, yheight=0.2, restore_neutron=1,
  options="x y, per cm2, slit")
AT (0,0,0.01) RELATIVE PREVIOUS

COMPONENT GuideOut_dxdy = Monitor_nD(
  xwidth=0.03, yheight=0.2, restore_neutron=1,
  options="dx dy, all auto, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT GuideOut_Phic = Monitor_nD(
  xwidth=0.03, yheight=0.2, restore_neutron=1,
  options="per cm2, capture, slit")
AT (0,0,0) RELATIVE PREVIOUS

COMPONENT GuideOut_L = Monitor_nD(
  xwidth=0.03, yheight=0.2, restore_neutron=1,
  options="lambda, limits=[1 21] bins=20, per cm2, slit")
AT (0,0,0) RELATIVE PREVIOUS

END
