Interface Factory<DetectorType extends Detector,SectorType extends Sector,SuperlayerType extends Superlayer,LayerType extends Layer>
- Type Parameters:
DetectorType- the specific type ofDetectorproduced by theFactorySectorType- the specific type ofSectorproduced by theFactorySuperlayerType- the specific type ofSuperlayerproduced by theFactoryLayerType- the specific type ofLayerproduced by theFactory
- All Superinterfaces:
Showable
- All Known Implementing Classes:
AlertDCFactory,AlertTOFFactory,BSTFactory,CNDFactory,DCFactory,DCFactoryUpdated,DCGeantFactory,ECFactory,FMTFactory,FTCALFactory,FTOFFactory
Detector,
Sector,
Superlayer, or
Layer objects for a specific type of
detector using the factory method pattern.
Detectors are constructed entirely from scratch using using as little hard
coded information (primarily equations). Instead, detectors and their
various components are constructed using a few important constants provided
by a ConstantProvider.
Detectors can be produced in four different coordinate systems via four different methods:
-
CLAS Coordinates:
createDetectorCLAS(ConstantProvider)- Detectors created in CLAS coordinates are in their final nominal positions
- z-axis: parallel to the beam, positive direction is down beam
- y-axis: anti-parallel to gravity, positive direction is "up"
- x-axis: forms a right-handed coordinate system, positive is left
- To Sector: Rotate each sector CCW around the z-axis by sectorId·60° to φ = 0.
-
Sector Coordinates:
createDetectorSector(ConstantProvider)- All sectors from the same detector coincide at φ = 0.
- To CLAS: Rotate each sector CW around z-axis by φ = sectorId·60°.
- To Tilted: Rotate each sector CCW around the y-axis by 25° to θ = 0.
- Exceptions: BST, CND, FTCAL
-
Tilted Coordinates:
createDetectorTilted(ConstantProvider)- The normal of the up-beam surface of each detector is parallel to the z-axis.
- To Sector: Rotate each sector CW around the y-axis by 25°.
- To Local: Translate each superlayer’s up-beam surface to z = 0.
- Exceptions: FTOF Panel2, BST, CND
-
Local Coordinates:
createDetectorTilted(ConstantProvider)- All sectors belonging to the same detector coincide.
- No rotations around the x-axis are required to get to CLAS.
- No translations along the x- or y-axis are required to get to CLAS.
- No rotations around the z-axis are required to get the first sector to CLAS.
- The upstream surface of each superlayer is at z=0 and in the xy-plane.
- Layers are in place relative to their respective superlayers and do not require further translations or rotations independently of their superlayer.
- To Tilted: Translate each superlayer’s up-beam surface along the z-axis.
- Exceptions: BST, CND
The Detector,
Sector,
Superlayer, and
Layer construction methods return objects in
Local coordinates.
Factory: Factory
Hierarchy:
Detector →
Sector →
Superlayer →
Layer →
Component
All objects are returned in their nominal positions. For information about
calibration see
Layer.setTransformation(org.jlab.geom.prim.Transformation3D).
Factories have no member variables or initialization procedure. It is acceptable to instantiate a new factory every time one is needed.
However some detectors DO have non-negligible initialization procedures. For example, the BST has 33792 wires, the end points of which are calculated using 67584 line-plane intersections. This can take ~0.5 seconds.
Example usage:
ConstantProvider constants = DataBaseLoader.getConstantsEC();
ECDetector detector;
detector = new ECFactory().createDetectorCLAS(constants);
detector = new ECFactory().createDetectorSector(constants);
detector = new ECFactory().createDetectorTilted(constants);
detector = new ECFactory().createDetectorLocal(constants);
// Constructed in “local” coordinates (varies by detector)
ECSector firstSector = factory.createSector(constants, 0);
ECSuperlayer outerEC = factory.createSuperlayer(constants, 0, 2);
ECLayer wLayer = factory.createLayer(constants, 0, 2, 2);
ConstantProvider dcConstants = DataBaseLoader.getConstantsDC();
DCDetector dc = new DCFactory().createDetectorCLAS(dcConstants);
DCSector sector = dc.getSector(0);
DCSuperlayer superlayer = sector.getSuperlayer(5);
DCLayer layer = superlayer.getLayer(5);
DriftChamberWire wire = layer.getComponent(12);
Point3D wireStart = wire.getLine().origin();
double length = dc.getSector(0).getSuperlayer(0).getLayer(0).getComponent(0).getLength();
int numSectors = dc.getNumSectors();
List midPoints = new ArrayList();
for (DCSector sector : dc.getAllSectors())
for (DCSuperlayer superlayer : sector.getAllSuperlayers())
for (DCLayer layer : sup.getAllLayers())
for (DriftChamberWire wire : layer.getAllComponents())
midPoints.add(wire.getMidpoint());
- Author:
- jnhankins
-
Method Summary
Modifier and TypeMethodDescriptionConstructs a newDetectorin CLAS coordinates using the given constants.Constructs a newDetectorin Local coordinates using the given constants.Constructs a newDetectorin Sector coordinates using the given constants.Constructs a newDetectorin Tilted coordinates using the given constants.createLayer(ConstantProvider cp, int sectorId, int superlayerId, int layerId) Constructs the specifiedLayerin Local coordinates using the given constants.createSector(ConstantProvider cp, int sectorId) Constructs the specifiedSectorin Local coordinates using the given constants.createSuperlayer(ConstantProvider cp, int sectorId, int superlayerId) Constructs the specifiedSuperlayerin Local coordinates using the given constants.getTransformation(ConstantProvider cp, int sector, int superlayer, int layer) Returns a transformation object for given sector, superlayer and layergetType()Returns a string that identifies the specific subtype of this factory.voidshow()InvokesSystem.out.println(this).
-
Method Details
-
createDetectorCLAS
Constructs a newDetectorin CLAS coordinates using the given constants.- Parameters:
cp- the constant provider- Returns:
- a detector in CLAS coordinates
-
createDetectorSector
Constructs a newDetectorin Sector coordinates using the given constants.- Parameters:
cp- the constant provider- Returns:
- a detector in Sector coordinates
-
createDetectorTilted
Constructs a newDetectorin Tilted coordinates using the given constants.- Parameters:
cp- the constant provider- Returns:
- a detector in Tilted coordinates
-
createDetectorLocal
Constructs a newDetectorin Local coordinates using the given constants.- Parameters:
cp- the constant provider- Returns:
- a detector in Local coordinates
-
createSector
Constructs the specifiedSectorin Local coordinates using the given constants.- Parameters:
cp- the constant providersectorId- the sector id of the desired sector- Returns:
- a sector in Local coordinates
-
createSuperlayer
Constructs the specifiedSuperlayerin Local coordinates using the given constants.- Parameters:
cp- the constant providersectorId- the sector id of the desired superlayersuperlayerId- the superlayer id of the desired superlayer- Returns:
- a superlayer in Local coordinates
-
createLayer
Constructs the specifiedLayerin Local coordinates using the given constants.- Parameters:
cp- the constant providersectorId- the sector id of the desired layersuperlayerId- the superlayer id of the desired layerlayerId- the layer id of the desired layer- Returns:
- a layer in Local coordinates
-
getType
String getType()Returns a string that identifies the specific subtype of this factory.- Returns:
- a string naming this factory's type
-
getTransformation
Returns a transformation object for given sector, superlayer and layer- Parameters:
cp-sector-superlayer-layer-- Returns:
-
getDetectorTransform
-
show
void show()InvokesSystem.out.println(this).
-