-class AliRawDB;
-
-
-// The following enumeration can be used once the kEventTypeMask has been
-// applied to the raw event type
-enum EAliRawEventType {
- kStartOfRun = 1, // START_OF_RUN
- kEndOfRun = 2, // END_OF_RUN
- kStartOfRunFiles = 3, // START_OF_RUN_FILES
- kEndOfRunFiles = 4, // END_OF_RUN_FILES
- kStartOfBurst = 5, // START_OF_BURST
- kEndOfBurst = 6, // END_OF_BURST
- kPhysicsEvent = 7, // PHYSICS_EVENT
- kCalibrationEvent = 8, // CALIBRATION_EVENT
- kFormatError = 9 // EVENT_FORMAT_ERROR
-};
-
-const Int_t kEventTypeMin = kStartOfRun;
-const Int_t kEventTypeMax = kFormatError;
-
-const UInt_t kEventMagicNumber = 0xDA1E5AFE;
-const UInt_t kEventMagicNumberSwapped = 0xFE5A1EDA;
-
-// Type sizes
-const Int_t kIdWords = 2;
-const Int_t kTriggerWords = 2;
-const Int_t kDetectorWords = 1;
-const Int_t kAttributeWords = 3;
-
-
-class AliRawEventHeader : public TObject {
-
-private:
- UInt_t fSize; // size of event in bytes
- UInt_t fMagic; // magic number used for consistency check
- UInt_t fHeadLen; // size of header in bytes
- UInt_t fVersion; // unique version identifier
- UInt_t fType; // event type
- UInt_t fRunNb; // run number
- UInt_t fId[kIdWords]; // id field
- UInt_t fTriggerPattern[kTriggerWords]; // trigger pattern
- UInt_t fDetectorPattern[kDetectorWords]; // detector pattern
- UInt_t fTypeAttribute[kAttributeWords]; // system (0,1) and user (2) attributes
- UInt_t fLDCId; // LDC id
- UInt_t fGDCId; // GDC id
-
-public:
- AliRawEventHeader() { fSize = 0; }
- virtual ~AliRawEventHeader() { }
-
- void *HeaderBegin() { return (void *) &fSize; }
- Int_t HeaderSize() const { return (Long_t) &fGDCId - (Long_t) &fSize + sizeof(fGDCId); }
- Bool_t DataIsSwapped() const;
- Bool_t IsSwapped() const { return (fMagic == kEventMagicNumberSwapped) ? kTRUE : kFALSE; }
- Bool_t IsValid() const { return IsSwapped() ? kTRUE : ((fMagic == kEventMagicNumber) ? kTRUE : kFALSE); }
- void Swap();
-
- UInt_t GetEventSize() const { return fSize; }
- UInt_t GetMagic() const { return fMagic; }
- UInt_t GetHeaderLength() const { return fHeadLen; }
- UInt_t GetVersion() const { return fVersion; }
- UInt_t GetType() const { return fType; }
- const char *GetTypeName() const;
- UInt_t GetRunNumber() const { return fRunNb; }
- UInt_t GetEventInRun() const;
- const UInt_t *GetId() const { return fId; }
- const UInt_t *GetTriggerPattern() const { return fTriggerPattern; }
- const UInt_t *GetDetectorPattern() const { return fDetectorPattern; }
- const UInt_t *GetTypeAttribute() const { return fTypeAttribute; }
- UInt_t GetLDCId() const { return fLDCId; }
- UInt_t GetGDCId() const { return fGDCId; }
-
- ClassDef(AliRawEventHeader,1) // Alice raw event header
-};
-
-
-class AliRawEquipmentHeader : public TObject {
-
-private:
- UInt_t fSize; // number of raw data bytes
- UInt_t fEquipmentType; // equipment type
- UInt_t fEquipmentID; // equipment ID
- UInt_t fTypeAttribute[kAttributeWords]; // system (0,1) and user (2) attributes
- UInt_t fBasicElementSizeType; // basic element size type
-
-public:
- AliRawEquipmentHeader() { fSize = 0; }
- ~AliRawEquipmentHeader() { }
-
- void *HeaderBegin() { return (void *) &fSize; }
- Int_t HeaderSize() const { return (Long_t) &fBasicElementSizeType - (Long_t) &fSize + sizeof(fBasicElementSizeType); }
- void Swap();
-
- UInt_t GetEquipmentSize() const { return fSize; }
- UInt_t GetEquipmentType() const { return fEquipmentType; }
- UInt_t GetId() const { return fEquipmentID; }
- const UInt_t *GetTypeAttribute() const { return fTypeAttribute; }
- UInt_t GetBasicSizeType() const { return fBasicElementSizeType; }
-
- ClassDef(AliRawEquipmentHeader,1) //Alice equipment header
-};
-
-
-class AliRawData : public TObject {
-
-private:
- Int_t fSize; // number of raw data bytes
- Int_t fBufSize; //!actual size of fRawData
- char *fRawData; //[fSize] raw event data
- Bool_t fOwner; //!if true object owns fRawData buffer
-
-public:
- AliRawData() { fSize = fBufSize = 0; fRawData = 0; fOwner = kFALSE; }
- virtual ~AliRawData() { if (fOwner) delete [] fRawData; }
-
- void SetSize(Int_t size) {
- if (size > fBufSize) {
- if (fOwner) delete [] fRawData;
- fRawData = new char [size];
- fBufSize = size;
- fOwner = kTRUE;
- }
- fSize = size;
- }
- void SetBuffer(void *buf, Int_t size) {
- if (fOwner) delete [] fRawData;
- fRawData = (char *) buf;
- fBufSize = size;
- fSize = size;
- fOwner = kFALSE;
- }
- Int_t GetSize() const { return fSize; }
- void *GetBuffer() { return fRawData; }
-
- ClassDef(AliRawData,1) // Alice raw event buffer
-};