Experience? When I find that I have been focusing for many hours on a complex task, it is usually something I slipped into effortlessly, even accidentally. The whole experience is pleasant. On the other hand I have tried on many occasions to force this when it wasn’t forthcoming, and on top of being extremely uncomfortable, it’s never worked.
I don’t think I’m completely helpless about it - factors such as sleep, exercise, environment, schedule fragmentation, etc. do seem to be involved, and I can influence those. But it doesn’t respond to force of will in the moment.