Class Some Classes for Handlich of Data
An event builder that collects data from DAQ devices and publishes them via DIM together with a description of the data.
An application sets a "header" of the data and the names of the DAQ devices by using the method "Init". When executing the method init, the EventBuilder will publish a DIM service "EVENTBUILDERNAME_dataDesciption" (see below).
During data acquisition, three things happen.
1) An applicatoin triggers the read out of the DAQ devices by using the command "ReadDAQData". This requires that an "eventID", that is sent together with the "ReadDAQData" command, is incremented for each subsequent command.
2) Then, the EventBuilder will collect the data by queyring the DAQ devices using a "ReadData" event.
3) Finally, the EventBuilder will publish the collected event data as a DIM service "EVENTBUILDERNAME_eventData".
"EVENTBUILDERNAME_dataDescription" has the format "D:1;C:32768;C" and contains a headerID (double timestamp), the names of the DAQ devices (char names, names separated by "|") and a user defined data header (char *header).
"EVENTBUILDERNAME_eventData" has the format "D:1;D:1;L:1;C" and contains the headerID (double timestamp), a timestamp (double timestamp), an eventID (long index) and the data (char *data). The data themselves are bundled using the "data 2 bytea array" from the CoreLib. Hence, they are packed according to the CS
command format "C:N;C:N;C:N[;C:N;C:N;C:N'[;...]]", where the first string contains the name of the DAQDevice, the second string contains the "data descriptor" of the data and the last byte array contains the "data" according to the "data descriptor". Since there can be more than one DAQDevice, each set of even data may contain data of more than one DAQDevice.
WARNING: It might be possible, that a client receives DIM service data more than once. As an example, this can happen, when a client re-connects to the DIM server publishing the data. In order to avoid duplicate data, the client MUST analyze the headerID (making sure, that the data belongs to the same "run") and the eventID (making sure, that no data is missed or duplicate).
IMPORTANT: One must consider the size of the "EVENTBUILDERNAME_eventData" service. Typically, all DIM services are published in "safe mode", which means that subscribing to a DIM service that is published by the same OS-task will work. However, if one would like to publish large services, it might be necessary to disable the "safe mode". In that case a task must not subsribe to its own services. The "safe mode" can be enabled/disabled via the configuration database.
Tip: There are useful routines in the DataLib, that may be used for packing/unpacking of data.
Gets data from a data collector and writes it to disk. The DiscArchiver is initialized by the "RegisterToEventBuilder" method. It obtains descriptionData of a run and the eventData of a run via DIM services
- 08 Sep 2010