Use static only when debugging PixelThresholdClusterizer

Helgrind reported a race condition with a function static. The
value of the static is only used during a compile time conditional
debugging. Therefore the static was moved to also be within the
same conditional build flag.
Switched the static to std::atomic so when conditionally compiled
the code will be thread safe.
Merge pull request #5065 from Dr15Jones/fixStaticsInPixelThresholdClusterizer

Use static only when debugging PixelThresholdClusterizer