]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCHWClusterTransformComponent.cxx
Updated SNM Glauber fit
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCHWClusterTransformComponent.cxx
index fdad5f9a61d18eaf1539a87ab0e23ac5c61e3a32..328229379206abc1a8640a54585484a0b4067104 100644 (file)
     @brief 
 */
 
-#if __GNUC__>= 3
-using namespace std;
-#endif
 #include "AliHLTTPCHWClusterTransformComponent.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCClusterDataFormat.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"
 #include "AliTPCcalibDB.h"
-#include "AliTPCTransform.h"
 
 #include "TMath.h"
+#include "TObjString.h" 
 #include <cstdlib>
 #include <cerrno>
 #include <sys/time.h>
 
+using namespace std;
+
 ClassImp(AliHLTTPCHWClusterTransformComponent) //ROOT macro for the implementation of ROOT specific class methods
 
+const char* AliHLTTPCHWClusterTransformComponent::fgkOCDBEntryHWTransform="HLT/ConfigTPC/TPCHWClusterTransform";
+
+AliHLTTPCClusterTransformation AliHLTTPCHWClusterTransformComponent::fgTransform;
+Bool_t AliHLTTPCHWClusterTransformComponent::fgTimeInitialisedFromEvent = 0;
+
 AliHLTTPCHWClusterTransformComponent::AliHLTTPCHWClusterTransformComponent()
 :
-fOfflineTransform(NULL)
+fDataId(kFALSE),
+fPublishRawClusters(kFALSE),
+fpDecoder(NULL),
+fBenchmark("HWClusterTransform")
 {
   // see header file for class documentation
   // or
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt  
-  
+
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
 }
 
