TSortedList problem

Tim Miller (tim.miller@vanderbilt.edu)
Thu, 12 Mar 1998 22:17:48 -0600


I haven't gotten around to v2.0 Beta yet so that means I'm
still somewhere in 1.03 land (Version 1.03/09 16 December 1997)
Anyways, I'm trying to sort these events by multiplicity.
However, there doesn't appear to be any sorting happening at
all. In fact, except for one element, it LOOKS like the array
going in is the same order as the sorted list coming out.

Anyways, I'll try to include all the code I can. I apologize
because it will make the post long(I hope I include everything)

~~~~ALL THAT STUFF DELETED~~~~ (i.e. last second revelation)

On a whim, I tried something out of the blue and BAM! it worked.
When using the TSortedList, it appears that the "ascending"
sorting method is screwed up? The descending works absolutely
fine (Thank goodness, this is the way I needed it). When I
try the following:

~~~~~~~Script1~~~~~~~~~
{
TSortedList *gMultSort;
gMultSort = new TSortedList; // Default is ascending
for(Int_t SortLoop = 0; SortLoop < 10; SortLoop++) {
gMultSort->Add(gMultEvts+SortLoop);
}
TIter next(gMultSort);
for(Int_t ScanLoop = 0; ScanLoop < 10; ScanLoop++) {
cout << "Event Number " << ScanLoop << "\t\t";
cout <<
((TMultClothes*)next())->GetEvent()->GetCounts()->GetMult();
cout << "\t";
cout << gMultEvts[ScanLoop].GetEvent()->GetCounts()->GetMult()
<< endl;
}
}
~~~~Output1
Event Number 0 458 569
Event Number 1 499 499
Event Number 2 569 533
Event Number 3 533 458
Event Number 4 552 552
Event Number 5 483 483
Event Number 6 573 573
Event Number 7 509 509
Event Number 8 512 512
Event Number 9 489 489

~~~~~~~~~~Script2
// All same except the following
gMultSort = new TSortedList(0); // kSortDescending = !kSortAscending
// kSortAscending = kTRUE;

~~~~ OUTPUT 2
Event Number 0 573 569
Event Number 1 569 499
Event Number 2 552 533
Event Number 3 533 458
Event Number 4 512 552
Event Number 5 509 483
Event Number 6 499 573
Event Number 7 489 509
Event Number 8 483 512
Event Number 9 458 489

Perhaps this was a previous bug report? Is this the right line
to send to?

-Tim

-- 
~~ WWW Page:  http://quantum.phy.vanderbilt.edu/~tim/ ~~~~~~~~~~
Tim Miller                   |  "Am I mature enough to get old?"
   Vanderbilt University     |                  --Me.
                             |  "With the amount of horse manure
 Graduate Studies in Physics |   currently in the air, the
   Relativistic Heavy Ions   |   pigs are starting to complain!"
                             |                  --Andrew Rose
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~