Interface Layer<ComponentType extends Component>
- Type Parameters:
ComponentType
- the specific type ofComponent
contained by theLayer
- All Superinterfaces:
Showable
- All Known Implementing Classes:
AbstractLayer
,AlertDCLayer
,AlertTOFLayer
,BSTLayer
,CNDLayer
,DCLayer
,ECLayer
,FMTLayer
,FTCALLayer
,FTOFLayer
,FTOFLayerMesh
The primary purpose of a Layer
object is to provide convenient
methods for accessing to the Component
objects it contains.
Factory: Factory
Hierarchy:
Detector
→
Sector
→
Superlayer
→
Layer
→
Component
Layer
contains a Plane3D
called plane
on
its up-beam surface 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.
Layer
also contains a Shape3D
called
boundary
that approximately defines the target-side
surface using a set of triangular faces.
Layer
handles coordinate systems and alignment calibration for
detectors using the methods getTransformation()
and
setTransformation(org.jlab.geom.prim.Transformation3D)
.
To learn how to create a Layer
and find much more information see
Factory
.
- Author:
- jnhankins
-
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable list of all components contained in this layer.Returns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.getComponent
(int componentId) Returns the component associated with the given component id.getCrossSections
(Transformation3D transformation) Returns a list of lists of lines such that each of the inner lists contains the cross section lines for a single component.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.int
Returns the id of this layer.int
Returns the number of components contained in in this layer.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.int
Returns the id of the sector that this layer is contained in.int
Returns the id of the superlayer that this layer is contained in.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.getType()
Returns a string that identifies the specific subtype of this layer.void
setTransformation
(Transformation3D transform) Sets the transformation for this layer.void
show()
InvokesSystem.out.println(this)
.
-
Method Details
-
getDetectorId
DetectorId getDetectorId()Returns the id of the detector that this layer is contained in.- Returns:
- the id of this layer's detector
-
getSectorId
int getSectorId()Returns the id of the sector that this layer is contained in.- Returns:
- the id of this layer's sector
-
getSuperlayerId
int getSuperlayerId()Returns the id of the superlayer that this layer is contained in.- Returns:
- the id of this layer's superlayer
-
getLayerId
int getLayerId()Returns the id of this layer.- Returns:
- the id of this layer.
-
getNumComponents
int getNumComponents()Returns the number of components contained in in this layer.- Returns:
- the number of components
-
getComponent
Returns the component associated with the given component id.- Parameters:
componentId
- the component id- Returns:
- the component with the specified id
-
getAllComponents
List<ComponentType> getAllComponents()Returns an unmodifiable list of all components contained in this layer.- Returns:
- an unmodifiable list of components
-
getBoundary
Shape3D getBoundary()Returns a Shape3D object that approximately defines the target-side surface of this layer using a set of triangular faces.- Returns:
- the shape of boundary of the beam-side surface
-
getPlane
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.- Returns:
- the up-beam surface plane
-
getCrossSections
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- Parameters:
transformation
- the transformation- Returns:
- a list of list of lines representing the cross section
- See Also:
-
getLayerHits
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.- Parameters:
path
- the path- Returns:
- a list of detector hits
-
getHits
Returns a list of DetecorHits which store information about intersections with components in this superlayer.- Parameters:
path
- the path- Returns:
- a list of detector hits
-
getTransformation
Transformation3D getTransformation()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);
- Returns:
- a copy of the current transformation
-
setTransformation
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
getTransformation()
.- Parameters:
transform
- the new transform- See Also:
-
getType
String getType()Returns a string that identifies the specific subtype of this layer.- Returns:
- a string naming this layer's type
-
show
-