# Presentation: 111082

## TeV Orbit Calculations:Beam Smoothing Tools

- “Cusper”
- “Smoother”

## “Cusper” 

- Fitter to detect distortions in the magnetic field based on deviations from the expected form of the beam position measurements
- Includes heuristics for rejecting BPM measurements as suspected bad readings
- Identifies positions and strengths of apparent distortions

## “Smoother”

- Tool to suggest optimum DFG settings to correct for distortions
- Optimization includes criteria which existing tools do not:
- Recognition of DFG current range restrictions
- Penalty for larger DFG currents
- Penalty for large inter-step slew

## Identifying “Maverick” Readings

- Technique:
- Local sine-curve fits to BPM data (corrected for  function)
- Fit with and without a key point (or pair of points) to be evaluated
- Bayesian approach:  Assume some *a priori* likelihood of a given measurement being bad
- Which is more likely?
- the (worse 2) probability of the fit including the key point
- the (better) probability of the fit excluding the key point, times the assumed likelihood of a bad measurement
- Slide the fits so that a single cusp does not spoil the identification of mavericks

## Subtleties in Identifying Mavericks

- There are various ways for the data to fool a heuristic for identifying mavericks
- The presence of a maverick, coupled with unlucky normal fluctuations, to cause
- incorrect rejection of a good reading
- incorrect acceptance of a bad reading
- Unit-testing the code exposed a number of such headaches

## Subtleties in Identifying Mavericks

- The presence of a true maverick here distorts the fit such that an acceptable measurement is rejected
- Modifications to the heuristic to correctly handle most of these subtleties have been made.
- Some situations still fool the filter, but these now involve very rare combinations of circumstances

## Identifying Cusps

- Fit with varying window sizes and positions
- Find three best fit curves:
- across the interval in question
- just to the right of the interval
- just to the left of the interval
- Again a Bayesian approach is used
- Some *a priori* likelihood for distortion in any given interval
- Which is more likely?
- the (worse 2) probability of the fit without a distortion
- the (better) probability of the fit excluding the key point, times the assumed likelihood of a distortion
- Last-pass overall optimization of cusp positions and magnitudes

## Cusper Status

- Can read BPM and Twiss parameter info from a couple of formats and use it to try to do the fit
- Display capability via Root
- Rejection filter implemented and unit-tested and tuned
- 99% of the effort, as usual, went into the boundary and pathological cases
- Cusp fitter implemented but as yet not at tested/tuned
- Major issue once the linux-based cusper exists:
- How (and whether) to integrate this with the control-room accessible tools
- Effort has been on “back burner” for a while

## “Smoother”

- Given the BPM readings and the desired target orbit readings, find the “best” DFG settings to correct the orbit.
- “Global” optimization across time steps in the ramp and squeeze, to minimize large slews
- Avoidance of suggested currents which are too large for the DFG to handle
- Consideration to avoiding large total currents
- Two DFG’s should not “fight each other” at large currents
- The overall optimization can be computationally intense
- This has been on the back burner for quite a while
- When the tool exists, integration with accelerator controls will also be an issue

## Beta Tool

- 	Once
- cusper is implemented
- new BPMs are in place
- 	it becomes possible to evaluate, for a given frame, the corrections to the  function which would explain BPM fluctuations not explained by identified cusps.
- A single such measurement is not very meaningful.
- An ensemble of these corrections, over time, might be helpful in determining the  function to better accuracy.
- Is this something people would be interested in?