Class AbstractLayer<ComponentType extends Component>
- Type Parameters:
- ComponentType- the specific type of- Componentcontained by the- Layer
- Direct Known Subclasses:
- AlertDCLayer,- AlertTOFLayer,- BSTLayer,- CNDLayer,- DCLayer,- ECLayer,- FMTLayer,- FTCALLayer,- FTOFLayer,- FTOFLayerMesh
Layer interface to minimize the effort required to
 implement a Layer.
 
 To implement a Layer, the programmer needs only to extend this class
 and provide implementations for the
 Layer.getType() method.
 
 Initially the Layer will contain no Components, so
 Components must be added to the Layer after
 AbstractLayer's constructor has been invoked via the
 addComponent(org.jlab.geom.base.Component) method.
 
 To set the boundary, use getBoundary() to retrieve the point and
 modify it accordingly. Similarly, to set the plane, use getPlane().
 
 If the subtyped Layer contains additional geometry data, then, to
 ensure that the additional geometry is properly rotated and translated with
 the Layer, the programmer must also override
 onSetTransformation(org.jlab.geom.prim.Transformation3D) which is
 invoked after setTransformation(org.jlab.geom.prim.Transformation3D)
 is invoked.
 
 AbstractLayer's constructor takes a boolean argument
 useBoundaryAsHitFilter, which, if true, causes the
 getLayerHits(org.jlab.geom.prim.Path3D) and
 getHits(org.jlab.geom.prim.Path3D) methods to return empty lists if
 the Path3D does not intersects any faces in this Layer's
 boundary. This can be useful for performance
 optimization or used to simulate dead zones between the layer's sensing
 component's active regions.
 
 AbstractLayer provides implementations for
 getLayerHits(Path3D) and getHits(Path3D) which test for
 intersections with the layer boundary and component volume shapes
 respectively. However, programmers may in many times need to override these
 methods based on the requirements of the type of detector this type of layer
 belongs to. Further, the these implementations are designed to be general
 enough to handle several types of detectors and components. Consequently,
 they do not contain optimizations that may be made available by the specific
 geometry of a specific detector or component type.
- Author:
- jhankins
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractLayer(DetectorId detectorId, int sectorId, int superlayerId, int layerId, boolean useBoundaryAsHitFilter) Initializes an empty AbstractLayer with the given id.
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddComponent(ComponentType component) Adds a component to this layer.final List<ComponentType>Returns an unmodifiable list of all components contained in this layer.final Shape3DReturns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.final ComponentTypegetComponent(int componentId) Returns the component associated with the given component id.getCrossSections(Transformation3D transform) Returns a list of lists of lines such that each of the inner lists contains the cross section lines for a single component.final DetectorIdReturns the id of the detector that this layer is contained in.Returns a list of DetecorHits which store information about intersections with components in this superlayer.getLayerHits(Path3D path) Returns a list of DetecorHits which store information about intersections with layer surface boundaries in this layer.final intReturns the id of this layer.final intReturns the number of components contained in in this layer.final Plane3DgetPlane()Returns a plane on the up-beam surface of this layer such that in the local coordinate system the reference point is at x = 0 y = 0, the z-coordinate is equal to the the minimum of the z-coordinates of the points in the surface boundary, and the normal is pointing down-beam.final intReturns the id of the sector that this layer is contained in.final intReturns the id of the superlayer that this layer is contained in.final Transformation3DReturns a copy of the transformation that was used to rotate and translate this layer from its initial position in local coordinates to its current position and orientation.protected voidonSetTransformation(Transformation3D transform) Classes extending AbstractLayer should implement onSetTransformation so that any additional geometric data they contain is transformed appropriately when AbstractLayer's onSetTransformation method is invoked.final voidsetTransformation(Transformation3D transform) Sets the transformation for this layer.voidshow()InvokesSystem.out.println(this).toString()
- 
Constructor Details- 
AbstractLayerprotected AbstractLayer(DetectorId detectorId, int sectorId, int superlayerId, int layerId, boolean useBoundaryAsHitFilter) Initializes an empty AbstractLayer with the given id.- Parameters:
- detectorId- the id of this layer's detector
- sectorId- the id of this layer's sector
- superlayerId- the id of this layer's superlayer
- layerId- the id of this layer
- useBoundaryAsHitFilter- if true, the- getLayerHits(org.jlab.geom.prim.Path3D)and- getHits(org.jlab.geom.prim.Path3D)methods will return empty lists if the- Path3Ddoes not intersects any faces in this- Layer's- boundary. This can be useful for performance optimization or used to simulate dead zones between the layer's sensing component's active regions.
 
 
- 
- 
Method Details- 
getDetectorIdDescription copied from interface:LayerReturns the id of the detector that this layer is contained in.- Specified by:
- getDetectorIdin interface- Layer<ComponentType extends Component>
- Returns:
- the id of this layer's detector
 
- 
getSectorIdpublic final int getSectorId()Description copied from interface:LayerReturns the id of the sector that this layer is contained in.- Specified by:
- getSectorIdin interface- Layer<ComponentType extends Component>
- Returns:
- the id of this layer's sector
 
