Optimization method to compensate accelerator performance drifts