&input                                                                                                                  
!configuration - muons                                                                                                  
! <lat_file_name> :character string -  BMAD format lattice file                                                         
   lat_file_name = 'bmad_esquad_grid.'                                                                                  
! <nturns> :integer - Number of turns to track                                                                          
  nturns  =4                                                                                                            
!   nturns  =42	                                                                                                        
! The next several lines refer to the intial muon phase space distribution                                              
! <nmuons> :integer - Number of muons to track                                                                          
!nmuon_first = 100000                                                                                                   
nmuons = 1                                                                                                              
! <create_new_distribution> :logical - Create a new distribution                                                        
  create_new_distribution = T                                                                                           
! <seed>: integer - ! Random number seed. If seed =0 then random number set to system clock. If seed > 0 then it will be
  seed =0                                                                                                               
! <new_file> :character string - If you choose to create a new distribution it will be saved in new_file. If the name is
  new_file  = 'empty'                                                                                                   
! <muon_file> : If you choose to read an existing distribution, here is where the name is written.                      
!  muon_file = 'VDstop_DS_436_12000.dat'       ! read the phase space distribution off the target from this file. If bla
!  muon_file = 'particles_endm4m5_100.txt'                                                                              
! muon_file = 'particles_M4M5End_400_mod.txt'                                                                           
! <tdistr> : Time distribution of the muons, choices are "flat", "gaus", "e821", "e989"                                 
  tdistr    = "e989-P10"                                                                                                
