#include "AliHLTTPCTransform.h"
#include "AliHLTTPCSpacePointData.h"
#include "AliHLTTPCClusterDataFormat.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
#include "AliHLTTPCRawCluster.h"
#include "AliHLTTPCHWCFEmulator.h"
#include "AliHLTTPCHWCFData.h"
#include "AliHLTErrorGuard.h"
+#include "AliTPCTransform.h"
#include "AliCDBManager.h"
#include "AliCDBEntry.h"
const char* AliHLTTPCHWClusterTransformComponent::fgkOCDBEntryHWTransform="HLT/ConfigTPC/TPCHWClusterTransform";
+AliHLTTPCClusterTransformation AliHLTTPCHWClusterTransformComponent::fgTransform;
+Bool_t AliHLTTPCHWClusterTransformComponent::fgTimeInitialisedFromEvent = 0;
+
AliHLTTPCHWClusterTransformComponent::AliHLTTPCHWClusterTransformComponent()
:
fDataId(kFALSE),
-fTransform(),
fPublishRawClusters(kFALSE),
fpDecoder(NULL),
fBenchmark("HWClusterTransform")
return new AliHLTTPCHWClusterTransformComponent();
}
-int AliHLTTPCHWClusterTransformComponent::DoInit( int argc, const char** argv ) {
-// see header file for class documentation
+int AliHLTTPCHWClusterTransformComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
AliTPCcalibDB *calib=AliTPCcalibDB::Instance();
if(!calib){
}
calib->SetRun(GetRunNo());
calib->UpdateRunInformations(GetRunNo());
-
- int err = fTransform.Init( GetBz(), GetTimeStamp() );
-
- if( err!=0 ){
- HLTError("Cannot retrieve offline transform from AliTPCcalibDB");
- return -ENOENT;
+
+ if( !fgTransform.IsInitialised() ){
+ int err = fgTransform.Init( GetBz(), GetTimeStamp() );
+ if( err!=0 ){
+ HLTError(Form("Cannot retrieve offline transform from AliTPCcalibDB, AliHLTTPCClusterTransformation returns %d",err));
+ return -ENOENT;
+ }
}
int iResult=0;
// see header file for class documentation
if (!fpDecoder) delete fpDecoder;
fpDecoder=NULL;
-
+ fgTransform.DeInit();
return 0;
}
AliHLTUInt32_t& size,
vector<AliHLTComponentBlockData>& outputBlocks ){
// see header file for class documentation
-
+
UInt_t maxOutSize = size;
size = 0;
int iResult = 0;
if(!IsDataEvent()) return 0;
if (!fpDecoder) return -ENODEV;
+ if( !fgTransform.IsInitialised() ){
+ HLTError(" TPC Transformation is not initialised ");
+ return -ENOENT;
+ }
fBenchmark.StartNewEvent();
fBenchmark.Start(0);
- // fTransform.SetCurrentTimeStamp( GetTimeStamp() ); !!! for the future
-
- for( unsigned long ndx=0; ndx<evtData.fBlockCnt; ndx++ ){
+ // Initialise the transformation here once more for the case of off-line reprocessing
+ if( !fgTimeInitialisedFromEvent ){
+ Long_t currentTime = static_cast<AliHLTUInt32_t>(time(NULL));
+ Long_t eventTimeStamp = GetTimeStamp();
+ if( TMath::Abs( fgTransform.GetCurrentTimeStamp() - eventTimeStamp )>60 &&
+ TMath::Abs( currentTime - eventTimeStamp)>60*60*5 ){
+ int err = fgTransform.SetCurrentTimeStamp( eventTimeStamp );
+ if( err!=0 ){
+ HLTError(Form("Cannot set time stamp, AliHLTTPCClusterTransformation returns %d",err));
+ return -ENOENT;
+ }
+ }
+ fgTimeInitialisedFromEvent = 1;
+ }
+
+ for( unsigned long ndx=0; ndx<evtData.fBlockCnt; ndx++ ){
const AliHLTComponentBlockData *iter = blocks+ndx;
long maxPoints = ((long)maxOutSize-size-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
AliHLTUInt32_t *buffer;
- buffer = (AliHLTUInt32_t*)iter->fPtr;
+ buffer = (AliHLTUInt32_t*)iter->fPtr;
+ AliHLTCDHWrapper cdh(iter->fPtr);
// skip the first 8 32-bit CDH words
- buffer += 8;
- UInt_t bufferSize32 = ((Int_t)iter->fSize - sizeof(AliRawDataHeader) )/sizeof(AliHLTUInt32_t);
+ buffer += cdh.GetHeaderSize()/sizeof(AliHLTUInt32_t);
+ UInt_t bufferSize32 = ((Int_t)iter->fSize - cdh.GetHeaderSize() )/sizeof(AliHLTUInt32_t);
if (fpDecoder->Init(reinterpret_cast<AliHLTUInt8_t*>(buffer), bufferSize32*sizeof(AliHLTUInt32_t))>=0 && fpDecoder->CheckVersion()>=0) {
for (AliHLTTPCHWCFData::iterator cl=fpDecoder->begin(); cl!=fpDecoder->end(); ++cl) {
c.SetQMax(cl.GetQMax());
Float_t xyz[3];
- fTransform.Transform( minSlice, padrow, pad, time, xyz );
+ int err = fgTransform.Transform( minSlice, padrow, pad, time, xyz );
+ if( err!=0 ){
+ HLTWarning(Form("Cannot transform the cluster, AliHLTTPCClusterTransformation returns error %d, %s",err, fgTransform.GetLastError()));
+ continue;
+ }
c.SetX(xyz[0]);
c.SetY(xyz[1]);
c.SetZ(xyz[2]);