#include "AliHLTTPCDigitReaderUnpacked.h"
#include "AliHLTTPCTransform.h"
#include "AliHLTTPCDefinitions.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
#include "AliHLTTPCHWCFEmulator.h"
#include "AliTPCcalibDB.h"
#include "AliTPCCalPad.h"
#include "AliTPCCalROC.h"
#include "TMath.h"
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
#include <cstdlib>
#include <algorithm>
#include <cerrno>
#include <sys/time.h>
+using namespace std;
AliHLTTPCHWCFSupport::AliHLTTPCHWCFSupport()
:
// see header file for class documentation
for( int i=0; i<fgkNSlices; i++ )
for( int j=0; j<fgkNPatches; j++ ) delete[] fMapping[i][j];
- delete[] fEventMemory;
- delete[] fEventMCMemory;
+ ReleaseEventMemory();
}
AliHLTTPCHWCFSupport::AliHLTTPCHWCFSupport(const AliHLTTPCHWCFSupport&)
}
+void AliHLTTPCHWCFSupport::ReleaseEventMemory()
+{
+ // clean up
+ if( fEventMemory ) delete[] fEventMemory;
+ if( fEventMCMemory )delete[] fEventMCMemory;
+ fEventMemory = 0;
+ fEventMCMemory = 0;
+}
+
+
const AliHLTUInt32_t *AliHLTTPCHWCFSupport::GetMapping( int slice, int patch )
{
// see header file for class documentation
// MC labels are provided if possible
//
- delete[] fEventMemory;
- delete[] fEventMCMemory;
+ ReleaseEventMemory();
rawEvent = 0;
rawEventSize32 = 0;
// already raw format -> only set the pointers and estimate the size
// read CDH header, estimate size of the data
-
- AliHLTUInt64_t headerSize = sizeof(AliRawDataHeader);
+ AliHLTCDHWrapper cdhHeader(block->fPtr);
+
+ AliHLTUInt64_t headerSize = cdhHeader.GetHeaderSize();
- AliRawDataHeader *cdhHeader = reinterpret_cast<AliRawDataHeader*>(block->fPtr);
-
AliHLTUInt64_t blockSize = block->fSize; // size of the raw data in bytes
- if( cdhHeader->fSize!=0xFFFFFFFF ){ // use size information from the header
- blockSize = cdhHeader->fSize;
+ if( cdhHeader.GetDataSize()!=0xFFFFFFFF ){ // use size information from the header
+ blockSize = cdhHeader.GetDataSize();
if( blockSize > block->fSize ){
HLTWarning("%s Could not find a valid DDL header!",str);
return 0;
if( !fEventMCMemory ){
HLTWarning("Not enougth memory: can not allocate %d bytes",totalNMC*sizeof(AliHLTTPCClusterMCLabel));
delete[] fEventMemory;
+ fEventMemory = 0;
return 0;
}
// The procedure checks consistency of the data
//
- const unsigned int headerSize32 = 8;
if (!buffer) return 0;
+ AliHLTCDHWrapper cdh((void*)buffer);
+ const unsigned int headerSize32 = cdh.GetHeaderSize()/4;
+
const char *str=Form("slice %d patch %d:", slice, patch);
if( bufferSize32 < headerSize32 ){