1 #ifndef ALIRAWEVENTHEADERBASE_H
2 #define ALIRAWEVENTHEADERBASE_H
4 // Author: Cvetan Cheshkov 10/10/2005
6 /* Copyright(c) 1998-2005, ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
9 //////////////////////////////////////////////////////////////////////////
11 // AliRawEventHeaderBase //
13 //////////////////////////////////////////////////////////////////////////
15 //#ifndef ROOT_TObject
16 //#include <TObject.h>
19 class AliRawEventHeaderBase : public TObject {
22 AliRawEventHeaderBase();
23 virtual ~AliRawEventHeaderBase() { if (fExtendedData) delete [] fExtendedData; }
25 void *HeaderBaseBegin() { return (void *) &fSize; }
26 Int_t HeaderBaseSize() const { return (Long_t) &fVersion - (Long_t) &fSize + sizeof(fVersion); }
28 Int_t HeaderSize() const;
29 Bool_t DataIsSwapped() const { return fIsSwapped; }
30 Bool_t IsSwapped() const { return (fMagic == fgkEventMagicNumberSwapped) ? kTRUE : kFALSE; }
31 Bool_t IsValid() const { return IsSwapped() ? kTRUE : ((fMagic == fgkEventMagicNumber) ? kTRUE : kFALSE); }
33 UInt_t SwapWord(UInt_t x) const;
34 void SwapData(const void* data, const void* buf, UInt_t size);
36 UInt_t GetEventSize() const { return fSize; }
37 UInt_t GetMagic() const { return fMagic; }
38 UInt_t GetHeadSize() const { return fHeadSize; }
39 UInt_t GetVersion() const { return fVersion; }
40 UInt_t GetMajorVersion() const { return ((fVersion>>16)&0x0000ffff); }
41 UInt_t GetMinorVersion() const { return (fVersion&0x0000ffff); }
43 UInt_t GetExtendedDataSize() const { return fExtendedDataSize; }
44 char* GetExtendedData() const { return fExtendedData; }
45 void SetExtendedDataSize(Int_t size) { fExtendedDataSize = size; }
46 void SetExtendedData(char *data) { fExtendedData = data; }
48 const char * GetTypeName();
49 static AliRawEventHeaderBase* Create(char*& data);
50 Int_t ReadHeader(char*& data);
51 UInt_t Get(const char *datamember) const;
52 const UInt_t* GetP(const char *datamember) const;
54 // The following enumeration can be used once the kEventTypeMask has been
55 // applied to the raw event type
56 enum EAliRawEventType {
57 kStartOfRun = 1, // START_OF_RUN
58 kEndOfRun = 2, // END_OF_RUN
59 kStartOfRunFiles = 3, // START_OF_RUN_FILES
60 kEndOfRunFiles = 4, // END_OF_RUN_FILES
61 kStartOfBurst = 5, // START_OF_BURST
62 kEndOfBurst = 6, // END_OF_BURST
63 kPhysicsEvent = 7, // PHYSICS_EVENT
64 kCalibrationEvent = 8, // CALIBRATION_EVENT
65 kFormatError = 9, // EVENT_FORMAT_ERROR
66 kStartOfData = 10, // START_OF_DATA
67 kEndOfData = 11, // END_OF_DATA
68 kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
69 kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT
73 AliRawEventHeaderBase(const AliRawEventHeaderBase&);
74 AliRawEventHeaderBase& operator=(const AliRawEventHeaderBase&);
76 UInt_t fSize; // size of event in bytes
77 UInt_t fMagic; // magic number used for consistency check
78 UInt_t fHeadSize; // size of header in bytes
79 UInt_t fVersion; // unique version identifier
81 UInt_t fExtendedDataSize; // size of header extension data
82 char *fExtendedData; //[fExtendedDataSize] pointer to header extension data
84 Bool_t fIsSwapped; // is data swapped
86 static const UInt_t fgkEventMagicNumber = 0xDA1E5AFE; // magic word
87 static const UInt_t fgkEventMagicNumberSwapped = 0xFE5A1EDA; // swapped magic word
89 ClassDef(AliRawEventHeaderBase,1) // Alice raw event header base class
92 #define EVENT_HEADER_VERSION(AA,BB) AliRawEventHeaderV##AA##_##BB
94 #define START_EVENT_HEADER(AA,BB) \
95 class AliRawEventHeaderV##AA##_##BB:public AliRawEventHeaderBase { \
97 AliRawEventHeaderV##AA##_##BB():AliRawEventHeaderBase() {}; \
98 virtual ~AliRawEventHeaderV##AA##_##BB() {}; \
101 #define END_EVENT_HEADER(AA,BB) \
102 ClassDef(AliRawEventHeaderV##AA##_##BB,1) \
104 ClassImp(AliRawEventHeaderV##AA##_##BB)