DEFINE INSTRUMENT GappedGuideField( double lambda=10.0, double dlambda=2.0, string fieldfile="fieldbox.dat") DECLARE %{ double sT1=216.8,sI1=1.24e+13; double sT2=33.9, sI2=1.02e+13; double sT3=16.7 ,sI3=3.0423e+12; %} INITIALIZE %{ %} TRACE COMPONENT Origin = Progress_bar() AT (0,0,0) ABSOLUTE COMPONENT VCS = Source_gen( yheight = 0.22, xwidth = 0.14, dist = 2.5, focus_xw = 0.03, focus_yh = 0.03, Lmin = lambda*(1-dlambda/2), Lmax = lambda*(1+dlambda/2), T1 = sT1, I1 = sI1, T2 = sT2, I2 = sI2, T3 = sT3, I3 = sI3, verbose = 1) AT (0,0,0) RELATIVE Origin COMPONENT SourceSlit = Slit( xwidth=0.03, yheight=0.03) AT (0,0,1e-3) RELATIVE VCS COMPONENT InitPolar = Set_pol( px = 0, py = 1, pz = 0) AT (0,0,1) RELATIVE VCS COMPONENT GuideField = Pol_Bfield( xwidth = 0.06, yheight = 0.06, zdepth = 1.0, filename = fieldfile, Bx = 0, By = 0, Bz = 0, fieldFunction=table_magnetic_field) AT(0,0,0.5) RELATIVE PREVIOUS COMPONENT GuideField_Stop = Pol_Bfield_stop( xwidth = 0.1, yheight = 0.1, zdepth=1.0) AT (0,0,0) RELATIVE GuideField COMPONENT AnalyzerOut = MeanPolLambda_monitor( xwidth = 0.03, yheight = 0.03, mx = 0, my = 1, mz = 0, Lmin = lambda*(1-dlambda/2), Lmax = lambda*(1+dlambda/2), filename="poly_out") AT (0,0,1) RELATIVE GuideField COMPONENT Detector = PSD_monitor( nx=101, ny=101, xwidth=0.1, yheight=0.1, filename="det") AT (0,0,0) RELATIVE PREVIOUS FINALLY %{ %} END