Added lock_guards to make the filling of histograms thread safe
Also applied to profiles. This will of course slow down slightly the current histograms. On the other hand, they should be replaced at some stage with the new ROOT7 ones, so this is kind of temporary