Class AbstractDetector<SectorType extends Sector>

java.lang.Object
org.jlab.geom.abs.AbstractDetector<SectorType>
Type Parameters:
SectorType - the specific type of Sector contained by the Detector
All Implemented Interfaces:
Detector<SectorType>, Showable
Direct Known Subclasses:
AlertDCDetector, AlertTOFDetector, BSTDetector, BSTRing, CNDDetector, DCDetector, ECDetector, FMTDetector, FTCALDetector, FTOFDetector, FTOFDetectorMesh

public abstract class AbstractDetector<SectorType extends Sector> extends Object implements Detector<SectorType>
This class provides a skeletal implementation of the Detector interface to minimize the effort required to implement a Detector.

To implement a Detector, the programmer needs only to extend this class and provide implementations for the Detector.getType() method.

Initially the Detector will contain no Sectors, so Sectors must be added to the Detector after AbstractDetector's constructor has been invoked via the addSector(org.jlab.geom.base.Sector) method.

Author:
jnhankins
  • Constructor Details Link icon

    • AbstractDetector Link icon

      protected AbstractDetector(DetectorId detectorId)
      Initializes an empty AbstractDetector with the given id.
      Parameters:
      detectorId - the id of this detector
  • Method Details Link icon

    • getDetectorId Link icon

      public final DetectorId getDetectorId()
      Description copied from interface: Detector
      Returns the id of this detector. This id is a DetectorID which is an enumeration type that uniquely identifies this detector. To find an integer id associated with this detector, call getDetectorId.getIdNumber().
      Specified by:
      getDetectorId in interface Detector<SectorType extends Sector>
      Returns:
      the id of this detector
    • getNumSectors Link icon

      public final int getNumSectors()
      Description copied from interface: Detector
      Returns the number of sectors contained in this detector.
      Specified by:
      getNumSectors in interface Detector<SectorType extends Sector>
      Returns:
      the number of sectors
    • addSector Link icon

      public final void addSector(SectorType sector)
      Adds a sector to this detector. If a sector with the same id is contained in this detector then the preexisting sector is replaced by the given sector. Intended for use by detector factories.
      Parameters:
      sector - the sector to add
    • getSector Link icon

      public final SectorType getSector(int sectorId)
      Description copied from interface: Detector
      Returns the sector associated with the given sector id.
      Specified by:
      getSector in interface Detector<SectorType extends Sector>
      Parameters:
      sectorId - the sector id
      Returns:
      the sector with the specified id
    • getAllSectors Link icon

      public final List<SectorType> getAllSectors()
      Description copied from interface: Detector
      Returns an unmodifiable list of all of the sectors contained in this detector.
      Specified by:
      getAllSectors in interface Detector<SectorType extends Sector>
      Returns:
      an unmodifiable list of all sectors
    • getCrossSections Link icon

      public final List<List<Line3D>> getCrossSections(Transformation3D transform)
      Description copied from interface: Detector
      Returns a list of lists of lines such that each of the inner lists contains the cross section lines for a single component.

      This method takes a Transformation3D object as an argument, then constructs a new Plane3D object in the xy-plane and applies the transformation to the plane. The intersection of the detector's component's shapes with the transformed plane is then calculated and stored in a list of lists of lines of lines. The inverse of the transformation is then applied to each line ensuring that each returned line is in the xy-plane

      Specified by:
      getCrossSections in interface Detector<SectorType extends Sector>
      Parameters:
      transform - the transformation
      Returns:
      a list of list of lines representing the cross section
      See Also:
    • getLayerHits Link icon

      public List<DetectorHit> getLayerHits(Path3D path)
      Description copied from interface: Detector
      Returns a list of DetecorHits which store information about intersections with layer surface boundaries in this detector. The component ids stored in the detector hits will all be set to -1 to indicate that detector hit does not specify a specific component.
      Specified by:
      getLayerHits in interface Detector<SectorType extends Sector>
      Parameters:
      path - the path
      Returns:
      a list of detector hits
    • getHits Link icon

      public List<DetectorHit> getHits(Path3D path)
      Description copied from interface: Detector
      Returns a list of DetecorHits which store information about intersections with components in this detector.
      Specified by:
      getHits in interface Detector<SectorType extends Sector>
      Parameters:
      path - the path
      Returns:
      a list of detector hits
    • show Link icon

      public void show()
      Description copied from interface: Detector
      Invokes System.out.println(this).
      Specified by:
      show in interface Detector<SectorType extends Sector>
      Specified by:
      show in interface Showable
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object