I’d like to return a histogram object from one function to be used within another. I am returning the histogram, among other variables. Later, I use this histogram to make a RooDataHist. However, it seems that whatever is being returned loses its histogram type and therefore it is not a histogram anymore. For example
def plot_hist(): file_name = "test" histogram = ROOT.TH1F(blah blah) histogram.SetTitle("") histogram.Draw() return file_name, histogram def otherFunc(): file_name, histogram = plot_hist() rHist = ROOT.RooDataHist("" , "", , histogram)
Now this gives me an error where I initialise rHist because it needs a TH1F as the last parameter. but since I passed it between functions, the histogram lost its TH1F type. I tried getting the histogram via ROOT.gDirectory.Get(“histname”), but that still doesn’t hold its type. What can I do?