&run_setup
    lattice = "TPSII-HOA-BVB-2S4SH-Error_V5-RF-CX1CY1.new" ,
    p_central_mev = 3e3,
    use_beamline = RINGRF,
    default_order = 3,
    rootname= tpsii-hoa-bvb-2s4sh-error_v5-rf-cx1cy1_cor_temp,
    random_number_seed = 987654321,   
    magnets = %s.mag,
    parameters = %s.param,
    semaphore_file = %s.done
    losses = %s.lost
    centroid =%s.cen
&end


&run_control
    n_steps=1,         !! number of error seeds
    n_passes = 100   
&end


!&twiss_output 
! filename = "%s.twi", 
! statistics=1, 
! radiation_integrals=1,
! output_at_each_step=1, 
!&end

&error_control 
	clear_error_settings=1 
	error_log = %s.erl 
&end


!Misalignment errors on quadrupoles
&error_element name=Q*, element_type=KQUAD,type=gaussian, item=DX, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=Q*, element_type=KQUAD,type=gaussian, item=DY, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=Q*, element_type=KQUAD,type=gaussian, item=TILT, amplitude=100e-6, cutoff=2,bind=0 &end
!&error_element name=Q*, element_type=KQUAD, item=FSE, amplitude=1e-4, cutoff=2,bind=0 &end

! Misalignment errors on dipole
&error_element name=*, element_type=CSBEND, type=gaussian, item=DX, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=*, element_type=CSBEND, type=gaussian, item=DY, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=*, element_type=CSBEND, type=gaussian, item=TILT, amplitude=100e-6, cutoff=2,bind=0 &end
!&error_element name=*, element_type=CSBEND, item=FSE, amplitude=1e-4, cutoff=2 &end

! Misalignment errors on sextupole
&error_element name=*, element_type=KSEXT,type=gaussian, item=DX, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=*, element_type=KSEXT,type=gaussian, item=DY, amplitude=30e-6, cutoff=2,bind=0 &end
&error_element name=*, element_type=KSEXT,type=gaussian, item=TILT, amplitude=100e-6, cutoff=2,bind=0 &end
!&error_element name=*, element_type=KSEXT, item=FSE, amplitude=1e-4, cutoff=2 &end


&error_control 
	summarize_error_settings=1
&end



&correct
        mode = "orbit", method = "global",
        verbose = 1, 
        n_iterations = 20, 
        n_xy_cycles = 1,
        correction_fraction[0] = 0.5, 0.5, !this line could be removed
        !bpm_noise = 0e-6, 0e-6,
        !correction_accuracy = 1e-7, 1e-7
        trajectory_output = "%s.orb",
        corrector_output = "%s.cor",
        statistics = "%s.scor", 
        bpm_output = "%s.bpm",
       !closed_orbit_iteration_fraction = 1e-2,
        closed_orbit_iterations = 200,
        closed_orbit_accuracy = 1e-9,
        !closed_orbit_accuracy_requirement= 1e-6,
	!minimum_SV_ratio[0] = 2*1e-4
	use_response_from_computed_orbits = 0,
&end


&bunched_beam  &end

&track
  center_on_orbit=1 
&end











