Hallc optics optim

From HallCWiki
Revision as of 09:35, 5 September 2011 by Jones (talk | contribs) (New page: New verison of the Hall C optics optimization code. This is a slimmed down version of the old code. = Optimization Source Code = *''optimize.f'' **Main program calls subroutines read_inp...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

New verison of the Hall C optics optimization code. This is a slimmed down version of the old code.

Optimization Source Code

  • optimize.f
    • Main program calls subroutines read_input, read_matrix, fit_init, fit_matrix.
  • read_input.f
    • reads in the input file.
    • Presently hardcoded to use the input filename as input.db
  • read_matrix.f
    • Reads in the standard replay optics matrix data file
    • Hardcode the constant offsets terms for xp,yp,y and delta.
  • fit_init.f
    • Hardcode collimator distance zcol = 166.+1.6
    • Hardcode dflag=0 . Set dflag=1 for delta optimization.
    • Hardcode the spec_type =1 for HMS which assumes 81 sieve holes. spec_type =2 could be used for SHMS. Need to have this a part of input.db
    • Hardcoded to look for variables HSXPFP,HSYTAR,HSXPTAR, HSYPTAR

gbeam_y,eventID,xtar in the ntuple.

    • If doing delta optimization set up for ep elastics. Assumes that in the ntuple the energy loss for the beam and scattering electron will be the 13th and 14th variable.
    • Loops through the ntuples using 2d ytar/xfp and xsieve/ysieve cut to select events. Hardcoded to accept a maximum of 200 events per hole and 100000 events total.
    • Fills arrays
      • Focal plane quantities pts(i,ntotal) = i=1,4 (for xfp,xpfp,yfp,ypfp) for each event
      • Known y (ydata) , xp (thdata) and yp (phdata) values.
zzero(ntotal) = ztarpos(k)*dcos(spec_ang)/100.0
ydata(ntotal) = ztarpos(k)*dsin(spec_ang)/100.0
If SHMS need to set ydata(ntotal) =−ztarpos(k)*dsin(spec_ang)/100.0
thdata(ntotal) = xsr(k,nh_found)/(zcol−zzero(ntotal)*100)
phdata(ntotal) = (ysr(k,nh_found)−ydata(ntotal)*100)/(zcol−zzero(ntotal)*100)
ydata(ntotal)=ydata(ntotal)−phdata(ntotal)*zzero(ntotal)
  • fit_matrix.f