public class SegmentationManager extends Driver implements ConditionsListener
Sensor
objects and segmentation information.
Typically, a Driver that controls event reconstruction creates an
instance of this class, supplying Segmenter
object that defines virtual
segmentation of the detector, and adds it to the event processing chain before any
drivers that need access to Sensor
s. See org.lcsim.contrib.onoprien.tracking.ExampleDriver1
or org.lcsim.contrib.onoprien.tracking.ExampleDriver2
.
Other drivers that need access to SegmentationManager can fetch it from the event record by calling event.get("SegmentationManager").
By default, Sensor objects are created as needed (that is, when there are hits
in those sensors), and are kept in cache unless JVM starts running out of memory.
If the user needs Sensor objects corresponding to all virtual segments of
the detector to be created before data processing, SegmentationManager
can be asked to do so by a call to set("MAKE_SENSORS_ON_DETECTOR_CHANGE", true).
It usually makes sense to do this if the user plans to use getSensors()
method in the future.
Driver.AbortRunException, Driver.NextEventException
Modifier and Type | Field and Description |
---|---|
private boolean |
_cacheStereoRequests |
private boolean |
_createSensorsOnDetectorChange |
private static SegmentationManager |
_defaultSegMan |
private Navigator |
_navigator |
private boolean |
_notInitialized |
private Segmenter |
_segmenter |
private HashMap<Integer,Sensor> |
_sensorMap |
private HashMap<Integer,SoftReference<Sensor>> |
_sensorWeakMap |
private HashMap<Sensor,List<Sensor>> |
_stereoMap |
HLEVEL_DEFAULT, HLEVEL_FULL, HLEVEL_HIGH, HLEVEL_NORMAL, HLEVEL_OFF
Constructor and Description |
---|
SegmentationManager(Segmenter segmenter)
Constructs a new instance of SegmentationManager.
|
Modifier and Type | Method and Description |
---|---|
void |
conditionsChanged(ConditionsEvent event)
Called by framework whenever ConditionsEvent is dispatched by ConditionsManager.
|
static SegmentationManager |
defaultInstance()
Returns segmentation manager that has been previously set with a call to
setDefaultInstance(SegmentationManager) method. |
private void |
detectorChanged()
Detector-dependent initialization.
|
int |
getChannelID(int sensorID,
Hep3Vector position)
Returns channel ID given sensor ID and global position.
|
int |
getChannelID(Sensor sensor,
Hep3Vector position)
Returns channel ID given sensor and global position.
|
int |
getChannelID(Sensor sensor,
SimTrackerHit hit)
Returns channel ID given sensor and global position extracted from the supplied
SimTrackerHit object. |
Navigator |
getNavigator()
Returns Navigator that provides various convenience methods for use
with Sensors created by this SegmentationManager.
|
Sensor |
getSensor(int sensorID)
Returns
Sensor object corresponding to the given sensor ID. |
Sensor |
getSensor(SimTrackerHit hit)
Converts cell ID and position obtained from
SimTrackerHit object to
sensor ID, and returns Sensor object corresponding to this ID. |
int |
getSensorID(SimTrackerHit hit)
Converts cell ID and position obtained from
SimTrackerHit object to sensor ID. |
Collection<Sensor> |
getSensors()
Returns a collection of Sensors corresponding to all virtual segments of the detector.
|
List<Sensor> |
getStereoPartners(Sensor sensor)
Returns a list of Sensors that might contain hits that should be combined
with hits in the Sensor supplied as an argument to form stereo pairs.
|
void |
process(EventHeader event)
Called by framework to process event.
|
void |
set(String name,
boolean value)
Set any boolean parameter.
|
static void |
setDefaultInstance(SegmentationManager segMan)
Set default segmentation manager.
|
add, clearStatistics, contains, detectorChanged, drivers, endOfData, getConditionsManager, getHistogramLevel, getLogger, getName, getRandom, printStatistics, processChildren, remove, resume, setHistogramLevel, setLogLevel, setRandom, startOfData, suspend
private static SegmentationManager _defaultSegMan
private boolean _notInitialized
private HashMap<Integer,SoftReference<Sensor>> _sensorWeakMap
private Segmenter _segmenter
private Navigator _navigator
private boolean _createSensorsOnDetectorChange
private boolean _cacheStereoRequests
public SegmentationManager(Segmenter segmenter)
segmenter
- Segmenter that defines virtual segmentation of the detector.public void conditionsChanged(ConditionsEvent event)
conditionsChanged
in interface ConditionsListener
event
- The event associated with the change.private void detectorChanged()
public void set(String name, boolean value)
getStereoPartners(org.lcsim.recon.tracking.vsegment.geom.Sensor)
will be cached.
Default: true.name
- Name of parameter to be set. Case is ignored.value
- Value to be assigned to the parameter.NoSuchParameterException
- Thrown if the supplied parameter name is unknown.
Subclasses may catch this exception after a call to super.set()
and set their own parameters.public Navigator getNavigator()
public void process(EventHeader event)
process
in class Driver
event
- The event to be processedDriver.NextEventException
,
Driver.AbortRunException
public Collection<Sensor> getSensors()
public Sensor getSensor(int sensorID)
Sensor
object corresponding to the given sensor ID.public int getChannelID(Sensor sensor, Hep3Vector position)
public int getChannelID(Sensor sensor, SimTrackerHit hit)
SimTrackerHit
object.
Returns -1 if the position does not belong to this sensor.public int getChannelID(int sensorID, Hep3Vector position)
public Sensor getSensor(SimTrackerHit hit)
SimTrackerHit
object to
sensor ID, and returns Sensor
object corresponding to this ID.public int getSensorID(SimTrackerHit hit)
SimTrackerHit
object to sensor ID.
FIXME: should be just return _segmenter.getSensorID(hit);
The rest is a workaround for Detector being created twice bug.public List<Sensor> getStereoPartners(Sensor sensor)
public static void setDefaultInstance(SegmentationManager segMan)
public static SegmentationManager defaultInstance()
setDefaultInstance(SegmentationManager)
method.Copyright © 2016 Linear Collider Detector (LCD). All rights reserved.