]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
dummy reconfiguration handler added
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinderComponent.cxx
index fa990d689a0419a6de2cfb7f76694b8f6c1d14fc..9b7490cc8440bbec30254bbbf39a8ba9b8031700 100644 (file)
@@ -1,12 +1,13 @@
 // $Id$
 
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
- *          Timm Steinbeck <timm@kip.uni-heidelberg.de>                   *
- *          Jochen Thaeder <thaeder@kip.uni-heidelberg.de>                *
- *          for The ALICE Off-line Project.                               *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  Timm Steinbeck <timm@kip.uni-heidelberg.de>           *
+ *                  Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  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   *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// a TPC cluster finder processing component for the HLT                     //
-// useable for packed data or unpacked data                                  //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+/** @file   AliHLTTPCClusterFinderComponent.cxx
+    @author Timm Steinbeck, Matthias Richter, Jochen Thaeder, Kenneth Aamodt
+    @date   
+    @brief  The TPC cluster finder processing component
+*/
 
+// see header file for class documentation                                   //
+// or                                                                        //
+// refer to README to build package                                          //
+// or                                                                        //
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt                          //
 
 #if __GNUC__>= 3
 using namespace std;
 #endif
-#include "AliHLTTPCLogging.h"
 #include "AliHLTTPCClusterFinderComponent.h"
 #include "AliHLTTPCDigitReaderPacked.h"
 #include "AliHLTTPCDigitReaderUnpacked.h"
 #include "AliHLTTPCDigitReaderRaw.h"
 #include "AliHLTTPCClusterFinder.h"
 #include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCRawDataFormat.h"
 #include "AliHLTTPCClusterDataFormat.h"
 #include "AliHLTTPCTransform.h"
-#include <stdlib.h>
-#include <errno.h>
+#include "AliHLTTPCClusters.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+
+#include <cstdlib>
+#include <cerrno>
+#include "TString.h"
+#include "TObjString.h"
+#include <sys/time.h>
 
 // this is a global object used for automatic component registration, do not use this
+// use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType"
+// use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType"
 AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(true);
 AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(false);
 
