StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
l3TrgReaderV20.cxx
1 #include "l3TrgReader.h"
2 #include "trgStructures.h"
3 
4 #include "l3Swap.h"
5 
6 #include <string.h>
7 
8 int l3TrgReader::readV20(void *buffer)
9 {
10  EvtDescData ed;
11  TrgSumData sumData;
12  RawTrgDet trgDet;
13 
14  // Need to swap byte order
15  l3SwapBuffer(&ed, buffer, sizeof(EvtDescData)/4);
16  l3SwapBuffer(&sumData,
17  (char*)buffer + sizeof(EvtDescData),
18  sizeof(TrgSumData)/4);
19  memcpy(&trgDet,
20  (char*)buffer + sizeof(EvtDescData) + sizeof(TrgSumData),
21  sizeof(RawTrgDet));
22 
23  // Everything is prepared, let's read the data
24  bunchXing_hi = swap32(ed.bunchXing_hi);
25  bunchXing_lo = swap32(ed.bunchXing_lo);
26 
27  token = swap16(ed.TrgToken);
28  triggerWord = swap16(ed.TriggerWord);
29  physicsWord = swap16(ed.physicsWord);
30 
31  memcpy(ZDC, trgDet.ZDC, 16);
32  memcpy(CTB, trgDet.CTB, 256);
33 
34  l2Result = sumData.L2Sum[0];
35 
36  return 0;
37 }