// @(#) $Id$
-
-// Author: Uli Frankenfeld <mailto:franken@fi.uib.no>, Anders Vestbo <mailto:vestbo$fi.uib.no>, Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
-//*-- Copyright © ALICE HLT Group
-
+// Original: AliHLTMemHandler.cxx,v 1.52 2005/06/14 10:55:21 cvetan
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: U. Frankenfeld, A. Vestbo, C. Loizides *
+ * Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/** @file AliHLTTPCMemHandler.cxx
+ @author U. Frankenfeld, A. Vestbo, C. Loizides, maintained by
+ Matthias Richter
+ @date
+ @brief input interface base class for the TPC tracking code before
+ migration to the HLT component framework
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+ */
/** \class AliHLTTPCMemHandler
<pre>
//_____________________________________________________________
</pre>
*/
+#include <cassert>
#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCStandardIncludes.h"
#include "AliHLTTPCDigitData.h"
#include "AliHLTTPCLogging.h"
#include "AliHLTTPCTransform.h"
ClassImp(AliHLTTPCMemHandler)
AliHLTTPCMemHandler::AliHLTTPCMemHandler()
+ :
+ fRowMin(0),
+ fRowMax(0),
+ fSlice(0),
+ fPatch(0),
+ fInBinary(NULL),
+ fOutBinary(NULL),
+ fPt(NULL),
+ fSize(0),
+ fIsRandom(kFALSE),
+ fNRandom(0),
+ fNGenerate(0),
+ fNUsed(0),
+ fNDigits(0),
+ fDPt(NULL),
+ fRandomDigits(NULL),
+ fDummy(0)
{
//Constructor
- fPt = 0;
- fSize =0;
- fInBinary = 0;
- fOutBinary = 0;
- fNRandom = 0;
Init(0,0);
- fIsRandom = kFALSE;
- fRandomDigits = 0;
- fDPt =0;
- fNGenerate = 0;
- fNUsed = 0;
- fNDigits = 0;
ResetROI();
}
-
AliHLTTPCMemHandler::~AliHLTTPCMemHandler()
{
//Destructor
void AliHLTTPCMemHandler::Init(Int_t s,Int_t p, Int_t *r)
{
//init handler
+ assert(s<fgkNSlice);
+ if (s>fgkNSlice) {
+ fSlice=0;
+ fPatch=0;
+ fRowMin=0;
+ fRowMax=0;
+ if (r) *r=0;
+ LOG(AliHLTTPCLog::kWarning,"AliHLTTPCMemHandler::Init","sector coordinates")
+ <<"Invalid slice no " << s <<ENDLOG;
+ return;
+ }
fSlice=s;fPatch=p;
if(r) {
fRowMin=r[0];
if(eta[1]==0)
{
LOG(AliHLTTPCLog::kWarning,"AliHLTTPCMemHandler::SetROI","Eta Values")
- <<"Bad ROI parameters. IDIOT! "<<ENDLOG;
+ <<"Bad ROI parameters."<<ENDLOG;
for(Int_t i=fRowMin; i<=fRowMax; i++)
{
fEtaMinTimeBin[i]=0;
}
///////////////////////////////////////// Digit IO
-Bool_t AliHLTTPCMemHandler::Memory2Binary(UInt_t nrow,AliHLTTPCDigitRowData *data)
+Bool_t AliHLTTPCMemHandler::Memory2BinaryFile(UInt_t nrow,AliHLTTPCDigitRowData *data)
{
//Write data to the outputfile as is. No run-length encoding is done.
-
+
if(!fOutBinary){
LOG(AliHLTTPCLog::kWarning,"AliHLTTPCMemHandler::Memory2Binary","File")
<<"No Output File"<<ENDLOG;
rewind(fInBinary);
AliHLTTPCDigitRowData *rowPt = data;
UInt_t rowcount = 0;
- Int_t outsize =0;
+ UInt_t outsize =0;
while(!feof(fInBinary)){
Byte_t *bytePt =(Byte_t *) rowPt;
+ if (sz<outsize+sizeof(AliHLTTPCDigitRowData)) {
+ LOG(AliHLTTPCLog::kFatal,"AliHLTTPCMemHandler::Binary2Memory","Memory")
+ << "target data buffer too small" <<ENDLOG;
+ return kFALSE;
+ }
if(fread(rowPt,sizeof(AliHLTTPCDigitRowData),1,fInBinary)!=1) break;
bytePt += sizeof(AliHLTTPCDigitRowData);
outsize += sizeof(AliHLTTPCDigitRowData);
- Int_t size = sizeof(AliHLTTPCDigitData) * rowPt->fNDigit;
+ UInt_t size = sizeof(AliHLTTPCDigitData) * rowPt->fNDigit;
+ if (sz<outsize+size) {
+ LOG(AliHLTTPCLog::kFatal,"AliHLTTPCMemHandler::Binary2Memory","Memory")
+ << "target data buffer too small" <<ENDLOG;
+ return kFALSE;
+ }
//if(fread(bytePt,size,1,fInBinary)!=1) break;
fread(bytePt,size,1,fInBinary);
bytePt += size;