allpix::ThreadedHistogram

A re-implementation of ROOT::TThreadedObject. More…

#include <ROOT.h>

Public Functions

Name
template <class… ARGS>
ThreadedHistogram(ARGS &&… args)
template <class… ARGS>
Int_t
Fill(ARGS &&… args)
An easy way to fill a histogram.
template <class… ARGS>
void
SetBinContent(ARGS &&… args)
An easy way to set bin contents.
void Write()
An easy way to write a histogram.
std::shared_ptr< T > Get()
Get the thread local instance of the histogram.
std::shared_ptr< T > Merge()
Merge the threaded histograms into final object.

Detailed Description

template <typename T ,
typename std::enable_if< std::is_base_of< TH1, T >::value >::type *  =nullptr>
class allpix::ThreadedHistogram;

A re-implementation of ROOT::TThreadedObject.

This class is a re-implementation of TThreadedObject for histograms and profiles, providing better scalability and an additional thin wrapper to commonly used histogram functions such as Fill() or SetBinContent(). Furthermore, it also does not depend on ROOT implementation changes that have happened to the original class between minor ROOT versions. This class scales to an arbitrary number of thread, irrespective of the underlying ROOT version.

Enables filling histograms in parallel and makes sure an empty instance will exist if not filled.

Public Functions Documentation

function ThreadedHistogram

template <class... ARGS>
inline explicit ThreadedHistogram(
    ARGS &&... args
)

function Fill

template <class... ARGS>
inline Int_t Fill(
    ARGS &&... args
)

An easy way to fill a histogram.

function SetBinContent

template <class... ARGS>
inline void SetBinContent(
    ARGS &&... args
)

An easy way to set bin contents.

function Write

inline void Write()

An easy way to write a histogram.

function Get

inline std::shared_ptr< T > Get()

Get the thread local instance of the histogram.

Based on get in https://root.cern/doc/master/classROOT_1_1TThreadedObject.html, optimized for faster retrieval.

function Merge

inline std::shared_ptr< T > Merge()

Merge the threaded histograms into final object.

Based on merging in https://root.cern/doc/master/classROOT_1_1TThreadedObject.html.


Updated on 2025-02-27 at 14:14:46 +0000