]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawDataHeader.h
New raw-data format. For details, see http://indico.cern.ch/materialDisplay.py?contri...
[u/mrichter/AliRoot.git] / RAW / AliRawDataHeader.h
1 #ifndef ALIRAWDATAHEADER_H
2 #define ALIRAWDATAHEADER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 struct AliRawDataHeader {
7   AliRawDataHeader() :
8     fSize(0xFFFFFFFF), 
9     fEventID1(0),
10     fL1TriggerType(0),
11     fVersion(2),
12     fEventID2(0),
13     fAttributesSubDetectors(0),
14     fStatusMiniEventID(0x1000),  // status bit 4: no L1/L2 trigger information
15     fTriggerClassLow(0),
16     fROILowTriggerClassHigh(0),
17     fROIHigh(0)
18   {}
19
20   UShort_t  GetEventID1() const
21     {return (fEventID1 & 0xFFF);};
22
23   UChar_t   GetL1TriggerMessage() const
24     {return (UChar_t)((fEventID1 >> 14) | ((UShort_t)fL1TriggerType << 2));};
25
26   UChar_t   GetVersion() const
27     {return fVersion;};
28
29   UChar_t   GetAttributes() const 
30     {return (fAttributesSubDetectors >> 24) & 0xFF;};
31   Bool_t    TestAttribute(Int_t index) const
32     {return (fAttributesSubDetectors >> (24 + index)) & 1;};
33   void      SetAttribute(Int_t index)
34     {fAttributesSubDetectors |= (1 << (24 + index));};
35   void      ResetAttribute(Int_t index)
36     {fAttributesSubDetectors &= (0xFFFFFFFF ^ (1 << (24 + index)));};
37   UInt_t    GetSubDetectors() const
38     {return fAttributesSubDetectors & 0xFFFFFF;};
39
40   UInt_t    GetStatus() const
41     {return (fStatusMiniEventID >> 12) & 0xFFFF;};
42   UInt_t    GetMiniEventID() const
43     {return fStatusMiniEventID & 0x7FF;};
44
45   ULong64_t GetTriggerClasses() const
46     {return ((ULong64_t) (fROILowTriggerClassHigh & 0x1FFFF)) << 32 + fTriggerClassLow;}
47   ULong64_t GetROI() const
48     {return ((ULong64_t) fROIHigh) << 32 + ((fROILowTriggerClassHigh >> 28) & 0xF);}
49
50   void      SetTriggerClass(ULong64_t mask)
51     {fTriggerClassLow = (UInt_t)(mask & 0xFFFFFFFF);  // low bits of trigger class
52      fROILowTriggerClassHigh = (UInt_t)((mask >> 32) & 0x3FFFF); // low bits of ROI data (bits 28-31) and high bits of trigger class (bits 0-17)
53     };
54
55   UInt_t    fSize;              // size of the raw data in bytes
56   UShort_t  fEventID1;          // bunch crossing number
57   UChar_t   fL1TriggerType;     // level 1 trigger type
58   UChar_t   fVersion;           // version of the data header format
59   UInt_t    fEventID2;          // orbit number
60   UInt_t    fAttributesSubDetectors; // block attributes (bits 24-31) and participating sub detectors
61   UInt_t    fStatusMiniEventID; // status & error bits (bits 12-27) and mini event ID (bits 0-11)
62   UInt_t    fTriggerClassLow;   // low bits of trigger class
63   UInt_t    fROILowTriggerClassHigh; // low bits of ROI data (bits 28-31) and high bits of trigger class (bits 0-17)
64   UInt_t    fROIHigh;           // high bits of ROI data
65 };
66
67 #endif