Ejemplo n.º 1
0
  /**
   * Creates a 1-D Histogram slice of the specified y Bin
   *
   * @param xBin the bin on the y axis to create a slice of
   * @return a slice of the x bins on the specified y bin as a 1-D Histogram
   */
  public H1D sliceX(int xBin) {
    String name = "Slice of " + xBin + " X Bin";
    double xMin = yAxis.min();
    double xMax = yAxis.max();
    int xNum = yAxis.getNBins();
    H1D sliceX = new H1D(name, name, xNum, xMin, xMax);

    for (int x = 0; x < xNum; x++) {
      sliceX.setBinContent(x, this.getBinContent(xBin, x));
    }
    return sliceX;
  }
Ejemplo n.º 2
0
  /**
   * Creates a 1-D Histogram slice of the specified x Bin
   *
   * @param yBin the bin on the x axis to create a slice of
   * @return a slice of the y bins on the specified x bin as a 1-D Histogram
   */
  public H1D sliceY(int yBin) {
    String name = "Slice of " + yBin + " Y Bin";
    double xMin = xAxis.min();
    double xMax = xAxis.max();
    int xNum = xAxis.getNBins();
    H1D sliceY = new H1D(name, name, xNum, xMin, xMax);

    for (int y = 0; y < xNum; y++) {
      sliceY.setBinContent(y, this.getBinContent(y, yBin));
    }

    return sliceY;
  }
Ejemplo n.º 3
0
  /**
   * Creates a projection of the 2D histogram onto the Y Axis, adding up all the x bins for each y
   * bin
   *
   * @return a H1D object that is a projection of the Histogram2D object onto the y-axis
   */
  public H1D projectionY() {
    String name = "Y Projection";
    double yMin = yAxis.min();
    double yMax = yAxis.max();
    int yNum = yAxis.getNBins();
    H1D projY = new H1D(name, yNum, yMin, yMax);

    double height = 0.0;
    for (int y = 0; y < yAxis.getNBins(); y++) {
      height = 0.0;
      for (int x = 0; x < xAxis.getNBins(); x++) {
        height += this.getBinContent(x, y);
      }
      projY.setBinContent(y, height);
    }

    return projY;
  }
Ejemplo n.º 4
0
  /**
   * Creates a projection of the 2D histogram onto the X Axis, adding up all the y bins for each x
   * bin
   *
   * @return a H1D object that is a projection of the Histogram2D object onto the x-axis
   */
  public H1D projectionX() {
    String name = "X Projection";
    double xMin = xAxis.min();
    double xMax = xAxis.max();
    int xNum = xAxis.getNBins();
    H1D projX = new H1D(name, xNum, xMin, xMax);

    double height = 0.0;
    for (int x = 0; x < xAxis.getNBins(); x++) {
      height = 0.0;
      for (int y = 0; y < yAxis.getNBins(); y++) {
        height += this.getBinContent(x, y);
      }
      projX.setBinContent(x, height);
    }

    return projX;
  }