+/** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCClusterFinderComponent)
 
 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(bool packed)
   :
-  // use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType"
-  // use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType"
-  fPackedSwitch(packed),
-
   fClusterFinder(NULL),
   fReader(NULL),
   fClusterDeconv(true),
   fXYClusterError(-1),
-  fZClusterError(-1)
+  fZClusterError(-1),
+  fPackedSwitch(packed),
+  fUnsorted(0),
+  fPatch(0),
+  fPadArray(NULL),
+  fGetActivePads(0)
 {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 }
 
-AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(const AliHLTTPCClusterFinderComponent&)
-  :
-  fPackedSwitch(0),
-  fClusterFinder(NULL),
-  fReader(NULL),
-  fClusterDeconv(true),
-  fXYClusterError(-1),
-  fZClusterError(-1)
+AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
 {
-  HLTFatal("copy constructor untested");
-}
-
-AliHLTTPCClusterFinderComponent& AliHLTTPCClusterFinderComponent::operator=(const AliHLTTPCClusterFinderComponent&)
-{ 
-  HLTFatal("assignment operator untested");
-  return *this;
+  // see header file for class documentation
 }
 
-AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
-    {
-    }
-
 // Public functions to implement AliHLTComponent's interface.
 // These functions are required for the registration process
 
 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
-    {
-      if (fPackedSwitch) return "TPCClusterFinderPacked";
-      else return "TPCClusterFinderUnpacked";
-    }
+{
+  // see header file for class documentation
+  if (fPackedSwitch) return "TPCClusterFinderPacked";
+  else return "TPCClusterFinderUnpacked";
+}
 
-void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponent_DataType>& list)
-    {
-    list.clear(); 
-    if (fPackedSwitch) list.push_back( AliHLTTPCDefinitions::gkDDLPackedRawDataType );
-    else list.push_back( AliHLTTPCDefinitions::gkUnpackedRawDataType );
+void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  // see header file for class documentation
+  list.clear(); 
+  if (fPackedSwitch) list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+  else list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
    
-    }
+}
 
-AliHLTComponent_DataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
-    {
-    return AliHLTTPCDefinitions::gkClustersDataType;
-    }
+AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
+{
+  // see header file for class documentation
+  return kAliHLTMultipleDataType;
+}
+
+int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+
+{
+  // see header file for class documentation
+  tgtList.clear();
+  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType);
+  return tgtList.size();
+}
 
 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-    {
-    // XXX TODO: Find more realistic values.  
-    constBase = 0;
-    if (fPackedSwitch)  inputMultiplier = (6 * 0.4);
-    else  inputMultiplier = 0.4;
-    }
+{
+  // see header file for class documentation
+  // XXX TODO: Find more realistic values.  
+  constBase = 0;
+  if (fPackedSwitch)  inputMultiplier = (6 * 0.4);
+  else  inputMultiplier = 0.4;
+}
 
 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
-    {
-    return new AliHLTTPCClusterFinderComponent(fPackedSwitch);
-    }
+{
+  // see header file for class documentation
+  return new AliHLTTPCClusterFinderComponent(fPackedSwitch);
+}
        
 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
-    {
-    if ( fClusterFinder )
-       return EINPROGRESS;
-
-    fClusterFinder = new AliHLTTPCClusterFinder();
+{
+  // see header file for class documentation
+  if ( fClusterFinder )
+    return EINPROGRESS;
+
+  fClusterFinder = new AliHLTTPCClusterFinder();
+
+  Int_t rawreadermode =  -1;
+  Int_t sigthresh = -1;
+  Double_t sigmathresh= -1;
+  Float_t occulimit = 1.0;
+  Int_t oldRCUFormat=0;
+  // Data Format version numbers:
+  // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word.
+  // 1: As 0, but pads/padrows are delivered "as is", without sorting
+  // 2: As 0, but RCU trailer is 3 32 bit words.
+  // 3: As 1, but RCU trailer is 3 32 bit words.
+  // -1: use offline raw reader
+
+  Int_t i = 0;
+  Char_t* cpErr;
+
+  while ( i < argc ) {      
+
+    // -- raw reader mode option
+    if ( !strcmp( argv[i], "rawreadermode" ) ) {
+      if ( argc <= i+1 ) {
+       Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" );
+       return ENOTSUP;
+      }
 
-    Int_t rawreadermode =  -1;
-    Int_t sigthresh = -1;
-    Float_t occulimit = 1.0;
+      // Decodes the rawreader mode: either number or string and returns the rawreadermode
+      // -1 on failure, -2 for offline
+      rawreadermode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[i+1] );
 
-    // Data Format version numbers:
-    // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word.
-    // 1: As 0, but pads/padrows are delivered "as is", without sorting
-    // 2: As 0, but RCU trailer is 3 32 bit words.
-    // 3: As 1, but RCU trailer is 3 32 bit words.
-    // -1: use offline raw reader
+      if (rawreadermode == -1 ) {
+       Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] );
+       return EINVAL;
+      }
 
-    Int_t i = 0;
-    Char_t* cpErr;
+      i += 2;
+      continue;
+    }
 
-    while ( i < argc ) {      
+    // -- pp run option
+    if ( !strcmp( argv[i], "pp-run" ) ) {
+      fClusterDeconv = false;
+      i++;
+      continue;
+    }
 
-      // -- raw reader mode option
-      if ( !strcmp( argv[i], "rawreadermode" ) ) {
-       if ( argc <= i+1 ) {
-         Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" );
-         return ENOTSUP;
-       }
-       
-       if ( !strcmp( argv[i+1], "sorted_1_trailerword" ) ) {
-         rawreadermode = 0;
-       }
-       else if ( !strcmp( argv[i+1], "sorted_3_trailerword" ) ) {
-         rawreadermode = 2;
-       }
-       else if ( !strcmp( argv[i+1], "unsorted_1_trailerword" ) ) {
-         rawreadermode = 1;
-       }
-       else if ( !strcmp( argv[i+1], "unsorted_3_trailerword" ) ) {
-         rawreadermode = 3;
-       }
-       else if ( !strcmp( argv[i+1], "offline" ) ) {
-         rawreadermode = -1;
-       }
-       else {
-         rawreadermode = strtoul( argv[i+1], &cpErr ,0);
-           if ( *cpErr ) {
-             Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] );
-             return EINVAL;
-           }
-       }
+    // -- zero suppression threshold
+    if ( !strcmp( argv[i], "adc-threshold" ) ) {
+      sigthresh = strtoul( argv[i+1], &cpErr ,0);
+      if ( *cpErr ) {
+       HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]);
+       return EINVAL;
+      }
+      i+=2;
+      continue;
+    }
 
-       i += 2;
-       continue;
+    // -- pad occupancy limit
+    if ( !strcmp( argv[i], "occupancy-limit" ) ) {
+      occulimit = strtod( argv[i+1], &cpErr);
+      if ( *cpErr ) {
+       HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]);
+       return EINVAL;
       }
+      i+=2;
+      continue;
+    }
 
-      // -- pp run option
-      if ( !strcmp( argv[i], "pp-run" ) ) {
-       fClusterDeconv = false;
-       i++;
-       continue;
+    // -- number of timebins (default 1024)
+    if ( !strcmp( argv[i], "timebins" ) ) {
+      TString parameter(argv[i+1]);
+      parameter.Remove(TString::kLeading, ' '); // remove all blanks
+      if (parameter.IsDigit()) {
+       AliHLTTPCTransform::SetNTimeBins(parameter.Atoi());
+       HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
+      } else {
+       HLTError("Cannot timebin specifier '%s'.", argv[i+1]);
+       return EINVAL;
       }
+      i+=2;
+      continue;
+    }
 
-      // -- zero suppression threshold
-      if ( !strcmp( argv[i], "adc-threshold" ) ) {
-       sigthresh = strtoul( argv[i+1], &cpErr ,0);
-       if ( *cpErr ) {
-         HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]);
-         return EINVAL;
-       }
-       i+=2;
-       continue;
+    // -- checking for rcu format
+    if ( !strcmp( argv[i], "oldrcuformat" ) ) {
+      oldRCUFormat = strtoul( argv[i+1], &cpErr ,0);
+      if ( *cpErr ){
+       HLTError("Cannot convert oldrcuformat specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
+       return EINVAL;
       }
+      i+=2;
+      continue;
+    }
+      
+    // -- checking for unsorted clusterfinding
+    if ( !strcmp( argv[i], "unsorted" ) ) {
+      fUnsorted = strtoul( argv[i+1], &cpErr ,0);
+      if ( *cpErr ){
+       HLTError("Cannot convert unsorted specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
+       return EINVAL;
+      }
+      i+=2;
+      continue;
+    }
+      
+    // -- checking for active pads, used in 2007 December run
+    if ( !strcmp( argv[i], "activepads" ) ) {
+      fGetActivePads = strtoul( argv[i+1], &cpErr ,0);
+      if ( *cpErr ){
+       HLTError("Cannot convert activepads specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
+       return EINVAL;
+      }
+      i+=2;
+      continue;
+    }
 
-      // -- pad occupancy limit
-      if ( !strcmp( argv[i], "occupancy-threshold" ) ) {
-       occulimit = strtof( argv[i+1], &cpErr);
-       if ( *cpErr ) {
-         HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]);
-         return EINVAL;
-       }
-       i+=2;
-       continue;
+    // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression
+    if ( !strcmp( argv[i], "nsigma-threshold" ) ) {
+       sigmathresh = strtoul( argv[i+1], &cpErr ,0);
+      if ( *cpErr ){
+       HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]);
+       return EINVAL;
       }
+      i+=2;
+      continue;
+    }
 
-      Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
-      return EINVAL;
+    Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
+    return EINVAL;
 
-    }
+  }
 
-    // Choose reader
-
-    if (fPackedSwitch) { 
-      if (rawreadermode == -1) {
-#if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-       fReader = new AliHLTTPCDigitReaderPacked();
-       fClusterFinder->SetReader(fReader);
-#else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-       HLTFatal("DigitReaderPacked not available - check your build");
-       return -ENODEV;
-#endif //  defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
-      } else {
+  // Choose reader
+
+  if (fPackedSwitch) { 
+    if (rawreadermode == -2) {
+      HLTDebug("using AliHLTTPCDigitReaderPacked");
+      fReader = new AliHLTTPCDigitReaderPacked();
+      if(oldRCUFormat==1){
+       fReader->SetOldRCUFormat(kTRUE);
+      }
+      else if(oldRCUFormat!=0){
+       HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
+      }
+      if(fUnsorted==1){
+       fReader->SetUnsorted(kTRUE);
+      }
+      fClusterFinder->SetReader(fReader);
+    } else {
 #if defined(HAVE_TPC_MAPPING)
-       fReader = new AliHLTTPCDigitReaderRaw(rawreadermode);
-       fClusterFinder->SetReader(fReader);
+      HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode);
+      fReader = new AliHLTTPCDigitReaderRaw(rawreadermode);
+      fClusterFinder->SetReader(fReader);
 #else //! defined(HAVE_TPC_MAPPING)
       HLTFatal("DigitReaderRaw not available - check your build");
       return -ENODEV;
 #endif //defined(HAVE_TPC_MAPPING)
-      }
-    }
-    else {
-      fReader = new AliHLTTPCDigitReaderUnpacked();
-      fClusterFinder->SetReader(fReader);
     }
-
-    // if pp-run use occupancy limit else set to 1. ==> use all 
-    if ( !fClusterDeconv )
-      fClusterFinder->SetOccupancyLimit(occulimit);
-    else 
-      fClusterFinder->SetOccupancyLimit(1.0);
+  }
+  else {
+    HLTDebug("using AliHLTTPCDigitReaderUnpacked");
+    fReader = new AliHLTTPCDigitReaderUnpacked();
+    fClusterFinder->SetReader(fReader);
+  }
+
+  // if pp-run use occupancy limit else set to 1. ==> use all 
+  if ( !fClusterDeconv )
+    fClusterFinder->SetOccupancyLimit(occulimit);
+  else 
+    fClusterFinder->SetOccupancyLimit(1.0);
       
-    // Variables to setup the Clusterfinder
-    // TODO: this sounds strange and has to be verified; is the cluster finder not working when
-    // fClusterDeconv = false ?
-    fClusterDeconv = true;
-    fXYClusterError = -1;
-    fZClusterError = -1;
+  // Variables to setup the Clusterfinder
+  // TODO: this sounds strange and has to be verified; is the cluster finder not working when
+  // fClusterDeconv = false ?
+  fClusterDeconv = true;
+  fXYClusterError = -1;
+  fZClusterError = -1;
 
  
-    fClusterFinder->SetDeconv( fClusterDeconv );
-    fClusterFinder->SetXYError( fXYClusterError );
-    fClusterFinder->SetZError( fZClusterError );
-    if ( (fXYClusterError>0) && (fZClusterError>0) )
-      fClusterFinder->SetCalcErr( false );
-    fClusterFinder->SetSignalThreshold(sigthresh);
-    
-    return 0;
-    }
+  fClusterFinder->SetDeconv( fClusterDeconv );
+  fClusterFinder->SetXYError( fXYClusterError );
+  fClusterFinder->SetZError( fZClusterError );
+  if ( (fXYClusterError>0) && (fZClusterError>0) )
+    fClusterFinder->SetCalcErr( false );
+  fClusterFinder->SetSignalThreshold(sigthresh);
+  fClusterFinder->SetNSigmaThreshold(sigmathresh);
+
+  return 0;
+}
 
 int AliHLTTPCClusterFinderComponent::DoDeinit()
-    {
+{
+  // see header file for class documentation
 
-    if ( fClusterFinder )
-       delete fClusterFinder;
-    fClusterFinder = NULL;
+  if ( fClusterFinder )
+    delete fClusterFinder;
+  fClusterFinder = NULL;
  
-    if ( fReader )
-       delete fReader;
-    fReader = NULL;
+  if ( fReader )
+    delete fReader;
+  fReader = NULL;
     
-    return 0;
-    }
+  return 0;
+}
 
-int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponent_EventData& evtData, 
-                                             const AliHLTComponent_BlockData* blocks, 
-                                             AliHLTComponent_TriggerData& trigData, AliHLTUInt8_t* outputPtr, 
+int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, 
+                                             const AliHLTComponentBlockData* blocks, 
+                                             AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, 
                                              AliHLTUInt32_t& size, 
-                                             vector<AliHLTComponent_BlockData>& outputBlocks )
-    {
+                                             vector<AliHLTComponentBlockData>& outputBlocks )
+{
+  // see header file for class documentation
 
-    //  == init iter (pointer to datablock)
-    const AliHLTComponent_BlockData* iter = NULL;
-    unsigned long ndx;
+  //  == init iter (pointer to datablock)
+  const AliHLTComponentBlockData* iter = NULL;
+  unsigned long ndx;
 
-    //  == OUTdatatype pointer
-    AliHLTTPCClusterData* outPtr;
+  //  == OUTdatatype pointer
+  AliHLTTPCClusterData* outPtr;
 
-    AliHLTUInt8_t* outBPtr;
-    UInt_t offset, mysize, nSize, tSize = 0;
+  AliHLTUInt8_t* outBPtr;
+  UInt_t offset, mysize, nSize, tSize = 0;
 
-    outBPtr = outputPtr;
-    outPtr = (AliHLTTPCClusterData*)outBPtr;
+  outBPtr = outputPtr;
+  outPtr = (AliHLTTPCClusterData*)outBPtr;
 
-    Int_t slice, patch, row[2];
-    unsigned long maxPoints, realPoints = 0;
+  Int_t slice, patch, row[2];
+  unsigned long maxPoints, realPoints = 0;
 
-    for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
-       {
-       iter = blocks+ndx;
-       mysize = 0;
-       offset = tSize;
+  for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+    {
+      iter = blocks+ndx;
+      mysize = 0;
+      offset = tSize;
 
 
-       if (fPackedSwitch) {    
-         char tmp1[14], tmp2[14];
-         DataType2Text( iter->fDataType, tmp1 );
-         DataType2Text( AliHLTTPCDefinitions::gkDDLPackedRawDataType, tmp2 );
-         Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received", 
-                  "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
-                  evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
+      if (fPackedSwitch) {
+       HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+                evtData.fEventID, evtData.fEventID, 
+                DataType2Text( iter->fDataType).c_str(), 
+                DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
 
-         if ( iter->fDataType != AliHLTTPCDefinitions::gkDDLPackedRawDataType ) continue;
+       if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
+           GetEventCount()<2) {
+         HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
+                    DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
+                    DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+         }
 
-       }
-       else {
-         char tmp1[14], tmp2[14];
-         DataType2Text( iter->fDataType, tmp1 );
-         DataType2Text( AliHLTTPCDefinitions::gkUnpackedRawDataType, tmp2 );
-         Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received", 
-                  "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
-                  evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
+       if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
+            iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
+
+      }
+      else {
+       HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+                evtData.fEventID, evtData.fEventID, 
+                DataType2Text( iter->fDataType).c_str(), 
+                DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
 
-         if ( iter->fDataType != AliHLTTPCDefinitions::gkUnpackedRawDataType ) continue;
+       if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
 
-       }
+      }
        
-       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-       row[0] = AliHLTTPCTransform::GetFirstRow( patch );
-       row[1] = AliHLTTPCTransform::GetLastRow( patch );
-       
-       Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Input Spacepoints", 
-                "Input: Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
-                realPoints, slice, patch, row[0], row[1] );
+      slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
+      patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+      row[0] = AliHLTTPCTransform::GetFirstRow( patch );
+      row[1] = AliHLTTPCTransform::GetLastRow( patch );
        
-       outPtr = (AliHLTTPCClusterData*)outBPtr;
+      if(fUnsorted){
+       if(fPadArray==NULL){
+         fClusterFinder->SetUnsorted(fUnsorted);
+         fPadArray = new AliHLTTPCPadArray(patch);
+         fPadArray->InitializeVector();
+       }
+       else if(fPadArray->GetPatch()!=patch||fPadArray->GetPatch()==-1){
+         if (GetEventCount()<3) {
+           HLTWarning("pad array not initialized for data of specification 0x%08x, block skipped", iter->fSpecification);
+         } else if ((GetEventCount()%5000)==0) { // assuming 0.5 to 1kHz this gives a message rate of 0.1 to 0.5 Hz
+           HLTWarning("reminder: pad array not initialized for data of specification 0x%08x", iter->fSpecification);
+         }
+         continue;
+       }
+      }
+
+      outPtr = (AliHLTTPCClusterData*)outBPtr;
 
-       maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
+      maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
 
-       fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
-       fClusterFinder->SetOutputArray( outPtr->fSpacePoints );
+      fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
+      fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
+       
+      if(fUnsorted){
+
+
+       fClusterFinder->SetPadArray(fPadArray);
+       /*        
+       double totalT=0;
+       struct timeval startT, endT;
+       gettimeofday( &startT, NULL );
+       */
+       fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize );
+       /*
+       gettimeofday( &endT, NULL );
+       unsigned long long dt;
+       dt = endT.tv_sec-startT.tv_sec;
+       dt *= 1000000ULL;
+       dt += endT.tv_usec-startT.tv_usec;
+       double dtd = ((double)dt);
+       totalT += dtd;
+       //        dtd = dtd / (double)eventIterations;
+       //        if ( iterations<=1 )
+       cout<<endl;
+       printf( "Time needed to read data: %f microsec. / %f millisec. / %f s\n", 
+               dtd, dtd/1000.0, dtd/1000000.0 );
+         
+       cout<<endl;
+       */
+       fClusterFinder->FindClusters();
+      }
+      else{
        fClusterFinder->Read(iter->fPtr, iter->fSize );
        fClusterFinder->ProcessDigits();
-       realPoints = fClusterFinder->GetNumberOfClusters();
-       
-       Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", 
-                "Number of spacepoints found: %lu.", realPoints );
-       
-       outPtr->fSpacePointCnt = realPoints;
-       nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
-       mysize += nSize+sizeof(AliHLTTPCClusterData);
+      }
+      realPoints = fClusterFinder->GetNumberOfClusters();
        