-AliHLTTPCHWClusterTransformComponent::~AliHLTTPCHWClusterTransformComponent() { 
-// see header file for class documentation
+AliHLTTPCHWClusterTransformComponent::~AliHLTTPCHWClusterTransformComponent()
+{ 
+  // destructor
+  if (!fpDecoder) delete fpDecoder;
+  fpDecoder=NULL;
 }
 
 const char* AliHLTTPCHWClusterTransformComponent::GetComponentID() { 
@@ -80,15 +100,16 @@ int AliHLTTPCHWClusterTransformComponent::GetOutputDataTypes(AliHLTComponentData
   // see header file for class documentation
 
   tgtList.clear();
-  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType| kAliHLTDataOriginTPC);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo | kAliHLTDataOriginTPC );
+  tgtList.push_back(AliHLTTPCDefinitions::fgkRawClustersDataType  | kAliHLTDataOriginTPC );
   return tgtList.size();
 }
 
 void AliHLTTPCHWClusterTransformComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) { 
   // see header file for class documentation
-
   constBase = 0;
-  inputMultiplier = 2.0;
+  inputMultiplier = 3.0;
 }
 
 AliHLTComponent* AliHLTTPCHWClusterTransformComponent::Spawn() { 
@@ -97,307 +118,341 @@ AliHLTComponent* AliHLTTPCHWClusterTransformComponent::Spawn() {
   return new AliHLTTPCHWClusterTransformComponent();
 }
        
-int AliHLTTPCHWClusterTransformComponent::DoInit( int /*argc*/, const char** /*argv*/ ) { 
-// see header file for class documentation
-
-  AliTPCcalibDB* pCalib=AliTPCcalibDB::Instance();
-  if(!pCalib ||
-     !(fOfflineTransform = AliTPCcalibDB::Instance()->GetTransform())){
-    HLTError("Can not retrieve Offline transform from AliTPCcalibDB (%p)", pCalib);
+int AliHLTTPCHWClusterTransformComponent::DoInit( int argc, const char** argv ) 
+{ 
+  // see header file for class documentation
+  
+  AliTPCcalibDB *calib=AliTPCcalibDB::Instance();  
+  if(!calib){
+    HLTError("AliTPCcalibDB does not exist");
     return -ENOENT;
   }
+  calib->SetRun(GetRunNo());
+  calib->UpdateRunInformations(GetRunNo());
+  
+  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_t i = 0;
-//   Char_t* cpErr;
-//   
-//   int iResult=0;
-//   
-//   TString configuration="";
-//   TString argument="";
-//   for (int j=0; j<argc && iResult>=0; j++) {
-//     
-//     argument=argv[j];
-//     if (!configuration.IsNull()) configuration+=" ";
-//     configuration+=argument;    
-//   }
-//    
-//   if (!configuration.IsNull()) {
-//     iResult=Configure(configuration.Data());
-//   } else {
-//     iResult=Reconfigure(NULL, NULL);
-//   }
+  int iResult=0;
+  iResult = ConfigureFromCDBTObjString(fgkOCDBEntryHWTransform);
 
-  return 0;
+  if (iResult>=0 && argc>0)
+    iResult=ConfigureFromArgumentString(argc, argv);
+
+  if (iResult>=0) {
+    fpDecoder=new AliHLTTPCHWCFData;
+    if (!fpDecoder) iResult=-ENOMEM;
+  }
+  
+  return iResult;
 } // end DoInit()
 
 int AliHLTTPCHWClusterTransformComponent::DoDeinit() { 
-  // see header file for class documentation 
-   
+  // see header file for class documentation   
+  if (!fpDecoder) delete fpDecoder;
+  fpDecoder=NULL;
+  fgTransform.DeInit();
   return 0;
 }
 
 int AliHLTTPCHWClusterTransformComponent::DoEvent(const AliHLTComponentEventData& evtData, 
-                                             const AliHLTComponentBlockData* blocks, 
-                                             AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, 
-                                             AliHLTUInt32_t& size, 
-                                             vector<AliHLTComponentBlockData>& outputBlocks ){
+                                                 const AliHLTComponentBlockData* blocks, 
+                                                 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, 
+                                                 AliHLTUInt32_t& size, 
+                                                 vector<AliHLTComponentBlockData>& outputBlocks ){
   // see header file for class documentation
-    
-  if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
-     size = 0;
-     return 0;
+  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;    
   }
 
-  const AliHLTComponentBlockData *iter = NULL;    
-  unsigned long ndx;
-
-  AliHLTTPCClusterData* outPtr;
-
-  AliHLTUInt8_t* outBPtr;
-  UInt_t offset, mysize, nSize, tSize = 0;
-
-  outBPtr = outputPtr;
-  outPtr  = (AliHLTTPCClusterData*)outBPtr;
-  
-  AliHLTTPCSpacePointData *spacePoints = outPtr->fSpacePoints;
-
-  unsigned long maxPoints = 0;
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+
+  // 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(ndx=0; ndx<evtData.fBlockCnt; ndx++){
for( unsigned long ndx=0; ndx<evtData.fBlockCnt; ndx++ ){
      
-     iter   = blocks+ndx;
-     mysize = 0;
-     offset = tSize;
-     HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
-             evtData.fEventID, evtData.fEventID, 
-             DataType2Text( iter->fDataType).c_str(), 
-             DataType2Text(AliHLTTPCDefinitions::fgkHWClustersDataType).c_str());                       
+    const AliHLTComponentBlockData *iter   = blocks+ndx;
+    
+    fBenchmark.AddInput(iter->fSize);
+    
+    HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+            evtData.fEventID, evtData.fEventID, 
+            DataType2Text( iter->fDataType).c_str(), 
+            DataType2Text(AliHLTTPCDefinitions::fgkHWClustersDataType).c_str());                       
  
-     if(iter->fDataType != AliHLTTPCDefinitions::fgkHWClustersDataType) continue;                        
-  
-     UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter); 
-     UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
-     //UInt_t maxSlice     = AliHLTTPCDefinitions::GetMaxSliceNr(*iter); 
-     //UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(*iter);
+    if(iter->fDataType == (AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo | kAliHLTDataOriginTPC) ){
+      // simply forward MC labels
+      
+      if( size+iter->fSize > maxOutSize ){
+       HLTWarning( "Output buffer (%db) is too small, required %db", maxOutSize, size+iter->fSize);
+       iResult  = -ENOSPC;
+       break;
+      }
+
+      memcpy( outputPtr, iter->fPtr, iter->fSize );
+      
+      AliHLTComponentBlockData bd;
+      FillBlockData( bd );
+      bd.fOffset = size;
+      bd.fSize = iter->fSize;
+      bd.fSpecification = iter->fSpecification;     
+      bd.fDataType = iter->fDataType;
+      outputBlocks.push_back( bd );     
+      fBenchmark.AddOutput(bd.fSize);    
+      size   += bd.fSize;
+      outputPtr += bd.fSize;
+      continue;
+    }
+
+    if(iter->fDataType != (AliHLTTPCDefinitions::fgkHWClustersDataType | kAliHLTDataOriginTPC)) continue;                        
+        
+    UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter); 
+    UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
+    //UInt_t maxSlice     = AliHLTTPCDefinitions::GetMaxSliceNr(*iter); 
+    //UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(*iter);
+    float padpitch=1.0;
+    if ((int)minPartition<AliHLTTPCTransform::GetNRowLow())
+      padpitch=AliHLTTPCTransform::GetPadPitchWidthLow();
+    else
+      padpitch=AliHLTTPCTransform::GetPadPitchWidthUp();
+    float zwidth=AliHLTTPCTransform::GetZWidth();
+
+    fBenchmark.SetName(Form("HWClusterTransform slice %d patch %d",minSlice,minPartition));
+
+    HLTDebug("minSlice: %d, minPartition: %d", minSlice, minPartition);
     
