Electronic excitations and defect creation in wide-gap MgO and Lu3Al5O12 crystals irradiated with swift heavy ions