Changeset 2133 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
05/22/03 18:27:22 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2132 r2133  
    11                                                 -*-*- END OF LINE -*-*-
    22
    3 
     3 2003/05/22: Abelardo Moralejo
     4
     5   * mhist/MHMatrix.[h,cc]
     6     - add member function ShuffleRows() to randomize the order of the
     7       matrix rows. This is useful for instance for the random forest,
     8       (See RanForest.C) when we feed a hadron training sample with
     9       both protons and helium nuclei: if they are ordered (first all
     10       events of one type, then those of the other) the method does not
     11       seem to work well. Any other kind of ordering might be harmful
     12       as well (in theta, phi or whatever).
    413
    514 2003/05/22: Wolfgang Wittek
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r2128 r2133  
    10831083    return i!=0;
    10841084}
     1085
     1086// --------------------------------------------------------------------------
     1087//
     1088// ShuffleEvents. Shuffles the order of the matrix rows.
     1089//
     1090//
     1091void MHMatrix::ShuffleRows(UInt_t seed)
     1092{
     1093  TRandom rnd(seed);
     1094
     1095  for (Int_t irow = 0; irow < fNumRow; irow++)
     1096    {
     1097      Int_t jrow = rnd.Integer(fNumRow);
     1098
     1099      for (Int_t icol = 0; icol < fM.GetNcols(); icol++)
     1100        {
     1101          Real_t tmp = fM(irow,icol);
     1102          fM(irow,icol) = fM(jrow,icol);
     1103          fM(jrow,icol) = tmp;
     1104        }
     1105    }
     1106
     1107  *fLog << warn << this->GetName() << " : Attention! Matrix rows have been shuffled." << endl;
     1108
     1109}
  • trunk/MagicSoft/Mars/mhist/MHMatrix.h

    r2043 r2133  
    112112    Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    113113
     114    void ShuffleRows(UInt_t seed);
     115
    114116    ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events
    115117};
Note: See TracChangeset for help on using the changeset viewer.