-     outPtr = (AliHLTTPCClusterData*)outBPtr;
-     maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
-     
-     AliHLTUInt32_t *buffer;     
-     buffer = (AliHLTUInt32_t*)iter->fPtr;  
-     
-     /*  
-     //cluster fabrication
-     buffer = new AliHLTUInt32_t[14];
-     //header
-     buffer[0]=0xffffffff;
-     buffer[1]=0xffffffff;
-     buffer[2]=0xffffffff;
-     buffer[3]=0xffffffff;
-     buffer[4]=0xffffffff;
-     buffer[5]=0xffffffff;
-     buffer[6]=0xffffffff;
-     buffer[7]=0xffffffff;
-     //cluster 1
-     buffer[8]=0xC60002EF;
-     buffer[9]=0x0;
-     buffer[10]=0x0;
-     buffer[11]=0x0;
-     buffer[12]=0x0;
-     //RCU trailer
-     buffer[13]=0x80000000;
-     */
-
-     Int_t sector=-99, thisrow=-99;
-
-     // PrintDebug(buffer, 14);
-     
-     // skip the first 8 32-bit CDH words
-     buffer += 8;
+    AliHLTTPCClusterData* outPtr  = (AliHLTTPCClusterData*)outputPtr;
+    outPtr->fSpacePointCnt=0;
 
