Hi D,
I have a code that runs separately and saves histograms (hist[1],hist[2]…) into a root file (example.root). What I want to do now is write separate macro that opens example.root and plots my histograms according to the example code I posted earlier.
I understand that.
What I am saying is that the variable hist is defined nowhere and the code, as is, cannot work. I propose you post the file being opened and the input root file. Without this step being accomplished, I am afraid I cannot help further.
the histograms’ names are in the form hist[?] therefore it makes harder to access them from a C++ script as something like hist[1] will be understood by the C++ interpreter as the first element of the hist array. Note also the first histogram in your file is not named at all, which will makes it even harder to access . So before going further is it possible for you to regenerate the .root file with proper named histograms ? for instance you can name them hist1hist2hist3 and hist4