/* ======================================================================== *\
!
! *
! * This file is part of MARS, the MAGIC Analysis and Reconstruction
! * Software. It is distributed to you in the hope that it can be a useful
! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
! * It is distributed WITHOUT ANY WARRANTY.
! *
! * Permission to use, copy, modify and distribute this software and its
! * documentation for any purpose is hereby granted without fee,
! * provided that the above copyright notice appear in all copies and
! * that both that copyright notice and this permission notice appear
! * in supporting documentation. It is provided "as is" without express
! * or implied warranty.
! *
!
!
!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
!
!   Copyright: MAGIC Software Development, 2000-2001
!
!
\* ======================================================================== */


//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// MArray                                                                   //
//                                                                          //
// This is an abstract base class for TObject derived Arrays. In principal  //
// it is almost the same than TArray. The difference is that this array     //
// base classed is derived from TObject which makes storage of variable     //
// sized arrays possible with splitlevel=1.                                 //
//                                                                          //
// This should not be needed anymore for root >3.00                         //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
#include "MArray.h"

#include <TArrayF.h>
#include <TArrayD.h>

ClassImp(MArray);

// --------------------------------------------------------------------------
//
//  Cuts the last entries of an array containing only zeros.
//
void MArray::StripZeros(TArrayD &arr)
{
    const Int_t n = arr.GetSize();

    for (Int_t i=n-1; i>=0; i--)
        if (arr[i] != 0)
        {
            arr.Set(i+1);
            break;
        }
}

// --------------------------------------------------------------------------
//
//  Cuts the last entries of an array containing only zeros.
//
void MArray::StripZeros(TArrayF &arr)
{
    const Int_t n = arr.GetSize();

    for (Int_t i=n-1; i>=0; i--)
        if (arr[i] != 0)
        {
            arr.Set(i+1);
            break;
        }
}
