Axis Extension for Sparse Histograms

Is it possible to extend any of the axes of a sparse histogram ?
For example, consider the following example

void Test(){

   TRandom3 Random;

   double Min[]  = {0., 0.};
   double Max[]  = {1., 10.};
   int    NBin[] = {100, 100};

   THnSparseD Hist("Hist", "Hist2D", 2, NBin, Min, Max);
   Hist.GetAxis(1)->SetCanExtend(true);

   for(int Iter = 0; Iter < 1000; Iter++)
     Hist.Fill(std::vector<double>{Random.Rndm(), 20*Random.Rndm()}.data());

   Hist.SaveAs("Hist.root");

}

The values for filling the second axis are intentionally sampled from a uniform
distribution from the range (0, 20). Initially the axis range maximum is taken to
be 10 but a possible extension criterion is set. However, the output histogram
has the maximum still set at 10 and of course there are entries in the overflow
bin.

Hi,

Thanks for the post. Maybe I am wrong, but aren’t the dimension of the array with which you fill the histogram and the dimension of the sparse histogram not matching?

Cheers,
Danilo

Hi,

Can you kindly elaborate? Maybe I am missing something trivial here.
Pardon my naivety.