Ignore:
Timestamp:
10/21/03 09:31:06 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHMatrix.cc

    r2406 r2419  
    8383//
    8484MHMatrix::MHMatrix(const char *name, const char *title)
    85     : fNumRow(0), fData(NULL)
     85    : fNumRows(0), fData(NULL)
    8686{
    8787    fName  = name  ? name  : gsDefName.Data();
     
    9494//
    9595MHMatrix::MHMatrix(const TMatrix &m, const char *name, const char *title)
    96     : fNumRow(m.GetNrows()), fM(m), fData(NULL)
     96    : fNumRows(m.GetNrows()), fM(m), fData(NULL)
    9797{
    9898    fName  = name  ? name  : gsDefName.Data();
     
    106106//
    107107MHMatrix::MHMatrix(MDataArray *mat, const char *name, const char *title)
    108     : fNumRow(0), fData(mat)
     108    : fNumRows(0), fData(mat)
    109109{
    110110    fName  = name  ? name  : gsDefName.Data();
     
    122122        delete fData;
    123123}
     124
     125// --------------------------------------------------------------------------
     126//
     127Bool_t MHMatrix::SetNumRow(Int_t row)
     128    {
     129      if (row>=fM.GetNrows() || row<0) return kFALSE;
     130      fRow = row;
     131      return kTRUE;
     132    }
     133
    124134
    125135// --------------------------------------------------------------------------
     
    205215void MHMatrix::AddRow()
    206216{
    207     fNumRow++;
    208 
    209     if (fM.GetNrows() > fNumRow)
     217    fNumRows++;
     218
     219    if (fM.GetNrows() > fNumRows)
    210220        return;
    211221
     
    237247
    238248    for (int col=0; col<fData->GetNumEntries(); col++)
    239         fM(fNumRow-1, col) = (*fData)(col);
     249        fM(fNumRows-1, col) = (*fData)(col);
    240250
    241251    return kTRUE;
     
    252262    // It's not a fatal error so we don't need to stop PostProcessing...
    253263    //
    254     if (fData->GetNumEntries()==0 || fNumRow<1)
     264    if (fData->GetNumEntries()==0 || fNumRows<1)
    255265        return kTRUE;
    256266
    257     if (fNumRow != fM.GetNrows())
     267    if (fNumRows != fM.GetNrows())
    258268    {
    259269        TMatrix m(fM);
    260         CopyCrop(fM, m, fNumRow);
     270        CopyCrop(fM, m, fNumRows);
    261271    }
    262272
     
    900910    //
    901911    CopyCrop(fM, mnewtmp, evtcount1);
    902     fNumRow = evtcount1;
     912    fNumRows = evtcount1;
    903913
    904914    if (evtcount1 < nmaxevts)
     
    10081018    //
    10091019    CopyCrop(fM, mnewtmp, evtcount1);
    1010     fNumRow = evtcount1;
     1020    fNumRows = evtcount1;
    10111021
    10121022    if (evtcount1 < nmaxevts)
     
    11111121    TVector v(fM.GetNcols());
    11121122    TVector tmp(fM.GetNcols());
    1113     for (Int_t irow = 0; irow<fNumRow; irow++)
    1114     {
    1115         const Int_t jrow = rnd.Integer(fNumRow);
     1123    for (Int_t irow = 0; irow<fNumRows; irow++)
     1124    {
     1125        const Int_t jrow = rnd.Integer(fNumRows);
    11161126
    11171127        v = TMatrixRow(fM, irow);
  • trunk/MagicSoft/Mars/mhist/MHMatrix.h

    r2357 r2419  
    3030    static const TString gsDefTitle; //! Default Title
    3131
    32     Int_t   fNumRow;    // Number of dimensions of histogram
     32    Int_t   fNumRows;   //! Number of rows filled into the matrix (this is NOT the number of rows of the matrix!)
    3333    Int_t   fRow;       //! Present row
    3434    TMatrix fM;         // Matrix to be filled
     
    7575
    7676    Bool_t IsValid() const { return fM.IsValid(); }
    77     Int_t  GetNumRows() const { return fNumRow; }
     77    Int_t  GetNumRows() const { return fM.GetNrows(); }
    7878
    7979    //void Draw(Option_t *opt=NULL);
     
    9494    void SortMatrixByColumn(Int_t ncol=0, Bool_t desc=kTRUE);
    9595
    96     Bool_t SetNumRow(Int_t row) { if (row>=fNumRow || row<0) return kFALSE; fRow = row; return kTRUE; }
     96    Bool_t SetNumRow(Int_t row);
     97 
    9798    Int_t GetNumRow() const { return fRow; };
    9899    Double_t operator[](Int_t col) { return fM(fRow, col); }
Note: See TracChangeset for help on using the changeset viewer.