-     //PrintDebug(buffer, (Int_t)iter->fSize/sizeof(AliHLTUInt32_t));
+    long maxPoints = ((long)maxOutSize-size-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
 
-     unsigned long nAddedClusters = 0;
+    AliHLTUInt32_t *buffer;     
+    buffer = (AliHLTUInt32_t*)iter->fPtr;
+    AliHLTCDHWrapper cdh(iter->fPtr);
      
-     for(UInt_t nWords=0; nWords<(iter->fSize/sizeof(AliHLTUInt32_t)); nWords+=5){
-     //     for(UInt_t nWords=0; nWords<5; nWords+=5){
-         
-       // check if bit 31 and 30 of the 32-bit word is 11 -> cluster (10 is RCU trailer)
-       AliHLTUInt32_t bit3130 = (buffer[nWords]>>30); // shift 30 to the right
-       
-       if(bit3130 == 0x3){ //beginning of a cluster
-
-          //PrintDebug(&buffer[nWords], 5);
-         
-          if(nAddedClusters>=maxPoints){
-             HLTWarning("No more space to add clusters, exiting!");
-              break;
-           }
-          
-          AliHLTTPCSpacePointData cluster = { 0.,0.,0.,0,0,0.,0.,0,0,kFALSE,0 };
-              
-          //get the first word
-          AliHLTUInt32_t  rowCharge = buffer[nWords];
-          AliHLTUInt8_t  *rowPtr    = reinterpret_cast<AliHLTUInt8_t*>(&rowCharge);      
-          rowPtr+=3; // this is to run for little endian architecture, the word is read from right to left
-       
-          cluster.fPadRow  = (UChar_t)((*rowPtr)&0x3f);
-          cluster.fCharge  = ((UInt_t)rowCharge&0xFFFFFF)>>6; //24-bit mask to get out the charge and division with 64(>>6) for the gain correction       
-          cluster.fSigmaY2 = (Float_t)buffer[nWords+3];
-          cluster.fSigmaZ2 = (Float_t)buffer[nWords+4];
-          
-          // correct expressions for the error calculation
-
-          //cluster.fSigmaY2 = TMath::Sqrt( (Float_t)buffer[nWords+3] - (Float_t)buffer[nWords+1]*(Float_t)buffer[nWords+1] );
-          //cluster.fSigmaY2 = TMath::Sqrt( (Float_t)buffer[nWords+3] - (Float_t)buffer[nWords+1]*(Float_t)buffer[nWords+1] );
-         
-         
-          
-          HLTInfo("padrow: %d, charge: %f, pad: %d, time: %d", cluster.fPadRow, (Float_t)cluster.fCharge, (Float_t)buffer[nWords+1], (Float_t)buffer[nWords+2]);
-                          
-          Float_t xyz[3]; xyz[0] = xyz[1] = xyz[2] = -99.;
-          
-         // if(fOfflineTransform == NULL){                
-             cluster.fPadRow += AliHLTTPCTransform::GetFirstRow(minPartition);                    
-             AliHLTTPCTransform::Slice2Sector(minSlice, cluster.fPadRow, sector, thisrow);           
-             AliHLTTPCTransform::Raw2Local(xyz, sector, thisrow, (Float_t)buffer[nWords+1], (Float_t)buffer[nWords+2]); 
-             if(minSlice>17) xyz[1]=(-1)*xyz[1];          
-             cluster.fX = xyz[0];
-             cluster.fY = xyz[1];
-             cluster.fZ = xyz[2]; 
-             
-//                } else {
-//     
-//           HLTInfo("padrow: %d, pad: %d", cluster.fPadRow, buffer[nWords+1]);   
-//        
-//           Double_t x[3] = {thisrow, (Float_t)buffer[nWords+1]+.5, (Float_t)buffer[nWords+2]}; 
-//           Int_t iSector[1]= {sector};
-//           fOfflineTransform->Transform(x,iSector,0,1);
-//           cluster.fX = x[0];
-//           cluster.fY = x[1];
-//           cluster.fZ = x[2];
-//           
-//        }
-//        cluster.fX = xyz[0];
-//                cluster.fY = xyz[1];
-//                cluster.fZ = xyz[2]; 
-          
-          //HLTInfo("X: %f, Y: %f, Z: %f, Charge: %d", cluster.fX,cluster.fY,cluster.fZ, cluster.fCharge);           
-          
-          spacePoints[nAddedClusters] = cluster;
-                  
-           nAddedClusters++; 
-       } // end of clusters starting with 11=0x3
-       else if(bit3130 == 0x2){ // we have reached the beginning of the RCU trailer - 10=0x2
-         break;
-       }
-     } // end of loop over clusters
-     
-     HLTDebug("Number of found clusters: %d", nAddedClusters);
+     // skip the first 8 32-bit CDH words
+    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) {
+        if(outPtr->fSpacePointCnt>=maxPoints){
+          HLTWarning("No more space to add clusters, exiting!");
+          iResult  = -ENOSPC;
+          break;
+        }
+
+        AliHLTTPCSpacePointData& c=outPtr->fSpacePoints[outPtr->fSpacePointCnt];
+        int padrow=cl.GetPadRow();
+        if (padrow<0) {
+          // something wrong here, padrow is stored in the cluster header
+          // word which has bit pattern 0x3 in bits bit 30 and 31 which was
+          // not recognized
+          ALIHLTERRORGUARD(1, "can not read cluster header word");
+          break;
+        }
+        padrow+=AliHLTTPCTransform::GetFirstRow(minPartition);
+        AliHLTUInt32_t charge=cl.GetCharge();
+
+        float pad=cl.GetPad();
+        float time=cl.GetTime();
+        float sigmaY2=cl.GetSigmaY2();
+        float sigmaZ2=cl.GetSigmaZ2();
+        sigmaY2*=padpitch*padpitch;
+        sigmaZ2*=zwidth*zwidth;
+        c.SetPadRow(padrow);
+        c.SetCharge(charge);
+        c.SetSigmaY2(sigmaY2);
+        c.SetSigmaZ2(sigmaZ2);
+        c.SetQMax(cl.GetQMax());
+
+        Float_t xyz[3];
+        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]);
+
+        // set the cluster ID so that the cluster dump printout is the same for FCF and SCF
+        c.SetID( minSlice, minPartition, outPtr->fSpacePointCnt );
+        
+        HLTDebug("Cluster number %d: %f, Y: %f, Z: %f, charge: %d \n", outPtr->fSpacePointCnt, cluster.fX, cluster.fY, cluster.fZ, (UInt_t)cluster.fCharge);
+        
+        outPtr->fSpacePointCnt++; 
+       } // end of loop over clusters
+     }     
+     HLTDebug("Number of found clusters: %d", outPtr->fSpacePointCnt);
      
