Getting Histograms from ROOT File and Cloning

_ROOT Version: 5.34/10
Platform: Not Provided
Compiler: Not Provided


I am trying to get histograms from a ROOT file, and clone them into the ROOT file and use them for fitting. I have attached my code below

const char *DATA_FILE_PATH = "DATA.root";
TH1F *clone[4];
	for (int b = 0; b < 4; b++){
		TString HistName = "";
		HistName += StrLabels[b];

		TH1F *temp;
		DATA_FILE_PATH.GetObject(HistName, temp);
		clone[b] = (TH1F*)temp->Clone();

The error I am receiving is

error: request for member 'GetObject' in 'DATA_FILE_PATH', which is of non-class type 'const char*'
   DATA_FILE_PATH.GetObject(HistName, temp);

HistName are names of the histograms in the ROOT file that I want to clone, and I would like to save the histograms in an array. I am not sure how to fix this.

Thank you very much!


DATA_INFILE.GetObject(HistName, temp);

Thank you so much! That fixed it!

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