Package cnuphys.snr.test
Class ChamberTest
java.lang.Object
cnuphys.snr.test.ChamberTest
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChamberTest
(DetectorTest detectorTest, int index, NoiseReductionParameters parameters, Rectangle2D.Double boundary) Create a test chamber--rectangular with uniform rectangular cells. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
bracketTrack
(TrackTest tt, int layer, int[] bracket) Bracket the range of wires that might be intersected by the track.protected void
cellBounds
(Rectangle2D.Double world, Rectangle local, int layer, int wire, Rectangle cell) Fill in a pixel rectangle with the cell pixel.protected void
cellRangeWorldBounds
(int layer, int minwire, int maxwire, Rectangle2D.Double wr) Get the world boundary of a range of cells.protected void
cellWorldBounds
(int layer, int wire, Rectangle2D.Double wr) Get the world boundary of a cell.void
clear all the hitsboolean
contains
(Point pp, Rectangle2D.Double world, Rectangle local) See if the pixel point is within the screen boundary of the chamber.protected HitTest
createHit
(int layer, int wire, HitTest.HitType type) Create a hitvoid
draw
(Graphics g, Rectangle2D.Double world, Rectangle local) Draw the chamber.void
drawAfter
(Graphics g, Rectangle2D.Double world, Rectangle local) Draw the chamber.protected void
drawCellOutlines
(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc) Draw all the cell outlines efficiently.protected void
drawLeftSegmentCandidates
(Graphics g, Rectangle2D.Double world, Rectangle local) Draw the segment candidate indicationsprotected void
drawLeftSegmentOutline
(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc) protected void
drawRightSegmentCandidates
(Graphics g, Rectangle2D.Double world, Rectangle local) Draw the segment candidate indicationsprotected void
drawRightSegmentOutline
(Graphics g, Rectangle2D.Double world, Rectangle local, Color fc) feedback
(Point pp, Rectangle2D.Double world, Rectangle local) Get a mouse over feedback string.findHit
(int layer, int wire) See if there is a hit at that spot.void
forceHit
(int layerOneBased, int wireOneBased) void
Generate random noiseGet the rectangular boundary of the chamber in world coordinates.getBounds
(Rectangle2D.Double world, Rectangle local) Obtains the bounding rectangle.protected Color
getHitColor
(HitTest ht) Get the color for a hitgetName()
Get the number of name in this chamber.int
Get the total number of hits.int
int
int
int
double
Get the fractional raw occupancy of this chamber.double
Get the fractional cleaned occupancy of this chamber.int
Get the total number of wires.void
Generate hits from a straight line trackvoid
Initialize spaceprotected void
layerWorldBounds
(int layer, Rectangle2D.Double wr) Get the world boundary of a layer.protected void
leftSegmentBounds
(Rectangle2D.Double world, Rectangle local, int wire, Rectangle cell) Get the bounds for drawing whether there is a potential left segment herevoid
Load all the hits into the bit data for noise reduction.void
markHits()
Mark the hit type for each hitvoid
Apply the noise reduction algorithm.protected void
rightSegmentBounds
(Rectangle2D.Double world, Rectangle local, int wire, Rectangle cell) Get the bounds for drawing whether there is a potential right segment hereprotected String
shiftString
(String prompt, int[] shifts) protected boolean
trackIntersectsLayer
(int layer, TrackTest tt) Check if a track intersects a layer.protected boolean
trackIntersectsRange
(int layer, int minwire, int maxwire, TrackTest tt) Check if a track intersects a range of wires.
-
Field Details
-
_maskFillLeft
-
_maskFillRight
-
_almostTransparent
-
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 collectionname
- the name of the chamber.boundary
- the rectangular boundary in world coordinates.
-
-
Method Details
-
draw
Draw the chamber.- Parameters:
g
- the Graphics context.world
- the world systemlocal
- the local system
-
drawAfter
Draw the chamber.- Parameters:
g
- the Graphics context.world
- the world systemlocal
- the local system
-
drawCellOutlines
Draw all the cell outlines efficiently.- Parameters:
g
- the graphics context.world
- the world system.local
- the local system.fc
- the fill color, can benull
.
-
drawLeftSegmentCandidates
Draw the segment candidate indications- Parameters:
g
-world
-local
-candidates
-
-
drawRightSegmentCandidates
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
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
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
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
Get the world boundary of a layer.- Parameters:
layer
- the layer index [0..]wr
- will be set to the layer boundary.
-
feedback
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
-
getBounds
Obtains the bounding rectangle.- Parameters:
world
- the world system.local
- the local system.- Returns:
- the bounding screen rectangle.
-
contains
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
Get the rectangular boundary of the chamber in world coordinates.- Returns:
- the rectangular boundary of the chamber in world coordinates.
-
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
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
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
Generate hits from a straight line track- Parameters:
world
- the world system.local
- the local system.tt
- the track used to generate hits.
-
bracketTrack
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
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
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.
-