! <tlength> : Width in time of distribution : (doesn't apply to tdistr="e821")                                          
  tlength   = 120.e-9                                                                                                   
! <tsigma> : standard deviation (width) of time distribution if it is gaussian, (sigma for tdistr="gaus", doesn't apply 
  tsigma    =  70.e-9                                                                                                   
! <pzdistr> : momentum distribution: "flat", "gaus"                                                                     
  pzdistr   = "gaus"                                                                                                    
                                                                                                                        
! <pz> : cutoff of longitudinal momentum distribution, (fractional energy offset with respect to reference)             
  pz        = 0.01                                                                                                      
! <pzsigma> : sigma for pzdistr="gaus"                                                                                  
  pzsigma   = 0.026                                                                                                     
! <epsdistr> : emittance distribution at production target: "delta", "flat", "gaus"                                     
  epsdistr  = "gaus"                                                                                                    
! <epsx> : horizontal emittance at inflector assuming no losses in injection channel (m-rad)                            
  epsx      = 16.6e-6                                                                                                   
!    epsx      = 33.2e-6                                                                                                
! <epsy> : vertical emittance at inflector assuming no losses in injection channel (m-rad)                              
  epsy      = 16.6e-6                                                                                                   
!    epsy      = 33.2e-6                                                                                                
                                                                                                                        
! <twiss> :12-real - betax, betay, alphax, alphay, etax, etapx, etay, etapy, phix, phiy, gammax, gammay at inflector   ,
  twiss     = 2.0, 10.0, 0., 0.0, 0.0, 0., 0., 0., 0.7, 0.7, 0., 0.                                                     
! <twiss_ref> : Reference point within inflector for twiss parameters specified in previous line. 'end' = at inflector e
  twiss_ref = 'end'                                                                                                     
!<start_tracking_at_inflector_exit>: logical - if true then start tracking the distribution at the inflector exit, if fa
  start_tracking_at_inflector_exit = T                                                                                  
!<twiss_file>: logical - if true, write twiss parameters every cm to "twiss_file.dat", and write transfer matrices for a
  twiss_file = F                                        ! true => write twiss parameters every cm to "twiss_file.dat"   
!<ring_twiss>: character - if <ring_twiss> = 'open' then use input twiss parameters as starting point for propagation ar
!                          if <ring_twiss> = 'closed' then use closed ring twiss parameters as starting point for propag
 ring_twiss = 'closed'                                                                                                  
! <inf_aperture> :character string - inflector aperture: "none", "rect" (rectangular), "e821"('D' shaped aperture of 821
  inf_aperture = "e821"                                                                                                 
! <inflector_width> :real - defines offset of axis of inflector from magic radius. If inflector_width = 0.009, central a
  inflector_width = 0.009                                                                                               
! <inf_end_us> :logical - if true include scattering at  upstream  end of inflector (E821 coils)                        
  inf_end_us   = T                                                                                                      
! <inf_end_ds> :logical - if true include scattering at  downstream  end of inflector (E821 coils)                      
  inf_end_ds   = T                                                                                                      
! <enerloss> :logical - if true include energy loss with scattering in inflector(E821 coils)!                           
  enerloss = F                                                                                                          
! <inflector_angle> :real - angle of inflector axis with respect to tangent line. The rotation axis is the downstream en
!       If angle < 0 the inflector is rotated clockwise about its downstream end                                        
  inflector_angle = -0.002                                                                                              
! <inflector_field> :6 reals - multiplier of Bmagic. If inflector_field = 1. then the inflector field = -Bmagic. Note th
                                                                                                                        
  inflector_field = 1.0                                ! multiplier of Bmagic. 1.012747 * Bmagic = B_wuzeng             
                                                                                                                        
                                                                                                                        
  initial_offsets_ref =  -2.9343E-02  0. 0. 1.6292E-02 0. 0. !Inf = -2mrad, 0mm, -2mrad                                 
  initial_offsets =  -2.9343E-02  0. 0. 1.6292E-02 0. 0. !Inf = -2mrad, 0mm, -2mrad                                     
!    initial_offsets =  0. 0. 0. 0. 0. 0.                                                                               
                                                                                                                        
!run 2-21                                                                                                               
inflector_end_target =  0.00   0.0  0.0 -0.002 0 0                                                                      
initial_offsets = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                                   
initial_offsets_ref = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                               
                                                                                                                        
!(d)                                                                                                                    
inflector_end_target = -0.001   0.0  0.0 -0.0015 0 0                                                                    
initial_offsets =  -3.7333E-02  0.  0.  1.8700E-02 0.  0.                                                               
initial_offsets_ref =  -3.7333E-02  0.  0.  1.8700E-02 0.  0.                                                           
                                                                                                                        
!(e)                                                                                                                    
inflector_end_target = -0.002   0.0  0.0 -0.00175 0 0                                                                   
initial_offsets =  -3.9107E-02 0. 0.  1.9133E-02 0. 0.                                                                  
initial_offsets_ref =  -3.9107E-02 0. 0.  1.9133E-02 0. 0.                                                              
                                                                                                                        
!(f)                                                                                                                    
inflector_end_target = -0.002   0.0  0.0 -0.00225 0 0                                                                   
initial_offsets =   -3.5098E-02  0.  0.  1.7872E-02 0 0                                                                 
initial_offsets_ref =   -3.5098E-02  0.  0.  1.7872E-02 0 0                                                             
                                                                                                                        
!(g)                                                                                                                    
inflector_end_target = -0.001   0.0  0.0 -0.00225 0 0                                                                   
initial_offsets =  -3.1247E-02 0. 0.   1.6777E-02 0. 0.                                                                 
initial_offsets_ref =  -3.1247E-02 0. 0.   1.6777E-02 0. 0.                                                             
                                                                                                                        
!(h)                                                                                                                    
inflector_end_target = -0.002   0.0  0.0  -0.003 0 0                                                                    
initial_offsets =   -2.9020E-02  0.  0.  1.5946E-02 0.  0.                                                              
initial_offsets_ref =   -2.9020E-02  0.  0.  1.5946E-02 0.  0.                                                          
                                                                                                                        
!(k)                                                                                                                    
inflector_field = 0.97                                                                                                  
!run 2-21                                                                                                               
inflector_end_target =  0.00   0.0  0.0 -0.002 0 0                                                                      
initial_offsets = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                                   
initial_offsets_ref = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                               
                                                                                                                        
!(l)                                                                                                                    
inflector_field = 0.97                                                                                                  
inflector_end_target = -0.001   0.0  0.0  -0.002 0 0                                                                    
initial_offsets = -7.0951E-02 0. 0.  2.9860E-02 0 0.                                                                    
initial_offsets_ref = -7.0951E-02 0. 0.  2.9860E-02 0 0.                                                                
                                                                                                                        
!(m)                                                                                                                    
inflector_field = 0.97                                                                                                  
inflector_end_target = -0.001   0.0  0.0  -0.0015 0 0                                                                   
initial_offsets = -7.4864E-02 0. 0.  3.1031E-02 0. 0.                                                                   
initial_offsets_ref = -7.4864E-02 0. 0.  3.1031E-02 0. 0.                                                               
                                                                                                                        
!(n)                                                                                                                    
inflector_field = 0.97                                                                                                  
inflector_end_target = 0.0   0.0  0.0  -0.0015 0 0                                                                      
initial_offsets =   -7.1242E-02  0. 0. 3.0075E-02 0. 0.                                                                 
initial_offsets_ref =   -7.1242E-02  0. 0. 3.0075E-02 0. 0.                                                             
                                                                                                                        
inflector_field=0.98                                                                                                    
inflector_end_target = 0.0   0.0  0.0  -0.001 0 0                                                                       
initial_offsets =  -6.2700E-02 0. 0.  2.7217E-02 0. 0.                                                                  
initial_offsets_ref =  -6.2700E-02 0. 0.  2.7217E-02 0. 0.                                                              
                                                                                                                        
                                                                                                                        
!(r)                                                                                                                    
inflector_field=0.98                                                                                                    
inflector_end_target = 0.0   0.0  0.0  -0.001 0 0                                                                       
initial_offsets =  -6.2700E-02 0.  0.   2.7216E-02  0.  0.                                                              
initial_offsets_ref =  -6.2700E-02 0.  0.   2.7216E-02  0.  0.                                                          
                                                                                                                        
!(p)                                                                                                                    
inflector_field=0.98                                                                                                    
inflector_end_target = 0.0   0.0  0.0  0.0 0 0                                                                          
initial_offsets =  -7.0534E-02 0. 0. 2.9587E-02 0. 0.                                                                   
initial_offsets_ref =  -7.0534E-02 0. 0. 2.9587E-02 0. 0.                                                               
                                                                                                                        
!(w)                                                                                                                    
inflector_field=0.99                                                                                                    
inflector_end_target = 0.0   0.0  0.0  0.001 0 0                                                                        
initial_offsets =-6.5915E-02 0. 0.  2.7917E-02 0. 0.                                                                    
initial_offsets_ref =-6.5915E-02 0. 0.  2.7917E-02 0. 0.                                                                
                                                                                                                        
                                                                                                                        
!(rv)                                                                                                                   
inflector_field=0.98                                                                                                    
inflector_end_target = 0.0   0.002  0.0  -0.001 0 0                                                                     
initial_offsets =  -6.2700E-02 0.0  0.   2.7216E-02  0.001  0.                                                          
initial_offsets_ref =  -6.2700E-02 0.0  0.   2.7216E-02  0.001  0.                                                      
                                                                                                                        
!(x)                                                                                                                    
inflector_field = 0.97                                                                                                  
inflector_end_target = -0.00085   0.0  0.0  -0.00125 0 0                                                                
initial_offsets =  -7.6273E-02 0. 0.  3.1469E-02 0. 0.                                                                  
initial_offsets_ref =  -7.6273E-02 0. 0.  3.1469E-02 0. 0.                                                              
                                                                                                                        
!(r)                                                                                                                    
inflector_field=0.98                                                                                                    
inflector_end_target = 0.0   0.0  0.0  -0.001 0 0                                                                       
initial_offsets =  -6.2700E-02 0.  0.   2.7216E-02  0.  0.                                                              
initial_offsets_ref =  -6.2700E-02 0.  0.   2.7216E-02  0.  0.                                                          
                                                                                                                        
                                                                                                                        
!(z)                                                                                                                    
inflector_end_target = -0.00185   0.0  0.0  -0.00025 0 0                                                                
initial_offsets =   -7.5210E-02 0. 0.  3.0745E-02 0. 0.                                                                 
initial_offsets_ref =   -7.5210E-02 0. 0.  3.0745E-02 0. 0.                                                             
                                                                                                                        
!(y)                                                                                                                    
inflector_end_target = -0.00185   0.0  0.0  -0.00125 0 0                                                                
initial_offsets =  -6.7462E-02 0. 0.  2.8424E-02 0. 0.                                                                  
initial_offsets_ref =  -6.7462E-02 0. 0.  2.8424E-02 0. 0.                                                              
                                                                                                                        
!run 2-21                                                                                                               
inflector_field = 0.97                                                                                                  
inflector_end_target =  0.00   0.0  0.0 -0.002 0 0                                                                      
initial_offsets = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                                   
initial_offsets_ref = -6.7331E-02  0. 0. 2.8897E-02 0. 0.                                                               
                                                                                                                        
                                                                                                                        
initial_offsets =  0.077 0.0 0. 0.0 0.0 0.0045                                                                          
initial_offsets_ref =  0.077 0.0 0. 0.0 0.0 0.0045                                                                      
                                                                                                                        
! <opt_incident> :logical - if true, the initial_offsets so that the trajectory emerges from the inflector on its axis a
 opt_incident = F                                                                                                       
!<inj_matrix_tracking> :logical - true: use matrices to propagate through injeciton channel, false: track using field ma
  inj_matrix_tracking = F                               ! if true, propagate trajectories through injection channel usei
                                                                                                                        
!<ring_theta> :real - Rotation of ring elements with respect to inflector exit                                          
  ring_theta      = 0.                                                                                                  
                                                                                                                        
!<kickerPlates> :integer - 989-curved plates, 821-flat plates, 1-uniform vertical field                                 
  kickerPlates    = 989                                      ! Controls shape of B-field: 1=uniform, 821, 989           
!<kickerCurcuit> :integer - Controls shape of pulse: 1=square kick, 821=RLC, 989=Blumlein                               
  kickerCircuit   = 20150328                                        ! Controls shape of pulse: 1=square kick, 821=RLC, 9
  kickerCircuit   = 20171113 !20150328                                        ! 20171113 - measured 11/17               
  kickerPulseFile = 'v0/traces-Ir.txt'                                                                                  
!<kickerFieldType> :integer -  Controls B-field calculation: 1=analytic, 2=mapped                                       
  kickerFieldType = 2                                       ! Controls B-field calculation: 1=analytic, 2=mapped        
!<kicker_params%kicker_field> : 3 reals - Bfield (T) for the three kicker mangets                                       
!    kicker_params%kicker_field      =   175.2e-4   175.2e-4  175.2e-4 ! Kick strength (Tesla) for 989 kick 60%  (292) -
     kicker_params%kicker_field      =   204.2e-4   204.2e-4  204.2e-4 ! Kick strength (Tesla) for 989 kick 60%  (292) -
     kicker_params%kicker_field      =   200.2e-4   200.2e-4  200.2e-4 ! Kick strength (Tesla) for 989 kick 68%  (292) -
    kicker_params%kicker_field =        200.e-4   170.e-4     185.e-4  ! Renee                                          
        kicker_params%kicker_field =        210.e-4   180.e-4     195.e-4  ! Renee + 10                                 
     kicker_params%kicker_field      =   233.6e-4   233.6e-4  233.6e-4 ! Kick strength (Tesla) for 989 kick 80% (292)   
     kicker_params%kicker_field      =   0   602.e-4  0 ! Kick strength (Tesla) for 989 kick 80% (292)                  
!          kicker_params%kicker_field      =   0. 0. 0. ! Kick strength (Tesla) for 989 kick 80% (292)                  
!        kicker_params%kicker_field      =   0. 0. 0. ! Kick strength (Tesla) for 989 kick 60%  (292) -                 
!<kicker_params%dtRise> : 3 reals - Rise time (seconds) of the flat top of the 3 kicker pulses                          
  kicker_params%dtRise   = 20.e-9 20.e-9 20.e-9 ! Kick  rise  (s)                                                       
!<kicker_params%dtFall> : 3 reals - Fall time (seconds) of the flat top of the 3 kicker pulses                          
  kicker_params%dtFall   = 20.e-9 20.e-9 20.e-9 ! Kick fall (s)                                                         
!<kicker_params%kick_width> : 3 reals - width of flat top of  3 kicker pulses                                           
  kicker_params%kick_width =   50.e-9   50.e-9   50.e-9   ! Kick width (seconds) -- doesn't apply to kickerCircuit=821  
!<kicker_tStart> : 3 reals - kicker start times, if kicker_tStart = -1 then automatically calculate kicker start time   
  kicker_tStart            =   2.0e-9   2.0e-9   2.0e-9   ! good choice for 127 cm kicker                               
!  kicker_tStart            =   10.0e-9   10.0e-9   10.0e-9   ! good choice for 60 cm kicker                            
  kicker_tStart            =   120.0e-9    120.0e-9   120.0e-9   ! good choice for 60 cm kicker                         
                                                                                                                        
!<quad_plate> : logical - if true then include scattering in Q1 quad plates                                             
  quad_plate    = F                                    ! include scatter in Q1 quad plates                              
!<quadPlates> : integer -  821 or 989 (displaced Q1 outer plate)  -- controls shape of E-field for Q1_Long, 1           
  quadPlates    = 1                                        ! 821, 989 -- controls shape of E-field for Q1_Long          
  quadCircuit   = 1                                          ! 0=off at injection, ramped up with tauRC=5us; 1=storage p
!<quadFieldType>: integer,  1=analytic, 2=mapped                                                                        
  quadFieldType = 1                                                                                                     
  quad_params   = 0.1058 0.1058 0.1058 0.1058                                                                           
                                                                                                                        
!<vparam_id>: integer - Determines parameter to be varied.                                                              
!                         0-nothing,  1-betax, 2-betay, 3-eta, 4-kick, 5-kick_width, 6-initial position offset, 7-initia
!                         8-kicker rise time, 9-kicker fall time, 10-inflector field (1.0=-B_magic), 11-initial energy o
!                         14-kicker_tStart                                                                              
  vparam_id = 4      ! 0-nothing,  1-betax, 2-betay, 3-eta, 4-kick, 5-kick_width, 6-initial position offset, 7-initial  
!<vparam_min> : real - minimum value of parameter to be varied                                                          
  vparam_min  = 0.6                                                                                                     
!<vparam_max> : real - maximum value of parameter to be varied                                                          
  vparam_max   =1.5					     ! maximum of parameter to vary                                                             
!<delta_vparam>: real - change in value of parameter in each step                                                       
  delta_vparam = 0.1				     ! parameter step                                                                           
!<vparam_cbo_turns>: integer - peak to peak CBO amplitude is determined over turns nturns - vparam_cbo_turns . default =
vparam_cbo_turns = 10                                                                                                   
!<loop>: logical - if true vary parameter (vparam_id) accoring to - vparam_min,vparam_max,delta_vparam.  If false then d
  loop = F                                                                                                              
                                                                                                                        
                                                                                                                        
!<fringe_file>: field_file_struct                                                                                       
!               character_string - name of file with magnetic field map of fringe field in injection channel.           
!           -4   real - grid_spacing                                                                                    
!               integer - type, type of read format = 1,2 (3 D map), 3 (extend 2D map to 3 dimensions) or 4 (uniform fie
!               integer - flag (miscellaneous)                                                                          
! possibilities include -  'injec_fld.dat'  0.5 0. 1 0,  or 'ring_inject_bfield3d_wuzheng_extended.dat'  0.5 0. 2  0    
  fringe_file = 'ring_inject_bfield3d_wuzheng_extended.dat'  0.5 0. 2  0                    !field map for fringe field,
!<inflector_file>: field_file_struct                                                                                    
!               character_string - name of file with magnetic field map of inflector field.                             
!               real - grid_spacing                                                                                     
!               integer - type, type of read format = 1,2 (3 D map), 3 (extend 2D map to 3 dimensions) or 4 (uniform fie
!               integer - flag (miscellaneous)                                                                          
! possibilities include -  'inf_field_alone.dat'  0.5 0.  1 0, 'uniform' 0.5 0. 4 0                                     
  inflector_file = 'inf_field_alone.dat' 0.5 0. 2 0             !field map for inflector field, grid spacing, gradient, 
                                                                                                                        
!<spin_tracking_on>: logical - if true then include spin tracking of muons. Default = true                              
 spin_tracking_on = T                                                                                                   
!<muon_decay>: logical - if true then include muon decay. Default = true                                                
 muon_decay_on =  F                                                                                                     
!<make_movie>: logical - if true save trajectory and spin every 5cm and layout of quads and kicker. Create png files for
make_movie = F                                                                                                          
!<gnu_input_only>: logical - if true then write gnu_input.dat and stop. Default = false                                 
!<use_lattice_twiss>: logical - if true use twiss parameters defined in lattice file to propagate through injection line
use_lattice_twiss = F                                                                                                   
!<write_phase_space>: logical - if true write phase space coordinates of each muon to a file at each element on first tu
write_phase_space_file = F                                                                                              
!<save_element_by_element_info> - if true allocate array muon_ele(:,:) to save distribution at each element. To reduce m
save_element_by_element_info = T                                                                                        
!<time_bin_width>: real - if non-zero, save moments vs time at end of each turn in bins of width = time_bin             
time_bin_width = 2.5e-9                                                                                                 
scraping_on = F                                                                                                         
horizontal_scrape = F                                                                                                   
bad_resistors = F                                                                                                       
extra_inf_scatter_factor = 0. !Increase scatter in inflector end by (1+extra_inf_scatter_factor)                        
!init_quad_focus = -0.145315  ! if = -0.145315 and if init_quad_steer = -0.145315 then same as  32kV, 22.7 kV config    
!init_quad_steer =  -0.145315                                                                                           
init_quad_focus = -0.18421  ! if = -0.18421 and if init_quad_steer = -0.18421 then same as  19kV, 12 kV config if index=
init_quad_steer =  -0.18421                                                                                             
init_quad_focus = -0.14634  ! if = -0.14634 and if init_quad_steer = -0.14634 then same as  20.5kV, 14.5 kV config if in
init_quad_steer =  -0.14634                                                                                             
!try less scraping                                                                                                      
init_quad_focus = -0.07104  ! half of nominal scrape at 18.3kV, 13.1 kV config   (18                                    
init_quad_steer =  -0.07104                                                                                             
init_quad_focus = -0.21312  ! 1.5 times nominal scrape at 18.3kV, 13.1 kV                                               
init_quad_steer =  -0.21312                                                                                             
init_quad_focus = -0.14208  ! if = -0.14208 and if init_quad_steer = -0.14208 then same as  18.3kV, 13.1 kV config   (18
init_quad_steer =  -0.14208                                                                                             
!init_quad_focus = -0.087432  ! if = -0.14208 and if init_quad_steer = -0.14208 then same as  18.3kV, 15.1 kV config   (
!init_quad_steer = -0.087432                                                                                            
!quad_ramp_start_time = 15.e-6                                                                                          
quad_ramp_start_time = 7.5e-6                                                                                           
quad_ramp_end_time = 35.e-6                                                                                             
error_fields = F                                                                                                        
azimuthal_exp_z ='BzFourier20170721.dat'  !'BzFourier20170628_LogID983.dat'                                             
azimuthal_exp_r= 'BrFourier2016.dat'                                                                                    
FiberScatter0 = F                                                                                                       
FiberEnergyLoss0 = F                                                                                                    
int_betaCrossE = F                                                                                                      
betaCrossE_verbose = F                                                                                                  
no_energy_change = F                                                                                                    
initial_offset_from_co = F                                                                                              
quad_fringe_energy_change=F                                                                                             
input_call = 'quad_input.dat'                                                                                           
BetaCrossE_start_time = 35.e-6                                                                                          
/                                                                                                                       
