Is it possible to create an 1D histogram without knowing the range of a variable in advance?

I have process that calculates some quantity Q. I want to fill a histogram from that data. The problem is the histogram must be filled at each step of calculation of Q but due to the real time calculation there is no information about the range of Q therefore I cannot create a histogram before the calculation. I tried to use default constructor and then just fill the histogram

TH1F* qH = new TH1F();
//Calculate Q

but it did not work — qH is of range from 0 to 1.
So what is a solution to my problem?

Thank you in advance.

// TH1::SetDefaultBufferSize(999999); // set the "default" value
TH1D *qH = new TH1D("qH", "qH title;X axis name;Y axis name", 1000, 0, 0); // 1000 bins, automatic binning
// qH->SetBuffer(999999); // for this "histogram" only

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.