Changeset 1511 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 09/02/02 15:58:52 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/HistIncl.h
r846 r1511 2 2 3 3 #include <TF1.h> 4 #include <TArrayI.h> 4 5 5 6 #endif // __CINT__ -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1500 r1511 49 49 50 50 #include <TList.h> 51 #include <TArrayF.h> 51 52 #include <TArrayD.h> 52 53 #include <TArrayI.h> … … 482 483 out << " " << GetUniqueName() << ".AddColumn(\"" << (*fData)[i].GetRule() << "\");" << endl; 483 484 } 485 486 const TArrayI MHMatrix::GetIndexOfSortedColumn(Int_t ncol, Bool_t desc) const 487 { 488 TMatrixColumn col(fM, ncol); 489 490 const Int_t n = fM.GetNrows(); 491 492 TArrayF array(n); 493 494 for (int i=0; i<n; i++) 495 array[i] = col(i); 496 497 TArrayI idx(n); 498 TMath::Sort(n, array.GetArray(), idx.GetArray(), desc); 499 500 return idx; 501 } 502 503 void MHMatrix::SortMatrixByColumn(Int_t ncol, Bool_t desc) 504 { 505 TArrayI idx = GetIndexOfSortedColumn(ncol, desc); 506 507 const Int_t n = fM.GetNrows(); 508 509 TMatrix m(n, fM.GetNcols()); 510 for (int i=0; i<n; i++) 511 { 512 TVector vold(n); 513 vold = TMatrixRow(fM, idx[i]); 514 515 TMatrixRow rownew(m, i); 516 rownew = vold; 517 } 518 519 fM = m; 520 } -
trunk/MagicSoft/Mars/mhist/MHMatrix.h
r1489 r1511 9 9 #endif 10 10 11 class TArrayI; 11 12 class MDataArray; 12 13 … … 59 60 void Reassign(); 60 61 62 const TArrayI GetIndexOfSortedColumn(Int_t ncol=0, Bool_t desc=kTRUE) const; 63 void SortMatrixByColumn(Int_t ncol=0, Bool_t desc=kTRUE); 64 61 65 ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events 62 66 };
Note:
See TracChangeset
for help on using the changeset viewer.