Class NoiseReductionParameters

java.lang.Object
cnuphys.snr.NoiseReductionParameters

public class NoiseReductionParameters extends Object
All the parameters needed for noise reduction. Each superlayer should have its own object. Now should be thread safe.
Author:
heddle
  • Field Details Link icon

    • _analysisLevel Link icon

      public static SNRAnalysisLevel _analysisLevel
    • LEFT_LEAN Link icon

      public static final int LEFT_LEAN
      See Also:
    • RIGHT_LEAN Link icon

      public static final int RIGHT_LEAN
      See Also:
    • leftSegments Link icon

      protected ExtendedWord leftSegments
      cumulative left segments. These are "results". When analysis is complete, this will contain an on bit at any location in layer 1 that is a potential start of a left leaning segment.
    • rightSegments Link icon

      protected ExtendedWord rightSegments
      cumulative right segments. These are "results". When analysis is complete, this will contain an on bit at any location in layer 1 that is a potential start of a right leaning segment.
  • Constructor Details Link icon

    • NoiseReductionParameters Link icon

      public NoiseReductionParameters()
      Create the parameters used for SNR analysis
    • NoiseReductionParameters Link icon

      public NoiseReductionParameters(int allowedMissingLayers, int[] leftLayerShifts, int[] rightLayerShifts)
      Create a NoiseReductionParameter using CLAS12 defaults for the number of superlayers, layers and wires
      Parameters:
      allowedMissingLayers - the number of missing layers permitted.
      leftLayerShifts - the shifts for left leaning tracks. Length should equal numLayers.
      rightLayerShifts - the shifts for right leaning tracks. Length should equal numLayers.
    • NoiseReductionParameters Link icon

      public NoiseReductionParameters(int numLayer, int numWire, int allowedMissingLayers, int[] leftLayerShifts, int[] rightLayerShifts)
      Create a NoiseReductionParameter using defaults for the number of superlayers, layers and wires
      Parameters:
      allowedMissingLayers - the number of missing layers permitted.
      leftLayerShifts - the shifts for left leaning tracks. Length should equal numLayers.
      rightLayerShifts - the shifts for right leaning tracks. Length should equal numLayers.
  • Method Details Link icon

    • getDefaultParameters Link icon

      public static NoiseReductionParameters getDefaultParameters()
      Get a default set of parameters with CLAS-like numbers
      Returns:
      a default set of parameters
    • getAdjacencyThreshold Link icon

      public int getAdjacencyThreshold()
      Get the adjacency threshold, used in stage 2 analysis where we look for clusters. This is used to remove additional noise in the vicinity of segments that do not pass a connectedness test.
      Returns:
      the adjacency threshold
    • setAdjacencyThreshold Link icon

      public void setAdjacencyThreshold(int adjacencyThreshold)
      Set the adjacency threshold, used in stage 2 analysis where we look for clusters. This is used to remove additional noise in the vicinity of segments that do not pass a connectedness test.
      Parameters:
      adjacencyThreshold - hte new threshold
    • getNumLayer Link icon

      public int getNumLayer()
      Get the number of layers per superlayer
      Returns:
      the number of layers per superlayer
    • getNumWire Link icon

      public int getNumWire()
      Get the number of wires per layer
      Returns:
      the number of wires per layer
    • copyEditableParameters Link icon

      public void copyEditableParameters(NoiseReductionParameters source)
      Copy those parameters that can be edited
      Parameters:
      source - the source object.
    • createWorkSpace Link icon

      public void createWorkSpace()
      Create all the workspace needed to remove the noise.
    • isNoiseHit Link icon

      public boolean isNoiseHit(int layer, int wire)
      Checks whether a given wire has a noise hit. Only sensible if analysis is complete.
      Parameters:
      layer - the 0-based layer 0..5
      wire - the 0-base wire 0..
      Returns:
      true if this was a noise hit--i.e., it is in the raw data but not the analyzed data
    • clear Link icon

      public void clear()
      Clear all data
    • getAllowedMissingLayers Link icon

      public int getAllowedMissingLayers()
      Returns the number of allowed missing layers.
      Returns:
      the number of allowed missing layers.
    • getLeftLayerShifts Link icon

      public int[] getLeftLayerShifts()
      Get the layer shifts for left leaning tracks.
      Returns:
      the layer shifts for left leaning tracks.
    • setLeftLayerShifts Link icon

      public void setLeftLayerShifts(int[] shifts)
      Set the left layer shifts used for left leaning segments
      Parameters:
      shifts - the left layer shifts
    • getRightLayerShifts Link icon

      public int[] getRightLayerShifts()
      Get the layer shifts for right leaning tracks.
      Returns:
      the layer shifts for right leaning tracks.
    • setRightLayerShifts Link icon

      public void setRightLayerShifts(int[] shifts)
      Set the right layer shifts used for right leaning segments
      Parameters:
      shifts - the right layer shifts
    • getLeftSegments Link icon

      public ExtendedWord getLeftSegments()
      Get the left leaning segment staring wire positions. This is meaningful only if the analysis has been performed.
      Returns:
      the left leaning segment staring wire positions.
    • getRightSegments Link icon

      public ExtendedWord getRightSegments()
      Get the right leaning segment staring wire positions.This is meaningful only if the analysis has been performed.
      Returns:
      the right leaning segment staring wire positions.
    • packHit Link icon

      public void packHit(int layer, int wire)
      pack a hit into the raw data
      Parameters:
      layer - the 0-based layer
      wire - the 0-based wire
    • setPackedData Link icon

      public void setPackedData(ExtendedWord[] packedData)
      Set new raw data. The analyzed flag is set to false.
      Parameters:
      rawData - the new raw data to set.
    • isAnalyzed Link icon

      public boolean isAnalyzed()
      Returns:
      the analyzed flag. If tue the data have been anaylzed, and noise bits removed from the packedData arrays.
    • removeNoise Link icon

      public void removeNoise()
      Remove the noise. This is the actual algorithm.
    • maxShift Link icon

      public int maxShift(int direction)
      Get the maximum shift for a given direction. It is assumed that this is in the shift for the last layer.
      Parameters:
      direction - either left (0) or right (1)
      Returns:
      the maximum shift for a given direction
    • addHitsInMask Link icon

      public void addHitsInMask(int layer, int wire, int direction, WireList list)
      Add wires that are in the masks of the clean data corresponding to a given wire (segment candidate start), layer, and direction
      Parameters:
      layer - the 0 based layer, for CLAS12 [0..5]
      wire - the 0 based wire, for CLAS12 [0..111]
      direction - either left (0) or right (1)
      list - the list to add to
    • missingLayersUsed Link icon

      public int missingLayersUsed(int direction, int wire)
      Get the number of missing layers used to find a segment candidate starting at the given wire in layer 1 (1..6)
      Parameters:
      direction - LEFT_LEAN (0) or RIGHT_LEAN (1)
      wire - the 0-based wire
      Returns:
      the number of missing layers used at that position
    • getRawOccupancy Link icon

      public double getRawOccupancy()
      Get the occupancy of the raw data. This should only be used by ced proper, not the test program.
      Returns:
      the occupancy of the raw. Multiply by 100 to express as percent.
    • getNoiseReducedOccupancy Link icon

      public double getNoiseReducedOccupancy()
      Get the occupancy of the packed data. This should only be used by ced proper, not the test program.
      Returns:
      the occupancy of the raw. Multiply by 100 to express as percent.
    • setAllowedMissingLayers Link icon

      public void setAllowedMissingLayers(int allowedMissingLayers)
      Set the number of allowed missing layers.
      Parameters:
      allowedMissingLayers - the number to set
    • totalRawHitCount Link icon

      public int totalRawHitCount()
      Total number of raw hits (all layers in this chamber/superlayer)
      Returns:
      number of raw hits
    • totalReducedHitCount Link icon

      public int totalReducedHitCount()
      Total number of noise reduced hits (all layers in this chamber/superlayer)
      Returns:
      number of noise reduced hits
    • setSNRAnalysisLevel Link icon

      public static void setSNRAnalysisLevel(SNRAnalysisLevel level)
      Set the analysis level OneStage: the classic SNR noise analysis TwoStage: the centers of mass are used to remove noise within the masks but disjoint from the segment (hopefully). This might result in the loss of the segment!
      Parameters:
      level - new level
    • getClusterFinder Link icon

      public SNRClusterFinder getClusterFinder()
      Get the cluster finder
      Returns:
      ther cluster finder
    • computeAdjacency Link icon

      public int computeAdjacency(int layer, int wire)
      Used in second stage analysis. Adjaceny counts that are within "del" from the given wire, where del is 1 for the layer the wire is in an increases by 1 for every layer as you move up or down. Thus for CLAS12, del is [1..5]
      Parameters:
      layer - the 0-based layer, for CLAS12 [0..5]
      wire - the 0-base wire, for CLAS12 [0..111]
      Returns:
      the adjacency value
    • getClusters Link icon

      public ArrayList<SNRCluster> getClusters()
      Get the list of clusters
      Returns:
      the list of clusters
    • setLookForTracks Link icon

      public static void setLookForTracks(boolean lookForTracks)
      Deprecated.
      doesn't do anything, kept for backwards capability.
      Parameters:
      lookForTracks -