Hi, I have some problem with Get() funcion, too. But maybe it's only a
sintax error.
In a file.root I have some histograms. Using a macro I just open the file
then I try to get a pointer to an histogram and I get a null pointer. When
I type single lines on root prompt I can use the histoname as a pointer.
For example:
{
char histo[20];
THF1* ptr;
TFile *f = TFile::Open("file.root","update");
for(i=0;i<5;i++) {
sprintf(histo,"h%d",i);
ptr=(*THF1)gDirectory->Get(histo);
ptr->Draw();
}
}
doesn't work
but
root[0] TFile f("file.root","update");
root[1] THF1 *ptr = h1;
//or THF1 *ptr=(*THF1)gDirectory->Get("h1");
root[2] ptr->Draw();
works fine.
What's wrong in the first case?
(using gFile or gROOT instead of gDirectory doesn't change my results)
using 3.03.09.
Sara Vecchio
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET