Thread safe fill of same tree and histograms from different synchronized threads

Individual objects of type TTree or TH1* (or TFile) can not n be accessed from multiple thread as the same time. However once you turn on thread support in ROOT (ROOT::EnableThreadSafety()) distinct objects of those types can be access concurrently.

I.e. what you described will work but you might also be able to achieve even better thread scaling by using (in some cases) distinct objects rather than sharing them with several thread (We also have an infrastructure (TBufferMerger) that allows the merging of concurrently produced TTree and TH*