]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliRawEventHeader.h
ReadDataHeader method added
[u/mrichter/AliRoot.git] / RAW / AliRawEventHeader.h
1 #ifndef ALIRAWEVENTHEADER_H
2 #define ALIRAWEVENTHEADER_H
3 // @(#)alimdc:$Name$:$Id$
4 // Author: Fons Rademakers  26/11/99
5
6 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
7  * See cxx source for full Copyright notice                               */
8
9 //////////////////////////////////////////////////////////////////////////
10 //                                                                      //
11 // AliRawEventHeader                                                    //
12 //                                                                      //
13 //////////////////////////////////////////////////////////////////////////
14
15 #ifndef ROOT_TObject
16 #include <TObject.h>
17 #endif
18
19
20 class AliRawEventHeader : public TObject {
21
22 public:
23    AliRawEventHeader() { fSize = 0; }
24    virtual ~AliRawEventHeader() { }
25
26    void         *HeaderBegin() { return (void *) &fSize; }
27    Int_t         HeaderSize() const { return (Long_t) &fGDCId - (Long_t) &fSize + sizeof(fGDCId); }
28    Bool_t        DataIsSwapped() const;
29    Bool_t        IsSwapped() const { return (fMagic == fgkEventMagicNumberSwapped) ? kTRUE : kFALSE; }
30    Bool_t        IsValid() const { return IsSwapped() ? kTRUE : ((fMagic == fgkEventMagicNumber) ? kTRUE : kFALSE); }
31    void          Swap();
32
33    UInt_t        GetEventSize() const { return fSize; }
34    UInt_t        GetMagic() const { return fMagic; }
35    UInt_t        GetHeaderLength() const { return fHeadLen; }
36    UInt_t        GetVersion() const { return fVersion; }
37    UInt_t        GetType() const { return fType; }
38    const char   *GetTypeName() const;
39    UInt_t        GetRunNumber() const { return fRunNb; }
40    UInt_t        GetEventInRun() const;
41    const UInt_t *GetId() const { return fId; }
42    const UInt_t *GetTriggerPattern() const { return fTriggerPattern; }
43    const UInt_t *GetDetectorPattern() const { return fDetectorPattern; }
44    const UInt_t *GetTypeAttribute() const { return fTypeAttribute; }
45    UInt_t        GetLDCId() const { return fLDCId; }
46    UInt_t        GetGDCId() const { return fGDCId; }
47
48    // The following enumeration can be used once the kEventTypeMask has been
49    // applied to the raw event type
50    enum EAliRawEventType {
51      kStartOfRun =       1,    // START_OF_RUN
52      kEndOfRun =         2,    // END_OF_RUN
53      kStartOfRunFiles =  3,    // START_OF_RUN_FILES
54      kEndOfRunFiles =    4,    // END_OF_RUN_FILES
55      kStartOfBurst =     5,    // START_OF_BURST
56      kEndOfBurst =       6,    // END_OF_BURST
57      kPhysicsEvent =     7,    // PHYSICS_EVENT
58      kCalibrationEvent = 8,    // CALIBRATION_EVENT
59      kFormatError =      9     // EVENT_FORMAT_ERROR
60    };
61
62    // Type sizes
63    enum {
64      kIdWords        = 2,
65      kTriggerWords   = 2,
66      kDetectorWords  = 1,
67      kAttributeWords = 3
68    };
69
70 private:
71    UInt_t fSize;          // size of event in bytes
72    UInt_t fMagic;         // magic number used for consistency check
73    UInt_t fHeadLen;       // size of header in bytes
74    UInt_t fVersion;       // unique version identifier
75    UInt_t fType;          // event type
76    UInt_t fRunNb;         // run number
77    UInt_t fId[kIdWords];  // id field
78    UInt_t fTriggerPattern[kTriggerWords];   // trigger pattern
79    UInt_t fDetectorPattern[kDetectorWords]; // detector pattern
80    UInt_t fTypeAttribute[kAttributeWords];  // system (0,1) and user (2) attributes
81    UInt_t fLDCId;         // LDC id
82    UInt_t fGDCId;         // GDC id
83
84    static const Int_t fgkEventTypeMin = kStartOfRun;   // minimal event type
85    static const Int_t fgkEventTypeMax = kFormatError;  // maximal event type
86
87    static const UInt_t fgkEventMagicNumber        = 0xDA1E5AFE; // magic word
88    static const UInt_t fgkEventMagicNumberSwapped = 0xFE5A1EDA; // swapped magic word
89
90    ClassDef(AliRawEventHeader,1)  // Alice raw event header
91 };
92
93 #endif