protected override IHistogram1D InternalSliceY(string title, int indexX1, int indexX2)
        {
            // Attention: our internal definition of bins has been choosen
            // so that this works properly even if the indeces passed in include
            // the underflow or overflow bins
            if (indexX2 < indexX1)
            {
                throw new ArgumentException("Invalid bin range");
            }

            int sliceBins = yAxis.Bins + 2;

            int[]    sliceEntries = new int[sliceBins];
            double[] sliceHeights = new double[sliceBins];
            double[] sliceErrors  = new double[sliceBins];

            for (int i = indexX1; i <= indexX2; i++)
            {
                //for (int j=yAxis.under; j<=yAxis.over; j++)
                for (int j = 0; j < sliceBins; j++)
                {
                    sliceEntries[j] += entries[i][j];
                    sliceHeights[j] += heights[i][j];
                    sliceErrors[j]  += errors[i][j];
                }
            }
            Histogram1D result = new Histogram1D(title, yAxis);

            result.SetContents(sliceEntries, sliceHeights, sliceErrors);
            return(result);
        }
Exemple #2
0
        protected override IHistogram1D InternalSliceX(string title, int indexY1, int indexY2)
        {
            // Attention: our internal definition of bins has been choosen
            // so that this works properly even if the indeces passed in include
            // the underflow or overflow bins
            if (indexY2 < indexY1)
            {
                throw new ArgumentException(Cern.LocalizedResources.Instance().Exception_InvalidBinRange);
            }

            int sliceBins = xAxis.Bins + 2;

            int[]    sliceEntries = new int[sliceBins];
            double[] sliceHeights = new double[sliceBins];
            double[] sliceErrors  = new double[sliceBins];

            //for (int i=yAxis.under; i<=yAxis.over; i++)
            for (int i = 0; i < sliceBins; i++)
            {
                for (int j = indexY1; j <= indexY2; j++)
                {
                    sliceEntries[i] += entries[i][j];
                    sliceHeights[i] += heights[i][j];
                    sliceErrors[i]  += errors[i][j];
                }
            }
            Histogram1D result = new Histogram1D(title, xAxis);

            result.SetContents(sliceEntries, sliceHeights, sliceErrors);
            return(result);
        }