Glenn Irwin secured the win in Race 2 of Bennetts British Superbike Championship weekend at Donington Park.