Class ChamberTest

java.lang.Object
cnuphys.snr.test.ChamberTest

public class ChamberTest extends Object
  • Field Details

    • _maskFillLeft

      public static final Color _maskFillLeft
    • _maskFillRight

      public static final Color _maskFillRight
    • _almostTransparent

      public static final Color _almostTransparent
    • boundary

      public Rectangle2D.Double boundary
      A world coordinate rectangular boundary.
    • index

      public int index
  • Constructor Details

    • ChamberTest

      public ChamberTest(DetectorTest detectorTest, int index, NoiseReductionParameters parameters, Rectangle2D.Double boundary)
      Create a test chamber--rectangular with uniform rectangular cells.
      Parameters:
      index - the index in the DetectorTest collection
      name - the name of the chamber.
      boundary - the rectangular boundary in world coordinates.
  • Method Details

    • draw

      public void draw(Graphics g, Rectangle2D.Double world, Rectangle local)
      Draw the chamber.
      Parameters:
      g - the Graphics context.
      world - the world system
      local - the local system
    • drawAfter

      public void drawAfter(Graphics g, Rectangle2D.Double world, Rectangle local)
      Draw the chamber.
      Parameters:
      g - the Graphics context.
      world - the world system
      local - the local system
    • drawCellOutlines

      protected void drawCellOutlines(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc)
      Draw all the cell outlines efficiently.
      Parameters:
      g - the graphics context.
      world - the world system.
      local - the local system.
      fc - the fill color, can be null.
    • drawLeftSegmentCandidates

      protected void drawLeftSegmentCandidates(Graphics g, Rectangle2D.Double world, Rectangle local)
      Draw the segment candidate indications
      Parameters:
      g -
      world -
      local -
      candidates -
    • drawRightSegmentCandidates

      protected void drawRightSegmentCandidates(Graphics g, Rectangle2D.Double world, Rectangle local)
      Draw the segment candidate indications
      Parameters:
      g -
      world -
      local -
      candidates -
    • drawLeftSegmentOutline

      protected void drawLeftSegmentOutline(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc)
    • drawRightSegmentOutline

      protected void drawRightSegmentOutline(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc)
    • getHitColor

      protected Color getHitColor(HitTest ht)
      Get the color for a hit
      Parameters:
      ht - the hit in question
      Returns:
      the fill color to use.
    • cellBounds

      protected void cellBounds(Rectangle2D.Double world, Rectangle local, int layer, int wire, Rectangle cell)
      Fill in a pixel rectangle with the cell pixel.
      Parameters:
      world - the world system.
      local - the local system.
      layer - the layer index [0..]
      wire - the wire index [0..]
      cell - the Rectangle that will be set to the cell boundary.
    • leftSegmentBounds

      protected void leftSegmentBounds(Rectangle2D.Double world, Rectangle local, int wire, Rectangle cell)
      Get the bounds for drawing whether there is a potential left segment here
      Parameters:
      world - the world system.
      local - the local system. * @param layer the layer index [0..]
      wire - the wire index [0..]
      cell - the Rectangle that will be set to the cell boundary.
    • rightSegmentBounds

      protected void rightSegmentBounds(Rectangle2D.Double world, Rectangle local, int wire, Rectangle cell)
      Get the bounds for drawing whether there is a potential right segment here
      Parameters:
      world - the world system.
      local - the local system. * @param layer the layer index [0..]
      wire - the wire index [0..]
      cell - the Rectangle that will be set to the cell boundary.
    • cellWorldBounds

      protected void cellWorldBounds(int layer, int wire, Rectangle2D.Double wr)
      Get the world boundary of a cell.
      Parameters:
      layer - the layer index [0..]
      wire - the wire index [0..]
      wr - will be set to the cell boundary.
    • cellRangeWorldBounds

      protected void cellRangeWorldBounds(int layer, int minwire, int maxwire, Rectangle2D.Double wr)
      Get the world boundary of a range of cells.
      Parameters:
      layer - the layer index [0..]
      minwire - the min wire index [0..]
      maxwire - the max wire index [minwire..]
      wr - will be set to the cell range boundary.
    • layerWorldBounds

      protected void layerWorldBounds(int layer, Rectangle2D.Double wr)
      Get the world boundary of a layer.
      Parameters:
      layer - the layer index [0..]
      wr - will be set to the layer boundary.
    • feedback

      public String feedback(Point pp, Rectangle2D.Double world, Rectangle local)
      Get a mouse over feedback string.
      Parameters:
      pp - the mouse location.
      world - the world system.
      local - the local system.
      Returns:
      the feedback string, or null if not over any cell.
    • shiftString

      protected String shiftString(String prompt, int[] shifts)
    • getBounds

      public Rectangle getBounds(Rectangle2D.Double world, Rectangle local)
      Obtains the bounding rectangle.
      Parameters:
      world - the world system.
      local - the local system.
      Returns:
      the bounding screen rectangle.
    • contains

      public boolean contains(Point pp, Rectangle2D.Double world, Rectangle local)
      See if the pixel point is within the screen boundary of the chamber.
      Parameters:
      pp - the pixel point.
      world - the world system.
      local - the local system.
      Returns:
      true if the point is conatined within the cjamber boundary.
    • getBoundary

      public Rectangle2D.Double getBoundary()
      Get the rectangular boundary of the chamber in world coordinates.
      Returns:
      the rectangular boundary of the chamber in world coordinates.
    • getName

      public String getName()
      Get the number of name in this chamber.
      Returns:
      the name of layers.
    • forceHit

      public void forceHit(int layerOneBased, int wireOneBased)
    • generateNoise

      public void generateNoise()
      Generate random noise
    • loadBitData

      public void loadBitData()
      Load all the hits into the bit data for noise reduction.
    • removeNoise

      public void removeNoise()
      Apply the noise reduction algorithm.
    • markHits

      public void markHits()
      Mark the hit type for each hit
    • createHit

      protected HitTest createHit(int layer, int wire, HitTest.HitType type)
      Create a hit
      Parameters:
      layer - the layer in question.
      wire - the wire in question.
      type - the type of hit.
      Returns:
      the created hit.
    • initializeSpace

      public void initializeSpace()
      Initialize space
    • findHit

      public HitTest findHit(int layer, int wire)
      See if there is a hit at that spot.
      Parameters:
      layer - the layer to check.
      wire - the wire to check.
      Returns:
      the hit at the given layer and wire, or null if there is none.
    • hitsFromTrack

      public void hitsFromTrack(TrackTest tt)
      Generate hits from a straight line track
      Parameters:
      world - the world system.
      local - the local system.
      tt - the track used to generate hits.
    • bracketTrack

      protected void bracketTrack(TrackTest tt, int layer, int[] bracket)
      Bracket the range of wires that might be intersected by the track. This is to speed up the process.
      Parameters:
      tt - the track in question.
      layer - the layer--already assumed that the layer test has been passed.
      bracket - int array with two elements. Upon return, search from bracket[0] to bracket[1].
    • trackIntersectsLayer

      protected boolean trackIntersectsLayer(int layer, TrackTest tt)
      Check if a track intersects a layer.
      Parameters:
      layer - the layer to check.
      tt - the track to test.
      Returns:
      true if the track intersects the layer.
    • trackIntersectsRange

      protected boolean trackIntersectsRange(int layer, int minwire, int maxwire, TrackTest tt)
      Check if a track intersects a range of wires.
      Parameters:
      layer - the layer to check.
      minwire - the min wire of the range.
      maxwire - the max wire of the range.
      tt - the track to test.
      Returns:
      true if the track intersects the layer.
    • clearHits

      public void clearHits()
      clear all the hits
    • getOccupancy

      public double getOccupancy()
      Get the fractional raw occupancy of this chamber.
      Returns:
      the fractional occupancy of this chamber.
    • getReducedOccupancy

      public double getReducedOccupancy()
      Get the fractional cleaned occupancy of this chamber.
      Returns:
      the fractional occupancy of this chamber.
    • getNumHits

      public int getNumHits()
      Get the total number of hits.
      Returns:
      the number of hits;
    • getNumNoiseHits

      public int getNumNoiseHits()
    • getNumSavedNoiseHits

      public int getNumSavedNoiseHits()
    • getNumRemovedNoiseHits

      public int getNumRemovedNoiseHits()
    • getNumTrackHits

      public int getNumTrackHits()
    • getTotalNumWires

      public int getTotalNumWires()
      Get the total number of wires.
      Returns:
      the total number of wires in all layers.