I have finally figured out how to pass a histogram to my function calcHisto(TH1D *h) and return a calculation, but the success has come at a steep price. I can no longer make a plot without a segmentation fault. In the attached working code I have commented out the definitions of ABC::calcHisto(TH1D *h) and ABC::singlehisto(). ABC::PlotSomething() now makes a plot. But, if I call or even just un-comment the definitions of singlehisto() and calcHisto(), ABC::PlotSomething() makes its plot and then the macro crashes. If I don’t call PlotSomething() then singlehisto() runs fine.
Is there some other way I should be passing my histogram to calcHisto(TH1D *h)? Or should I not be passing histograms?