public class DAQConfigDriver
extends org.lcsim.util.Driver
DAQConfigDriver
is responsible for accessing the
DAQ configuration settings, and then passing them to the associated
class ConfigurationManager
so that they can be accessed
by other classes.EvioDAQParser
object which
contains all of the DAQ configuration information and pass this to
the ConfigurationManager
. It will continue to update
the ConfigurationManager
during the run if new parser
objects appear, and can thusly account for changing DAQ conditions.
readDataFiles
must be set to
true
and the parameters runNumber
and also
filepath
must be defined. runNumber
defines
the run number of the configuration to be loaded and the parameter
filepath
defines the location of the data file repository.
ConfigurationManager
, as it can
not be initialized otherwise.ConfigurationManager
Modifier and Type | Field and Description |
---|---|
private int[] |
crateNumber |
private File[] |
dataFiles |
private String |
filepath |
private boolean |
firstEvent |
private boolean |
readDataFiles |
private int |
runNumber |
Constructor and Description |
---|
DAQConfigDriver() |
Modifier and Type | Method and Description |
---|---|
protected static String[][] |
getDataFileArrays(BufferedReader[] reader)
Converts DAQ configuration data streams into an array of strings
where each array entry represents a line in the configuration
file.
|
private static String[][] |
getDataFileArrays(File[] dataFiles)
Converts DAQ configuration data files into an array of strings
where each array entry represents a line in the configuration
file.
|
protected int |
getRunNumber()
Gets the run number that the DAQConfigDriver is set to use.
|
void |
process(org.lcsim.event.EventHeader event)
Checks an event for the DAQ configuration banks and passes them
to the
ConfigurationManager if the driver is set to
read from the EvIO data stream. |
void |
setDataFileRepository(String filepath)
Sets the location of the DAQ configuration data files.
|
void |
setReadDataFiles(boolean state)
Sets whether or not to read the DAQ configuration directly from
the EvIO data stream or whether to read the configuration from
data files.
|
void |
setRunNumber(int run)
Sets the run number of the DAQ configuration being processed.
|
void |
startOfData()
Verifies the parameter
filepath for the data file
repository and checks that appropriate data files exist for the
requested run number if the driver is set to read from data files. |
private int runNumber
private String filepath
private boolean firstEvent
private boolean readDataFiles
private File[] dataFiles
private int[] crateNumber
public void startOfData()
filepath
for the data file
repository and checks that appropriate data files exist for the
requested run number if the driver is set to read from data files.
Otherwise, this does nothing.startOfData
in class org.lcsim.util.Driver
public void process(org.lcsim.event.EventHeader event)
ConfigurationManager
if the driver is set to
read from the EvIO data stream. Otherwise, this will parse the
data files on the first event and then do nothing.process
in class org.lcsim.util.Driver
event
- - The current LCIO event.private static final String[][] getDataFileArrays(File[] dataFiles) throws IOException
dataFiles
- - An array of File
objects pointing
to the data files that are to be converted. These are expected
to be plain text files.String
objects where the first array index corresponds to the object
of the same index in the File
array and the second
array index corresponds to the lines in the file referenced by
the File
object.IOException
- Occurs if there is an issue with accessing
or reading the objects in the objects referred to by the files
pointed to in the dataFiles
array.protected static final String[][] getDataFileArrays(BufferedReader[] reader) throws IOException
reader
- - An array of BufferedReader
objects
containing DAQ trigger configuration crate data.String
objects where the first array index corresponds to the object
of the same index in the BufferedReader
array and
the second array index corresponds to the lines in the stream
referenced by the BufferedReader
object.IOException
- Occurs if there is an issue with reading
data stream.protected final int getRunNumber()
-1
in the event that the driver reads from
an EvIO file.int
primitive.
Will return -1
if the driver is set to read from an
EvIO file.public void setRunNumber(int run)
run
- - The run number of the data files to be used.public void setDataFileRepository(String filepath)
filepath
- - The file path of the data file repository.public void setReadDataFiles(boolean state)
runNumber
and filepath
must also be defined if this is set to true
.state
- - true
indicates that the configuration
should be read from data files, and false
that it
should be read from the EvIO stream.Copyright © 2019. All rights reserved.