Hello
I have defined a sortable histogram class, derived from TH1F, which will
sort based on the maximum bin content. My first try at writing the IsEqual and
Compare functions are as follows
Bool_t TH1Fs::IsEqual(TObject *obj)
{
Float_t a = GetMaximum();
Float_t b = ((TH1F*)obj)->GetMaximum();
return ( a == b ) ;
}
Int_t TH1Fs::Compare(TObject* obj)
{
Float_t a = TH1F::GetMaximum();
Float_t b = ((TH1F*)obj)->GetMaximum();
return ( (a == b) ? 0 : ( (a > b) ? 1 : -1 ) ) ;
}
I then load up a TObjArray with TH1Fs objects and call the Sort function, but
it crashes in IsEqual when it tries to call
Float_t b = ((TH1F*)obj)->GetMaximum();
The cast seems to match the one in define in TObjNum of
http://root.cern.ch/root/html/examples/tcollex.C.html, except the example
referenced a data member and did not call a function.
What am I missing? Thanks for any help.
_____________
Dr. Anthony A. Faust | Anthony.Faust@dres.dnd.ca
Defence Research Establishment Suffield | PH: (403) 544-5362
Box 4000, Medicine Hat, Alberta, CANADA T1A 8K6 | FAX: (403) 544-4704
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET