I am having a look to the documentation of classes THnD
and THnSparse
. I see in the documentation that this objects are filled as a traditional TH1D
histogram, using Fill
. So I could just iterate and fill. But there is a more straight forward way to do this?
I see for example inside RDataFrame
there is a method .HistoND
that I imagine it returns a THnD
.
However, how could I initialise a THnSparse
object that seems to be more suited for data with many zeros?
If I try:
auto hN = dataFrame.HistoND( ... );
It works, but how do I cast
the auto to the object I want?
Ok, (edit) I found that I could create a THnd
:
root [17] THnD *hNd = new THnD(*dd)
(THnD *) 0x5556cbb7e770
root [18] hNd->GetEntries()
(double) 10000.000
But not a THnSparse
with the same technique:
root [19] THnSparse *hSparse = new THnSparse(*dd)
ROOT_prompt_19:1:26: error: allocating an object of abstract class type 'THnSparse'
THnSparse *hSparse = new THnSparse(*dd)
^
/programas/root/6.26.06/include/THnSparse.h:61:20: note: unimplemented pure virtual method 'GenerateArray' in 'THnSparse'
virtual TArray* GenerateArray() const = 0;
^
root [20]