public class Evio
extends java.lang.Object
This class is used as a layer on top of evio to handle CODA3 specific details. The EMU will received evio data in standard CODA3 output (same as file format) which contains banks - in this case, ROC Raw Records and Physics Events all of which are in formats given below.
####################################
Network Transfer Evio 4 Output Format:
####################################
MSB(31) LSB(0)
<--- 32 bits ------------------------>
_______________________________________
| Block Length |
|_____________________________________|
| Block Number |
|_____________________________________|
| Header Length = 8 |
|_____________________________________|
| Event Count |
|_____________________________________|
| Reserved 1 |
|_____________________________________|
| Bit Info | Version |
|_____________________________________|
| Reserved 2 |
|_____________________________________|
| Magic Number |
|_____________________________________|
| |
| Payload Bank |
| (ROC Raw, Physics, |
| Control or User event) |
|_____________________________________|
| |
| Payload Bank |
|_____________________________________|
| |
| Payload Bank |
|_____________________________________|
| |
| Payload Bank |
|_____________________________________|
############################
ROC Raw Record:
############################
MSB(31) LSB(0)
<--- 32 bits ------------------------>
_______________________________________
| Event Length |
|_____________________________________|
| S | ROC ID | 0x10 | M |
|_____________________________________| ------
| Trigger Bank Length | ^
|_____________________________________| |
| 0xFF1X | 0x20 | M | |
|_____________________________________| |
| ID 1 | 0x01 | ID len 1 | Trigger Bank
|_____________________________________| |
| Event Number 1 | |
|_____________________________________| |
| Timestamp1 (bits 31-0) | |
|_____________________________________| |
| Timestamp1 (bits 47-32) | |
|_____________________________________| |
| Misc. 1 (?) | |
|_____________________________________| |
| ... | |
|_____________________________________| |
| | |
| (One segment for each event) | |
| | |
|_____________________________________| |
| ID M | 0x01 | ID len M | |
|_____________________________________| |
| Event Number M | |
|_____________________________________| |
|________ Timestamp M (?) ________| |
|_____________________________________| |
| Misc. M (?) | V
|_____________________________________| ------
| |
| Data Block Bank 1 |
| (data of M events from |
| 1 to multiple modules) |
| |
|_____________________________________|
| ... |
|_____________________________________|
| |
| Data Block Last |
| (there will be only 1 block |
| unless user used multiple DMAs) |
| |
|_____________________________________|
M = number of events (0 = user event).
0x0F01 is the Trigger Bank identifier.
S is the 4-bit status:
|_____________________________________|
| Single| Big | Error | Sync |
| Event | Endian | | Event |
| Mode | | | |
|_____________________________________|
Endian bit is set if data is big endian
############################
Physics Event:
############################
MSB(31) LSB(0)
<--- 32 bits ------------------------>
_______________________________________
| Event Length |
|_____________________________________|
| builder = 0xFFXX | 0x10 | M |
|_____________________________________| ------
| Built Trigger Bank Length | ^
|_____________________________________| |
| 0xFF2X | 0x20 | N | |
|_____________________________________| Built
| 2 EB (Common) Segments | Trigger Bank
|_____________________________________| (see below)
| ROC 1 Segment | |
|_____________________________________| |
| ... | |
|_____________________________________| |
| ROC N Segment | V
|_____________________________________| ------
| |
| Data Bank 1 |
| (wraps 1 or more data |
| blocks for a ROC) |
|_____________________________________|
| |
| ... |
|_____________________________________|
| |
| Data Bank N |
| (One bank for each roc) |
|_____________________________________|
M = number of events.
N is the number of ROCs.
0xFFXX is the id of the event builder
0xFF2X is the Built Trigger Bank identifier
####################################
Physics Event's Built Trigger Bank:
####################################
MSB(31) LSB(0)
<--- 32 bits ------------------------>
_______________________________________
| Built Trigger Bank Length |
|_____________________________________|
| 0xFF2X | 0x20 | N |
|_____________________________________| --------
| EB id | 0xa | 4 | ^
|_____________________________________| |
|________ First Event Number _________| |
|_____________________________________| |
|__________ Avg Timestamp 1 __________| |
|_____________________________________| |
|__________ ... __________| |
|_____________________________________| |
|__________ Avg Timestamp M __________| |
|_____________________________________| |
|______ Run Number & Run Type ________| |
|_____________________________________| |
| EB id | 0x05 | Len | |
|_____________________________________| |
| Event Type 2 | Event Type 1 | Common Data
|_____________________________________| |
| ... | |
|_____________________________________| |
| Event Type M | Event Type M-1 | V
|_____________________________________| -------
|roc1 id | 0x01 | Len | ^
|_____________________________________| |
| Timestamp for ev 1 | |
|_____________________________________| |
| Misc. 1 for ev 1 | ROC Data
|_____________________________________| (missing if single event mode,
| ... | or sparsified and no timestamp
|_____________________________________| data available)
| Timestamp M | |
|_____________________________________| |
| Misc. M | |
|_____________________________________| |
| | |
| (one for each ROC, to ROC N) | |
|_____________________________________| V
N is the number of ROCs.
M is the number of events.
0xFF2X is the Built Trigger Bank identifier.
############################
Physics Event's Data Bank:
############################
MSB(31) LSB(0)
<--- 32 bits ------------------------>
_______________________________________
| Data Bank Length |
|_____________________________________|
| S | ROC id | 0x10 | M |
|_____________________________________|
| |
| Data Block Bank 1 |
| |
|_____________________________________|
| |
| ... |
|_____________________________________|
| |
| Data Bank Last |
| |
|_____________________________________|
M is the number of events.
Modifier and Type | Method and Description |
---|---|
static void |
buildPhysicsEventWithPhysics(org.jlab.coda.jevio.EvioNode[] inputNodes,
java.nio.ByteBuffer evBuf,
int inputCount,
int writeIndex,
boolean fastCopyReady,
int[] returnLen,
java.nio.ByteBuffer[] rocRecord)
Build a single physics event with the given array of Physics events.
|
static void |
buildPhysicsEventWithPhysics(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder)
Build a single physics event with the given trigger bank and the given array of Physics events.
|
static org.jlab.coda.jevio.EvioBank |
buildPhysicsEventWithRocRaw(org.jlab.coda.jevio.EvioNode[] rocNodes,
boolean fastCopyReady,
int numRocs,
int writeIndex,
java.nio.ByteBuffer builtEventBuf,
int[] returnLen,
java.nio.ByteBuffer[] rocRecord)
Build a single physics event with the given array of ROC raw records.
|
static org.jlab.coda.jevio.EvioBank |
buildPhysicsEventWithRocRaw(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder)
Build a single physics event with the given trigger bank
and the given array of ROC raw records.
|
static boolean |
checkConsistency(PayloadBuffer[] buildingBanks,
long eventNumber)
Check each payload bank - one from each input channel - for a number of issues:
|
static void |
checkInput(PayloadBuffer pBuf,
DataChannel channel,
EventType eventType,
org.jlab.coda.jevio.EvioNode inputNode,
boolean recordIdError)
Check the given payload buffer for correct record id, source id.
|
static boolean |
checkInputType(int recordId,
DataChannel channel,
EventType eventType,
org.jlab.coda.jevio.EvioNode inputNode)
Check the given payload buffer for event type
(physics, ROC raw, control, or user) as well as evio structure type.
|
static void |
checkPayload(PayloadBuffer pBuf,
DataChannel channel)
Check the given payload buffer for correct format
(physics, ROC raw, control, or user).
|
static int |
checkRecordIdSequence(int recordId,
int expectedRecordId,
boolean print,
EventType eventType,
DataChannel channel)
Check the data coming over a channel for sequential record ids.
|
static int |
createCodaTag(boolean sync,
boolean error,
boolean isBigEndian,
boolean singleEventMode,
int id)
Create a 16-bit, CODA-format tag for a ROC Raw Record or Physics Event
out of 4 status bits and a 12-bit id.
|
static int |
createCodaTag(int status,
int id)
Create a 16-bit, CODA-format tag for a ROC Raw Record, Physics Event,
or Data Transport Record out of 4-bit status/type and a 12-bit id.
|
static PayloadBuffer |
createControlBuffer(ControlType type,
int runNumber,
int runType,
int eventsInRun,
int eventsSinceSync,
java.nio.ByteOrder order,
boolean error)
Create a Control event with a ByteBuffer which is ready to read.
|
static org.jlab.coda.jevio.EvioEvent |
createControlEvent(ControlType type,
int runNumber,
int runType,
int eventsInRun,
int eventsSinceSync,
boolean error)
Create a Control event.
|
static void |
createRocRawRecordFast(int rocID,
int triggerType,
int detectorId,
int status,
int eventNumber,
int numEvents,
long timestamp,
java.nio.ByteBuffer buf,
org.jlab.coda.jevio.CompactEventBuilder builder)
Create an Evio ROC Raw record event/bank to be placed in a Data Transport record.
|
static int[] |
generateData(int firstEvNum,
int words,
boolean isSEM,
long timestamp)
Generate a single data block bank of fake data.
|
static int |
getTagCodaId(int codaTag)
Get the id which is the lower 12 bits of the CODA-format tag.
|
static int |
getTagStatus(org.jlab.coda.jevio.EvioBank bank)
Get the given bank's CODA-format tag's status which is the upper 4 bits.
|
static int |
getTagStatus(int codaTag)
Get the given CODA-format tag's status which is the upper 4 bits.
|
static void |
gotConsistentControlEvents(PayloadBuffer[] buildingBanks,
int runNumber,
int runType)
When this is called all channels had control events.
|
static boolean |
isBuiltTriggerBank(org.jlab.coda.jevio.EvioNode node)
Determine whether a bank is a built trigger bank or not.
|
static boolean |
isRawTriggerBank(org.jlab.coda.jevio.EvioNode node)
Determine whether a bank is a trigger bank from a ROC or not.
|
static boolean |
isSyncEvent(org.jlab.coda.jevio.EvioNode node)
Determine whether a bank is a SYNC control event or not.
|
static boolean |
isTagBigEndian(int codaTag)
See if the given CODA-format tag indicates data is big endian.
|
static boolean |
isTagSingleEventMode(int codaTag)
See if the given CODA-format tag indicates the ROC is in single event mode.
|
static boolean |
isTagSyncEvent(int codaTag)
See if the given CODA-format tag indicates it is a sync event.
|
static boolean |
isUserEvent(org.jlab.coda.jevio.EvioBank bank)
Determine whether a bank is a USER event or not.
|
static boolean |
isUserEvent(org.jlab.coda.jevio.EvioNode node)
Determine whether an event is a USER event or not.
|
static boolean |
makeTriggerBankFromPhysics(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop)
Combine the trigger banks of all input payload banks of Physics event format (from previous
event builder) into a single trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromPhysics(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.EvioNode[] rocNodes,
org.jlab.coda.jevio.EvioNode[] triggerBanks,
java.nio.ByteBuffer[] inputBuffers,
java.nio.ByteBuffer evBuf,
int ebId,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
boolean fastCopyReady,
int timestampSlop,
int[] returnLen,
long[] longData,
long[] commonLong,
long[] firstInputCommonLong,
long[] timestampsMin,
long[] timestampsMax,
short[] eventTypes,
short[] eventTypesRoc1)
Combine the trigger banks of all input payload banks of Physics event format (from previous
event builder) into a single trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromPhysicsOrig(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop)
Combine the trigger banks of all input payload banks of Physics event format (from previous
event builder) into a single trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks,
java.nio.ByteBuffer builtEventBuf,
int ebId,
long firstEventNumber,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop,
int buildThreadOrder,
long[] longData,
short[] evData,
int[] segmentData,
int[] returnLen,
int[] rocOffset,
java.nio.ByteBuffer[] rocRecord,
org.jlab.coda.jevio.EvioNode[] rocNodes,
boolean fastCopyReady)
Combine the trigger banks of all input payload banks of ROC raw format into a single
trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
long firstEventNumber,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop,
int buildThreadOrder)
Combine the trigger banks of all input payload banks of ROC raw format into a single
trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
long firstEventNumber,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop,
int buildThreadOrder,
long[] longData,
short[] evData,
int[] segmentData,
int[] returnLen)
Combine the trigger banks of all input payload banks of ROC raw format into a single
trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromRocRawOld(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
long firstEventNumber,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop,
int buildThreadOrder)
Combine the trigger banks of all input payload banks of ROC raw format into a single
trigger bank which will be used in the final built event.
|
static boolean |
makeTriggerBankFromRocRawOrig(PayloadBuffer[] inputPayloadBanks,
org.jlab.coda.jevio.CompactEventBuilder builder,
int ebId,
long firstEventNumber,
int runNumber,
int runType,
boolean includeRunData,
boolean sparsify,
boolean checkTimestamps,
int timestampSlop,
int buildThreadOrder)
Combine the trigger banks of all input payload banks of ROC raw format into a single
trigger bank which will be used in the final built event.
|
static int |
setTagEndian(int codaTag,
boolean isBigEndian)
Set the given CODA-format tag to indicate data is little/big endian.
|
static boolean |
tagHasError(int codaTag)
See if the given CODA-format tag indicates the ROC/EB has an error.
|
public static int createCodaTag(boolean sync, boolean error, boolean isBigEndian, boolean singleEventMode, int id)
sync
- is sync eventerror
- is errorisBigEndian
- data is big endiansingleEventMode
- is single event modeid
- lowest 12 bits are idpublic static int createCodaTag(int status, int id)
status
- lowest 4 bits are status/typeid
- lowest 12 bits are idpublic static int getTagCodaId(int codaTag)
codaTag
- tag from evio bank.public static boolean isTagSingleEventMode(int codaTag)
codaTag
- tag from evio bank.true
if the ROC is in single event mode.public static boolean isTagSyncEvent(int codaTag)
codaTag
- tag from evio bank.true
if is a sync event.public static boolean isTagBigEndian(int codaTag)
codaTag
- tag from evio bank.true
if data is big endian.public static int setTagEndian(int codaTag, boolean isBigEndian)
codaTag
- tag from evio bank.isBigEndian
- true
if big endian, else false
public static boolean tagHasError(int codaTag)
codaTag
- tag from evio bank.true
if the ROC/EB has an error.public static int getTagStatus(int codaTag)
codaTag
- tag from evio bank.public static int getTagStatus(org.jlab.coda.jevio.EvioBank bank)
bank
- bank to analyzepublic static boolean isSyncEvent(org.jlab.coda.jevio.EvioNode node)
node
- object corresponding to evio structuretrue
if arg is SYNC event, else false
public static boolean isUserEvent(org.jlab.coda.jevio.EvioBank bank)
bank
- input banktrue
if arg is USER event, else false
public static boolean isUserEvent(org.jlab.coda.jevio.EvioNode node)
node
- input nodetrue
if arg is USER event, else false
public static boolean isRawTriggerBank(org.jlab.coda.jevio.EvioNode node)
node
- input nodetrue
if arg is trigger bank, else false
public static boolean isBuiltTriggerBank(org.jlab.coda.jevio.EvioNode node)
node
- input nodetrue
if arg is a built trigger bank, else false
public static void checkPayload(PayloadBuffer pBuf, DataChannel channel) throws EmuException
No checks done on arguments. However, format of payload buffers is checked here for the first time.
pBuf
- payload buffer to be examinedchannel
- input channelEmuException
- if physics or roc raw bank has improper formatpublic static void checkInput(PayloadBuffer pBuf, DataChannel channel, EventType eventType, org.jlab.coda.jevio.EvioNode inputNode, boolean recordIdError)
pBuf
- payload buffer to be examinedchannel
- input channel buffer is fromeventType
- type of input event in bufferinputNode
- EvioNode object representing eventrecordIdError
- non-fatal record id error found in
checkInputType(int, DataChannel, EventType, EvioNode)
.public static int checkRecordIdSequence(int recordId, int expectedRecordId, boolean print, EventType eventType, DataChannel channel)
recordId
- id associated with an incoming evio event
(each of which may contain several physics events)expectedRecordId
- expected record idprint
- if true, print out when record id is out-of-seq.eventType
- type of input eventchannel
- input channel data is frompublic static boolean checkInputType(int recordId, DataChannel channel, EventType eventType, org.jlab.coda.jevio.EvioNode inputNode) throws EmuException
recordId
- id associated with an incoming evio event
(each of which may contain several physics events)channel
- input channel buffer is fromeventType
- type of input eventinputNode
- EvioNode object representing eventEmuException
- if event is unknown type;
if physics or roc raw bank has improper formatpublic static boolean checkConsistency(PayloadBuffer[] buildingBanks, long eventNumber) throws EmuException
Check each payload bank - one from each input channel - for a number of issues:
buildingBanks
- array containing banks that will be built togethereventNumber
- first event number in each bank (used for diagnostic output).
Currently event # will not be valid for SEB with multiple streams.true
if non-fatal error occurred, else false
EmuException
- if some physics and others ROC raw event types;
if there are a differing number of events in each payload bank;
if some events have a sync bit set and others do not.public static void gotConsistentControlEvents(PayloadBuffer[] buildingBanks, int runNumber, int runType) throws EmuException
buildingBanks
- array containing events that will be built togetherrunNumber
- check this (correct) run # against the one in the control eventrunType
- check this (correct) run type against the one in the control eventEmuException
- if events contain mixture of different control types;
if prestart events contain bad datapublic static org.jlab.coda.jevio.EvioEvent createControlEvent(ControlType type, int runNumber, int runType, int eventsInRun, int eventsSinceSync, boolean error)
Sync event:
_______________________________________
| Event Length = 4 |
|_____________________________________|
| type = 0xFFD0 | 0x1 | 0 |
|_____________________________________|
| time |
|_____________________________________|
| number of events since last sync |
|_____________________________________|
| number of events in run |
|_____________________________________|
Prestart event:
_______________________________________
| Event Length = 4 |
|_____________________________________|
| type = 0xFFD1 | 0x1 | 0 |
|_____________________________________|
| time |
|_____________________________________|
| Run Number |
|_____________________________________|
| Run Type |
|_____________________________________|
Go (type = 0xFFD2), Pause (type = 0xFFD3) or
End (type = 0xFFD4) event:
_______________________________________
| Event Length = 4 |
|_____________________________________|
| type | 0x1 | 0 |
|_____________________________________|
| time |
|_____________________________________|
| (reserved) |
|_____________________________________|
| number of events in run |
|_____________________________________|
type
- control type, must be SYNC, PRESTART, GO, PAUSE, or ENDrunNumber
- current run number for prestart eventrunType
- current run type for prestart eventeventsInRun
- number of events so far in run for all except prestart eventeventsSinceSync
- number of events since last sync for sync eventerror
- END control event sent due to error conditionpublic static PayloadBuffer createControlBuffer(ControlType type, int runNumber, int runType, int eventsInRun, int eventsSinceSync, java.nio.ByteOrder order, boolean error)
type
- control type, must be SYNC, PRESTART, GO, PAUSE, or ENDrunNumber
- current run number for prestart eventrunType
- current run type for prestart eventeventsInRun
- number of events so far in run for all except prestart eventeventsSinceSync
- number of events since last sync for sync eventorder
- byte order in which to write event into buffererror
- END control event sent due to error conditionpublic static boolean makeTriggerBankFromPhysicsOrig(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop) throws EmuException
If timestamp checking is enabled, it will only be valid here if all physics events being currently built have come via previous event builders in which timestamp checking was enabled. In this case, each input bank must have timestamp information in its trigger bank or an exception with be thrown. The first level of event builders check the timestamp drift of each ROC. This (2nd or higher) level of event builder checks the average timestamp for an event from one group of ROCs against another group's. The trigger bank created in this method will contain the average timestamps.
If run number and run type data are included in all input banks, then they will be checked for consistency. A non-fatal error will be returned if they are not.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps exist.
Note that if incoming trigger banks are from events built in single event mode,
then there will be no roc-specific data in that case as well. If roc-specific
data is missing from any of the trigger banks, then it will be missing in the
final trigger bank as well.
inputPayloadBanks
- array containing a bank (Physics event) from each channel's
payload buffer queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no relevant datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
true
if non-fatal error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromPhysics(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop) throws EmuException
If timestamp checking is enabled, it will only be valid here if all physics events being currently built have come via previous event builders in which timestamp checking was enabled. In this case, each input bank must have timestamp information in its trigger bank or an exception with be thrown. The first level of event builders check the timestamp drift of each ROC. This (2nd or higher) level of event builder checks the average timestamp for an event from one group of ROCs against another group's. The trigger bank created in this method will contain the average timestamps.
If run number and run type data are included in all input banks, then they will be checked for consistency. A non-fatal error will be returned if they are not.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps exist.
Note that if incoming trigger banks are from events built in single event mode,
then there will be no roc-specific data in that case as well. If roc-specific
data is missing from any of the trigger banks, then it will be missing in the
final trigger bank as well.
inputPayloadBanks
- array containing a bank (Physics event) from each channel's
payload buffer queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no relevant datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
true
if non-fatal error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromPhysics(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.EvioNode[] rocNodes, org.jlab.coda.jevio.EvioNode[] triggerBanks, java.nio.ByteBuffer[] inputBuffers, java.nio.ByteBuffer evBuf, int ebId, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, boolean fastCopyReady, int timestampSlop, int[] returnLen, long[] longData, long[] commonLong, long[] firstInputCommonLong, long[] timestampsMin, long[] timestampsMax, short[] eventTypes, short[] eventTypesRoc1) throws EmuException
If timestamp checking is enabled, it will only be valid here if all physics events being currently built have come via previous event builders in which timestamp checking was enabled. In this case, each input bank must have timestamp information in its trigger bank or an exception with be thrown. The first level of event builders check the timestamp drift of each ROC. This (2nd or higher) level of event builder checks the average timestamp for an event from one group of ROCs against another group's. The trigger bank created in this method will contain the average timestamps.
If run number and run type data are included in all input banks, then they will be checked for consistency. A non-fatal error will be returned if they are not.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps exist.
Note that if incoming trigger banks are from events built in single event mode,
then there will be no roc-specific data in that case as well. If roc-specific
data is missing from any of the trigger banks, then it will be missing in the
final trigger bank as well.
Many of the inputs are externally provided arrays used here in order to avoid allocating them each time this method is called. Some, like rocNodes, triggerBanks, and inputBuffers, are quickly found in FastEventBuilder and easy to pass in.
inputPayloadBanks
- array containing a bank (Physics event) from each channel's
payload buffer queue that will be built into one event.rocNodes
- array of EvioNodes of input banks.triggerBanks
- array of EvioNodes of input trigger banks.inputBuffers
- array of ByteBuffers of input banks.evBuf
- ByteBuffer in which event is being built.ebId
- id of event builder calling this method.runNumber
- run number to place in trigger bank.runType
- run type to place in trigger bank.includeRunData
- if true
, add run number and run type.sparsify
- if true
, do not add roc specific segments if no relevant data.checkTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger bankfastCopyReady
- if true
, ...timestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
.returnLen
- array in which to return index in evBuf just past trigger bank.longData
- array used to store long data of trigger bank.commonLong
- array used to hold long trigger data for comparison of inputs.firstInputCommonLong
- array used to hold long trigger data from first input.timestampsMin
- array used to store min timestamp for each event.timestampsMax
- array used to store max timestamp for each event.eventTypes
- array used to hold short trigger data for comparison of inputs.eventTypesRoc1
- array used to store short trigger data from first input.true
if non-fatal error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks, java.nio.ByteBuffer builtEventBuf, int ebId, long firstEventNumber, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop, int buildThreadOrder, long[] longData, short[] evData, int[] segmentData, int[] returnLen, int[] rocOffset, java.nio.ByteBuffer[] rocRecord, org.jlab.coda.jevio.EvioNode[] rocNodes, boolean fastCopyReady) throws EmuException
To check timestamp consistency, for each event the difference between the max and
min timestamps cannot exceed the argument timestampSlop. If it does for any event,
this method returns true
.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps and/or roc misc data exist.
Many of the inputs are externally provided arrays used here in order to avoid allocating them each time this method is called. Some, like rocNodes, rocRecord, and rocOffset, are quickly found in FastEventBuilder and easy to pass in.
inputPayloadBanks
- array containing a bank (ROC Raw) from each channel's
payload bank queue that will be built into one event.builtEventBuf
- ByteBuffer of event being built.ebId
- id of event builder calling this method.firstEventNumber
- event number to place in trigger bank.runNumber
- run number to place in trigger bank.runType
- run type to place in trigger bank.includeRunData
- if true
, add run number and run type.sparsify
- if true
, do not add roc specific segments if no such data.checkTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger bank.timestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
.buildThreadOrder
- for debug printout, which build thread.longData
- long array, passed in to avoid unnecessary object creation.evData
- short array, passed in to avoid unnecessary object creation.segmentData
- int array, passed in to avoid unnecessary object creation.returnLen
- int array used to return index into builtEventBuf of where to write.rocOffset
- array of rocNodes' backing buffer offsets.rocRecord
- array of rocNodes' backing buffers.rocNodes
- array of EvioNodes of input banks.fastCopyReady
- if true
, roc data buffer backing byte arrays and
EB's ByteBufferSupply buffers both have the same endian value.true
if recoverable error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, long firstEventNumber, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop, int buildThreadOrder) throws EmuException
To check timestamp consistency, for each event the difference between the max and
min timestamps cannot exceed the argument timestampSlop. If it does for any event,
this method returns true
.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps and/or roc misc data exist.
inputPayloadBanks
- array containing a bank (ROC Raw) from each channel's
payload bank queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodfirstEventNumber
- event number to place in trigger bankrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no such datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
buildThreadOrder
- build thread number for debug printouttrue
if recoverable error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromRocRaw(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, long firstEventNumber, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop, int buildThreadOrder, long[] longData, short[] evData, int[] segmentData, int[] returnLen) throws EmuException
To check timestamp consistency, for each event the difference between the max and
min timestamps cannot exceed the argument timestampSlop. If it does for any event,
this method returns true
.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps and/or roc misc data exist.
inputPayloadBanks
- array containing a bank (ROC Raw) from each channel's
payload bank queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodfirstEventNumber
- event number to place in trigger bankrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no such datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
buildThreadOrder
- build thread number for debug printoutlongData
- long array, passed in to avoid unnecessary object creation.evData
- short array, passed in to avoid unnecessary object creation.segmentData
- int array, passed in to avoid unnecessary object creation.returnLen
- int array of length 1 used to return # of valid elements in segmentData.true
if recoverable error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromRocRawOrig(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, long firstEventNumber, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop, int buildThreadOrder) throws EmuException
To check timestamp consistency, for each event the difference between the max and
min timestamps cannot exceed the argument timestampSlop. If it does for any event,
this method returns true
.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps and/or roc misc data exist.
inputPayloadBanks
- array containing a bank (ROC Raw) from each channel's
payload bank queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodfirstEventNumber
- event number to place in trigger bankrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no such datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
buildThreadOrder
- build thread number for debug printouttrue
if non fatal error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static boolean makeTriggerBankFromRocRawOld(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder, int ebId, long firstEventNumber, int runNumber, int runType, boolean includeRunData, boolean sparsify, boolean checkTimestamps, int timestampSlop, int buildThreadOrder) throws EmuException
To check timestamp consistency, for each event the difference between the max and
min timestamps cannot exceed the argument timestampSlop. If it does for any event,
this method returns true
.
If sparsify flag is true
, then no roc-specific data is included.
The trigger bank is not sparsified if timestamps and/or roc misc data exist.
inputPayloadBanks
- array containing a bank (ROC Raw) from each channel's
payload bank queue that will be built into one eventbuilder
- object used to build trigger bankebId
- id of event builder calling this methodfirstEventNumber
- event number to place in trigger bankrunNumber
- run number to place in trigger bankrunType
- run type to place in trigger bankincludeRunData
- if true
, add run number and run typesparsify
- if true
, do not add roc specific segments if no such datacheckTimestamps
- if true
, check timestamp consistency and
return false if inconsistent, include them in trigger banktimestampSlop
- maximum number of timestamp ticks that timestamps can differ
for a single event before the error bit is set in a bank's
status. Only used when checkTimestamps arg is true
buildThreadOrder
- build thread number for debug printouttrue
if non fatal error occurred, else false
EmuException
- for major error in event building which necessitates stopping the buildpublic static void buildPhysicsEventWithPhysics(org.jlab.coda.jevio.EvioNode[] inputNodes, java.nio.ByteBuffer evBuf, int inputCount, int writeIndex, boolean fastCopyReady, int[] returnLen, java.nio.ByteBuffer[] rocRecord)
inputNodes
- array containing EvioNode events that will be built together.evBuf
- ByteBuffer containing event being built.inputCount
- number of input channels.writeIndex
- index in evBuf's backing array to start writing.fastCopyReady
- if true
, roc data buffer backing byte arrays and
EB's ByteBufferSupply buffers both have the same endian value.returnLen
- int array used to return index into evBuf of where to write.rocRecord
- array of backing buffers to inputNodes.public static void buildPhysicsEventWithPhysics(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder)
inputPayloadBanks
- array containing Physics events that will be built togetherbuilder
- object used to build eventpublic static org.jlab.coda.jevio.EvioBank buildPhysicsEventWithRocRaw(org.jlab.coda.jevio.EvioNode[] rocNodes, boolean fastCopyReady, int numRocs, int writeIndex, java.nio.ByteBuffer builtEventBuf, int[] returnLen, java.nio.ByteBuffer[] rocRecord)
rocNodes
- array containing EvioNode events that will be built together.fastCopyReady
- if true
, roc data buffer backing byte arrays and
EB's ByteBufferSupply buffers both have the same endian value.numRocs
- number of input channels.writeIndex
- index into evBuf to start writing.builtEventBuf
- ByteBuffer containing event being built.returnLen
- int array used to return index into evBuf of where to write.rocRecord
- array of backing buffers to inputNodes.public static org.jlab.coda.jevio.EvioBank buildPhysicsEventWithRocRaw(PayloadBuffer[] inputPayloadBanks, org.jlab.coda.jevio.CompactEventBuilder builder)
inputPayloadBanks
- array containing ROC raw records that will be built togetherbuilder
- object used to build trigger bankpublic static int[] generateData(int firstEvNum, int words, boolean isSEM, long timestamp)
firstEvNum
- starting event numberwords
- amount of data in 32bit words besides event # and timestampisSEM
- in single event mode if true
timestamp
- 48-bit timestamp used only in single event modepublic static void createRocRawRecordFast(int rocID, int triggerType, int detectorId, int status, int eventNumber, int numEvents, long timestamp, java.nio.ByteBuffer buf, org.jlab.coda.jevio.CompactEventBuilder builder) throws org.jlab.coda.jevio.EvioException
rocID
- ROC id numbertriggerType
- trigger type id number (0-15)detectorId
- id of detector producing data in data block bankstatus
- 4-bit status associated with dataeventNumber
- starting event numbernumEvents
- number of physics events in created recordtimestamp
- starting event's timestampbuf
- ByteBuffer in which to write generated eventbuilder
- used to build evio events in buffer acquired from bbSupplyorg.jlab.coda.jevio.EvioException
- if error in building evio event.