- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getDetectorId()
- getSectorId()
- getSuperlayerId()
- getLayerId()
- getNumComponents()
- addComponent(ComponentType)
- getComponent(int)
- getAllComponents()
- getBoundary()
- getPlane()
- getTransformation()
- setTransformation(Transformation3D)
- onSetTransformation(Transformation3D)
- getCrossSections(Transformation3D)
- getLayerHits(Path3D)
- getHits(Path3D)
- show()
- toString()
Class AbstractLayer<ComponentType extends Component>
- Type Parameters:
ComponentType
- the specific type ofComponent
contained by theLayer
- 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 Component
s, so
Component
s 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 Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractLayer
(DetectorId detectorId, int sectorId, int superlayerId, int layerId, boolean useBoundaryAsHitFilter) Initializes an empty AbstractLayer with the given id. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addComponent
(ComponentType component) Adds a component to this layer.final List
<ComponentType> Returns an unmodifiable list of all components contained in this layer.final Shape3D
Returns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.final ComponentType
getComponent
(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 DetectorId
Returns 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 int
Returns the id of this layer.final int
Returns the number of components contained in in this layer.final Plane3D
getPlane()
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 int
Returns the id of the sector that this layer is contained in.final int
Returns the id of the superlayer that this layer is contained in.final Transformation3D
Returns 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 void
onSetTransformation
(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 void
setTransformation
(Transformation3D transform) Sets the transformation for this layer.void
show()
InvokesSystem.out.println(this)
.toString()
-
Constructor Details
-
AbstractLayer
protected 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 detectorsectorId
- the id of this layer's sectorsuperlayerId
- the id of this layer's superlayerlayerId
- the id of this layeruseBoundaryAsHitFilter
- if true, thegetLayerHits(org.jlab.geom.prim.Path3D)
andgetHits(org.jlab.geom.prim.Path3D)
methods will return empty lists if thePath3D
does not intersects any faces in thisLayer
'sboundary
. This can be useful for performance optimization or used to simulate dead zones between the layer's sensing component's active regions.
-
-
Method Details
-
getDetectorId
Description copied from interface:Layer
Returns the id of the detector that this layer is contained in.- Specified by:
getDetectorId
in interfaceLayer<ComponentType extends Component>
- Returns:
- the id of this layer's detector
-
getSectorId
public final int getSectorId()Description copied from interface:Layer
Returns the id of the sector that this layer is contained in.- Specified by:
getSectorId
in interfaceLayer<ComponentType extends Component>
- Returns:
- the id of this layer's sector
-
getSuperlayerId
public final int getSuperlayerId()Description copied from interface:Layer
Returns the id of the superlayer that this layer is contained in.- Specified by:
getSuperlayerId
in interfaceLayer<ComponentType extends Component>
- Returns:
- the id of this layer's superlayer
-
getLayerId
public final int getLayerId()Description copied from interface:Layer
Returns the id of this layer.- Specified by:
getLayerId
in interfaceLayer<ComponentType extends Component>
- Returns:
- the id of this layer.
-
getNumComponents
public final int getNumComponents()Description copied from interface:Layer
Returns the number of components contained in in this layer.- Specified by:
getNumComponents
in interfaceLayer<ComponentType extends Component>
- Returns:
- the number of components
-
addComponent
Adds 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
-
getComponent
Description copied from interface:Layer
Returns the component associated with the given component id.- Specified by:
getComponent
in interfaceLayer<ComponentType extends Component>
- Parameters:
componentId
- the component id- Returns:
- the component with the specified id
-
getAllComponents
Description copied from interface:Layer
Returns an unmodifiable list of all components contained in this layer.- Specified by:
getAllComponents
in interfaceLayer<ComponentType extends Component>
- Returns:
- an unmodifiable list of components
-
getBoundary
Description copied from interface:Layer
Returns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.- Specified by:
getBoundary
in interfaceLayer<ComponentType extends Component>
- Returns:
- the shape of boundary of the beam-side surface
-
getPlane
Description copied from interface:Layer
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.- Specified by:
getPlane
in interfaceLayer<ComponentType extends Component>
- Returns:
- the up-beam surface plane
-
getTransformation
Description copied from interface:Layer
Returns 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:
getTransformation
in interfaceLayer<ComponentType extends Component>
- Returns:
- a copy of the current transformation
-
setTransformation
Description copied from interface:Layer
Sets 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:
setTransformation
in interfaceLayer<ComponentType extends Component>
- Parameters:
transform
- the new transform- See Also:
-
onSetTransformation
Classes 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:
-
getCrossSections
Description copied from interface:Layer
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
Plane3D
object 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:
getCrossSections
in interfaceLayer<ComponentType extends Component>
- Parameters:
transform
- the transformation- Returns:
- a list of list of lines representing the cross section
- See Also:
-
getLayerHits
Description copied from interface:Layer
Returns 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:
getLayerHits
in interfaceLayer<ComponentType extends Component>
- Parameters:
path
- the path- Returns:
- a list of detector hits
-
getHits
Description copied from interface:Layer
Returns a list of DetecorHits which store information about intersections with components in this superlayer.- Specified by:
getHits
in interfaceLayer<ComponentType extends Component>
- Parameters:
path
- the path- Returns:
- a list of detector hits
-
show
-
toString
-