It's the way it's supposed to work. But it doesn't always. I get trapped in random negative thoughts all the time, lie to myself, confuse reality with my perception of it and get hung up on feelings of worthlessness and failure.
https://en.wikipedia.org/wiki/Transcranial_magnetic_stimulat... (to modify brain settings)
and something like https://openbci.com/ (to read brain data)