-       Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Input Spacepoints", 
-                "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
-                realPoints, slice, patch, row[0], row[1] );
-       AliHLTComponent_BlockData bd;
-       FillBlockData( bd );
-       bd.fOffset = offset;
-       bd.fSize = mysize;
-       bd.fSpecification = iter->fSpecification;
-       //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
-       outputBlocks.push_back( bd );
+      outPtr->fSpacePointCnt = realPoints;
+      nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
+      mysize += nSize+sizeof(AliHLTTPCClusterData);
+
+      Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", 
+              "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
+              realPoints, slice, patch, row[0], row[1] );
+      AliHLTComponentBlockData bd;
+      FillBlockData( bd );
+      bd.fOffset = offset;
+      bd.fSize = mysize;
+      bd.fSpecification = iter->fSpecification;
+      bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
+      //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
+      outputBlocks.push_back( bd );
        
-       tSize += mysize;
-       outBPtr += mysize;
-       outPtr = (AliHLTTPCClusterData*)outBPtr;
+      tSize += mysize;
+      outBPtr += mysize;
+      outPtr = (AliHLTTPCClusterData*)outBPtr;
        
-       if ( tSize > size )
-           {
-           Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", 
-                    "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
-                    tSize, size );
-           return EMSGSIZE;
-           }
+      if(fGetActivePads){
+       AliHLTTPCPadArray::AliHLTTPCActivePads* outPtrActive;
+       UInt_t activePadsSize, activePadsN = 0;
+       outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
+       offset=tSize;
+       Int_t maxActivePads = (size-tSize)/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
+       activePadsSize= fClusterFinder->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)outPtrActive,maxActivePads)*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
+       
+       AliHLTComponentBlockData bdActive;
+       FillBlockData( bdActive );
+       bdActive.fOffset = offset;
+       bdActive.fSize = activePadsSize;
+       bdActive.fSpecification = iter->fSpecification;
+       bdActive.fDataType = AliHLTTPCDefinitions::fgkActivePadsDataType;
+       outputBlocks.push_back( bdActive );
+       
+       tSize+=activePadsSize;
+       outBPtr += activePadsSize;
+       outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
+      }
+
+      if ( tSize > size )
+       {
+         Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", 
+                  "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
+                  tSize, size );
+         return EMSGSIZE;
        }
+    }
     
-    size = tSize;
+  size = tSize;
 
-    return 0;
-    }
+  return 0;
+}
 
-   
+int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+  // see header file for class documentation
+  const char* path="HLT/ConfigTPC";
+  if (cdbEntry) path=cdbEntry;
+  if (path) {
+    HLTInfo("reconfigure from entry %s, chain id %s", path, (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: %s", pString->GetString().Data());
+      } else {
+       HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+      }
+    } else {
+      HLTError("can not fetch object \"%s\" from CDB", path);
+    }
+  }
+}