Hi,
I am reading a root file and getting the histograms with this code:
Root version 5.18/00
int fillEigenvector(char *theoryfile,char *hname){
TH1F** isto=0;
isto = new TH1F*[42];
TFile *f=TFile::Open(theoryfile);
for (int k=0; k<41; k++){
char dirname[12];
f->cd(dirname);
isto[k] = new TH1F;
isto[k] =(TH1F)(gDirectory->Get(hname));
}
// ... ... ...
//
return 1;
}
the problem is that if I call this function in interactive mode (with the interpreter) it works
but when I try to compile the code in which I call this function I got this error message:
no matching function for call to `TH1F::TH1F(TObject*)’
It is clear which is the meaning of the error but I don’t know how to avoid this;
I also tried with something like:
isto[k] = (TH1F)f->Get(hname);
or
isto[k] = (TH1F) f->FindObjectAny(hname);
but I get the same error.
cheers,
Francesco
p.s.
I compiled with
g++ analysis.cpp -o analysis root-config --cflags --libs