<> = MPD Raw Data Format = Data file constructed with following ''TLV-like'' '''block'''. == TLV block == ||<-32 rowclass="bits">Block Header|| ||word #||byte offset||description|| ||<:>0||<:>0||Sync word (32-bit integer)|| ||<:>1||<:>4||Block payload length: '''N''' bytes (32-bit integer)|| ||<-32 rowclass="bits">Block Payload|| ||<:>2||<:>8||<|3> ''Block payload'' || ||<:>...||<:>...|| ||<:>N+1||<:>4(N+1)|| Sync words can be one of these: * 0x2A50D5AF - [[#REGULAR_BLOCK|Regular event block]] * 0x4A62B59D - [[#STAT_BLOCK|Statistic block (aka End-of-burst)]] * 0x72617453 - [[#COMPLEX_TLV_BLOCK|Start run block]] 'Star' * 0x706F7453 - [[#COMPLEX_TLV_BLOCK|Stop run block]] 'Stop' * 0x67654246 - [[#COMPLEX_TLV_BLOCK|Start file block]] 'FBeg' * 0x646E4546 - [[#COMPLEX_TLV_BLOCK|Stop file block]] 'FEnd' * 0x4E4F534A - [[#JSON|JSON block]] 'JSON' Previously there were blocks that doesn't suit TLV-format: * 0x2A502A50 - [[#REGULAR_OLD_BLOCK|Regular event block (old format)]] * 0x4A624A62 - [[#EOB_OLD_BLOCK|End-of-burst block (old format)]] <> == Regular event block payload == ||<-32 rowclass="bits">Event payload|| ||32-bit word #||description|| ||<:>0||Event number|| ||<-32 rowclass="bits">Devices Payload|| ||<-32 rowclass="bits">Device Event Block #1|| ||<:>1||<:|3>[[#DEVICE_EVENT_BLOCK|Device Block]] from a device ('''S,,1,,''' bytes)|| ||<:>...|| ||<:>1+(S,,1,,/4-1)|| ||<-32 rowclass="bits">Device Event Block #2|| ||<:>1+S,,1,,/4||<:|3>[[#DEVICE_EVENT_BLOCK|Device Block]] from a device ('''S,,2,,''' bytes)|| ||<:>...|| ||<:>1+S,,1,,/4+(S,,2,,/4-1)|| ||<:-2>...|| ||<:-2>Till the last block|| ||<:-2>...|| In this case ''Regular event block'' payload length should be equated to the sum of the event number field and all blocks length: (4 + S,,1,, + S,,2,, + ...) bytes. <> === Device Event Block === ||<-32 rowclass="bits">Device Event Header|| ||word #||byte offset||bits||description|| ||<:>0||<:>0||31:0||Device Serial Number|| ||<:|2>1||<:|2>4||31:24||[[DeviceId|Device ID]]|| ||23:0||Device Event Payload Length: 4*N bytes|| ||<-32 rowclass="bits">Device Event Payload|| ||<:>2||<:>8||<-2|3> ''Block payload'' || ||<:>...||<:>...|| ||<:>N+1||<:>4(N+1)|| Some devices splits their payload onto ''MStream Block''. In this case Device Event Payload will be foloving: ||<-32 rowclass="bits">Device Event Payload|| ||<-32 rowclass="bits">MStream Block #1|| ||32-bit word #||description|| ||<:>0||<:-2|3>MStream Block ('''S,,1,,''' 32-bit words)|| ||<:>...|| ||<:>S,,1,,-1|| ||<-32 rowclass="bits">MStream Block #2|| ||<:>S,,1,,||<:-2|3>MStream Block ('''S,,2,,''' 32-bit words)|| ||<:>...|| ||<:>S,,1,,+(S,,2,,-1)|| ||<:-4>...|| In this case ''Device Event Payload Length'' should be equaled to: 4*N = 4*(S,,1,,+S,,2,,+...) bytes. ==== MStream Block ==== ||<-32 rowclass="bits">MStream Header|| ||<:|3>0||<:|3>0||31:24||Subtype-defined bits|| ||23:2||MStream Payload Length: '''S''' 32-bit words|| ||1:0||MStream Subtype|| ||<-32 rowclass="bits">MStream payload|| ||<:>1||<:>4||31:0||<|3>[[MStream_2_1|MStream]] payload|| ||<:-3>...|| ||<:>S||<:>4*S||31:0|| <> == Statistic block payload == ||<-32 rowclass="bits">Statistic payload|| ||32-bit word #||description|| ||<:>0||Reserved 32-bit field|| ||<-32 rowclass="bits">Devices Payload|| ||<-32 rowclass="bits">Device Event Block #1|| ||<:>1||<:|3>[[#DEVICE_EVENT_BLOCK|Device Block]] from a device ('''S,,1,,''' bytes)|| ||<:>...|| ||<:>1+(S,,1,,/4-1)|| ||<-32 rowclass="bits">Device Event Block #2|| ||<:>1+S,,1,,/4||<:|3>[[#DEVICE_EVENT_BLOCK|Device Block]] from a device ('''S,,2,,''' bytes)|| ||<:>...|| ||<:>1+S,,1,,/4+(S,,2,,/4-1)|| ||<:-2>...|| ||<:-2>Till the last block|| ||<:-2>...|| Statistic block is a successor of ''End-of-burst block (old format)'' Instead of the event number field, there will be a reserved 32-bit field. The remainder is a sequence of Device Event Blocks (same as in ''Regular event block'') <> == Complex TLV Block (Start/Stop of Run/File) == ||<-32 rowclass="bits">Start/Stop Header|| ||32-bit word #||description|| ||<:>0||Sync word:<
>'''0x72617453''' - run start<
>'''0x706F7453''' - run stop<
>'''0x67654246''' - file begin<
>'''0x646E4546''' - file end|| ||<:>1||Payload length: ('''S,,1,,'''+'''S,,2,,'''+...) bytes|| ||<-32 rowclass="bits">Start/Stop Payload|| ||<-32 rowclass="bits">TLV Record #1|| ||<:>2||<|3>TLV Record ('''S,,1,,''' bytes)|| ||<:>...|| ||<:>2+(S,,1,,/4-1)|| ||<-32 rowclass="bits">TLV Record #2|| ||<:>2+S1/4||<|3>TLV Record ('''S,,2,,''' bytes)|| ||<:>...|| ||<:>2+S,,1,,/4+(S,,2,,/4-1)|| ||<:-4>...|| At this moment Start/Stop Run payload can contains: * [[#SYNC_RUN_NUMBER|Run Number Record]] * [[#SYNC_RUN_INDEX|Run Index Record]] File begin/end contains following payloads: * [[#SYNC_RUN_NUMBER|Run Number Record]] * [[#SYNC_RUN_INDEX|Run Index Record]] * [[#SYNC_EV_ORDER|Event order Record]] (optional) * [[#SYNC_FILE_ID|File Id Record]] <> === Run Number Record === ||<-32 rowclass="bits">Run Number Record|| ||32-bit word #||description|| ||<:>0||Sync word 0x236E7552|| ||<:>1||Block length: 4 bytes|| ||<:>2||Run number|| <> === Run Index Record === ||<-32 rowclass="bits">Run Index Record|| ||32-bit word #||description|| ||<:>0||Sync word 0x78646E49|| ||<:>1||Block length: index length in bytes (N-2)*4|| ||<:>2||<|3>Run index (in Latin1)|| ||<:>...|| ||<:>N-1|| <> === Event order Record === ||<-32 rowclass="bits">Run Number Record|| ||32-bit word #||description|| ||<:>0||Sync word 0x71655345|| ||<:>1||Block length: 4 bytes|| ||<:>2||Event number order|| This field defines what event numbers will be stored in current file. Only those that meet the following condition will be saved: EvNum % EvNumShift == EvNumOrder <> === File Id Record === ||<-32 rowclass="bits">Run Number Record|| ||32-bit word #||description|| ||<:>0||Sync word 0x64496946|| ||<:>1||Block length: 4 bytes|| ||<:>2||File id|| 'File id' is sequential number of file since Star Run (0 - for 1st file). <> == JSON block == This type reserved for future usage such as: * device configuration * device status <> <> == Non-TLV blocks == ||<-32 rowclass="bits">Block Header|| ||word #||byte offset||description|| ||<:>0||<:>0||Sync word (32-bit integer)|| ||<:>1||<:>4||Block payload length: '''N''' bytes (32-bit integer)|| ||<:>2||<:>8||Event number (32-bit integer)|| ||<-32 rowclass="bits">Block Payload|| ||<:>3||<:>12||<|3> ''Block payload'' || ||<:>...||<:>...|| ||<:>N+1||<:>4(N+1)|| This blocks has sync-word 0x2A502A50 (Regular event) or 0x4A624A62 (EOB). The difference between ''Regular event block'' and ''old format block'' (sync:0x2A502A50) is including of ''event number'' field into block payload. This type of block is deprecated. Since Run of 2022, they will be excluded. == Virtual devices == List of virtual deices: * T0 configuration and status: {[[DeviceId|0x56 (DEVICE_ID_SOFTWARE)]], 0x30543074} ('t0T0') * Run configuration: {[[DeviceId|0x56 (DEVICE_ID_SOFTWARE)]], 0x43526372} ('rcRC') = Data Samples = Some real data captures: [[MpdDaqSampleData]] ---- [[CategoryMPD|MPD]] [[CategoryMStream|MStream]] [[CategoryRawData|RawData]]