20 Reading histograms from external C++ or FORTRAN programs

You can display histograms created by a C++ or FORTRAN program using the HBook class. For this, use the CFBook libraryhttp://www.desy.de/ chekanov/CFBook/. This package generate 2 static libraries : libcbook.a (to be linked with C++) or libfbook.a (to be linked with FORTRAN).

Then you can read histograms filled by the CFBook library as shown in the examples "hbook.py" (for 1D) or "hbook2D.py".

>>> from jhplot  import * 
>>> hb = HBook()        # create HBook instance 
>>> hb.read("cpp.xml")  # read output file "cpp.xml" from the CFBook package
>>> print hb.listH1D()  # list all histograms
>>> h1 = hb.getH1D(10)  # get H1D histogram with ID=10
>>> c1.draw(h1)         # draw it