find object help

Jacek M. Holeczek (holeczek@clri6a.gsi.de)
Mon, 17 Feb 1997 17:59:24 +0100 (CET)


Hi,
A small note - some time ago there were notes about ROOT extentions to C++
somewhere on the root www page - in "C++ Coding Conventions" I think.
Now I cannot find it any more. Are they moved, or are they lost ?
Another point - is there somewhere a postscript version of the "Taligent
rules" ?
My real questions are here.
I need to write a small event unpacking function in form :
...
if ( exists_histogram_with_name_EventLength ) EventLength->Fill(...);
...
if ( exists_histogram_with_name_RawCamac0 ) RawCamac0->Fill(...);
...
if ( exists_ntuple_with_name_MiniNtuple ) MiniNtuple->Fill(...);
...
What I need are pieces of code "exists_histogram_with_name_..." and
"exists_ntuple_with_name_..." :
1. both "search_routines" should scan ONLY the MEMORY in "current"
subdirectory for a certain histogram/ntuple - this makes the
problem that if the user has opened a file, the gDirectory
points to that file -> is there a way to get the LAST path
which was used in memory ( RAM ) ? ( In worst case I could assume
that all histograms/ntuples are allowed to exist in gROOT only. )
2. It would be good to check both that an object with the given
name exists ( "EventLength", "RawCamac0", "MiniNtuple" ), and
that it belongs to proper class ( "TH1S", "TNtuple" ).
In case the TNtuple is too pure, I might switch to TTree with
one branch ( in this case I would have to chect whether the branch
exists and contains proper leafs - or maybe I should simply get an
address of a leaf with a particular name independent of where
it actualy "hangs" ).
3. both routines should be very fast - assuming that I need to
fill 2000 (raw) histograms I would like to be able to analyze
2000 events/second, thus such a "search" should work faster then
4e6 times per second ( God, am I stupid ? )
4. maybe I should simply forget these "if (..)" and simply Fill(...)
histograms/ntuples, and if they don't exist, they will not be
created/filled ( hopefully this will behave quietly ).
Thanks in advance,
Jacek.
P.S. The TNtuple::TNtuple(...) description claims that one can have different
different types of variables in varlist. I can't see this in source code.
Somehow they all seem to be of type Float_t. Jacek.