From 26f75fad869470213e4c77b841799f539cbd0401 Mon Sep 17 00:00:00 2001 From: hristov Date: Mon, 24 Mar 2014 10:16:41 +0100 Subject: [PATCH] ALIROOT-5420 Changes for CDH v3 --- RAW/AliAltroBuffer.cxx | 2 +- RAW/AliAltroBufferV3.cxx | 2 +- RAW/AliRawDataHeaderV3.h | 89 +++++++++++++ RAW/AliRawEventHeaderVersions.h | 15 +++ RAW/AliRawReader.cxx | 8 ++ RAW/AliRawReader.h | 30 ++++- RAW/AliRawReaderRoot.cxx | 64 +++++++-- RAW/CMakelibRAWDatabase.pkg | 2 +- RAW/dateStream.cxx | 16 +-- RAW/event.h | 213 ++++++++++++++++++++---------- STEER/STEER/AliRawDataHeaderSim.h | 6 +- TOF/AliTOFDecoder.cxx | 13 +- TOF/AliTOFDecoder.h | 5 +- TOF/AliTOFRawStream.cxx | 14 +- 14 files changed, 369 insertions(+), 110 deletions(-) create mode 100644 RAW/AliRawDataHeaderV3.h diff --git a/RAW/AliAltroBuffer.cxx b/RAW/AliAltroBuffer.cxx index 924477cddc2..815cfd67b0e 100644 --- a/RAW/AliAltroBuffer.cxx +++ b/RAW/AliAltroBuffer.cxx @@ -265,7 +265,7 @@ UChar_t AliAltroBuffer::WriteRCUTrailer(Int_t rcuId) UInt_t currentFilePos = fFile->Tellp(); UInt_t size = currentFilePos-fDataHeaderPos; - size -= sizeof(AliRawDataHeader); + size -= sizeof(AliRawDataHeaderV3); if ((size % 5) != 0) { AliFatal(Form("The current raw data payload is not a mutiple of 5 (%d) ! Can not write the RCU trailer !",size)); diff --git a/RAW/AliAltroBufferV3.cxx b/RAW/AliAltroBufferV3.cxx index e47dcace5ee..13dff27431c 100644 --- a/RAW/AliAltroBufferV3.cxx +++ b/RAW/AliAltroBufferV3.cxx @@ -169,7 +169,7 @@ UChar_t AliAltroBufferV3::WriteRCUTrailer(Int_t rcuId) UInt_t currentFilePos = fFile->Tellp(); UInt_t size = currentFilePos-fDataHeaderPos; - size -= sizeof(AliRawDataHeader); + size -= sizeof(AliRawDataHeaderV3); size /= 4; if (size > 0x3FFFFFF) { diff --git a/RAW/AliRawDataHeaderV3.h b/RAW/AliRawDataHeaderV3.h new file mode 100644 index 00000000000..6b195f23b7f --- /dev/null +++ b/RAW/AliRawDataHeaderV3.h @@ -0,0 +1,89 @@ +#ifndef ALIRAWDATAHEADERV3_H +#define ALIRAWDATAHEADERV3_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +struct AliRawDataHeaderV3 { + AliRawDataHeaderV3() : + fSize(0xFFFFFFFF), + fWord2(3<<24), + fEventID2(0), + fAttributesSubDetectors(0), + fStatusMiniEventID(0x10000), // status bit 4: no L1/L2 trigger information + fTriggerClassLow(0), + fTriggerClassesMiddleLow(0), + fTriggerClassesMiddleHigh(0), + fROILowTriggerClassHigh(0), + fROIHigh(0) + {} + + // Adding virtual destructor breaks + // C++ struct backward compatibility + // Do not uncomment the line below!!! + // virtual ~AliRawDataHeaderV3() {} + + UShort_t GetEventID1() const + { + return (UShort_t)( fWord2 & 0xFFF ); + }; + + UInt_t GetEventID2() const + { + return fEventID2; + }; + + UChar_t GetL1TriggerMessage() const + { + return (UChar_t)( (fWord2 >> 14) & 0xFF ); + }; + + UChar_t GetVersion() const + { + return (UChar_t)( (fWord2 >> 24) & 0xFF ); + }; + + UChar_t GetAttributes() const + {return (fAttributesSubDetectors >> 24) & 0xFF;}; + Bool_t TestAttribute(Int_t index) const + {return (fAttributesSubDetectors >> (24 + index)) & 1;}; + void SetAttribute(Int_t index) + {fAttributesSubDetectors |= (1 << (24 + index));}; + void ResetAttribute(Int_t index) + {fAttributesSubDetectors &= (0xFFFFFFFF ^ (1 << (24 + index)));}; + UInt_t GetSubDetectors() const + {return fAttributesSubDetectors & 0xFFFFFF;}; + + UInt_t GetStatus() const + {return (fStatusMiniEventID >> 12) & 0xFFFF;}; + UInt_t GetMiniEventID() const + {return fStatusMiniEventID & 0xFFF;}; + + ULong64_t GetTriggerClasses() const + {return (((ULong64_t) (fTriggerClassesMiddleLow & 0x3FFFF)) << 32) | fTriggerClassLow;} + ULong64_t GetTriggerClassesNext50() const + {return (((ULong64_t) (fROILowTriggerClassHigh & 0x3FFFF)) << 32) | fTriggerClassesMiddleHigh;} + ULong64_t GetROI() const + {return (((ULong64_t) fROIHigh) << 4) | ((fROILowTriggerClassHigh >> 28) & 0xF);} + + void SetTriggerClass(ULong64_t mask) + {fTriggerClassLow = (UInt_t)(mask & 0xFFFFFFFF); // low bits of trigger class + fTriggerClassesMiddleLow = (UInt_t)((mask >> 32) & 0x3FFFF); // low bits of ROI data (bits 28-31) and high bits of trigger class (bits 0-17) + }; + void SetTriggerClassNext50(ULong64_t mask) + {fTriggerClassesMiddleHigh = (UInt_t)(mask & 0xFFFFFFFF); // low bits of trigger class + fROILowTriggerClassHigh = (UInt_t)((mask >> 32) & 0x3FFFF); // low bits of ROI data (bits 28-31) and high bits of trigger class (bits 0-17) + }; + + UInt_t fSize; // size of the raw data in bytes + UInt_t fWord2; // bunch crossing, L1 trigger message and fomrat version + UInt_t fEventID2; // orbit number + UInt_t fAttributesSubDetectors; // block attributes (bits 24-31) and participating sub detectors + UInt_t fStatusMiniEventID; // status & error bits (bits 12-27) and mini event ID (bits 0-11) + UInt_t fTriggerClassLow; // low bits of trigger class + UInt_t fTriggerClassesMiddleLow; // 18 bits go into eventTriggerPattern[1] (low), 14 bits are zeroes (cdhMBZ2) + UInt_t fTriggerClassesMiddleHigh; // Goes into eventTriggerPattern[1] (high) and [2] (low) + UInt_t fROILowTriggerClassHigh; // low bits of ROI data (bits 28-31) and high bits of trigger class (bits 0-17) + UInt_t fROIHigh; // high bits of ROI data +}; + +#endif diff --git a/RAW/AliRawEventHeaderVersions.h b/RAW/AliRawEventHeaderVersions.h index 809e0ed18aa..41c4384b009 100644 --- a/RAW/AliRawEventHeaderVersions.h +++ b/RAW/AliRawEventHeaderVersions.h @@ -177,4 +177,19 @@ START_EVENT_HEADER(3,13) END_EVENT_HEADER(3,13) +START_EVENT_HEADER(3,14) + + UInt_t fType; // event type + UInt_t fRunNb; // run number + UInt_t fId[2]; // id field + UInt_t fTriggerPattern[4]; // trigger pattern + UInt_t fDetectorPattern; // detector pattern + UInt_t fTypeAttribute[3]; // system (0,1) and user (2) attributes + UInt_t fLdcId; // LDC id + UInt_t fGdcId; // GDC id + UInt_t fTimestamp; // event timestamp + UInt_t fTimestampUsec; // event timestamp (microseconds) + +END_EVENT_HEADER(3,14) + #endif diff --git a/RAW/AliRawReader.cxx b/RAW/AliRawReader.cxx index a6a6d1f555e..fc0529058a4 100644 --- a/RAW/AliRawReader.cxx +++ b/RAW/AliRawReader.cxx @@ -62,6 +62,7 @@ AliRawReader::AliRawReader() : fEquipmentIdsOut(NULL), fRequireHeader(kTRUE), fHeader(NULL), + fHeaderV3(NULL), fCount(0), fSelectEquipmentType(-1), fSelectMinEquipmentId(-1), @@ -74,6 +75,7 @@ AliRawReader::AliRawReader() : fEventNumber(-1), fErrorLogs("AliRawDataErrorLog",100), fHeaderSwapped(NULL), + fHeaderSwappedV3(NULL), fIsValid(kTRUE), fIsTriggerClassLoaded(kFALSE) { @@ -81,6 +83,7 @@ AliRawReader::AliRawReader() : // Allocate the swapped header in case of Mac #ifndef R__BYTESWAP fHeaderSwapped=new AliRawDataHeader(); + fHeaderSwappedV3=new AliRawDataHeaderV3(); #endif } @@ -122,6 +125,7 @@ AliRawReader::AliRawReader(const AliRawReader& rawReader) : fEquipmentIdsOut(rawReader.fEquipmentIdsOut), fRequireHeader(rawReader.fRequireHeader), fHeader(rawReader.fHeader), + fHeaderV3(rawReader.fHeaderV3), fCount(rawReader.fCount), fSelectEquipmentType(rawReader.fSelectEquipmentType), fSelectMinEquipmentId(rawReader.fSelectMinEquipmentId), @@ -134,6 +138,7 @@ AliRawReader::AliRawReader(const AliRawReader& rawReader) : fEventNumber(-1), fErrorLogs("AliRawDataErrorLog",100), fHeaderSwapped(NULL), + fHeaderSwappedV3(NULL), fIsValid(rawReader.fIsValid), fIsTriggerClassLoaded(rawReader.fIsTriggerClassLoaded) { @@ -141,6 +146,7 @@ AliRawReader::AliRawReader(const AliRawReader& rawReader) : // Allocate the swapped header in case of Mac #ifndef R__BYTESWAP fHeaderSwapped=new AliRawDataHeader(*rawReader.fHeaderSwapped); + fHeaderSwappedV3=new AliRawDataHeader(*rawReader.fHeaderSwappedV3); #endif } @@ -152,6 +158,7 @@ AliRawReader& AliRawReader::operator = (const AliRawReader& rawReader) fEquipmentIdsOut = rawReader.fEquipmentIdsOut; fHeader = rawReader.fHeader; + fHeaderV3 = rawReader.fHeaderV3; fCount = rawReader.fCount; fSelectEquipmentType = rawReader.fSelectEquipmentType; @@ -182,6 +189,7 @@ AliRawReader::~AliRawReader() if (fEquipmentIdsOut) delete fEquipmentIdsOut; fErrorLogs.Delete(); if (fHeaderSwapped) delete fHeaderSwapped; + if (fHeaderSwappedV3) delete fHeaderSwappedV3; } AliRawReader* AliRawReader::Create(const char *uri) diff --git a/RAW/AliRawReader.h b/RAW/AliRawReader.h index b2ee284adb9..f913553e31b 100644 --- a/RAW/AliRawReader.h +++ b/RAW/AliRawReader.h @@ -17,6 +17,7 @@ #include "AliRawDataErrorLog.h" #include "AliRawDataHeader.h" +#include "AliRawDataHeaderV3.h" class THashList; class TChain; @@ -94,29 +95,42 @@ class AliRawReader: public TObject { Int_t GetDataSize() const {if (fHeader) { - if (fHeader->fSize != 0xFFFFFFFF) return fHeader->fSize - sizeof(AliRawDataHeader); - else return GetEquipmentSize() - GetEquipmentHeaderSize() - sizeof(AliRawDataHeader); - } else return GetEquipmentSize() - GetEquipmentHeaderSize();}; + if (fHeader->fSize != 0xFFFFFFFF) return fHeader->fSize - sizeof(AliRawDataHeader); + else return GetEquipmentSize() - GetEquipmentHeaderSize() - sizeof(AliRawDataHeader); + } else if(fHeaderV3){ + if (fHeaderV3->fSize != 0xFFFFFFFF) return fHeaderV3->fSize - sizeof(AliRawDataHeaderV3); + else return GetEquipmentSize() - GetEquipmentHeaderSize() - sizeof(AliRawDataHeaderV3); + } + else return GetEquipmentSize() - GetEquipmentHeaderSize();}; Int_t GetVersion() const - {if (fHeader) return fHeader->GetVersion(); else return -1;}; + {if (fHeader) return fHeader->GetVersion(); + else if (fHeaderV3) return fHeaderV3->GetVersion(); + else return -1;}; Bool_t IsValid() const - {if (fHeader) return fHeader->TestAttribute(0); - else return kFALSE;}; + {if (fHeader) return fHeader->TestAttribute(0); + else if (fHeaderV3) return fHeaderV3->TestAttribute(0); + else return kFALSE;}; Bool_t IsCompressed() const {if (fHeader) return fHeader->TestAttribute(1); + else if (fHeaderV3) return fHeaderV3->TestAttribute(1); else return kFALSE;}; Bool_t TestBlockAttribute(Int_t index) const - {if (fHeader) return fHeader->TestAttribute(index); + {if (fHeader) return fHeader->TestAttribute(index); + else if (fHeaderV3) return fHeaderV3->TestAttribute(index); else return kFALSE;}; UChar_t GetBlockAttributes() const {if (fHeader) return fHeader->GetAttributes(); + else if (fHeaderV3) return fHeaderV3->GetAttributes(); else return 0;}; UInt_t GetStatusBits() const {if (fHeader) return fHeader->GetStatus(); + else if (fHeaderV3) return fHeaderV3->GetStatus(); else return 0;}; const AliRawDataHeader* GetDataHeader() const {return fHeader;} + const AliRawDataHeaderV3* GetDataHeaderV3() const + {return fHeaderV3;} virtual Bool_t ReadHeader() = 0; virtual Bool_t ReadNextData(UChar_t*& data) = 0; @@ -189,6 +203,7 @@ class AliRawReader: public TObject { Bool_t fRequireHeader; // if false, data without header is accepted AliRawDataHeader* fHeader; // current data header + AliRawDataHeaderV3* fHeaderV3; // current data header Int_t fCount; // counter of bytes to be read for current DDL Int_t fSelectEquipmentType; // type of selected equipment (<0 = no selection) @@ -205,6 +220,7 @@ class AliRawReader: public TObject { TClonesArray fErrorLogs; // raw data decoding errors AliRawDataHeader* fHeaderSwapped; // temporary buffer for swapping header on PowerPC + AliRawDataHeaderV3* fHeaderSwappedV3; // temporary buffer for swapping header on PowerPC UInt_t SwapWord(UInt_t x) const; UShort_t SwapShort(UShort_t x) const; diff --git a/RAW/AliRawReaderRoot.cxx b/RAW/AliRawReaderRoot.cxx index 86c9bc17139..97f92858c55 100644 --- a/RAW/AliRawReaderRoot.cxx +++ b/RAW/AliRawReaderRoot.cxx @@ -191,10 +191,19 @@ AliRawReaderRoot::AliRawReaderRoot(const AliRawReaderRoot& rawReader) : fSubEvent = fEvent->GetSubEvent(fSubEventIndex-1); fEquipment = fSubEvent->GetEquipment(fEquipmentIndex); fRawData = fEquipment->GetRawData(); - fCount = 0; + fCount = 0; fHeader = (AliRawDataHeader*) ((UChar_t*) fRawData->GetBuffer() + ((UChar_t*) rawReader.fHeader - (UChar_t*) rawReader.fRawData->GetBuffer())); + // Now check the version of the header + UChar_t version = 2; + if (fHeader) version = fHeader->GetVersion(); + if (version==3) { + fHeader = NULL; + fHeaderV3 = (AliRawDataHeaderV3*) ((UChar_t*) fRawData->GetBuffer() + + ((UChar_t*) rawReader.fHeaderV3 - + (UChar_t*) rawReader.fRawData->GetBuffer())); + } fPosition = (UChar_t*) fRawData->GetBuffer() + (rawReader.fPosition - (UChar_t*) rawReader.fRawData->GetBuffer()); fEnd = ((UChar_t*) fRawData->GetBuffer()) + fRawData->GetSize(); @@ -445,23 +454,57 @@ Bool_t AliRawReaderRoot::ReadHeader() // "read" the data header fHeader = (AliRawDataHeader*) fPosition; + // Now check the version of the header + UChar_t version = 2; + if (fHeader) version=fHeader->GetVersion(); + if (version==2) { + #ifndef R__BYTESWAP + SwapData((void*) fHeader, (void*) fHeaderSwapped, sizeof(AliRawDataHeader)); + fHeader=fHeaderSwapped; +#endif + if ((fPosition + fHeader->fSize) != fEnd) { + if (fHeader->fSize != 0xFFFFFFFF) + Warning("ReadHeader", + "Equipment %d : raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !", + fEquipment->GetEquipmentHeader()->GetId(),fHeader->fSize, fEnd - fPosition); + fHeader->fSize = fEnd - fPosition; + } + fPosition += sizeof(AliRawDataHeader); + fHeaderV3 = 0; + } else if (version==3) { + fHeaderV3 = (AliRawDataHeaderV3*) fPosition; #ifndef R__BYTESWAP - SwapData((void*) fHeader, (void*) fHeaderSwapped, sizeof(AliRawDataHeader)); - fHeader=fHeaderSwapped; + SwapData((void*) fHeaderV3, (void*) fHeaderSwapped, sizeof(AliRawDataHeaderV3)); + fHeaderV3=fHeaderSwappedV3; #endif - if ((fPosition + fHeader->fSize) != fEnd) { - if (fHeader->fSize != 0xFFFFFFFF) - Warning("ReadHeader", - "Equipment %d : raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !", - fEquipment->GetEquipmentHeader()->GetId(),fHeader->fSize, fEnd - fPosition); - fHeader->fSize = fEnd - fPosition; + if ((fPosition + fHeaderV3->fSize) != fEnd) { + if (fHeaderV3->fSize != 0xFFFFFFFF) + Warning("ReadHeader", + "Equipment %d : raw data size found in the header is wrong (%d != %ld)! Using the equipment size instead !", + fEquipment->GetEquipmentHeader()->GetId(),fHeader->fSize, fEnd - fPosition); + fHeaderV3->fSize = fEnd - fPosition; + } + fPosition += sizeof(AliRawDataHeaderV3); + fHeader = 0; } - fPosition += sizeof(AliRawDataHeader); } if (fHeader && (fHeader->fSize != 0xFFFFFFFF)) { fCount = fHeader->fSize - sizeof(AliRawDataHeader); + // check consistency of data size in the header and in the sub event + if (fPosition + fCount > fEnd) { + Error("ReadHeader", "size in data header exceeds event size!"); + Warning("ReadHeader", "skipping %ld bytes", fEnd - fPosition); + fEquipment->GetEquipmentHeader()->Dump(); + fCount = 0; + fPosition = fEnd; + fErrorCode = kErrSize; + continue; + } + } else if (fHeaderV3 && (fHeaderV3->fSize != 0xFFFFFFFF)) { + fCount = fHeaderV3->fSize - sizeof(AliRawDataHeaderV3); + // check consistency of data size in the header and in the sub event if (fPosition + fCount > fEnd) { Error("ReadHeader", "size in data header exceeds event size!"); @@ -526,6 +569,7 @@ Bool_t AliRawReaderRoot::Reset() fEquipment = NULL; fRawData = NULL; fHeader = NULL; + fHeaderV3 = NULL; fCount = 0; fPosition = fEnd = NULL; diff --git a/RAW/CMakelibRAWDatabase.pkg b/RAW/CMakelibRAWDatabase.pkg index 0fd590d707e..fc0827ae481 100644 --- a/RAW/CMakelibRAWDatabase.pkg +++ b/RAW/CMakelibRAWDatabase.pkg @@ -59,5 +59,5 @@ if(DATE_ROOT) endif(DATE_ROOT) -set ( EXPORT AliRawDataHeader.h AliAltroMapping.h) +set ( EXPORT AliRawDataHeader.h AliRawDataHeaderV3.h AliAltroMapping.h) set ( EINCLUDE STEER/ESD STEER/STEERBase ) diff --git a/RAW/dateStream.cxx b/RAW/dateStream.cxx index f49eca0feba..69715eb8b6b 100644 --- a/RAW/dateStream.cxx +++ b/RAW/dateStream.cxx @@ -61,7 +61,7 @@ struct gdcEventDescriptorStruct { struct eventHeaderStruct header; int loaded; unsigned long32 detPattern; - eventTimestampType timestamp; + eventTimestampSecType timestamp; } *currGdc; struct ldcEventDescriptorStruct { struct equipmentEventDescriptorStruct *head; @@ -71,7 +71,7 @@ struct ldcEventDescriptorStruct { struct eventHeaderStruct header; int loaded; unsigned long32 detPattern; - eventTimestampType timestamp; + eventTimestampSecType timestamp; } *currLdc; struct equipmentEventDescriptorStruct { struct equipmentEventDescriptorStruct *next; @@ -89,7 +89,7 @@ struct payloadDescriptorStruct { int lineNmb; eventGdcIdType currGdcId; unsigned long32 currDetPattern; -eventTimestampType currTimestamp; +eventTimestampSecType currTimestamp; eventLdcIdType currLdcId; equipmentIdType currEquipmentId; int currRunNb; @@ -632,10 +632,6 @@ void loadPayload( const char *fileName ) { printf( "\n" ); printf( " " ); - if ( cdh->cdhMBZ3 != 0 ) { - printf( "MBZ3:0x%x ", - cdh->cdhMBZ3 ); - } printf( "ROI:0x(%08x-%01x)", cdh->cdhRoiHigh, cdh->cdhRoiLow ); if ( cdh->cdhRoiHigh != 0 || cdh->cdhRoiLow != 0 ) { @@ -1587,11 +1583,11 @@ RoiHigh/Low reference:0x%x-%x current:0x%x-%x\n", if ( cdh->cdhMBZ0 != 0 || cdh->cdhMBZ1 != 0 || cdh->cdhMBZ2 != 0 - || cdh->cdhMBZ3 != 0 ) { + ) { fprintf( stderr, - "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x MBZ3:0x%x\n", + "%s: CDH check failed. MBZ0:0x%x MBZ1:0x%x MBZ2:0x%x\n", myName, - cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2, cdh->cdhMBZ3 ); + cdh->cdhMBZ0, cdh->cdhMBZ1, cdh->cdhMBZ2 ); exit( 1 ); } } diff --git a/RAW/event.h b/RAW/event.h index 41d4bb56fe8..31b4459cc42 100644 --- a/RAW/event.h +++ b/RAW/event.h @@ -45,10 +45,18 @@ * L1 trigger message [14-21] * V03.08 RD 17-Jan-07 Added "BY DETECTOR" event system attribute * V03.09 RD 08-Feb-07 Moved trigger and detector masks down 1 bit + * KS 14-May-08 Define trigger error bits 13+14 for the CDH + * V03.10 RD 10-Nov-09 Define ATTR_EMPTY_EVENT attribute (removed) + * V03.11 RD 01-Dec-10 Timestamp sec + usec + * V03.12 RD 13-Sep-11 Added ATTR_ORIGINAL_EVENT and CDH_ORIGINAL_EVENT + * V03.13 RD 15-Feb-12 Added SYNC event + * RD 15-Jan-14 Added FLUSHED_EVENT and INCOMPLETE_EVENT + * V03.14 RD 12-Feb-14 Changes for increased number of trigger classes + * (old:50, new:100) and for CDH V3 * * Preprocessor definitions: * NDEBUG Define BEFORE including this file to disable run-time checks on - * various parameters + * various parameters made via assert() * * Related facilities: * validateEvent.c Validation program, should be run after EACH change to @@ -57,8 +65,8 @@ #ifndef __event_h__ #define __event_h__ -#define EVENT_MAJOR_VERSION_NUMBER 0x0003 -#define EVENT_MINOR_VERSION_NUMBER 0x0009 +#define EVENT_MAJOR_VERSION_NUMBER 3 +#define EVENT_MINOR_VERSION_NUMBER 14 /* ========== System includes ========= */ #include /* Needed by: memset, memcpy */ @@ -66,14 +74,16 @@ /* ========== Definitions for the event header ========== */ -/* ---------- Header base size ---------- */ -/* This value must be updated for each change in the eventHeaderStruct */ -#define EVENT_HEAD_BASE_SIZE 68 +/* ------------------------- Header base size ------------------------- */ +/* This value must be updated for each change in the eventHeaderStruct */ +/* This has not been made automatic as we want to keep this value under */ +/* strict control... */ +#define EVENT_HEAD_BASE_SIZE 80 /* ---------- Event size ---------- */ typedef unsigned long32 eventSizeType; -/* ---------- Magic signature and its byte-swapped version ---------- */ +/* ----------- Magic signature and its byte-swapped version ----------- */ typedef unsigned long32 eventMagicType; #define EVENT_MAGIC_NUMBER ((eventMagicType)0xDA1E5AFE) #define EVENT_MAGIC_NUMBER_SWAPPED ((eventMagicType)0xFE5A1EDA) @@ -102,8 +112,9 @@ typedef unsigned long32 eventTypeType; #define END_OF_DATA ((eventTypeType)11) #define SYSTEM_SOFTWARE_TRIGGER_EVENT ((eventTypeType)12) #define DETECTOR_SOFTWARE_TRIGGER_EVENT ((eventTypeType)13) +#define SYNC_EVENT ((eventTypeType)14) #define EVENT_TYPE_MIN 1 -#define EVENT_TYPE_MAX 13 +#define EVENT_TYPE_MAX 14 enum eventTypeEnum { startOfRun = START_OF_RUN, endOfRun = END_OF_RUN, @@ -117,7 +128,8 @@ enum eventTypeEnum { startOfData = START_OF_DATA, endOfData = END_OF_DATA, systemSoftwareTriggerEvent = SYSTEM_SOFTWARE_TRIGGER_EVENT, - detectorSoftwareTriggerEvent = DETECTOR_SOFTWARE_TRIGGER_EVENT + detectorSoftwareTriggerEvent = DETECTOR_SOFTWARE_TRIGGER_EVENT, + syncEvent = SYNC_EVENT }; #define EVENT_TYPE_OK(t) (((t) >= EVENT_TYPE_MIN) && (((t) <= EVENT_TYPE_MAX))) @@ -187,19 +199,20 @@ typedef unsigned long32 eventIdType[EVENT_ID_WORDS]; memcpy((void*)to,(const void*)from,EVENT_ID_BYTES) #define ADD_EVENT_ID(a,b) ((a)[1]+=(b)[1],(a)[0]+=(b)[0]) #define SUB_EVENT_ID(a,b) ((a)[1]-=(b)[1],(a)[0]-=(b)[0]) -#define ZERO_EVENT_ID(id) memset(id,0,EVENT_ID_BYTES) +#define ZERO_EVENT_ID(id) memset((void *)(id),0,EVENT_ID_BYTES) /* ---------- Trigger pattern (and relative masks) ---------- */ -#define EVENT_TRIGGER_PATTERN_BYTES 8 +// The top bit of the trigger pattern is reserved for the validity flag +#define EVENT_TRIGGER_PATTERN_BYTES 16 #define EVENT_TRIGGER_PATTERN_WORDS ((EVENT_TRIGGER_PATTERN_BYTES)>>2) typedef unsigned long32 eventTriggerPatternType[EVENT_TRIGGER_PATTERN_WORDS]; #define EVENT_TRIGGER_ID_MIN 0 -#define EVENT_TRIGGER_ID_MAX 49 +#define EVENT_TRIGGER_ID_MAX 99 #define CHECK_TRIGGER(t) (assert(((t)>=EVENT_TRIGGER_ID_MIN) && \ ((t)<=EVENT_TRIGGER_ID_MAX))) #define TRIGGER_TO_BIT(t) (1<<((t)&0x1f)) #define TRIGGER_TO_WORD(t) (CHECK_TRIGGER(t), (t)>>5) -#define ZERO_TRIGGER_PATTERN(p) ((p)[0]=0, (p)[1]=0) +#define ZERO_TRIGGER_PATTERN(p) memset( (void *)(p), 0, EVENT_TRIGGER_PATTERN_BYTES ) #define SET_TRIGGER_IN_PATTERN(p,id) (p)[TRIGGER_TO_WORD(id)] |= \ TRIGGER_TO_BIT(id) #define CLEAR_TRIGGER_IN_PATTERN(p,id) (p)[TRIGGER_TO_WORD(id)] &= \ @@ -208,19 +221,18 @@ typedef unsigned long32 eventTriggerPatternType[EVENT_TRIGGER_PATTERN_WORDS]; TRIGGER_TO_BIT(id) #define TEST_TRIGGER_IN_PATTERN(p,id) (((p)[TRIGGER_TO_WORD(id)] & \ TRIGGER_TO_BIT(id)) != 0) -#define TRIGGER_PATTERN_INVALID(p) (((p)[1] & 0x80000000) == 0) -#define TRIGGER_PATTERN_VALID(p) (((p)[1] & 0x80000000) != 0) -#define VALIDATE_TRIGGER_PATTERN(p) ((p)[1] |= 0x80000000) -#define INVALIDATE_TRIGGER_PATTERN(p) ((p)[1] &= 0x7fffffff) -#define COPY_TRIGGER_PATTERN(f,t) ((t)[0] = (f)[0], (t)[1]=(f)[1]) -#define TRIGGER_PATTERN_OK(p) (((p)[1] & 0x7fe00000) == 0) +#define TRIGGER_PATTERN_INVALID(p) (((p)[EVENT_TRIGGER_PATTERN_WORDS-1] & 0x80000000) == 0) +#define TRIGGER_PATTERN_VALID(p) (((p)[EVENT_TRIGGER_PATTERN_WORDS-1] & 0x80000000) != 0) +#define VALIDATE_TRIGGER_PATTERN(p) ((p)[EVENT_TRIGGER_PATTERN_WORDS-1] |= 0x80000000) +#define INVALIDATE_TRIGGER_PATTERN(p) ((p)[EVENT_TRIGGER_PATTERN_WORDS-1] &= 0x7fffffff) +#define COPY_TRIGGER_PATTERN(f,t) memcpy( (void *)(t), (void *)(f), EVENT_TRIGGER_PATTERN_BYTES ) +#define TRIGGER_PATTERN_OK(p) (((p)[EVENT_TRIGGER_PATTERN_WORDS-1] & 0x7ffffff0) == 0) /* ---------- Detectors cluster (and relative masks) ---------- */ #define EVENT_DETECTOR_PATTERN_BYTES 4 #define EVENT_DETECTOR_PATTERN_WORDS (EVENT_DETECTOR_PATTERN_BYTES>>2) typedef unsigned long32 eventDetectorPatternType[EVENT_DETECTOR_PATTERN_WORDS]; #define EVENT_DETECTOR_ID_MIN 0 -#define EVENT_DETECTOR_HW_ID_MAX 23 #define EVENT_DETECTOR_ID_MAX 30 #define CHECK_DETECTOR(d) (assert(((d) >= EVENT_DETECTOR_ID_MIN) &&\ ((d) <= EVENT_DETECTOR_ID_MAX))) @@ -235,28 +247,8 @@ typedef unsigned long32 eventDetectorPatternType[EVENT_DETECTOR_PATTERN_WORDS]; #define VALIDATE_DETECTOR_PATTERN(p) ((p)[0] |= 0x80000000) #define INVALIDATE_DETECTOR_PATTERN(p) ((p)[0] &= 0x7fffffff) #define COPY_DETECTOR_PATTERN(f,t) ((t)[0] = (f)[0]) -#define DETECTOR_PATTERN_OK(p) (((p)[0] & 0x3f000000) == 0) -#define EVENT_DETECTOR_ITS_SPD 0 -#define EVENT_DETECTOR_ITS_SDD 1 -#define EVENT_DETECTOR_ITS_SSD 2 -#define EVENT_DETECTOR_TPC 3 -#define EVENT_DETECTOR_TRD 4 -#define EVENT_DETECTOR_TOF 5 -#define EVENT_DETECTOR_HMPID 6 -#define EVENT_DETECTOR_PHOS 7 -#define EVENT_DETECTOR_CPV 8 -#define EVENT_DETECTOR_PMD 9 -#define EVENT_DETECTOR_MUON_TRK 10 -#define EVENT_DETECTOR_MOUN_TRG 11 -#define EVENT_DETECTOR_FMD 12 -#define EVENT_DETECTOR_T0 13 -#define EVENT_DETECTOR_V0 14 -#define EVENT_DETECTOR_ZDC 15 -#define EVENT_DETECTOR_ACORDE 16 -#define EVENT_DETECTOR_TRG 17 -#define EVENT_DETECTOR_EMCAL 18 -#define EVENT_DETECTOR_HLT 19 -#define EVENT_DETECTOR_DAQ_TEST 30 +#define DETECTOR_PATTERN_OK(p) (((p)[0] & 0x1f000000) == 0) + /* ---------- The sizes and positions of the typeAttribute field ---------- */ #define ALL_ATTRIBUTE_WORDS 3 @@ -327,7 +319,10 @@ typedef unsigned long32 eventTypeAttributeType[ALL_ATTRIBUTE_WORDS]; #define ATTR_KEEP_PAGES 70 /* Do not deallocate pages */ #define ATTR_HLT_DECISION 71 /* Event contains HLT decis. */ #define ATTR_BY_DETECTOR_EVENT 72 /* Event created by "by det."*/ +#define ATTR_ORIGINAL_EVENT 73 /* All original payloads */ +#define ATTR_FLUSHED_EVENT 92 /* Flushed event */ +#define ATTR_INCOMPLETE_EVENT 93 /* Incomplete event */ #define ATTR_EVENT_DATA_TRUNCATED 94 /* Truncated payload */ #define ATTR_EVENT_ERROR 95 /* Invalid event content */ @@ -341,6 +336,9 @@ typedef unsigned long32 eventTypeAttributeType[ALL_ATTRIBUTE_WORDS]; ATTR_2_B(ATTR_KEEP_PAGES) | \ ATTR_2_B(ATTR_HLT_DECISION) | \ ATTR_2_B(ATTR_BY_DETECTOR_EVENT) | \ + ATTR_2_B(ATTR_ORIGINAL_EVENT) | \ + ATTR_2_B(ATTR_INCOMPLETE_EVENT) | \ + ATTR_2_B(ATTR_FLUSHED_EVENT) | \ ATTR_2_B(ATTR_EVENT_DATA_TRUNCATED) | \ ATTR_2_B(ATTR_EVENT_ERROR))) == 0) @@ -352,8 +350,26 @@ typedef eventHostIdType eventGdcIdType; #define HOST_ID_MAX ((eventHostIdType)511) /* The maximum allowed ID */ #define VOID_ID ((eventHostIdType)-1) /* Unloaded ID */ -/* ---------- timestamp ---------- */ -/* The following definition is in common for 32 and 64 bit machines. +/* ---------- Timestamps ---------- + + The timestamp of the event is associated to: + + - Trigger arrived on the LDC + - First sub-event arrived on the GDC + - Event ready when monitoring by detector + + The timestamp is split into seconds and microseconds. + + Please note that the typical accuracy of the Unix clock is on + the order of the millisecond. + + For more details on the subject, see the man page for gettimeofday + and the description of the Unix standard type struct timeval +*/ + +/* ---------- Seconds timestamp ---------- + + The following definition is in common for 32 and 64 bit machines. In both architectures, the field must be loaded into a time_t variable before being used. Failure to do so may cause undefined results up to the early termination of the process. @@ -364,13 +380,17 @@ typedef eventHostIdType eventGdcIdType; time_t t; - t = eventHeaderStruct.eventTimestamp; + t = eventHeaderStruct.eventTimestampSec; cTime( &t ); (or whatever else can be done with a time_t) Please note that the available timestamp will wrap sometime around Jan 18, 19:14:07, 2038... */ -typedef unsigned long32 eventTimestampType; +typedef unsigned long32 eventTimestampSecType; + +/* Microseconds: range [0..999999] + */ +typedef unsigned long32 eventTimestampUsecType; /* ---------- The event header structure (with + without data) ---------- */ struct eventHeaderStruct { @@ -386,7 +406,12 @@ struct eventHeaderStruct { eventTypeAttributeType eventTypeAttribute; eventLdcIdType eventLdcId; eventGdcIdType eventGdcId; - eventTimestampType eventTimestamp; + union { + eventTimestampSecType eventTimestampSec; + /* This definition is only for backward compatibility with event.h < 3.11 */ + eventTimestampSecType eventTimestamp; + }; + eventTimestampUsecType eventTimestampUsec; }; struct eventStruct { @@ -395,9 +420,9 @@ struct eventStruct { }; /* ========== Definitions for the Vector ========== */ -typedef short eventVectorBankIdType; -typedef unsigned int eventVectorSizeType; -typedef unsigned int eventVectorOffsetType; +typedef short eventVectorBankIdType; +typedef datePointer eventVectorSizeType; +typedef datePointer eventVectorOffsetType; struct eventVectorStruct { eventVectorBankIdType eventVectorBankId; @@ -433,7 +458,13 @@ struct equipmentHeaderStruct { struct equipmentDescriptorStruct { struct equipmentHeaderStruct equipmentHeader; struct eventVectorStruct equipmentVector; -}; +} +#ifdef __GNUC__ + __attribute__((__packed__)); +#else + // Find whatever method for your compiler to pack the above structure without paddings + ; +#endif struct equipmentStruct { struct equipmentHeaderStruct equipmentHeader; @@ -457,27 +488,75 @@ struct eventLocationDescriptorStruct { (sizeof( struct equipmentDescriptorStruct )))) /* ========== Common data header ========== */ -#define CDH_SIZE (8 * 4) -#define CDH_VERSION 2 - -#define CDH_TRIGGER_OVERLAP_ERROR_BIT 0 -#define CDH_TRIGGER_MISSING_ERROR_BIT 1 -#define CDH_DATA_PARITY_ERROR_BIT 2 -#define CDH_CONTROL_PARITY_ERROR_BIT 3 -#define CDH_TRIGGER_INFORMATION_UNAVAILABLE_BIT 4 -#define CDH_FEE_ERROR_BIT 5 -#define CDH_HLT_DECISION_BIT 6 -#define CDH_HLT_PAYLOAD_BIT 7 -#define CDH_DDG_PAYLOAD_BIT 8 -#define CDH_TRIGGER_L1_TIME_VIOLATION_ERROR_BIT 9 -#define CDH_TRIGGER_L2_TIME_VIOLATION_ERROR_BIT 10 -#define CDH_TRIGGER_PREPULSE_ERROR_BIT 11 -#define CDH_TRIGGER_ERROR_BIT 12 +#define CDH_SIZE (4* 10) +#define CDH_VERSION 3 + +#define CDH_TRIGGER_OVERLAP_ERROR_BIT 0 +#define CDH_TRIGGER_MISSING_ERROR_BIT 1 +#define CDH_DATA_PARITY_ERROR_BIT 2 +#define CDH_CONTROL_PARITY_ERROR_BIT 3 +#define CDH_TRIGGER_INFORMATION_UNAVAILABLE_BIT 4 +#define CDH_FEE_ERROR_BIT 5 +#define CDH_HLT_DECISION_BIT 6 +#define CDH_HLT_PAYLOAD_BIT 7 +#define CDH_DDG_PAYLOAD_BIT 8 +#define CDH_TRIGGER_L1_TIME_VIOLATION_ERROR_BIT 9 +#define CDH_TRIGGER_L2_TIME_VIOLATION_ERROR_BIT 10 +#define CDH_TRIGGER_PREPULSE_ERROR_BIT 11 +#define CDH_TRIGGER_ERROR_BIT 12 +#define CDH_TRIGGER_L1_MISSING_L2_RECEIVED_BIT 13 +#define CDH_TRIGGER_MULTI_EVENT_BUFFER_ERROR_BIT 14 +#define CDH_ORIGINAL_EVENT_BIT 15 + +/* Macro to load the trigger classes of an event header + using the cdhTriggerClasses* fields */ +#define CDH_LOAD_EVENT_TRIGGER_PATTERN( etp, l, ml, mh, h ) \ + ( etp[0] = ((unsigned long32)(l)), \ + etp[1] = ((unsigned long32)(ml) & 0x0003ffff) | ((unsigned long32)(mh) << 18), \ + etp[2] = ((unsigned long32)(mh) >> 14) | ((unsigned long32)(h) << 18), \ + etp[3] = ((unsigned long32)(h) >> 14) & 0xf) /* Please note how the above data structure has been defined for LE systems. Code running on BE systems must have all fields reverted to work correctly! */ struct commonDataHeaderStruct { + unsigned cdhBlockLength : 32; + /* ------------------------------------- */ + unsigned cdhEventId1 : 12; + unsigned cdhMBZ1 : 2; + unsigned cdhL1TriggerMessage : 8; + unsigned cdhMBZ0 : 2; + unsigned cdhVersion : 8; + /* ------------------------------------- */ + unsigned cdhEventId2 : 24; + unsigned cdhParRequests : 8; + /* ------------------------------------- */ + unsigned cdhParticipatingSubDetectors : 24; + unsigned cdhBlockAttributes : 8; + /* ------------------------------------- */ + unsigned cdhMiniEventId : 12; + unsigned cdhStatusErrorBits : 20; + /* ------------------------------------- */ + unsigned cdhTriggerClassesLow : 32; // Goes into eventTriggerPattern[0] + /* ------------------------------------- */ + unsigned cdhTriggerClassesMiddleLow : 18; // Goes into eventTriggerPattern[1] (low) + unsigned cdhMBZ2 : 14; + /* ------------------------------------- */ + unsigned cdhTriggerClassesMiddleHigh : 32; // Goes into eventTriggerPattern[1] (high) and [2] (low) + /* ------------------------------------- */ + unsigned cdhTriggerClassesHigh : 18; // Goes into eventTriggerPattern[2] (high) and [3] + unsigned cdhMBZ4 : 10; + unsigned cdhRoiLow : 4; + /* ------------------------------------- */ + unsigned cdhRoiHigh : 32; +}; + +/* Old (V2) structure, defined for backward + compatibility. + + MAY DISAPPEAR IN FUTURE VERSIONS OF DATE! +*/ +struct commonDataHeaderV2Struct { unsigned cdhBlockLength : 32; /* ------------------------------------- */ unsigned cdhEventId1 : 12; diff --git a/STEER/STEER/AliRawDataHeaderSim.h b/STEER/STEER/AliRawDataHeaderSim.h index 005ca5fbd6a..132b5e984bd 100644 --- a/STEER/STEER/AliRawDataHeaderSim.h +++ b/STEER/STEER/AliRawDataHeaderSim.h @@ -5,14 +5,14 @@ #include -#include "AliRawDataHeader.h" +#include "AliRawDataHeaderV3.h" #include "AliRunLoader.h" #include "AliCentralTrigger.h" -class AliRawDataHeaderSim : public AliRawDataHeader { +class AliRawDataHeaderSim : public AliRawDataHeaderV3 { public: - AliRawDataHeaderSim() : AliRawDataHeader() { + AliRawDataHeaderSim() : AliRawDataHeaderV3() { // Takes the trigger mask and // stores it in the data header AliRunLoader *runloader = AliRunLoader::Instance(); diff --git a/TOF/AliTOFDecoder.cxx b/TOF/AliTOFDecoder.cxx index 48cf58215ca..24043f9ac12 100644 --- a/TOF/AliTOFDecoder.cxx +++ b/TOF/AliTOFDecoder.cxx @@ -50,6 +50,7 @@ TOF Raw Data decoder #include "AliTOFDecoder.h" #include "AliTOFGeometry.h" #include "AliRawDataHeader.h" +#include "AliRawDataHeaderV3.h" #include "AliTOFRawDataFormat.h" ClassImp(AliTOFDecoder) @@ -177,7 +178,7 @@ AliTOFDecoder::~AliTOFDecoder() //_________________________________________________________________ Bool_t -AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh) +AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh, const AliRawDataHeaderV3 *cdhV3) { /* main decoding routine. * it loops over nWords 32-bit words @@ -216,9 +217,11 @@ AliTOFDecoder::Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeade Short_t currentBunchID = -1; Short_t currentL0BCID = -1; Short_t currentMiniEventID = cdh ? cdh->GetMiniEventID() : (Short_t)(-1); + currentMiniEventID = cdhV3 ? cdhV3->GetMiniEventID() : (Short_t)(-1); Short_t currentEventID1 = cdh ? cdh->GetEventID1() : (Short_t)(-1); + currentEventID1 = cdhV3 ? cdhV3->GetEventID1() : (Short_t)(-1); AliDebug(1, Form("EvID1 = %d, EvID2 = %d, currentMiniEventID = %d", currentEventID1, cdh->GetEventID2(), currentMiniEventID)); - if (!cdh) + if (!cdh && !cdhV3) AliWarning("CDH not valid: deltaBunchID not reliable "); /*** V2718 patch ***/ @@ -934,7 +937,7 @@ void AliTOFDecoder::GetArrayDDL(Int_t* array, Int_t ddl){ } //------------------------------------------------------------ -void AliTOFDecoder::PrintStack(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh) +void AliTOFDecoder::PrintStack(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh, const AliRawDataHeaderV3 *cdhV3) { /* It loops over nWords 32-bit words * starting at *rawData and prints them in 0x format. @@ -942,9 +945,11 @@ void AliTOFDecoder::PrintStack(const UInt_t *rawData, Int_t nWords, const AliRaw */ Short_t currentMiniEventID = cdh ? cdh->GetMiniEventID() : (Short_t)(-1); + currentMiniEventID = cdhV3 ? cdhV3->GetMiniEventID() : (Short_t)(-1); Short_t currentEventID1 = cdh ? cdh->GetEventID1() : (Short_t)(-1); + currentEventID1 = cdhV3 ? cdhV3->GetEventID1() : (Short_t)(-1); AliDebug(1, Form("EvID1 = %d, EvID2 = %d, currentMiniEventID = %d", currentEventID1, cdh->GetEventID2(), currentMiniEventID)); - if (!cdh) + if (!cdh && !cdhV3) AliWarning("CDH not valid: deltaBunchID not reliable "); AliInfo("Printing raw data stack for current equipment\n"); diff --git a/TOF/AliTOFDecoder.h b/TOF/AliTOFDecoder.h index e22136b45ae..902bdfadd3d 100644 --- a/TOF/AliTOFDecoder.h +++ b/TOF/AliTOFDecoder.h @@ -92,6 +92,7 @@ class AliTOFHitDataBuffer; struct AliRawDataHeader; +struct AliRawDataHeaderV3; class AliTOFDecoder : public TObject { @@ -102,14 +103,14 @@ class AliTOFDecoder : public TObject AliTOFDecoder &operator = (const AliTOFDecoder &source); //operator = ~AliTOFDecoder(); //distructor - Bool_t Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh); //main decode function + Bool_t Decode(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh, const AliRawDataHeaderV3 *cdhV3=0); //main decode function void SetVerbose(Int_t Verbose = 1) {fVerbose = Verbose;}; //set verbose level void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fV2718Patch = V2718Patch;}; //set V2718 patch (no DRM) void SetDataBuffer(AliTOFHitDataBuffer *DB) {fDataBuffer = DB;}; //set up data buffer void SetPackedDataBuffer(AliTOFHitDataBuffer *PDB) {fPackedDataBuffer = PDB;}; //set up packed data buffer void GetArrayDDL(Int_t* array, Int_t iDDL); // method to return array of TOFchannels corresponding to a given DDL id - void PrintStack(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh); + void PrintStack(const UInt_t *rawData, Int_t nWords, const AliRawDataHeader *cdh, const AliRawDataHeaderV3 *cdhV3=0); enum { kMinPlate0=0,kMaxPlate0=2, diff --git a/TOF/AliTOFRawStream.cxx b/TOF/AliTOFRawStream.cxx index b46291de470..138ed7b0ac7 100644 --- a/TOF/AliTOFRawStream.cxx +++ b/TOF/AliTOFRawStream.cxx @@ -125,6 +125,7 @@ Revision 0.01 2005/07/22 A. De Caro #include "AliRawEventHeaderBase.h" #include "AliRawDataHeader.h" +#include "AliRawDataHeaderV3.h" #include "AliTOFDecoderV2.h" #include "AliTOFTDCHit.h" @@ -1436,7 +1437,8 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) { Int_t currentEquipment; Int_t currentDDL; - const AliRawDataHeader *currentCDH; + const AliRawDataHeader *currentCDH = 0x0; + const AliRawDataHeaderV3 *currentCDHV3 = 0x0; //pointers UChar_t *data = 0x0; @@ -1456,6 +1458,7 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) { } currentCDH = fRawReader->GetDataHeader(); + if (!currentCDH) currentCDHV3 = fRawReader->GetDataHeaderV3(); const Int_t kDataSize = fRawReader->GetDataSize(); const Int_t kDataWords = kDataSize / 4; data = new UChar_t[kDataSize]; @@ -1487,7 +1490,7 @@ Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) { fDecoder->SetPackedDataBuffer(&fPackedDataBuffer[currentDDL]); //start decoding - if (fDecoder->Decode((UInt_t *)data, kDataWords, currentCDH) == kTRUE) { + if (fDecoder->Decode((UInt_t *)data, kDataWords, currentCDH, currentCDHV3) == kTRUE) { fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL)); if (verbose) AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL)); ResetDataBuffer(currentDDL); @@ -1719,8 +1722,11 @@ AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose) /* read and check CDH info */ const AliRawDataHeader *currentCDH = fRawReader->GetDataHeader(); - Int_t currentMiniEventID = currentCDH->GetMiniEventID(); - Int_t currentEventID1 = currentCDH->GetEventID1(); + const AliRawDataHeaderV3 *currentCDHV3 = fRawReader->GetDataHeaderV3(); + Int_t currentMiniEventID = currentCDH ? currentCDH->GetMiniEventID(): -1; + currentMiniEventID = currentCDHV3 ? currentCDHV3->GetMiniEventID(): -1; + Int_t currentEventID1 = currentCDH? currentCDH->GetEventID1() : -1; + currentEventID1 = currentCDHV3? currentCDHV3->GetEventID1() : -1; /* read decoder summary data */ AliTOFDecoderSummaryData *decodersd; -- 2.39.3