Hi,
Seems like there had been a driver problem and caused your laptop to shut down on itself. Do a hard reset first, remove the battery, AC adapter and other device connected into it then press and hold the power button for 20 seconds. Plug in both battery and AC adapter and power it on again. Once on the desktop make sure to update all the drivers in Device Manager or check if there's any driver that has any yellow question mark on them.