[ROOT] 2 questions about Histogram in Memory ?

From: Frederic Sarazin (sarazin@triumf.ca)
Date: Thu May 30 2002 - 21:12:44 MEST


Dear ROOTers,

I want to retrieve myHist and keep it in memory
EXACTLY as it was on disk.

Please consider the following example:

root [0] TFile *f = new TFile("test.root")
root [1] TH1 *myHist = f->Get("myHist")
root [2] myHist->SetDirectory(0)
root [3] f->Close()

I want this part to be treated by my GUI. The user selects
a histogram on disk and decide to transfer it into memory.
The problem is at root[1]...

I have two questions...

1 - Is it possible to "dynamically" cast *myHist with its
true class (in C++)?

2 - in this example, I create a new pointer which happens to have
the same name than myHist... my GUI would need to
create the pointer with the same name than the one on disk.
Is it possible ? Is there a way to really keep an exact copy of
myHist in memory when f is closed (same pointer name) ?

Thanks for your help and thoughts,

Fred



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET