Changeset 1829


Ignore:
Timestamp:
03/18/03 18:20:27 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
2 edited

Legend:

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

    r1828 r1829  
    8787// --------------------------------------------------------------------------
    8888//
     89//  Default Constructor
     90//
     91MHMatrix::MHMatrix(const TMatrix &m, const char *name, const char *title)
     92    : fNumRow(m.GetNrows()), fM(m), fData(NULL)
     93{
     94    fName  = name  ? name  : gsDefName.Data();
     95    fTitle = title ? title : gsDefTitle.Data();
     96}
     97
     98// --------------------------------------------------------------------------
     99//
    89100//  Constructor. Initializes the columns of the matrix with the entries
    90101//  from a MDataArray
     
    689700//
    690701Bool_t MHMatrix::DefRefMatrix(const UInt_t refcolumn, const TH1F &thsh,
    691                               const Int_t nmaxevts, TMatrix *rest)
     702                              Int_t nmaxevts, TMatrix *rest)
    692703{
    693704    if (!fM.IsValid())
     
    720731        return kFALSE;
    721732    }
     733
     734    if (nmaxevts==0)
     735        nmaxevts = fM.GetNrows();
    722736
    723737    //
     
    917931//              are not interested in this
    918932//
    919 Bool_t MHMatrix::DefRefMatrix(const Int_t nmaxevts, TMatrix *rest)
     933Bool_t MHMatrix::DefRefMatrix(Int_t nmaxevts, TMatrix *rest)
    920934{
    921935    if (!fM.IsValid())
     
    924938        return kFALSE;
    925939    }
     940
     941    if (nmaxevts>fM.GetNrows())
     942    {
     943        *fLog << err << dbginf << "Number of maximum events exceeds number of events" << endl;
     944        return kFALSE;
     945    }
     946
     947    if (nmaxevts<0)
     948    {
     949        *fLog << err << dbginf << "Number of maximum events < 0" << endl;
     950        return kFALSE;
     951    }
     952
     953    if (nmaxevts==0)
     954        nmaxevts = fM.GetNrows();
    926955
    927956    const Int_t nrows = fM.GetNrows();
  • trunk/MagicSoft/Mars/mhist/MHMatrix.h

    r1828 r1829  
    5555    MHMatrix(const char *name=NULL, const char *title=NULL);
    5656    MHMatrix(MDataArray *mat, const char *name=NULL, const char *title=NULL);
     57    MHMatrix(const TMatrix &m, const char *name=NULL, const char *title=NULL);
    5758    ~MHMatrix();
    5859
     
    100101
    101102    Bool_t DefRefMatrix(const UInt_t refcolumn, const TH1F &thsh,
    102                         const Int_t nmaxevts=0, TMatrix *mrest=NULL);
    103     Bool_t DefRefMatrix(const Int_t nmaxevts=0, TMatrix *mrest=NULL);
     103                        Int_t nmaxevts=0, TMatrix *mrest=NULL);
     104    Bool_t DefRefMatrix(Int_t nmaxevts=0, TMatrix *mrest=NULL);
    104105
    105106    ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events
Note: See TracChangeset for help on using the changeset viewer.