Optimization of cardiac resynchronization therapy in atrial fibrillation and sinus rhythm by