Interface Factory<DetectorType extends Detector,SectorType extends Sector,SuperlayerType extends Superlayer,LayerType extends Layer>   
- Type Parameters:
- DetectorType- the specific type of- Detectorproduced by the- Factory
- SectorType- the specific type of- Sectorproduced by the- Factory
- SuperlayerType- the specific type of- Superlayerproduced by the- Factory
- LayerType- the specific type of- Layerproduced by the- Factory
- 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 SummaryModifier 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- 
createDetectorCLASConstructs a newDetectorin CLAS coordinates using the given constants.- Parameters:
- cp- the constant provider
- Returns:
- a detector in CLAS coordinates
 
- 
createDetectorSectorConstructs a newDetectorin Sector coordinates using the given constants.- Parameters:
- cp- the constant provider
- Returns:
- a detector in Sector coordinates
 
- 
createDetectorTiltedConstructs a newDetectorin Tilted coordinates using the given constants.- Parameters:
- cp- the constant provider
- Returns:
- a detector in Tilted coordinates
 
- 
createDetectorLocalConstructs a newDetectorin Local coordinates using the given constants.- Parameters:
- cp- the constant provider
- Returns:
- a detector in Local coordinates
 
- 
createSectorConstructs the specifiedSectorin Local coordinates using the given constants.- Parameters:
- cp- the constant provider
- sectorId- the sector id of the desired sector
- Returns:
- a sector in Local coordinates
 
- 
createSuperlayerConstructs the specifiedSuperlayerin Local coordinates using the given constants.- Parameters:
- cp- the constant provider
- sectorId- the sector id of the desired superlayer
- superlayerId- the superlayer id of the desired superlayer
- Returns:
- a superlayer in Local coordinates
 
- 
createLayerConstructs the specifiedLayerin Local coordinates using the given constants.- Parameters:
- cp- the constant provider
- sectorId- the sector id of the desired layer
- superlayerId- the superlayer id of the desired layer
- layerId- the layer id of the desired layer
- Returns:
- a layer in Local coordinates
 
- 
getTypeString getType()Returns a string that identifies the specific subtype of this factory.- Returns:
- a string naming this factory's type
 
- 
getTransformationReturns a transformation object for given sector, superlayer and layer- Parameters:
- cp-
- sector-
- superlayer-
- layer-
- Returns:
 
- 
getDetectorTransform
- 
showvoid show()InvokesSystem.out.println(this).
 
-