public final class EpicsData extends Object
read(EventHeader)
method should be used to create one of these objects
from an LCIO event. The keys are stored in the string parameters of the collection, because
GenericObject
cannot persist string data.Modifier and Type | Field and Description |
---|---|
private Map<String,Double> |
dataMap
The mapping of EPICS variable names to their double values.
|
private static String |
DEFAULT_COLLECTION_NAME
Default collection name in the LCSim events.
|
private static Map<String,float[]> |
DUMMY_FLOAT_MAP
Dummy float parameters to make LCIO persistency work.
|
private static Map<String,int[]> |
DUMMY_INT_MAP
Dummy int parameters to make LCIO persistency work.
|
private static String |
EPICS_VARIABLE_NAMES
Collection parameter that has the EPICS variable names.
|
private EpicsHeader |
epicsHeader
The EPICS header information.
|
Constructor and Description |
---|
EpicsData()
Class constructor.
|
EpicsData(String data)
Class constructor that parses string data.
|
Modifier and Type | Method and Description |
---|---|
private void |
fromGenericObject(org.lcsim.event.GenericObject object,
String[] names)
Given a list of names, read the double values from the
GenericObject into the data map of
this object. |
(package private) void |
fromString(String rawData)
Parse a raw data string from the EVIO data bank and turn it into a list of keys and values within this object.
|
static EpicsData |
getEpicsData(org.jlab.coda.jevio.EvioEvent evioEvent)
Get EPICS data from an EVIO event.
|
EpicsHeader |
getEpicsHeader()
Get the EPICS header information or
null if not set. |
Set<String> |
getKeys()
Get the list of EPICS variables used by this object.
|
Double |
getValue(String name)
Get a double value from the key, which should be a valid EPICS variable name.
|
boolean |
hasKey(String key)
Return
true if the data has the given key. |
static EpicsData |
read(org.lcsim.event.EventHeader event)
Read data into this object from an LCIO event using the default collection name.
|
private static EpicsData |
read(org.lcsim.event.EventHeader event,
String collectionName)
Read data into this object from a collection in the LCIO event with the given collection name.
|
void |
setEpicsHeader(EpicsHeader epicsHeader)
Set the EPICS header information.
|
void |
setValue(String name,
double value)
Set a variable's value.
|
private EpicsGenericObject |
toGenericObject()
Convert this object into a
GenericObject that can be written into an LCIO collection. |
String |
toString()
Convert this object to a string.
|
void |
write(org.lcsim.event.EventHeader event)
Write this object's data into a
GenericObject collection in the LCIO event using the default
collection name. |
private void |
write(org.lcsim.event.EventHeader event,
String collectionName)
Write this object into an LCIO event with the given collection name.
|
private static final String DEFAULT_COLLECTION_NAME
private static final Map<String,float[]> DUMMY_FLOAT_MAP
private static final Map<String,int[]> DUMMY_INT_MAP
private static final String EPICS_VARIABLE_NAMES
private final Map<String,Double> dataMap
private EpicsHeader epicsHeader
public EpicsData()
EpicsData(String data)
data
- the string datapublic static EpicsData read(org.lcsim.event.EventHeader event)
Read data into this object from an LCIO event using the default collection name.
This is the primary method for users to read the EPICS data into their Drivers in the
Driver.process(EventHeader)
method.
event
- the LCIO eventprivate static EpicsData read(org.lcsim.event.EventHeader event, String collectionName)
event
- the LCIO eventcollectionName
- the collection nameprivate void fromGenericObject(org.lcsim.event.GenericObject object, String[] names)
GenericObject
into the data map of
this object.object
- the GenericObject
with the data valuesnames
- The list of names.void fromString(String rawData)
rawData
- the raw EPICS data in the form of a stringpublic EpicsHeader getEpicsHeader()
null
if not set.public Set<String> getKeys()
public Double getValue(String name)
public boolean hasKey(String key)
true
if the data has the given key.true
if data has the given keypublic void setEpicsHeader(EpicsHeader epicsHeader)
epicsHeader
- the EpicsHeader
objectpublic void setValue(String name, double value)
name
- the name of the variablevalue
- the new value of the variableprivate EpicsGenericObject toGenericObject()
GenericObject
that can be written into an LCIO collection.GenericObject
representing this datapublic String toString()
public void write(org.lcsim.event.EventHeader event)
GenericObject
collection in the LCIO event using the default
collection name.event
- the LCIO eventprivate void write(org.lcsim.event.EventHeader event, String collectionName)
event
- the LCIO eventcollectionName
- the name of the collection in the output eventpublic static EpicsData getEpicsData(org.jlab.coda.jevio.EvioEvent evioEvent)
evioEvent
- the EVIO eventnull
if it is not present in the eventCopyright © 2019. All rights reserved.