ROOT Version: 6.18/04
Platform: Linux
I am trying to loop over different histograms in a rootfile and draw these histograms on the same plot. I have tried:
‘’’
void Function();
auto f = new TFile (“output.root”);
std::vectorstd::string Cut = {“L1_F10”, “L1_F30”};
int n = Cut.Size();
TH1D h[n];
for (unsigned i = 0; i < n; i++) {
h[i] = (TH1D)f->Get(“L1_F%d”);
if (i ==0) h[i]->Draw();
else h[i]->Draw(“same”);
‘’’
I get the error saying that “null passed to a callee that required a non-null argument [-Wnonnull]: h[i]->Draw()”
So something is wrong with how I refer to my file (i.e. the %d), which maybe has something to do with the fact that my vector contains strings, rather than integers, but I am not sure how to fix this.