ROOT looses track of my histograms

I have two programs (code below) which virtually do the same things excepted the sorting principal is different. The programs take a root file that contains a TTree I made which has histograms of different variables. I then use:

TH1D* workingHist = (TH1D*) myTree->Get(histName);

I then draw the histograms to the default canvas. The first program draws the histogram in the “HIST” style without being prompted, and the second draws with the error bars unless you use the Draw(“HIST”) option.

Can you explain this discrepancy?

The code is attached (although perhaps in comprehensible) below. BinSorter_2018Feb8.C is program 1 and BinSorter_FC.C is program 2.

BinSorter_FC.C (10.4 KB)
BinSorter_2018Feb8.C (10.7 KB)

_ROOT Version: 6
_Platform: Linux
_Compiler: Whatever Fermilab has

I guess some “histName” have errors (e.g. they were filled with “weights” or they were scaled and then you need “HIST”) while another ones do not have them (no need for “HIST”).

After “Get”, try to add: workingHist->Sumw2(kFALSE);

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