ROOT Version: 6.32.04 Platform: Mac OS X 14.6.1 Compiler: Apple clang version 15.0.0 (clang-1500.3.9.4)
Hello all. I have a text file describing a histogram in the format of two columns: bin_centers and bin_contents. I am trying to find a simple way to read this into a TH1F.
TH1F allows for you to create a histogram using a TVector defining the bin_contents. That’s great, because I can write a simple C++ code to read the text file’s columns into two TVector objects. However, TH1F’s constructor only accepts ONE TVector object, that describing bin_contents. How can we use the TVector->TH1F as a way of defining a complete TH1F histogram object?
Or maybe there is other functionality for reading ascii text files into TH1?
We are working on improving the histogramming interface and this kind of feedback is precious to us and will be taken into consideration.
What you can do today is to use this constructor, which takes in input the bins lower edges (which you can easily derive from the centers in your input data) and then set the bin contents, looping on the bins and invoking the SetBinContent method.
I hope this is simple enough for your current setup.