|Welcome to the Monastery|
In studies that I have read based on that, they have shown that caffeine can have the effect of narrowing ones focus on the task at hand, which is great if you are healthy and relatively awake.
One major problem with that is that caffeine's mechanism of action is to block the pathway that makes us feel fatigue - but the results of fatigue are still there in the background.
So if your sleepy, non-alert self injests some caffeine, then you will quickly feel refreshed and as if you are focused and getting much done - but for the most part, you just feel that way and your productivity is declining at the same rate as if you hadn't had the caffeine (in many cases it is actually worse because you will think you are doing okay and continue to work, your quantity of work increase, but not the quality - whereas were you to actually feel how tired you really were, you might have stopped and gone to bed - as a result, when you come back to all of your work later - it is very likely that you have a lot of junk that you have to wade through).
Now if you really want something chemical in nature to narrow your focus - then you are going to want some derivative of the methamphetamine family.
The largest downside of this (aside from the whole "addiction" part) is that it will make you focus on something very intently. You won't eat, you won't be tired, and you will have to finish what you are working on with great determination... but that thing which grabs this undying attention may very well be something entirely different than what you should be working on. So instead of solving some computer programming issue - you might instead vaccum the entire upstairs of your house with amazing diligence.
and as it has already been noted - frequently instead of narrowing your focus on the task at hand, you instead should be lessoning the grasp of your conscious mind and allowing the rest to have a hand.
There are some odd things afoot now, in the Villa Straylight.