Changeset 1511
- Timestamp:
- 09/02/02 15:58:52 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1509 r1511 1 1 -*-*- END -*-*- 2 3 2002/09/02: Thomas Bretz 4 5 * mhist/MHMatrix.[h,cc]: 6 - added GetIndexdOfSortedColumn 7 - added SortMatrixByColumn 8 9 * mhist/HistIncl.h: 10 - added TArrayI.h (for MHMatrix.h) 11 12 2 13 3 14 2002/08/19: Thomas Bretz … … 28 39 - added comments 29 40 - added another sanity check in SetBinning(TH1*,TH1*) 41 30 42 31 43 -
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.