Reading a Histogram from a Canvas stored in a Root file

Dear Root experts,
I have a simple script that reads histograms from several root files (one histogram called JPsiMass from a Canvase with the same name stored in each file) and stores in a vector of TH1D*.
After reading and storing them, I can Draw them but that’s all I can do.
I would like, for example, find the bin with maximum content in one of them (please see the code attached) but I get the following error:

In file included from input_line_9:6:
././HistogramAnalyzer.cc:51:77: error: no member named 'GetMaximun' in 'TH1D'
        std::cout << "#########################################" << tempHistogram->GetMaximun() << endl;

My code is:

void HistogramAnalyzer(std::vector<std::string> FileNames) {

	std::vector<TH1D*> InputHistograms;

	for (auto FN=FileNames.begin(); FN!=FileNames.end(); FN++) {
		TFile* InputRootFile = new TFile(FN->c_str(), "READ");
		InputRootFile->ls();
		TCanvas* InputCanvas = (TCanvas*)InputRootFile->Get("JPsiMass");
		TH1D* InputHistogram = (TH1D*)InputCanvas->GetPrimitive("JPsiMass");
		InputHistograms.push_back(InputHistogram);
	}

	TCanvas* temp_canv = new TCanvas("temp","temp");
	InputHistograms[0]->Draw();
	std::cout << "Maximum Bin = " << InputHistograms[0]->GetMaximumBin() << endl;
}

Thank you for your help in advance

GetMaximun ?

Hi @Wile_E_Coyote
Sorry that was a typo, I meant GetMaximumBin().
Other methods don’t work either like GetMaximum(), or GetBinContent()

To make it more clear, when I loop over the vector of histograms this problem happens. If I work with one, lets say “InputHistograms[0]” everything is good, but if I use “InputHistograms[i]” in a loop, I get the error message.

What “error message”?

BTW. Make sure all canvases contain what you expect: InputCanvas->ls();

Hi @Wile_E_Coyote
Thank you very much for your help.
Indeed, part of the problem was the input canvases being totally empty.
Also when looping over histograms, if I use
for (int h=0; h<InputHistograms.size(); i++)
instead of
for (auto h=InputHistograms.begin(); h!=InputHistograms.end(); h++)
my code works fine.

Anyway, the problem is solved and the code works.
Thank you again