protected override IHistogram2D InternalSliceYZ(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 yBins = yAxis.Bins + 2; int zBins = zAxis.Bins + 2; int[][] sliceEntries = new int[yBins, zBins].ToJagged(); double[][] sliceHeights = new double[yBins, zBins].ToJagged(); double[][] sliceErrors = new double[yBins, zBins].ToJagged(); for (int i = indexX1; i <= indexX2; i++) { for (int j = 0; j < yBins; j++) { for (int k = 0; k < zBins; k++) { sliceEntries[j][k] += entries[i][j][k]; sliceHeights[j][k] += heights[i][j][k]; sliceErrors[j][k] += errors[i][j][k]; } } } Histogram2D result = new Histogram2D(title, yAxis, zAxis); result.setContents(sliceEntries, sliceHeights, sliceErrors); return(result); }
protected override IHistogram2D InternalSliceXZ(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 xBins = xAxis.Bins + 2; int zBins = zAxis.Bins + 2; int[][] sliceEntries = new int[xBins, zBins].ToJagged(); double[][] sliceHeights = new double[xBins, zBins].ToJagged(); double[][] sliceErrors = new double[xBins, zBins].ToJagged(); for (int i = 0; i < xBins; i++) { for (int j = indexY1; j <= indexY2; j++) { for (int k = 0; i < zBins; k++) { sliceEntries[i][k] += entries[i][j][k]; sliceHeights[i][k] += heights[i][j][k]; sliceErrors[i][k] += errors[i][j][k]; } } } Histogram2D result = new Histogram2D(title, xAxis, zAxis); result.setContents(sliceEntries, sliceHeights, sliceErrors); return(result); }