-     outPtr->fSpacePointCnt = nAddedClusters;
-     nSize = sizeof(AliHLTTPCSpacePointData)*outPtr->fSpacePointCnt;
-     mysize += nSize+sizeof(AliHLTTPCClusterData);
+     UInt_t mysize = sizeof(AliHLTTPCClusterData) + sizeof(AliHLTTPCSpacePointData)*outPtr->fSpacePointCnt;
  
      AliHLTComponentBlockData bd;
      FillBlockData( bd );
-     bd.fOffset = offset;
+     bd.fOffset = size;
      bd.fSize = mysize;
-     bd.fSpecification = iter->fSpecification;
-     bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
+     bd.fSpecification = iter->fSpecification;     
+     if(fDataId==kFALSE) bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
+     else                bd.fDataType = AliHLTTPCDefinitions::fgkAlterClustersDataType;
+     
+     //HLTDebug("datatype: %s", DataType2Text(bd.fDataType).c_str());
+     
      outputBlocks.push_back( bd );
      
-     tSize   += mysize;
-     outBPtr += mysize;
-     outPtr   = (AliHLTTPCClusterData*)outBPtr;
+     fBenchmark.AddOutput(bd.fSize);    
+     size   += mysize;
+     outputPtr += mysize;
   
-   } // end of loop over data blocks
-   size = tSize;
-   return 0;
+     if (fPublishRawClusters) {
+
+       long maxRawClusters = ((long)maxOutSize-size-sizeof(AliHLTTPCRawClusterData))/sizeof(AliHLTTPCRawCluster);
+       
+       if( maxRawClusters<=0 ) {
+        HLTWarning("No more space to add raw clusters, exiting!");
+        iResult  = -ENOSPC;
+       } else {       
+
+        // copy raw cluster data from input
+        
+        AliHLTTPCRawClusterData* outputRaw= (AliHLTTPCRawClusterData*)(outputPtr);
+       
+        outputRaw->fVersion = 0;
+        outputRaw->fCount = 0;
+
+        // check if there are clusters available, if not the format might
+        // not even been decoded at that moment 
+        if (fpDecoder->GetNumberOfClusters()>0) {
+        for (AliHLTTPCHWCFData::iterator cl=fpDecoder->begin(); cl!=fpDecoder->end(); ++cl) {
+          if(outputRaw->fCount>=maxRawClusters){
+            HLTWarning("No more space to add clusters, exiting!");
+            iResult  = -ENOSPC;
+            break;
+          }
+          AliHLTTPCRawCluster &c = outputRaw->fClusters[outputRaw->fCount];
+          int padrow=cl.GetPadRow();
+          if (padrow<0) {
+            // something wrong here, padrow is stored in the cluster header
+            // word which has bit pattern 0x3 in bits bit 30 and 31 which was
+            // not recognized
+            break;
+          }
+          padrow+=AliHLTTPCTransform::GetFirstRow(minPartition);
+          AliHLTUInt32_t charge= cl.GetCharge();
+
+          float pad =cl.GetPad();
+          float time =cl.GetTime();
+          float sigmaP2=cl.GetSigmaY2();
+          float sigmaT2=cl.GetSigmaZ2();
+          c.SetPadRow(padrow);
+          c.SetCharge(charge);
+          c.SetPad(pad);  
+          c.SetTime(time);
+          c.SetSigmaY2(sigmaP2);
+          c.SetSigmaZ2(sigmaT2);
+          c.SetQMax(cl.GetQMax());
+
+          // store cluster and continue
+          outputRaw->fCount++;
+        }
+        }
+
+        // fill into HLT output data
+        AliHLTComponentBlockData bdRawClusters;
+        FillBlockData( bdRawClusters );
+        bdRawClusters.fOffset = size;
+        bdRawClusters.fSize = sizeof(AliHLTTPCRawClusterData)+outputRaw->fCount*sizeof(AliHLTTPCRawCluster);
+        bdRawClusters.fSpecification = iter->fSpecification;
+        bdRawClusters.fDataType = AliHLTTPCDefinitions::fgkRawClustersDataType | kAliHLTDataOriginTPC;
+        outputBlocks.push_back( bdRawClusters );
+        fBenchmark.AddOutput(bdRawClusters.fSize);
+        size   += bdRawClusters.fSize;
+        outputPtr += bdRawClusters.fSize;
+       }
+     }
+  } // end of loop over data blocks  
+  
+  fBenchmark.Stop(0);
+  HLTInfo(fBenchmark.GetStatistics());
+  
+  return iResult;
 } // end DoEvent()
