The Gaudi Framework
v30r3 (a5ef0a68)
|
The latest changes (2018-03-08) of the THistSvc provide two improvements:
std::unique_ptr
s in the interfaceParallel usage of the THistSvc is possible through either:
regHist()
to register a clone for each involved thread that can be merged in the end. (e.g. during finalize
of an Algorithm/Service ...)regSharedHist()
to register a single instance for all threads that is mutexed and accessed through a LockedHandle<>
Both approaches have their use cases, but for moderate histogram usage during a normal job of some kind, sharing a single instance is probably best.
In future ROOT versions (ROOT 7?) it might be possible to introduce further methods of parallelized histograms. Histograms with atomic bins looks very promising.
You should register your TObejects to the THistSvc through moving std::unique_ptr
s into the reg*
method. The THistSvc manages these objects and is also responsible for writing these to ROOT files etc.
If your usage looked like this before:
you should replace it with:
or even
This way it is clear that the THistSvc takes ownership of these objects. Working on the returned raw pointers is no issue as long as the THistSvc is still present (until finalize
is called) and as long as the user does not do anything malicious with it (i.e. deleting it).