Hello Rooters,
I’m having a problem with a null pointer being returned when I try to retrieve the contours from a TH2D.
I have attached a sample script which illustrates my problem, but here is a brief excerpt of the sequence that is causing me trouble (assume TH2D* HistStreamFn is defined):
HistStreamFn->Draw("CONT LIST");
// Get Contours
TObjArray *conts = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
if (conts == NULL){
printf("***No Contours Were Extracted!\n");
TotalConts = 0;
}
else{
TotalConts = conts->GetSize();
}
On the first run, conts is null, but repeating the GetListOfSpecials command in the interpreter returns a valid and correct pointer to the contours. This also occurs when running the script a 2nd time.
I suspect this is the result of a multithreading issue since I can successfully retrieve the TObjArray pointer on repeated attempts, but it could also be something I’m doing wrong.
If anyone can shed some light on this I would really appreciate it!
Josh de Bever
CSI Medical Physics Group
The University of Western Ontario
London, Ontario, Canada
System: Mac OSX, ROOT v4.00/04, Single Processor
ROOTtest2.C (2.93 KB)