+
+int AliHLTTPCHWClusterTransformComponent::ScanConfigurationArgument(int argc, const char** argv){
+
+  // see header file for class documentation
+
+  if (argc<=0) return 0;
+  int i=0;
+  TString argument=argv[i];
+
+  if (argument.CompareTo("-solenoidBz")==0){
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];
+    AliTPCcalibDB*  calib=AliTPCcalibDB::Instance();
+    if(!calib){
+      HLTError("CalibDB instance cannot be created.");
+      return 0;
+    }
+    Float_t magneticField = argument.Atof();
+    calib->SetExBField(magneticField);
+    HLTInfo("SolenoidBz is set to %f in the calibDB",magneticField);
+    return 2;
+  }
+
+  if (argument.CompareTo("-change-dataId")==0){
+    HLTDebug("Change data ID received.");
+    fDataId = kTRUE;
+    return 1;
+  }
+  
+  if (argument.CompareTo("-charge-threshold")==0) {
+    if (++i>=argc) return -EPROTO;
+    argument=argv[i];    
+    HLTInfo("The argument -charge-threshold is deprecated.");
+    return 2;
+  }    
+
+  if (argument.CompareTo("-publish-raw")==0) {
+    fPublishRawClusters=kTRUE;
+    return 1;
+  }  
   
-// int AliHLTTPCHWClusterTransformComponent::Configure(const char* arguments) { 
-//   // see header file for class documentation
-//   
-//   int iResult=0;
-//   if (!arguments) return iResult;
-//   HLTInfo("parsing configuration string \'%s\'", arguments);
-// 
-//   TString allArgs=arguments;
-//   TString argument;
-//   int bMissingParam=0;
-// 
-//   TObjArray* pTokens=allArgs.Tokenize(" ");
-//   if (pTokens) {
-//     for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
-//       argument=((TObjString*)pTokens->At(i))->GetString();
-//       if (argument.IsNull()) continue;
-//      
-//       if (argument.CompareTo("-sum-noise-histograms")==0) {
-//     fNoiseHistograms = kTRUE;
-//     HLTInfo("got \'-sum-noise-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-//     
-//       } else if (argument.CompareTo("-sum-krypton-histograms")==0) {
-//     fKryptonHistograms = kTRUE;
-//     HLTInfo("got \'-sum-krypton-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-//     
-//       } else if (argument.CompareTo("-use-general")==0) {
-//     fUseGeneral = kTRUE;
-//     HLTInfo("got \'-use-general\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-//     
-//       } else if (argument.CompareTo("-ignore-specification")==0) {
-//     fIgnoreSpecification = kTRUE;
-//     HLTInfo("got \'-ignore-specification\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-//       }
-//       else {
-//     HLTError("unknown argument %s", argument.Data());
-//     iResult=-EINVAL;
-//     break;
-//       }
-//     } // end for
-//     
-//   
-//     delete pTokens;
-//   
-//   } // end if pTokens
-//   
-//   if (bMissingParam) {
-//     HLTError("missing parameter for argument %s", argument.Data());
-//     iResult=-EINVAL;
-//   }
-//   return iResult;
-// }
-
-// int AliHLTTPCHWClusterTransformComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/) { 
-//   // see header file for class documentation
-// 
-//   int iResult=0;
-//   const char* path="HLT/ConfigTPC/TPCHistogramHandlerComponent";
-//   const char* defaultNotify="";
-//   if (cdbEntry) {
-//     path=cdbEntry;
-//     defaultNotify=" (default)";
-//   }
-//   
-//   if (path) {
-//     HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
-//     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
-//     if (pEntry) {
-//       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
-//       if (pString) {
-//     HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
-//     iResult=Configure(pString->GetString().Data());
-//       } else {
-//     HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
-//       }
-//     } else {
-//       HLTError("cannot fetch object \"%s\" from CDB", path);
-//     }
-//   }
-//   return iResult;
-// }
+  // unknown argument
+  return -EINVAL;
+}
 
+int AliHLTTPCHWClusterTransformComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/) { 
+  // see header file for class documentation
+  return ConfigureFromCDBTObjString(fgkOCDBEntryHWTransform);
+}
 
 void AliHLTTPCHWClusterTransformComponent::PrintDebug(AliHLTUInt32_t *buffer, Int_t size){
 // see header file for class documentation 
@@ -425,3 +480,45 @@ void AliHLTTPCHWClusterTransformComponent::PrintDebug(AliHLTUInt32_t *buffer, In
     printf("\n");
   }
 } // end of PrintDebug
+
+void AliHLTTPCHWClusterTransformComponent::GetOCDBObjectDescription( TMap* const targetMap)
+{
+  // Get a list of OCDB object description needed for the particular component
+  if (!targetMap) return;
+  
+  // OCDB entries for component arguments
+
+  targetMap->Add(new TObjString("HLT/ConfigTPC/TPCHWClusterTransform"), new TObjString("component argument for the charge threshold"));
+  
+  // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
+  targetMap->Add(new TObjString("TPC/Calib/Parameters"),    new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/TimeDrift"),     new TObjString("drift velocity calibration"));
+  targetMap->Add(new TObjString("TPC/Calib/TimeGain"),     new TObjString("time gain  calibration"));
+  targetMap->Add(new TObjString("TPC/Calib/Temperature"),   new TObjString("temperature map"));
+  targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
+  targetMap->Add(new TObjString("TPC/Calib/ClusterParam"),  new TObjString("cluster parameters"));
+  targetMap->Add(new TObjString("TPC/Calib/Correction"),  new TObjString("coreection"));
+  targetMap->Add(new TObjString("TPC/Calib/RecoParam"),  new TObjString("reconstruction parameters"));
+  // OCDB entries needed to be fetched by the Pendolino
+  targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
+  targetMap->Add(new TObjString("GRP/CTP/CTPtiming"),     new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
+
+  // OCDB entries necessary for replaying data on the HLT cluster
+  targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));  
+  // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
+  targetMap->Add(new TObjString("TPC/Calib/Distortion"),  new TObjString("distortion map"));
+  targetMap->Add(new TObjString("TPC/Calib/GainFactorDedx"), new TObjString("gain factor dedx"));
+  targetMap->Add(new TObjString("TPC/Calib/PadTime0"),    new TObjString("time0 offset pad by pad"));
+  targetMap->Add(new TObjString("TPC/Calib/PadNoise"),    new TObjString("pad noise values"));
+  targetMap->Add(new TObjString("TPC/Calib/Pedestals"),   new TObjString("pedestal info"));
+  targetMap->Add(new TObjString("TPC/Calib/Pulser"),      new TObjString("pulser info"));
+  targetMap->Add(new TObjString("TPC/Calib/CE"),          new TObjString("CE laser calibration result"));
+  targetMap->Add(new TObjString("TPC/Calib/Raw"),         new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/QA"),          new TObjString("not important"));
+  targetMap->Add(new TObjString("TPC/Calib/Mapping"),     new TObjString("unknown content"));
+  targetMap->Add(new TObjString("TPC/Calib/Goofie"),      new TObjString("Goofie values, not used at the moment (05.03.2010)"));
+  targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
+  targetMap->Add(new TObjString("TPC/Calib/Ref"),         new TObjString("unknown content"));
+}