Step 1: Ask what physiological event happens without the brain's input. Sleep-related erections arise automatically during REM sleep and rely only on healthy nerves and arteries supplying the penis.
Step 2: This phenomenon is captured by nocturnal penile tumescence (NPT) testing, which also takes the early morning erection into account. Because it bypasses the conscious mind, it isolates the hardware from the software.
Step 3: Apply the logic. If a man cannot achieve an erection during sex but still has firm sleep and morning erections, his plumbing and wiring are fine and the problem is in the mind, so it is psychogenic. If NPT is flat, the cause is organic.
Step 4: Rule out the rest because they are therapeutic, not diagnostic. Intracavernosal PIPE injections and oral sildenafil treat the dysfunction, while the squeeze technique manages premature ejaculation. The diagnostic differentiator is therefore NPT.
\[\boxed{\text{Nocturnal penile tumescence}}\]