- 
getSuperlayerIdpublic final int getSuperlayerId()Description copied from interface:LayerReturns the id of the superlayer that this layer is contained in.- Specified by:
- getSuperlayerIdin interface- Layer<ComponentType extends Component>
- Returns:
- the id of this layer's superlayer
 
- 
getLayerIdpublic final int getLayerId()Description copied from interface:LayerReturns the id of this layer.- Specified by:
- getLayerIdin interface- Layer<ComponentType extends Component>
- Returns:
- the id of this layer.
 
- 
getNumComponentspublic final int getNumComponents()Description copied from interface:LayerReturns the number of components contained in in this layer.- Specified by:
- getNumComponentsin interface- Layer<ComponentType extends Component>
- Returns:
- the number of components
 
- 
addComponentAdds a component to this layer. If a component with the same id is contained in this layer then the preexisting component is replaced by the given component. Intended for use by detector factories.- Parameters:
- component- the component to add
 
- 
getComponentDescription copied from interface:LayerReturns the component associated with the given component id.- Specified by:
- getComponentin interface- Layer<ComponentType extends Component>
- Parameters:
- componentId- the component id
- Returns:
- the component with the specified id
 
- 
getAllComponentsDescription copied from interface:LayerReturns an unmodifiable list of all components contained in this layer.- Specified by:
- getAllComponentsin interface- Layer<ComponentType extends Component>
- Returns:
- an unmodifiable list of components
 
- 
getBoundaryDescription copied from interface:LayerReturns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.- Specified by:
- getBoundaryin interface- Layer<ComponentType extends Component>
- Returns:
- the shape of boundary of the beam-side surface
 
- 
getPlaneDescription copied from interface:LayerReturns a plane on the up-beam surface of this layer such that in the local coordinate system the reference point is at x = 0 y = 0, the z-coordinate is equal to the the minimum of the z-coordinates of the points in the surface boundary, and the normal is pointing down-beam.- Specified by:
- getPlanein interface- Layer<ComponentType extends Component>
- Returns:
- the up-beam surface plane
 
- 
getTransformationDescription copied from interface:LayerReturns a copy of the transformation that was used to rotate and translate this layer from its initial position in local coordinates to its current position and orientation.Note: The following paragraph uses the term "coordinate system" loosely. The layer's current "coordinate system" is ment to mean the true coordinate system (i.e. local, tilted, sector, or CLAS) with, optionally, additional translations and rotations applied to account for misalignments, etc. Applying the returned translation to a point will transform that point from the local coordinate system to this layer's coordinate system. To translate a point from this layer's current coordinate system. Example: Translating a point back to local coordinates 
 Layer layer = ...Example: Applying alignment calibrations
 Transformation3D inverse = layer.getTransformation().inverse();
 Point3D point = layer.getComponent(0).getMidpoint();
 Point3D local = new Point3D(point);
 inverse.apply(local);
 System.out.println("Current Coords:"+point+" Local Coords: "+local);
 Transformation3D nominal = layer.getTransformation(); Transformation3D calibrated = new Transformation3D(nominal); ... // add rotations and translations to calibrate the alighnment layer.setTransformation(calibrated);
 - Specified by:
- getTransformationin interface- Layer<ComponentType extends Component>
- Returns:
- a copy of the current transformation
 
- 
setTransformationDescription copied from interface:LayerSets the transformation for this layer.Internally, to apply the new transformation, this method will use the inverse of its current transformation to move itself back into local coordinates, it will then move itself to its new coordinates by applying the new the transformation before storing it. For much more information and example codesee Layer.getTransformation().- Specified by:
- setTransformationin interface- Layer<ComponentType extends Component>
- Parameters:
- transform- the new transform
- See Also:
 
- 
onSetTransformationClasses extending AbstractLayer should implement onSetTransformation so that any additional geometric data they contain is transformed appropriately when AbstractLayer's onSetTransformation method is invoked. To implement this method simply apply the given transformation on all of the transformable contained in the layer that are not managed by AbstractLayer. This method is called at the end of AbstractLayer's setTransformation method.- Parameters:
- transform- the full transformation from the old coordinate system to the new coordinate system
- See Also:
 
- 
getCrossSectionsDescription copied from interface:LayerReturns 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 Plane3Dobject in the xy-plane and applies the transformation to the plane. The intersection of the layer'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:
- getCrossSectionsin interface- Layer<ComponentType extends Component>
- Parameters:
- transform- the transformation
- Returns:
- a list of list of lines representing the cross section
- See Also:
 
- 
getLayerHitsDescription copied from interface:LayerReturns a list of DetecorHits which store information about intersections with layer surface boundaries in this layer. 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:
- getLayerHitsin interface- Layer<ComponentType extends Component>
- Parameters:
- path- the path
- Returns:
- a list of detector hits
 
- 
getHitsDescription copied from interface:LayerReturns a list of DetecorHits which store information about intersections with components in this superlayer.- Specified by:
- getHitsin interface- Layer<ComponentType extends Component>
- Parameters:
- path- the path
- Returns:
- a list of detector hits
 
- 
showpublic void show()Description copied from interface:LayerInvokesSystem.out.println(this).
- 
toString
 
-