Hi,
I want to find a histogram which I stored in a any sub directory of the Root tree or a (known) file. I thought the FindObjectAny() Method was the right thing, but this fails if the TDirectory does not belong to a writable TFile (see the following example):
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 4.04/02 29 June 2005 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.
CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] gROOT->cd()
(Bool_t)1
root [1] gROOT->mkdir("test")
(class TDirectory*)0x9077a30
root [2] test->cd()
(Bool_t)1
root [3] new TH1F("testHist", "a test histo",10,0,10)
(class TH1F*)0x908ee68
root [4] gROOT->cd()
(Bool_t)1
root [5] gDirectory->FindObjectAny("testHist")
(const class TObject*)0x0
In the current directory FindObjectAny works:
root [6] gDirectory->cd("test")
(Bool_t)1
root [7] gDirectory->FindObjectAny("testHist")
(const class TObject*)0x908ee68
How can I search directory structures for objets?
Cheers,
J.