21template <
typename T,
unsigned int NDIM>
27 using Result_t = THn_t;
30 std::vector<std::shared_ptr<THn_t>> fHistos;
35 THnHelper(std::string_view
name, std::string_view title, std::array<int, NDIM> nbins, std::array<double, NDIM> xmins,
36 std::array<double, NDIM>
xmax)
40 fHistos.emplace_back(std::make_shared<THn_t>(std::string(
name).c_str(), std::string(title).c_str(),
41 NDIM, nbins.data(), xmins.data(),
xmax.data()));
45 THnHelper(THnHelper &&) =
default;
46 THnHelper(
const THnHelper &) =
delete;
47 std::shared_ptr<THn_t> GetResultPtr()
const {
return fHistos[0]; }
51 template <
typename... ColumnTypes>
52 void Exec(
unsigned int slot, ColumnTypes... values)
55 std::array<
double,
sizeof...(ColumnTypes)> valuesArr{
static_cast<double>(values)...};
56 fHistos[slot]->Fill(valuesArr.data());
62 auto &res = fHistos[0];
64 res->Add(fHistos[slot].get());
68 std::string GetActionName(){
73void df018_customActions()
82 auto genF = [&genD]() {
return (
float)genD(); };
83 auto genI = [&genD]() {
return (
int)genD(); };
84 auto dd =
d.Define(
"x0", genD).Define(
"x1", genD).Define(
"x2", genF).Define(
"x3", genI);
88 using Helper_t = THnHelper<float, 4>;
90 Helper_t helper{
"myThN",
91 "A THn with 4 dimensions",
93 {-10., -10, -4., -6.},
97 auto myTHnT = dd.Book<
double,
double, float,
int>(std::move(helper), {
"x0",
"x1",
"x2",
"x3"});
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
R__EXTERN TRandom * gRandom
Base class for action helpers, see RInterface::Book() for more information.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
Templated implementation of the abstract base THn.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
CPYCPPYY_EXTERN bool Exec(const std::string &cmd)
void(off) SmallVectorTemplateBase< T
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
UInt_t GetThreadPoolSize()
Returns the size of ROOT's thread pool.
TSeq< unsigned int > TSeqU
void Initialize(Bool_t useTMVAStyle=kTRUE)