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