C++ code keeps crashing

Please read tips for efficient and successful posting and posting code

ROOT Version: root 6.24/02
Platform: Ubuntu Linux20.4
Compiler: gcc

Hi there I am writing c++ code to plot .root file histograms on the same graph, but it keeps crashing every time I run the code

Please attach your code as text file, it makes it easier to reproduce and debug issues than a screenshot.

One thing to check is if the file and tree variables are valid, i.e. if the ROOT files can indeed be successfully opened and if the histograms can be found, like this

TFile *file = TFile::Open(fnames[i]);
if (!file || file->IsZombie()) {
   // error
TH1 *h = ...
if (!h) {
   // error

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