changes by Kenneth
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Mar 2008 17:03:10 +0000 (17:03 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Mar 2008 17:03:10 +0000 (17:03 +0000)
- AliHLTTPCPad: Added method GetNextGoodSignal
- AliHLTTPCPadArray removed
- AliHLTTPCZeroSuppressionComponent does the zero suppression but
  the output is not yet functional
- coding conventions and warnings

16 files changed:
HLT/TPCLib/AliHLTTPCClusterFinder.cxx
HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
HLT/TPCLib/AliHLTTPCDigitDumpComponent.cxx
HLT/TPCLib/AliHLTTPCDigitReader.cxx
HLT/TPCLib/AliHLTTPCDigitReaderDecoder.cxx
HLT/TPCLib/AliHLTTPCMapping.cxx
HLT/TPCLib/AliHLTTPCMapping.h
HLT/TPCLib/AliHLTTPCPad.cxx
HLT/TPCLib/AliHLTTPCPad.h
HLT/TPCLib/AliHLTTPCPadArray.cxx [deleted file]
HLT/TPCLib/AliHLTTPCPadArray.h [deleted file]
HLT/TPCLib/AliHLTTPCZeroSuppressionComponent.cxx
HLT/TPCLib/AliHLTTPCZeroSuppressionComponent.h
HLT/libAliHLTTPC.pkg

index dcd2115..4f4834c 100644 (file)
@@ -34,7 +34,6 @@
 #include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCMemHandler.h"
 #include "AliHLTTPCPad.h"
-#include "AliHLTTPCPadArray.h"
 #include <sys/time.h>
 
 #if __GNUC__ >= 3
@@ -143,14 +142,12 @@ AliHLTTPCClusterFinder::AliHLTTPCClusterFinder()
   fXYErr(0.2),
   fZErr(0.3),
   fOccupancyLimit(1.0),
-  fPadArray(NULL),
   fUnsorted(0),
-  fActivePads(),
-  fNumberOfPadsInRow(NULL),
-  fNumberOfRows(0),
+  fVectorInitialized(kFALSE),
   fRowPadVector(),
   fClusters(),
-  fVectorInitialized(kFALSE),
+  fNumberOfPadsInRow(NULL),
+  fNumberOfRows(0),
   fRowOfFirstCandidate(0)
 {
   //constructor  
@@ -197,10 +194,10 @@ void AliHLTTPCClusterFinder::InitializePadArray(){
 
   memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows));
 
-  for(Int_t i=0;i<fNumberOfRows;i++){
+  for(UInt_t i=0;i<fNumberOfRows;i++){
     fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow);
     AliHLTTPCPadVector tmpRow;
-    for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+    for(UInt_t j=0;j<fNumberOfPadsInRow[i];j++){
       AliHLTTPCPad *tmpPad = new AliHLTTPCPad(2);
       tmpPad->SetID(i,j);
       tmpRow.push_back(tmpPad);
@@ -213,8 +210,8 @@ void AliHLTTPCClusterFinder::InitializePadArray(){
 Int_t AliHLTTPCClusterFinder::DeInitializePadArray()
 {
   // see header file for class documentation
-  for(Int_t i=0;i<fNumberOfRows;i++){
-    for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
+  for(UInt_t i=0;i<fNumberOfRows;i++){
+    for(UInt_t j=0;j<fNumberOfPadsInRow[i];j++){
       delete fRowPadVector[i][j];
       fRowPadVector[i][j]=NULL;
     }
@@ -259,7 +256,6 @@ void AliHLTTPCClusterFinder::ProcessDigits()
   AliHLTTPCSignal_t charge=0;
 
   fNClusters = 0;
-  fActivePads.clear();
 
   // initialize block for reading packed data
   iResult=fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
@@ -381,16 +377,6 @@ void AliHLTTPCClusterFinder::ProcessDigits()
          }
        }
       }
-
-      /*      if (fActivePads.size()==0 ||
-             fActivePads.back().fRow!=fCurrentRow-rowOffset ||
-             fActivePads.back().fPad!=pad) {
-             AliHLTTPCPadArray::AliHLTTPCActivePads entry;
-             entry.fRow=fCurrentRow-rowOffset;
-             entry.fPad=pad;
-             fActivePads.push_back(entry);      
-             }
-      */
       if (pCurrentPad) {
        Float_t occupancy=pCurrentPad->GetOccupancy();
        //HLTDebug("pad %d occupancy level: %f", pCurrentPad->GetPadNumber(), occupancy);
@@ -757,13 +743,7 @@ void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
 
 //----------------------------------Methods for the new unsorted way of reading the data --------------------------------
 
-void AliHLTTPCClusterFinder::SetPadArray(AliHLTTPCPadArray * padArray)
-{
-  // see header file for function documentation
-  fPadArray=padArray;
-}
-
-void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size, Int_t mode)
+void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size)
 {
   //set input pointer
   fPtr = (UChar_t*)ptr;
@@ -810,7 +790,7 @@ void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size, Int_
 
 Bool_t AliHLTTPCClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* cluster,Int_t nextPadToRead){
   //Checking if we have a match on the next pad
-  for(Int_t candidateNumber=0;candidateNumber<nextPad->fClusterCandidates.size();candidateNumber++){
+  for(UInt_t candidateNumber=0;candidateNumber<nextPad->fClusterCandidates.size();candidateNumber++){
     AliHLTTPCClusters *candidate =&nextPad->fClusterCandidates[candidateNumber]; 
     if(cluster->fMean-candidate->fMean==1 || candidate->fMean-cluster->fMean==1 || cluster->fMean-candidate->fMean==0){
       cluster->fMean=candidate->fMean;
@@ -824,7 +804,7 @@ Bool_t AliHLTTPCClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCCluste
       //setting the matched pad to used
       nextPad->fUsedClusterCandidates[candidateNumber]=1;
       nextPadToRead++;
-      if(nextPadToRead<fNumberOfPadsInRow[fRowOfFirstCandidate]){
+      if(nextPadToRead<(Int_t)fNumberOfPadsInRow[fRowOfFirstCandidate]){
        nextPad=fRowPadVector[fRowOfFirstCandidate][nextPadToRead];
        ComparePads(nextPad,cluster,nextPadToRead);
       }
@@ -844,9 +824,9 @@ void AliHLTTPCClusterFinder::FindClusters()
   // see header file for function documentation
 
   AliHLTTPCClusters* tmpCandidate=NULL;
-  for(Int_t row=0;row<fNumberOfRows;row++){
+  for(UInt_t row=0;row<fNumberOfRows;row++){
     fRowOfFirstCandidate=row;
-    for(Int_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
+    for(UInt_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
       AliHLTTPCPad *tmpPad=fRowPadVector[row][pad];
       for(size_t candidate=0;candidate<tmpPad->fClusterCandidates.size();candidate++){
        if(tmpPad->fUsedClusterCandidates[candidate]){
@@ -902,25 +882,6 @@ void AliHLTTPCClusterFinder::PrintClusters()
   }
 }
 
-/*
-
-Int_t AliHLTTPCClusterFinder::GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads)
-{
-  // see header file for function documentation
-  Int_t iResult=0;
-  if (fPadArray) {
-    iResult=fPadArray->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)activePads , maxActivePads);
-  } else if ((iResult=fActivePads.size())>0) {
-    if (iResult>maxActivePads) {
-      HLTWarning("target array (%d) not big enough to receive %d active pad descriptors", maxActivePads, iResult);
-      iResult=maxActivePads;
-    }
-    memcpy(activePads, &fActivePads[0], iResult*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads));
-  }
-
-  return iResult;
-}
-*/
 void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *list)//This is used when using the AliHLTTPCClusters class for cluster data
 {
   //write cluster to output pointer
index e1147fd..f466ef7 100644 (file)
@@ -22,7 +22,7 @@
 
 
 #include "AliHLTLogging.h"
-#include "AliHLTTPCPadArray.h"
+#include "AliHLTTPCPad.h"
 class AliHLTTPCSpacePointData;
 class AliHLTTPCDigitReader;
 
@@ -74,10 +74,8 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   Int_t GetNumberOfClusters() const {return fNClusters;}
 
   //----------------------------------Methods for the new unsorted way of reading data ----------
-  void SetPadArray(AliHLTTPCPadArray *padArray);
-  void ReadDataUnsorted(void* ptr,unsigned long size, Int_t mode);
+  void ReadDataUnsorted(void* ptr,unsigned long size);
   void FindClusters();
-  //  Int_t GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads);
   void WriteClusters(Int_t nclusters,AliHLTTPCClusters *list);
   void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;}
   void SetPatch(Int_t patch){fCurrentPatch=patch;}
@@ -120,8 +118,6 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   
   Float_t fOccupancyLimit; // Occupancy Limit
 
-  AliHLTTPCPadArray * fPadArray; //! transient
-
   Int_t fUnsorted;       // enable for processing of unsorted digit data
   Bool_t fVectorInitialized;
 
@@ -137,8 +133,6 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   
   UInt_t fRowOfFirstCandidate;
 
-  /** list of active pads if PadArray is not used */
-  vector<AliHLTTPCPadArray::AliHLTTPCActivePads> fActivePads; //!transient
 
 #ifdef do_mc
   void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
index 8d3e98e..400b122 100644 (file)
@@ -73,7 +73,6 @@ AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   fModeSwitch(mode),
   fUnsorted(0),
   fPatch(0),
-  fPadArray(NULL),
   fGetActivePads(0)
 {
   // see header file for class documentation
@@ -451,23 +450,6 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        fClusterFinder->SetUnsorted(fUnsorted);
        fClusterFinder->SetPatch(patch);
       }
-      /*      if(fUnsorted){
-             if(fPadArray==NULL){
-             fClusterFinder->SetUnsorted(fUnsorted);
-             //fPadArray = new AliHLTTPCPadArray(patch);
-             //fPadArray->InitializeVector(fModeSwitch);
-             }
-             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;
 
@@ -477,7 +459,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
        
       if(fUnsorted){
-       fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize, fModeSwitch);
+       fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
 
        fClusterFinder->FindClusters();
       }
@@ -507,28 +489,6 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       outBPtr += mysize;
       outPtr = (AliHLTTPCClusterData*)outBPtr;
        
-      /*      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 )
        {
index e137619..9e35c70 100644 (file)
@@ -22,7 +22,6 @@
 #include "AliHLTProcessor.h"
 
 class AliHLTTPCClusterFinder;
-class AliHLTTPCPadArray;
 class AliHLTTPCDigitReader;
 
 /**
@@ -117,41 +116,35 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
        AliHLTTPCDigitReader* fReader;                                               //!transient
 
        bool fClusterDeconv; //!transient
-      float fXYClusterError; //!transient
-      float fZClusterError; //!transient
-      /**
-       * switch to indicated the reader
-       * use fModeSwitch = 0 for packed inputtype "gkDDLPackedRawDataType"
-       * use fModeSwitch = 1 for unpacked inputtype "gkUnpackedRawDataType"
-       * use fModeSwitch = 2 for packed inputtype "gkDDLPackedRawDataType" with new digit reader
-       */
-      Int_t fModeSwitch;                                                           // see above
+       float fXYClusterError; //!transient
+       float fZClusterError; //!transient
+       /**
+        * switch to indicated the reader
+        * use fModeSwitch = 0 for packed inputtype "gkDDLPackedRawDataType"
+        * use fModeSwitch = 1 for unpacked inputtype "gkUnpackedRawDataType"
+        * use fModeSwitch = 2 for packed inputtype "gkDDLPackedRawDataType" with new digit reader
+        */
+       Int_t fModeSwitch;                                                           // see above
       
-      /*
-       * Reads the data the new unsorted way if true
-       *
-       */
-      Int_t fUnsorted;                                                               //!transient
-
-      /*
-       * Patch number to be read, currently given as component argument,
-       * will be changed later.
-       */
-      Int_t fPatch;                                                                  //!transient
-
-      /*
-       * Switch to specify if one ship out a list of active pads.
-       * Used for the 2007 December run. 
-       */
-      Int_t fGetActivePads;                                                          //!transient
-
-      /*
-       * Pointer to a PadArray object containing a double array of all the pads in
-       * the current patch.
-       */
-      AliHLTTPCPadArray * fPadArray;                                                 //!transient
-
-      ClassDef(AliHLTTPCClusterFinderComponent, 2)
-
-    };
+       /*
+        * Reads the data the new unsorted way if true
+        *
+        */
+       Int_t fUnsorted;                                                               //!transient
+
+       /*
+        * Patch number to be read, currently given as component argument,
+        * will be changed later.
+        */
+       Int_t fPatch;                                                                  //!transient
+
+       /*
+        * Switch to specify if one ship out a list of active pads.
+        * Used for the 2007 December run. 
+        */
+       Int_t fGetActivePads;                                                          //!transient
+
+       ClassDef(AliHLTTPCClusterFinderComponent, 3)
+
+};
 #endif
index a56fed8..ac0ce8a 100644 (file)
@@ -172,7 +172,7 @@ int AliHLTTPCDigitDumpComponent::CloseWriter()
 }
 
 int AliHLTTPCDigitDumpComponent::DumpEvent( const AliHLTComponentEventData& evtData,
-                                           const AliHLTComponentBlockData* blocks, 
+                                           const AliHLTComponentBlockData* /*blocks*/, 
                                            AliHLTComponentTriggerData& /*trigData*/ )
 {
   // see header file for class documentation
index 798af0d..4783388 100644 (file)
@@ -87,7 +87,7 @@ void AliHLTTPCDigitReader::SetUnsorted(Bool_t /*unsorted*/)
   HLTWarning("common sorting functionality has not yet been implemented");
 }
 
-bool AliHLTTPCDigitReader::Next(int type)
+bool AliHLTTPCDigitReader::Next(int /*type*/)
 {
   // see header file for class documentation
   if (!CheckFlag(kLocked)) return NextSignal();
index 2aa48b1..15324aa 100644 (file)
@@ -69,7 +69,7 @@ AliHLTTPCDigitReaderDecoder::~AliHLTTPCDigitReaderDecoder()
   }
 }
 
-int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
+int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t /*slice*/)
 {
   // see header file for class documentation
   //  HLTDebug("Initializing block in decoder");
index a667ccb..9056017 100644 (file)
@@ -37,10 +37,10 @@ ClassImp(AliHLTTPCMapping)
 
 AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
   :
-  fNHWAdd(0),
-  fMaxHWAdd(0),
   fCurrentRowMapping(NULL),
-  fCurrentPadMapping(NULL)
+  fCurrentPadMapping(NULL),
+  fNHWAdd(0),
+  fMaxHWAdd(0)
 {
   // see header file for class documentation
   // or
@@ -50,7 +50,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
 
   switch(patch){
   case 0:
-    if(!fMapping0IsDone){
+    if(!fgMapping0IsDone){
       memset(fgRowMapping0, 0, fgkMapping0Size*sizeof(UInt_t));
       memset(fgPadMapping0, 0, fgkMapping0Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -59,7 +59,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
     fCurrentPadMapping=fgPadMapping0;
     break;
   case 1:
-    if(!fMapping1IsDone){
+    if(!fgMapping1IsDone){
       memset(fgRowMapping1, 0, fgkMapping1Size*sizeof(UInt_t));
       memset(fgPadMapping1, 0, fgkMapping1Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -68,7 +68,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
     fCurrentPadMapping=fgPadMapping1;
     break;
   case 2:
-    if(!fMapping2IsDone){
+    if(!fgMapping2IsDone){
       memset(fgRowMapping2, 0, fgkMapping2Size*sizeof(UInt_t));
       memset(fgPadMapping2, 0, fgkMapping2Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -77,7 +77,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
     fCurrentPadMapping=fgPadMapping2;
     break;
   case 3:
-    if(!fMapping3IsDone){
+    if(!fgMapping3IsDone){
       memset(fgRowMapping3, 0, fgkMapping3Size*sizeof(UInt_t));
       memset(fgPadMapping3, 0, fgkMapping3Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -86,7 +86,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
     fCurrentPadMapping=fgPadMapping3;
     break;
   case 4:
-    if(!fMapping4IsDone){
+    if(!fgMapping4IsDone){
       memset(fgRowMapping4, 0, fgkMapping4Size*sizeof(UInt_t));
       memset(fgPadMapping4, 0, fgkMapping4Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -95,7 +95,7 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
     fCurrentPadMapping=fgPadMapping4;
     break;
   case 5:
-    if(!fMapping5IsDone){
+    if(!fgMapping5IsDone){
       memset(fgRowMapping5, 0, fgkMapping5Size*sizeof(UInt_t));
       memset(fgPadMapping5, 0, fgkMapping5Size*sizeof(UInt_t));
       InitializeMap(patch);
@@ -106,12 +106,12 @@ AliHLTTPCMapping::AliHLTTPCMapping(UInt_t patch)
   }
 }
 
-Bool_t AliHLTTPCMapping::fMapping0IsDone=kFALSE;
-Bool_t AliHLTTPCMapping::fMapping1IsDone=kFALSE;
-Bool_t AliHLTTPCMapping::fMapping2IsDone=kFALSE;
-Bool_t AliHLTTPCMapping::fMapping3IsDone=kFALSE;
-Bool_t AliHLTTPCMapping::fMapping4IsDone=kFALSE;
-Bool_t AliHLTTPCMapping::fMapping5IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping0IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping1IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping2IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping3IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping4IsDone=kFALSE;
+Bool_t AliHLTTPCMapping::fgMapping5IsDone=kFALSE;
 UInt_t AliHLTTPCMapping::fgRowMapping0[fgkMapping0Size];
 UInt_t AliHLTTPCMapping::fgPadMapping0[fgkMapping0Size];
 UInt_t AliHLTTPCMapping::fgRowMapping1[fgkMapping1Size];
@@ -188,7 +188,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping0[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping0[hwAdd]=pad;
          }
-         fMapping0IsDone=kTRUE;
+         fgMapping0IsDone=kTRUE;
          break;
        case 1:
          if(fgkMapping1Size<fMaxHWAdd){
@@ -203,7 +203,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping1[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping1[hwAdd]=pad;
          }
-         fMapping1IsDone=kTRUE;
+         fgMapping1IsDone=kTRUE;
          break;
        case 2:
          if(fgkMapping2Size<fMaxHWAdd){
@@ -218,7 +218,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping2[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping2[hwAdd]=pad;
          }
-         fMapping2IsDone=kTRUE;
+         fgMapping2IsDone=kTRUE;
          break;
        case 3:
          if(fgkMapping3Size<fMaxHWAdd){
@@ -233,7 +233,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping3[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping3[hwAdd]=pad;
          }
-         fMapping3IsDone=kTRUE;
+         fgMapping3IsDone=kTRUE;
          break;
        case 4:
          if(fgkMapping4Size<fMaxHWAdd){
@@ -248,7 +248,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping4[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping4[(UInt_t)hwAdd]=(UInt_t)pad;
          }
-         fMapping4IsDone=kTRUE;
+         fgMapping4IsDone=kTRUE;
          break;
        case 5:
          if(fgkMapping5Size<fMaxHWAdd){
@@ -263,7 +263,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            fgRowMapping5[hwAdd]=row-fNRowsToSubtract;
            fgPadMapping5[hwAdd]=pad;
          }
-         fMapping5IsDone=kTRUE;
+         fgMapping5IsDone=kTRUE;
          break;
        }
       }
@@ -272,7 +272,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
   inFile.close();
 }
 
-UInt_t AliHLTTPCMapping::GetRow(UInt_t hwadd)
+UInt_t AliHLTTPCMapping::GetRow(UInt_t hwadd) const
 {
   // see header file for class documentation
   assert(fCurrentRowMapping);
@@ -282,7 +282,7 @@ UInt_t AliHLTTPCMapping::GetRow(UInt_t hwadd)
   return fCurrentRowMapping[hwadd];
 }
 
-UInt_t AliHLTTPCMapping::GetPad(UInt_t hwadd)
+UInt_t AliHLTTPCMapping::GetPad(UInt_t hwadd) const
 {
   // see header file for class documentation
   assert(fCurrentPadMapping);
index 4399265..4186ba1 100644 (file)
@@ -46,14 +46,14 @@ public:
    * @param HWAddress    The hardware address of the given pad
    * @return Pad number of given HWAddress
    */
-  UInt_t GetPad(UInt_t HWAddress);
+  UInt_t GetPad(UInt_t HWAddress) const;
 
   /**
    * Get the row number belonging to hardware address.
    * @param HWAddress    The hardware address of the given pad you are on.
    * @return Row number of hardware address (Pad).
    */
-  UInt_t GetRow(UInt_t HWAddress);
+  UInt_t GetRow(UInt_t HWAddress) const;
 
  private:
   /** standard constructor prohibited, pad no always required */
@@ -64,55 +64,68 @@ public:
   AliHLTTPCMapping& operator=(const AliHLTTPCMapping&);
   
   //Flags to check if mapping is done for the six patches
-  static Bool_t fMapping0IsDone;
-  static Bool_t fMapping1IsDone;
-  static Bool_t fMapping2IsDone;
-  static Bool_t fMapping3IsDone;
-  static Bool_t fMapping4IsDone;
-  static Bool_t fMapping5IsDone;
+  /** flag to check if mapping is done for patch 0 */
+  static Bool_t fgMapping0IsDone;
+  /** flag to check if mapping is done for patch 1 */
+  static Bool_t fgMapping1IsDone;
+  /** flag to check if mapping is done for patch 2 */
+  static Bool_t fgMapping2IsDone;
+  /** flag to check if mapping is done for patch 3 */
+  static Bool_t fgMapping3IsDone;
+  /** flag to check if mapping is done for patch 4 */
+  static Bool_t fgMapping4IsDone;
+  /** flag to check if mapping is done for patch 5 */
+  static Bool_t fgMapping5IsDone;
 
 
   /** size of mapping arrays */
-  static const Int_t fgkMapping0Size=3200;                         // see above
+  static const UInt_t fgkMapping0Size=3200;                          // see above
   /** size of mapping array for patch 1 */
-  static const Int_t fgkMapping1Size=3584;                         // see above
+  static const UInt_t fgkMapping1Size=3584;                          // see above
   /** size of mapping array for patch 2 */
-  static const Int_t fgkMapping2Size=3200;                         // see above
+  static const UInt_t fgkMapping2Size=3200;                          // see above
   /** size of mapping array for patch 3 */
-  static const Int_t fgkMapping3Size=3328;                         // see above
+  static const UInt_t fgkMapping3Size=3328;                          // see above
   /** size of mapping array for patch 4 */
-  static const Int_t fgkMapping4Size=3328;                         // see above
+  static const UInt_t fgkMapping4Size=3328;                          // see above
   /** size of mapping array for patch 5 */
-  static const Int_t fgkMapping5Size=3328;                         // see above
+  static const UInt_t fgkMapping5Size=3328;                          // see above
 
-  /** mapping arrays for patch 0 */
+  /** row mapping array for patch 0 */
   static UInt_t fgRowMapping0[fgkMapping0Size];                      // see above
+  /** pad mapping array for patch 0 */
   static UInt_t fgPadMapping0[fgkMapping0Size];                      // see above
-  /** mapping arrays for patch 1 */
+  /** row mapping array for patch 1 */
   static UInt_t fgRowMapping1[fgkMapping1Size];                      // see above
+  /** pad mapping array for patch 1 */
   static UInt_t fgPadMapping1[fgkMapping1Size];                      // see above
-  /** mapping arrays for patch 2 */
+  /** row mapping array for patch 2 */
   static UInt_t fgRowMapping2[fgkMapping2Size];                      // see above
+  /** pad mapping array for patch 2 */
   static UInt_t fgPadMapping2[fgkMapping2Size];                      // see above
-  /** mapping arrays for patch 3 */
+  /** row mapping array for patch 3 */
   static UInt_t fgRowMapping3[fgkMapping3Size];                      // see above
+  /** pad mapping array for patch 3 */
   static UInt_t fgPadMapping3[fgkMapping3Size];                      // see above
-  /** mapping arrays for patch 4 */
+  /** row mapping array for patch 4 */
   static UInt_t fgRowMapping4[fgkMapping4Size];                      // see above
+  /** pad mapping array for patch 4 */
   static UInt_t fgPadMapping4[fgkMapping4Size];                      // see above
-  /** mapping arrays for patch 5 */
+  /** row mapping array for patch 5 */
   static UInt_t fgRowMapping5[fgkMapping5Size];                      // see above
+  /** pad mapping array for patch 5 */
   static UInt_t fgPadMapping5[fgkMapping5Size];                      // see above
 
-  /** current mapping array */
-  UInt_t *fCurrentRowMapping;                                     //!transient
-  UInt_t *fCurrentPadMapping;                                     //!transient
+  /** current row mapping array */
+  UInt_t *fCurrentRowMapping;                                        //!transient
+  /** current pad mapping array */
+  UInt_t *fCurrentPadMapping;                                        //!transient
 
   /** Number of hardware adresses */
-  UInt_t fNHWAdd;                                                 // see above
+  UInt_t fNHWAdd;                                                    // see above
 
   /** Maximum number of hardware addresses */
-  UInt_t fMaxHWAdd;                                               // see above
+  UInt_t fMaxHWAdd;                                                  // see above
 
   ClassDef(AliHLTTPCMapping, 0)
 };
index 0163317..0b76a1a 100644 (file)
@@ -75,12 +75,9 @@ AliHLTTPCPad::AliHLTTPCPad()
   fDataSignals(NULL),
   fSignalPositionArray(NULL),
   fSizeOfSignalPositionArray(0),
-  fNSigmaThreshold(0),
-  fSignalThreshold(0),
-  fModeSwitch(0),
   fNGoodSignalsSent(0),
-  fDebugHistoBeforeZS(NULL),
-  fDebugHistoAfterZS(NULL)
+  fNSigmaThreshold(0),
+  fSignalThreshold(0)
 {
   // see header file for class documentation
   // or
@@ -91,16 +88,16 @@ AliHLTTPCPad::AliHLTTPCPad()
   fDataSignals= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
   memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
   
-  fSignalPositionArray= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
+  fSignalPositionArray= new Int_t[AliHLTTPCTransform::GetNTimeBins()];
   memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
   fSizeOfSignalPositionArray=0;
 
 }
 
-AliHLTTPCPad::AliHLTTPCPad(Int_t mode)
+AliHLTTPCPad::AliHLTTPCPad(Int_t dummy)
   :
-  fClusterCandidates(0),
-  fUsedClusterCandidates(0),
+  fClusterCandidates(),
+  fUsedClusterCandidates(),
   fRowNo(-1),
   fPadNo(-1),
   fThreshold(0),
@@ -120,18 +117,16 @@ AliHLTTPCPad::AliHLTTPCPad(Int_t mode)
   fDataSignals(NULL),
   fSignalPositionArray(NULL),
   fSizeOfSignalPositionArray(0),
-  fNSigmaThreshold(0),
-  fSignalThreshold(0),
-  fModeSwitch(mode),
   fNGoodSignalsSent(0),
-  fDebugHistoBeforeZS(NULL),
-  fDebugHistoAfterZS(NULL)
+  fNSigmaThreshold(0),
+  fSignalThreshold(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
+  dummy=0;//to get rid of warning until things are cleaned up better
 }
 
 AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins)
@@ -157,12 +152,9 @@ AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins)
   fDataSignals(NULL),
   fSignalPositionArray(NULL),
   fSizeOfSignalPositionArray(0),
-  fNSigmaThreshold(0),
-  fSignalThreshold(0),
-  fModeSwitch(0),
   fNGoodSignalsSent(0),
-  fDebugHistoBeforeZS(NULL),
-  fDebugHistoAfterZS(NULL)
+  fNSigmaThreshold(0),
+  fSignalThreshold(0)
 {
   // see header file for class documentation
 }
@@ -178,18 +170,10 @@ AliHLTTPCPad::~AliHLTTPCPad()
     delete [] fDataSignals;
     fDataSignals=NULL;
   }
-  if (fSignalPositionArray) {
+  if (fSignalPositionArray!=NULL) {
     delete [] fSignalPositionArray;
     fSignalPositionArray=NULL;
   }
-  if(fDebugHistoBeforeZS){
-    delete fDebugHistoBeforeZS;
-    fDebugHistoBeforeZS=NULL;
-  }
-  if(fDebugHistoAfterZS){
-    delete fDebugHistoAfterZS;
-    fDebugHistoAfterZS=NULL;
-  }
 }
 
 Int_t AliHLTTPCPad::SetID(Int_t rowno, Int_t padno)
@@ -198,15 +182,6 @@ Int_t AliHLTTPCPad::SetID(Int_t rowno, Int_t padno)
   fRowNo=rowno;
   fPadNo=padno;
 
-#if DebugHisto
-  char *nameBefore;
-  sprintf(nameBefore,"beforeRow%dPad%d",fRowNo,fPadNo);
-  char *nameAfter;
-  sprintf(nameAfter,"afterRow%dPad%d",fRowNo,fPadNo);
-  fDebugHistoBeforeZS = new TH1F(nameBefore,nameBefore,1024,0,1024);
-  fDebugHistoAfterZS = new TH1F(nameAfter,nameAfter,1024,0,1024);
-#endif
-
   return 0;
 }
 
@@ -508,9 +483,9 @@ void AliHLTTPCPad::PrintRawData()
   // see header file for class documentation
   for(Int_t bin=0;bin<AliHLTTPCTransform::GetNTimeBins();bin++){
     if(GetDataSignal(bin)>0)
-      cout<<fRowNo<<"\t"<<fPadNo<<"\t"<<bin<<"\t"<<GetDataSignal(bin)<<endl;;
+      //This cout should be here since using logging produces output that is much more difficult to read
+       cout<<fRowNo<<"\t"<<fPadNo<<"\t"<<bin<<"\t"<<GetDataSignal(bin)<<endl;
   }
-  //  cout<<"bins: "<<AliHLTTPCTransform::GetNTimeBins()<<endl;
 }
 
 void AliHLTTPCPad::ClearCandidates(){
@@ -521,12 +496,13 @@ void AliHLTTPCPad::ClearCandidates(){
 void AliHLTTPCPad::SetDataToDefault()
 {
   // see header file for class documentation
-  if(fDataSignals && fSignalPositionArray){
+  //  if(fDataSignals && fSignalPositionArray){
     for(Int_t i =0;i<fSizeOfSignalPositionArray;i++){
       fDataSignals[fSignalPositionArray[i]]=-1;
     }
     fSizeOfSignalPositionArray=0;
-  }
+    fNGoodSignalsSent = 0;
+    //  }
 }
 
 void AliHLTTPCPad::SetDataSignal(Int_t bin,Int_t signal)
@@ -535,27 +511,40 @@ void AliHLTTPCPad::SetDataSignal(Int_t bin,Int_t signal)
   fDataSignals[bin]=signal;
   fSignalPositionArray[fSizeOfSignalPositionArray]=bin;
   fSizeOfSignalPositionArray++;
-#if DebugHisto 
-  fDebugHistoBeforeZS->Fill(bin,signal);
-#endif
 }
 
-Bool_t AliHLTTPCPad::GetNextGoodSignal(Int_t &time, Int_t &signal ){
-  /*  for(Int_t i=70;i<900;i++){
-    if(fDataSignals[i]>0){
-      printf("Signals which are good: Bin: %d Signal: %d\n",i,fDataSignals[i]);
-    }
-    }*/
+Bool_t AliHLTTPCPad::GetNextGoodSignal(Int_t &time, Int_t &signal){
   if(fNGoodSignalsSent<fSizeOfSignalPositionArray&&fSizeOfSignalPositionArray>0){
     time = fSignalPositionArray[fNGoodSignalsSent];
     signal = GetDataSignal(time);
-    //    printf("GoodSignal: Row: %d Pad: %d time %d  signal %d  signalsSent: %d\n",fRowNo,fPadNo,fSignalPositionArray[fNGoodSignalsSent],GetDataSignal(time), fNGoodSignalsSent);
+
     fNGoodSignalsSent++;
     return kTRUE;
   }
   return kFALSE;
 }
 
+Bool_t AliHLTTPCPad::GetNextGoodSignal(Int_t &time,Int_t &bunchSize,Int_t dummy){
+  dummy=0;//to get rid of warning until things are cleaned up better
+  if(fNGoodSignalsSent<fSizeOfSignalPositionArray&&fSizeOfSignalPositionArray>0){
+    time = fSignalPositionArray[fNGoodSignalsSent];
+    bunchSize=1;
+    fNGoodSignalsSent++;
+    while(fNGoodSignalsSent<fSizeOfSignalPositionArray){
+      if(fDataSignals[time+bunchSize+1]>0){
+       bunchSize++;
+       fNGoodSignalsSent++;
+      }
+      else{
+       break;
+      }
+    }
+    fNGoodSignalsSent++;
+   return kTRUE;
+  }
+  return kFALSE;
+}
+
 Int_t AliHLTTPCPad::GetDataSignal(Int_t bin) const
 {
   // see header file for class documentation
@@ -613,10 +602,9 @@ void AliHLTTPCPad::ZeroSuppress(Double_t nRMS, Int_t threshold, Int_t reqMinPoin
     HLTInfo("No signals added for this pad, zerosuppression aborted: pad %d row %d",fPadNo,fRowNo);
     return;
   }
-  // HLTInfo("sumNAdded=%d    nAdded=%d pad %d ",sumNAdded,nAdded,fPadNo);
+
   Double_t averageValue=(Double_t)sumNAdded/nAdded;//true average for threshold approach, average of signals squared for rms approach
  
-  //  Double_t rms=0;
   if(useRMS){
     //Calculate the RMS
     if(averageValue>0){
@@ -630,14 +618,12 @@ void AliHLTTPCPad::ZeroSuppress(Double_t nRMS, Int_t threshold, Int_t reqMinPoin
     fThresholdUsed = (Int_t)(averageValue + threshold); 
   }
 
-  averageValue = 55.3;
-  // Do zero suppression on the adc values within [beginTime,endTime]
+  // Do zero suppression on the adc values within [beginTime,endTime](add the good values)
   for(Int_t i=beginTime;i<endTime;i++){
     if(fDataSignals[i]>fThresholdUsed){
-      //  HLTInfo("Signal Larger in pad %d time %d signal %d  ,   threshold: %d  averageValue %e",fPadNo,i,fDataSignals[i],fThresholdUsed, averageValue);
       Int_t firstSignalTime=i;
       for(Int_t left=1;left<timebinsLeft;left++){//looking 5 to the left of the signal to add tail
-       if(fDataSignals[i-left]-averageValue+valueUnderAverage>0&&i-left>=beginTime){
+       if(fDataSignals[i-left]-averageValue+valueUnderAverage>0 && i-left>=beginTime){
          firstSignalTime--;
        }
        else{
@@ -645,6 +631,9 @@ void AliHLTTPCPad::ZeroSuppress(Double_t nRMS, Int_t threshold, Int_t reqMinPoin
        }
       }
       Int_t lastSignalTime=i;
+      while(fDataSignals[lastSignalTime+1]>fThresholdUsed && lastSignalTime+1<endTime){
+       lastSignalTime++;
+      }
       for(Int_t right=1;right<timebinsRight;right++){//looking 5 to the left of the signal to add tail
        if(fDataSignals[i+right]-averageValue+valueUnderAverage>0&&i+right<endTime){
          lastSignalTime++;
@@ -653,175 +642,32 @@ void AliHLTTPCPad::ZeroSuppress(Double_t nRMS, Int_t threshold, Int_t reqMinPoin
          break;
        }       
       }
+      
       for(Int_t t=firstSignalTime;t<lastSignalTime;t++){
-       //      cout<<"Row: "<<fRowNo<<" Pad: "<<fPadNo<<"   Adding to tmebin: "<<t<<" signal: "<<(AliHLTTPCSignal_t)(fDataSignals[t]-averageValue + valueUnderAverage)<<endl;
        fDataSignals[t]=(AliHLTTPCSignal_t)(fDataSignals[t]-averageValue + valueUnderAverage);
-       //      cout<<"Adding to signalPosition array bin number: "<<fSizeOfSignalPositionArray<<"    timebin number: "<<t<<endl;
        fSignalPositionArray[fSizeOfSignalPositionArray]=t;
        fSizeOfSignalPositionArray++;
-       //      cout<<"Number of signals added so far: "<<fSizeOfSignalPositionArray<<"     firstSignalTimeBin: "<<firstSignalTime<<"     lastSignalTimeBin: "<<lastSignalTime<<endl;
-       /*      if(fRowNo==29&&fPadNo==58){
-         cout<<"Signal added: Row: "<<fRowNo<<" Pad: "<<fPadNo<<"  Time: "<<t<<" signal: "<<fDataSignals[t]<<"  #signals: "<<fSizeOfSignalPositionArray<<endl;
-       }
-       */
-#if DebugHisto
-      fDebugHistoAfterZS->Fill(t,fDataSignals[t]);
-#endif
       }
       i+=lastSignalTime;
     }
+  }
+  //reset the rest of the data
+  Int_t counterSize=fSizeOfSignalPositionArray;
+
+  for(Int_t d=endTime;d>=beginTime;d--){
+    if(d==fSignalPositionArray[counterSize-1]&&counterSize-1>=0){
+      counterSize--;
+    }
     else{
-      fDataSignals[i]=-1;
+      fDataSignals[d]=-1;
     }
   }
+  if(fDataSignals[beginTime+1]<1){
+    fDataSignals[beginTime]=0;
+  }
 }
 
 void AliHLTTPCPad::AddClusterCandidate(AliHLTTPCClusters candidate){
   fClusterCandidates.push_back(candidate);
   fUsedClusterCandidates.push_back(0);
 }
-
-void AliHLTTPCPad::SaveHistograms(){
-#if DebugHisto
-  if(fSizeOfSignalPositionArray==0){
-    return;
-  }
-  char* filename;
-  sprintf(filename,"/afsuser/kenneth/SimpleComponentWrapper/histos/HistogramsRow%dPad%d.root",fRowNo,fPadNo);
-  TFile file(filename,"RECREATE");
-  fDebugHistoBeforeZS->Write();
-  fDebugHistoAfterZS->Write();
-  file.Close();
-#endif
-}
-
-void AliHLTTPCPad::FindClusterCandidates()
-{
-  // see header file for class documentation
-  /*
-  if(fSizeOfSignalPositionArray<2){
-    return;
-  }
-
-  if(fNSigmaThreshold>0){
-    ZeroSuppress(fNSigmaThreshold);
-  }
-  else if(fSignalThreshold>0){
-    ZeroSuppress((Double_t)0,(Int_t)fSignalThreshold);
-  }
-  UInt_t seqcharge=0;
-  UInt_t seqaverage=0;
-  UInt_t seqerror=0;
-  vector<Int_t> tmpPos;
-  vector<Int_t> tmpSig;
-  UInt_t isFalling=0;
-
-  for(Int_t pos=fSizeOfSignalPositionArray-2;pos>=0;pos--){
-    if(fSignalPositionArray[pos]==fSignalPositionArray[pos+1]+1){
-      seqcharge+=fDataSignals[fSignalPositionArray[pos+1]];    
-      seqaverage += fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
-      seqerror += fSignalPositionArray[pos+1]*fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
-         
-      tmpPos.push_back(fSignalPositionArray[pos+1]);
-      tmpSig.push_back(fDataSignals[fSignalPositionArray[pos+1]]);
-
-      if(fDataSignals[fSignalPositionArray[pos+1]]>fDataSignals[fSignalPositionArray[pos]]){
-       isFalling=1;
-      }
-      if(fDataSignals[fSignalPositionArray[pos+1]]<fDataSignals[fSignalPositionArray[pos]]&&isFalling){
-       Int_t seqmean=0;
-       seqmean = seqaverage/seqcharge;
-       
-       //Calculate mean in pad direction:
-       Int_t padmean = seqcharge*fPadNo;
-       Int_t paderror = fPadNo*padmean;
-       AliHLTTPCClusters candidate;
-       candidate.fTotalCharge   = seqcharge;
-       candidate.fPad       = padmean;
-       candidate.fPad2      = paderror;
-       candidate.fTime      = seqaverage;
-       candidate.fTime2     = seqerror;
-       candidate.fMean          = seqmean;
-       candidate.fLastMergedPad = fPadNo;
-       fClusterCandidates.push_back(candidate);
-       fUsedClusterCandidates.push_back(0);
-       isFalling=0;
-       seqcharge=0;
-       seqaverage=0;
-       seqerror=0;
-
-       tmpPos.clear();
-       tmpSig.clear();
-
-       continue;
-      }
-        
-      if(pos<1){
-       seqcharge+=fDataSignals[fSignalPositionArray[0]];       
-       seqaverage += fSignalPositionArray[0]*fDataSignals[fSignalPositionArray[0]];
-       seqerror += fSignalPositionArray[0]*fSignalPositionArray[0]*fDataSignals[fSignalPositionArray[0]];
-       tmpPos.push_back(fSignalPositionArray[0]);
-       tmpSig.push_back(fDataSignals[fSignalPositionArray[0]]);
-         
-       //Calculate mean of sequence:
-       Int_t seqmean=0;
-       seqmean = seqaverage/seqcharge;
-         
-       //Calculate mean in pad direction:
-       Int_t padmean = seqcharge*fPadNo;
-       Int_t paderror = fPadNo*padmean;
-       AliHLTTPCClusters candidate;
-       candidate.fTotalCharge   = seqcharge;
-       candidate.fPad       = padmean;
-       candidate.fPad2      = paderror;
-       candidate.fTime      = seqaverage;
-       candidate.fTime2     = seqerror;
-       candidate.fMean          = seqmean;
-       candidate.fLastMergedPad = fPadNo;
-       fClusterCandidates.push_back(candidate);
-       fUsedClusterCandidates.push_back(0);
-       isFalling=0;
-       seqcharge=0;
-       seqaverage=0;
-       seqerror=0;
-
-       tmpPos.clear();
-       tmpSig.clear();
-      }
-    }
-    else if(seqcharge>0){
-      seqcharge+=fDataSignals[fSignalPositionArray[pos+1]];    
-      seqaverage += fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
-      seqerror += fSignalPositionArray[pos+1]*fSignalPositionArray[pos+1]*fDataSignals[fSignalPositionArray[pos+1]];
-      tmpPos.push_back(fSignalPositionArray[pos+1]);
-      tmpSig.push_back(fDataSignals[fSignalPositionArray[pos+1]]);
-
-      //Calculate mean of sequence:
-      Int_t seqmean=0;
-      seqmean = seqaverage/seqcharge;
-       
-      //Calculate mean in pad direction:
-      Int_t padmean = seqcharge*fPadNo;
-      Int_t paderror = fPadNo*padmean;
-      AliHLTTPCClusters candidate;
-      candidate.fTotalCharge   = seqcharge;
-      candidate.fPad       = padmean;
-      candidate.fPad2      = paderror;
-      candidate.fTime      = seqaverage;
-      candidate.fTime2     = seqerror;
-      candidate.fMean          = seqmean;
-      candidate.fLastMergedPad = fPadNo;
-      fClusterCandidates.push_back(candidate);
-      fUsedClusterCandidates.push_back(0);
-      isFalling=0;
-      seqcharge=0;
-      seqaverage=0;
-      seqerror=0;
-
-      tmpPos.clear();
-      tmpSig.clear();
-    }
-  }
-  */
-}
-
index 07e774c..9faa35e 100644 (file)
@@ -26,7 +26,6 @@
 
 typedef Int_t AliHLTTPCSignal_t;
 
-#define DebugHisto 0
 
 /**
  * @class AliHLTTPCPad
@@ -47,9 +46,9 @@ public:
 
   /** 
    * Constructor
-   * @param mode  mode determines if one need the raw data(not quite true at the moment but will be)
+   * @param dummy  dummy determines if one need the raw data. If a dummy number is given, the pad object will be initialized without using memory for raw data
    */
-  AliHLTTPCPad(Int_t mode);
+  AliHLTTPCPad(Int_t dummy);
 
   /** 
    * Constructor
@@ -66,10 +65,10 @@ public:
   struct AliClusterData
   {
     UInt_t fTotalCharge;   //tot charge of cluster
-    UInt_t fPad;       //pad value
-    UInt_t fTime;      //time value
-    ULong64_t fPad2;   //for error in XY direction
-    ULong64_t fTime2;  //for error in Z  direction
+    UInt_t fPad;           //pad value
+    UInt_t fTime;          //time value
+    ULong64_t fPad2;       //for error in XY direction
+    ULong64_t fTime2;      //for error in Z  direction
     UInt_t fMean;          //mean in time
     UInt_t fFlags;         //different flags
     UInt_t fChargeFalling; //for deconvolution
@@ -90,11 +89,13 @@ public:
 
   /**
    * Get the row number.
+   * @return Row number
    */
   Int_t GetRowNumber() const {return fRowNo;}
 
   /**
-   * Get the pad number.
+   * Get the pad number on the row.
+   * @return Pad number on row
    */
   Int_t GetPadNumber() const {return fPadNo;}
 
@@ -257,20 +258,28 @@ public:
    */
   Int_t GetSize() const {return fNofBins;}
   
+  /*
+   * Clears the vector of cluster candidates.
+   */
   void ClearCandidates();
 
   /**
    * Set the data array to -1
    */
   void SetDataToDefault();
+
   /**
    * Stores the signal in the data array, stores the timebin number of the signal,
    * and increments a counter.
+   * @param bin       Timebin nuber of signal
+   * @param signal    Size of signal 
    */
   void SetDataSignal(Int_t bin,Int_t signal);
 
   /**
    * Returns the signal in the specified bin
+   * @param bin       Timebin number
+   * @return          Signal in the given timebin
    */
   Int_t GetDataSignal(Int_t bin) const;
 
@@ -285,24 +294,45 @@ public:
    * The method is checked with 2006 cosmics data, and it looks good.
    * If you want to use the threshold approach you HAVE to set nSigma=-1 and threshold>0. For example: If you want all signals 
    * 30 adc counts above threshold you should call the function like this: ZeroSuppress(-1,30)
-   * @param nRMS            Specify nRMS threshold
-   * @param threshold       Specify what adc threshold above average (remember to give nRMS=-1 if you want to use this approach)
-   * @param reqMinPoint     Required minimum number of points to do zerosuppression default AliHLTTPCTransform::GetNTimeBins/2 (1024/2).
-   * @param beginTime       Lowest timebin value. Gating grid causes some problems in the first timebins.
-   * @param endTime         Highest timebin value.
+   * @param nRMS               Specify nRMS threshold
+   * @param threshold          Specify what adc threshold above average (remember to give nRMS=-1 if you want to use this approach)
+   * @param reqMinPoint        Required minimum number of points to do zerosuppression default AliHLTTPCTransform::GetNTimeBins/2 (1024/2).
+   * @param beginTime          Lowest timebin value. Gating grid causes some problems in the first timebins.
+   * @param endTime            Highest timebin value.
+   * @param timebinsLeft       Timebins to include left of the signals above threshold (to include tails)
+   * @param timebinsRight      Timebins to include right of the signals above threshold (to include tails)
+   * @param valueBelowAverage  The number of adc-counts below the average value. (sometimes there can be useful to also add some signals below average for your signals, especially when there is a lot of noise) It means that more of the tails of the signal is added.
    */
   void ZeroSuppress(Double_t nRMS,Int_t threshold,Int_t reqMinPoint,Int_t beginTime,Int_t endTime,Int_t timebinsLeft, Int_t timebinsRight, Int_t valueBelowAverage);
   
-
+  /**
+   * Returns the next signal which survived the ZeroSuppression 
+   * @param time            Refernence to timebin number
+   * @param signal          Refernence to signal
+   * @return                True if there are more signals
+  */
   Bool_t GetNextGoodSignal(Int_t &time,Int_t &signal);
 
+  /**
+   * Bool method which returns the timein number of the first signal and number of consecutive signals, used together with GetPointer(bin) to access data 
+   * @param time            Refernence to timebin number
+   * @param bunchSize       Refernence to number of consecutive signals
+   * @return                True if there are more signals
+  */
+  Bool_t GetNextGoodSignal(Int_t &time,Int_t &bunchSize,Int_t dummy);
+
+  /**
+   * Returns number of signals added
+   * @return                Number of signals
+   */
   UInt_t GetNAddedSignals(){return fSizeOfSignalPositionArray;}
 
   /**
-   * Finds the cluster candidate. If atleast two signals in the data array are neighbours
-   * they are stored in a cluster candidate vector.
+   * Returns the pointer to the first data signal
+   * @param bin             Timebin number
+   * @return                pointer to data signal in bin
    */
-  void FindClusterCandidates();
+  UInt_t* GetPointer(Int_t bin){return (UInt_t*)&fDataSignals[bin];  }
 
   /**
    * Adds cluster candidate to the fClusterCandidates.
@@ -324,8 +354,6 @@ public:
    */
   void SetNSigmaThreshold(Double_t i){fNSigmaThreshold=i;}
 
-  void SaveHistograms();
-
   /**
    * Vector of cluster candidates
    */
@@ -395,17 +423,19 @@ public:
    * Array containing info on which bins have signals
    */
   Int_t *fSignalPositionArray;                                     //! transient
+
+  /** Size of signals in fSignalPositionArray */
   Int_t fSizeOfSignalPositionArray;                                //! transient
 
+  /** Number of good signals sent (good signals is signals surviving ZeroSuppression) */
   Int_t fNGoodSignalsSent;
   
+  /** Number of sigma threshold for the ZeroSuppression */
   Double_t fNSigmaThreshold;                                       //! transient
+
+  /** Signal threshold for the ZeroSuppression */
   Double_t fSignalThreshold;                                       //! transient
 
-  TH1F *fDebugHistoBeforeZS;                                       //! transient
-  TH1F *fDebugHistoAfterZS;                                        //! transient
-  
-  Int_t fModeSwitch;                                               //! transient
-  ClassDef(AliHLTTPCPad, 4)
+  ClassDef(AliHLTTPCPad, 5)
 };
 #endif // ALIHLTTPCPAD_H
diff --git a/HLT/TPCLib/AliHLTTPCPadArray.cxx b/HLT/TPCLib/AliHLTTPCPadArray.cxx
deleted file mode 100644 (file)
index 62bf8a8..0000000
+++ /dev/null
@@ -1,680 +0,0 @@
-// @(#) $Id$
-
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- *                                                                        *
- * Authors: Kenneth Aamodt <Kenneth.Aamodt@student.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   AliHLTTPCPadArray.cxx
-    @author Kenneth Aamodt
-    @date   
-    @brief  Class containing TPC Pad objects.
-*/
-
-// 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 <cerrno>
-#include "AliHLTTPCPadArray.h"
-#include "AliHLTTPCPad.h"
-#include "AliHLTStdIncludes.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCDigitReader.h"
-#include "AliHLTTPCClusters.h"
-#include <vector>
-#include <sys/time.h>
-
-/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTTPCPadArray)
-
-AliHLTTPCPadArray::AliHLTTPCPadArray()
-  :
-  fRowPadVector(),
-  fClusters(),
-  fPatch(-1),
-  fFirstRow(-1),
-  fLastRow(-1),
-  fThreshold(10),
-  fNumberOfPadsInRow(NULL),
-  fNumberOfRows(0),
-  fDigitReader(NULL),
-  fSignalThreshold(0),
-  fNSigmaThreshold(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
-}
-
-AliHLTTPCPadArray::AliHLTTPCPadArray(Int_t patch)
-  :
-  fRowPadVector(),
-  fClusters(),
-  fPatch(patch),
-  fFirstRow(-1),
-  fLastRow(-1),
-  fThreshold(10),
-  fNumberOfPadsInRow(NULL),
-  fNumberOfRows(0),
-  fDigitReader(NULL),
-  fSignalThreshold(0),
-  fNSigmaThreshold(0)
-{
-  // see header file for class documentation
-}
-
-AliHLTTPCPadArray::~AliHLTTPCPadArray()
-{
-  // see header file for class documentation
-}
-
-Int_t AliHLTTPCPadArray::InitializeVector(Int_t mode)
-{
-  // see header file for class documentation
-
-  if(fPatch>5||fPatch<0){
-    HLTFatal("Patch is not set");
-    return 0;
-  }
-
-  fFirstRow = AliHLTTPCTransform::GetFirstRow(fPatch);
-  fLastRow = AliHLTTPCTransform::GetLastRow(fPatch);
-
-  fNumberOfRows=fLastRow-fFirstRow+1;
-  fNumberOfPadsInRow= new Int_t[fNumberOfRows];
-
-  memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows));
-
-  for(Int_t i=0;i<fNumberOfRows;i++){
-    fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow);
-    AliHLTTPCPadVector tmpRow;
-    for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
-      AliHLTTPCPad *tmpPad = new AliHLTTPCPad();
-      tmpPad->SetID(i,j);
-      tmpRow.push_back(tmpPad);
-    }
-    fRowPadVector.push_back(tmpRow);
-  }
-  return 0;
-}
-
-Int_t AliHLTTPCPadArray::DeInitializeVector()
-{
-  // see header file for class documentation
-  for(Int_t i=0;i<fNumberOfRows;i++){
-    for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
-      delete fRowPadVector[i][j];
-    }
-    fRowPadVector[i].clear();
-  }
-  fRowPadVector.clear();
-  return 1;
-} 
-
-void AliHLTTPCPadArray::SetPatch(Int_t patch)
-{
-  // see header file for class documentation
-  fPatch=patch;
-}
-
-void AliHLTTPCPadArray::SetDigitReader(AliHLTTPCDigitReader* digitReader)
-{
-  // see header file for class documentation
-  fDigitReader=digitReader;
-}
-
-Int_t AliHLTTPCPadArray::ReadData(Int_t mode)
-{
-  // see header file for class documentation
-
-  switch (fPatch){
-  case 0:
-    if(mode!=2){
-      while(fDigitReader->Next()){
-       UInt_t row  = fDigitReader->GetRow();
-       UInt_t pad  = fDigitReader->GetPad();
-       UInt_t time = fDigitReader->GetTime();
-       if(row<fNumberOfRows){
-         if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-           fRowPadVector[row][pad]->SetDataSignal(time,fDigitReader->GetSignal());
-         }
-       }
-      }
-    }
-    else{
-       while(fDigitReader->NextChannel()){
-         while(fDigitReader->NextBunch()){
-           const UInt_t *bunchData= fDigitReader->GetSignals();
-           UInt_t row=fDigitReader->GetRow();
-           UInt_t pad=fDigitReader->GetPad();
-           UInt_t time=fDigitReader->GetTime();
-           AliHLTTPCClusters candidate;
-           for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-             candidate.fTotalCharge+=bunchData[i];     
-             candidate.fTime += time*bunchData[i];
-             candidate.fTime2 += time*time*bunchData[i];
-             time++;
-           }
-           if(candidate.fTotalCharge>0){
-             candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-             candidate.fPad=candidate.fTotalCharge*pad;
-             candidate.fPad2=candidate.fPad*pad;
-             candidate.fLastMergedPad=pad;
-             fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-           }
-         }
-       }
-
-    }
-    break;
-  case 1:
-    if(mode!=2){
-      while(fDigitReader->Next()){
-       UInt_t row  = fDigitReader->GetRow()-fFirstRow;
-       UInt_t pad  = fDigitReader->GetPad();
-       UInt_t time = fDigitReader->GetTime();
-       if(row<fNumberOfRows){
-         if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-           fRowPadVector[row][pad]->SetDataSignal(time,fDigitReader->GetSignal()); 
-         }
-       }     
-      }
-    }
-    else{
-       while(fDigitReader->NextChannel()){
-         while(fDigitReader->NextBunch()){
-           const UInt_t *bunchData= fDigitReader->GetSignals();
-           UInt_t row=fDigitReader->GetRow();
-           UInt_t pad=fDigitReader->GetPad();
-           UInt_t time=fDigitReader->GetTime();
-           AliHLTTPCClusters candidate;
-           for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-             candidate.fTotalCharge+=bunchData[i];     
-             candidate.fTime += time*bunchData[i];
-             candidate.fTime2 += time*time*bunchData[i];
-             time++;
-           }
-           if(candidate.fTotalCharge>0){
-             candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-             candidate.fPad=candidate.fTotalCharge*pad;
-             candidate.fPad2=candidate.fPad*pad;
-             candidate.fLastMergedPad=pad;
-             fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-           }
-         }
-       }
-
-    }
-
-    break;
-  case 2:
-    if(mode!=2){
-      while(fDigitReader->Next()){
-       UInt_t row=fDigitReader->GetRow();
-       UInt_t pad=fDigitReader->GetPad();
-       UInt_t time= fDigitReader->GetTime();
-       if(row<fNumberOfRows){
-         if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-           fRowPadVector[fDigitReader->GetRow()][fDigitReader->GetPad()]->SetDataSignal(fDigitReader->GetTime(),fDigitReader->GetSignal());
-         }
-       }
-      }
-    }
-    else{
-      while(fDigitReader->NextChannel()){
-       while(fDigitReader->NextBunch()){
-         const UInt_t *bunchData= fDigitReader->GetSignals();
-         UInt_t row=fDigitReader->GetRow();
-         UInt_t pad=fDigitReader->GetPad();
-         UInt_t time=fDigitReader->GetTime();
-         AliHLTTPCClusters candidate;
-         for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-           candidate.fTotalCharge+=bunchData[i];       
-           candidate.fTime += time*bunchData[i];
-           candidate.fTime2 += time*time*bunchData[i];
-           time++;
-         }
-         if(candidate.fTotalCharge>0){
-           candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-           candidate.fPad=candidate.fTotalCharge*pad;
-           candidate.fPad2=candidate.fPad*pad;
-           candidate.fLastMergedPad=pad;
-           fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-         }
-       }
-      }  
-    }
-    break;
-  case 3:
-    if(mode!=2){
-      while(fDigitReader->Next()){
-       UInt_t row=fDigitReader->GetRow()-27;
-       UInt_t pad=fDigitReader->GetPad();
-       UInt_t time= fDigitReader->GetTime();
-       if(row<fNumberOfRows){
-         if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-           fRowPadVector[row][pad]->SetDataSignal(time,fDigitReader->GetSignal());
-         }
-       }
-      }
-    }
-    else{
-      while(fDigitReader->NextChannel()){
-       while(fDigitReader->NextBunch()){
-         const UInt_t *bunchData= fDigitReader->GetSignals();
-         UInt_t row=fDigitReader->GetRow();
-         UInt_t pad=fDigitReader->GetPad();
-         UInt_t time=fDigitReader->GetTime();
-         AliHLTTPCClusters candidate;
-         for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-           candidate.fTotalCharge+=bunchData[i];       
-           candidate.fTime += time*bunchData[i];
-           candidate.fTime2 += time*time*bunchData[i];
-           time++;
-         }
-         if(candidate.fTotalCharge>0){
-           candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-           candidate.fPad=candidate.fTotalCharge*pad;
-           candidate.fPad2=candidate.fPad*pad;
-           candidate.fLastMergedPad=pad;
-           fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-         }
-       }
-      } 
-    }
-    break;
-  case 4:
-    if(mode!=2){
-    while(fDigitReader->Next()){
-      UInt_t row=fDigitReader->GetRow()-54;
-      UInt_t pad=fDigitReader->GetPad();
-      UInt_t time= fDigitReader->GetTime();
-      if(row<fNumberOfRows){
-       if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-         fRowPadVector[row][pad]->SetDataSignal(time,fDigitReader->GetSignal());
-       }
-      }
-    }
-    }
-    else{
-       while(fDigitReader->NextChannel()){
-         while(fDigitReader->NextBunch()){
-           const UInt_t *bunchData= fDigitReader->GetSignals();
-           UInt_t row=fDigitReader->GetRow();
-           UInt_t pad=fDigitReader->GetPad();
-           UInt_t time=fDigitReader->GetTime();
-           AliHLTTPCClusters candidate;
-           for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-             candidate.fTotalCharge+=bunchData[i];     
-             candidate.fTime += time*bunchData[i];
-             candidate.fTime2 += time*time*bunchData[i];
-             time++;
-           }
-           if(candidate.fTotalCharge>0){
-             candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-             candidate.fPad=candidate.fTotalCharge*pad;
-             candidate.fPad2=candidate.fPad*pad;
-             candidate.fLastMergedPad=pad;
-             fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-           }
-         }
-       }
-
-    }
-
-    break;
-  case 5:
-    if(mode!=2){
-      while(fDigitReader->Next()){
-       UInt_t row=fDigitReader->GetRow()-76;
-       UInt_t pad=fDigitReader->GetPad();
-       UInt_t time= fDigitReader->GetTime();
-       if(row<fNumberOfRows){
-         if(pad<fNumberOfPadsInRow[row]&&time<AliHLTTPCTransform::GetNTimeBins()){
-           fRowPadVector[row][pad]->SetDataSignal(time,fDigitReader->GetSignal());
-         }
-       }
-      }
-    }
-    else{
-      while(fDigitReader->NextChannel()){
-       while(fDigitReader->NextBunch()){
-         const UInt_t *bunchData= fDigitReader->GetSignals();
-         UInt_t row=fDigitReader->GetRow();
-         UInt_t pad=fDigitReader->GetPad();
-         UInt_t time=fDigitReader->GetTime();
-           AliHLTTPCClusters candidate;
-           for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
-             candidate.fTotalCharge+=bunchData[i];     
-             candidate.fTime += time*bunchData[i];
-             candidate.fTime2 += time*time*bunchData[i];
-             time++;
-           }
-           if(candidate.fTotalCharge>0){
-             candidate.fMean=candidate.fTime/candidate.fTotalCharge;
-             candidate.fPad=candidate.fTotalCharge*pad;
-             candidate.fPad2=candidate.fPad*pad;
-             candidate.fLastMergedPad=pad;
-             fRowPadVector[row][pad]->AddClusterCandidate(candidate);
-           }
-         }
-       }
-
-    }
-
-    break;
-  }
-  return 0;
-}
-
-void AliHLTTPCPadArray::FindClusters(Int_t match)
-{
-  //see header file for documentation
-  Int_t nClusters=0;
-  Int_t totalChargeOfPreviousCandidate=0;
-  Int_t clusterChargeIsFalling=0;
-  for(Int_t row=0;row<fNumberOfRows;row++){
-    for(Int_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
-      AliHLTTPCPad *tmp1=fRowPadVector[row][pad];
-      AliHLTTPCPad *tmp2=fRowPadVector[row][pad+1];
-      for(size_t c1=0;c1<tmp1->fClusterCandidates.size();c1++){
-
-       if(tmp1->fUsedClusterCandidates[c1]){
-         continue;
-       }
-
-       for(size_t c2=0;c2<tmp2->fClusterCandidates.size();c2++){
-
-         if(tmp2->fUsedClusterCandidates[c2]){
-           continue;
-         }
-
-         Int_t diff= tmp1->fClusterCandidates[c1].fMean - tmp2->fClusterCandidates[c2].fMean;
-
-         if(diff < -match){
-           break;
-         }
-         if(diff <= match){
-
-           if((Int_t)(tmp1->fClusterCandidates[c1].fTotalCharge - tmp2->fClusterCandidates[c2].fTotalCharge)>0){
-             clusterChargeIsFalling=1;
-           }
-
-           tmp1->fUsedClusterCandidates[c1]=1;
-           tmp2->fUsedClusterCandidates[c2]=1;
-
-           AliHLTTPCClusters tmpCluster;
-           tmpCluster.fTotalCharge = tmp1->fClusterCandidates[c1].fTotalCharge;
-           tmpCluster.fPad     = tmp1->fClusterCandidates[c1].fPad;
-           tmpCluster.fPad2    = tmp1->fClusterCandidates[c1].fPad2;
-           tmpCluster.fTime    = tmp1->fClusterCandidates[c1].fTime;
-           tmpCluster.fTime2   = tmp1->fClusterCandidates[c1].fTime2;
-           tmpCluster.fRowNumber = row;
-
-           tmpCluster.fTotalCharge += tmp2->fClusterCandidates[c2].fTotalCharge;
-           tmpCluster.fPad     += tmp2->fClusterCandidates[c2].fPad;
-           tmpCluster.fPad2    += tmp2->fClusterCandidates[c2].fPad2;
-           tmpCluster.fTime    += tmp2->fClusterCandidates[c2].fTime;
-           tmpCluster.fTime2   += tmp2->fClusterCandidates[c2].fTime2;
-           tmpCluster.fMean         = tmp2->fClusterCandidates[c2].fMean;
-           totalChargeOfPreviousCandidate = tmp2->fClusterCandidates[c2].fTotalCharge;
-
-           //int rowNumber=row;
-           int lastPad=pad+1;
-           nClusters++;
-           Int_t doBreak=0;
-           for(Int_t morePads=pad+2;morePads<fNumberOfPadsInRow[row];morePads++){
-             AliHLTTPCPad *tmpx=fRowPadVector[row][morePads];
-             if(morePads>lastPad+1){
-               break;
-             }
-             for(size_t cx=0;cx<tmpx->fClusterCandidates.size();cx++){
-               if(tmpx->fUsedClusterCandidates[cx]){
-                 continue;
-               }
-               Int_t diffx=tmpCluster.fMean - tmpx->fClusterCandidates[cx].fMean;
-               if(diffx<-match){
-                 doBreak=1;
-                 break;
-               }
-               if(diffx <= match){
-                 if((Int_t)(totalChargeOfPreviousCandidate - tmpx->fClusterCandidates[cx].fTotalCharge)>0){
-                   clusterChargeIsFalling=1;
-                 }
-
-                 if(clusterChargeIsFalling&&(Int_t)(totalChargeOfPreviousCandidate - tmpx->fClusterCandidates[cx].fTotalCharge)<=0){
-                   //Means we have a deconvoluted cluster.
-                   totalChargeOfPreviousCandidate=0;
-                   doBreak=1;
-                   break;
-                 }
-                 
-                 tmpx->fUsedClusterCandidates[cx]=1;
-                 tmpCluster.fTotalCharge += tmpx->fClusterCandidates[cx].fTotalCharge;
-                 tmpCluster.fPad     += tmpx->fClusterCandidates[cx].fPad;
-                 tmpCluster.fPad2    += tmpx->fClusterCandidates[cx].fPad2;
-                 tmpCluster.fTime    += tmpx->fClusterCandidates[cx].fTime;
-                 tmpCluster.fTime2   += tmpx->fClusterCandidates[cx].fTime2;
-                 tmpCluster.fMean         = tmpx->fClusterCandidates[cx].fMean;
-                 lastPad=morePads;
-
-                 totalChargeOfPreviousCandidate=tmpx->fClusterCandidates[cx].fTotalCharge;
-               }
-             }
-             if(doBreak){
-               break;
-             }
-           }
-           
-           if(tmpCluster.fTotalCharge< UInt_t(fThreshold)){
-             nClusters--;
-           }
-           else{
-             //Code to look for tails, TODO insert flag.
-             /* UInt_t meanTime=tmpCluster.fMean;
-             if(pad>0){
-               AliHLTTPCPad *tmpBefore=fRowPadVector[row][pad-1];
-               //checking the fMean -1 timebin for single timebin value in the pad before the cluster
-               if(meanTime>0){
-                 Int_t charge =tmpBefore->GetDataSignal(meanTime-1); 
-                 if(charge){
-                   tmpCluster.fTotalCharge+= charge;
-                   tmpCluster.fPad        += charge*(pad-1);
-                   tmpCluster.fPad2       += charge*(pad-1)*(pad-1); 
-                   tmpCluster.fTime       += meanTime*charge;
-                   tmpCluster.fTime2      += meanTime*charge*charge;
-                 } 
-               }
-               //checking the fMean timebin for single timebin value in the pad before the cluster
-               Int_t charge2 =tmpBefore->GetDataSignal(meanTime); 
-               if(charge2){
-                 tmpCluster.fTotalCharge+= charge2;
-                 tmpCluster.fPad        += charge2*(pad);
-                 tmpCluster.fPad2       += charge2*(pad)*(pad); 
-                 tmpCluster.fTime       += meanTime*charge2;
-                 tmpCluster.fTime2      += meanTime*charge2*charge2;
-               } 
-               //checking the fMean +1 timebin for single timebin value in the pad before the cluster
-               if(meanTime<AliHLTTPCTransform::GetNTimeBins()){
-                 Int_t charge3 =tmpBefore->GetDataSignal(meanTime+1); 
-                 if(charge3){
-                   tmpCluster.fTotalCharge+= charge3;
-                   tmpCluster.fPad        += charge3*(pad+1);
-                   tmpCluster.fPad2       += charge3*(pad+1)*(pad+1); 
-                   tmpCluster.fTime       += meanTime*charge3;
-                   tmpCluster.fTime2      += meanTime*charge3*charge3;
-                 } 
-               }
-             }
-             
-             if(lastPad<fNumberOfPadsInRow[row]-2){
-               AliHLTTPCPad *tmpAfter=fRowPadVector[row][lastPad+1];
-               //checking the fMean +1 timebin for single timebin value in the pad after the cluster
-               if(meanTime>0){
-                 Int_t charge4 =tmpAfter->GetDataSignal(meanTime-1); 
-                 if(charge4){
-                   tmpCluster.fTotalCharge+= charge4;
-                   tmpCluster.fPad        += charge4*(pad-1);
-                   tmpCluster.fPad2       += charge4*(pad-1)*(pad-1); 
-                   tmpCluster.fTime       += meanTime*charge4;
-                   tmpCluster.fTime2      += meanTime*charge4*charge4;
-                 } 
-               }
-
-             
-               //checking the fMean +1 timebin for single timebin value in the pad after the cluster
-               Int_t charge5 =tmpAfter->GetDataSignal(meanTime); 
-               if(charge5){
-                 tmpCluster.fTotalCharge+= charge5;
-                 tmpCluster.fPad        += charge5*(pad);
-                 tmpCluster.fPad2       += charge5*(pad)*(pad); 
-                 tmpCluster.fTime       += meanTime*charge5;
-                 tmpCluster.fTime2      += meanTime*charge5*charge5;
-               } 
-               //checking the fMean +1 timebin for single timebin value in the pad after the cluster
-               if(meanTime<AliHLTTPCTransform::GetNTimeBins()){
-                 Int_t charge6 =tmpAfter->GetDataSignal(meanTime+1); 
-                 if(charge6){
-                   tmpCluster.fTotalCharge+= charge6;
-                   tmpCluster.fPad        += charge6*(pad+1);
-                   tmpCluster.fPad2       += charge6*(pad+1)*(pad+1); 
-                   tmpCluster.fTime       += meanTime*charge6;
-                   tmpCluster.fTime2      += meanTime*charge6*charge6;
-                 } 
-               }
-             }
-             */
-             //              tmpCluster.fTime= tmpCluster.fTime/tmpCluster.fTotalCharge;
-             totalChargeOfPreviousCandidate=0;
-             clusterChargeIsFalling=0;
-             tmpCluster.fFirstPad=pad;
-             switch (fPatch){
-             case 0:
-               tmpCluster.fRowNumber=row;
-               break;
-             case 1:
-               tmpCluster.fRowNumber=row+30;
-               break;
-             case 2:
-               tmpCluster.fRowNumber=row+63;
-               break;
-             case 3:
-               tmpCluster.fRowNumber=row+90;
-               break;
-             case 4:
-               tmpCluster.fRowNumber=row+117;
-               break;
-             case 5:
-               tmpCluster.fRowNumber=row+139;
-               break;
-             }
-
-             fClusters.push_back(tmpCluster);
-           }
-         }
-       }
-      }
-    }
-  }
-
-  HLTInfo("Found %d clusters.",nClusters);
-  // PrintClusters();
-}
-
-void AliHLTTPCPadArray::PrintClusters()
-{
-  // see header file for class documentation
-  for(size_t i=0;i<fClusters.size();i++){
-    cout<<"Cluster number: "<<i<<endl;
-    cout<<"Row: "<<fClusters[i].fRowNumber<<" Pad: "<<fClusters[i].fFirstPad<<endl;
-    cout<<"Total Charge: "<<fClusters[i].fTotalCharge<<endl;
-    cout<<"PadError:     "<<fClusters[i].fPad2<<endl;
-    cout<<"TimeMean:     "<<fClusters[i].fTime<<endl;
-    cout<<"TimeError:    "<<fClusters[i].fTime2<<endl;
-    cout<<endl;
-    cout<<endl;
-  }
-}
-
-void AliHLTTPCPadArray::DataToDefault()
-{
-  //see header file for documentation
-  for(Int_t i=0;i<fNumberOfRows;i++){
-    for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){
-       fRowPadVector[i][j]->SetDataToDefault();
-    }
-  }
-  fClusters.clear();
-}
-
-void AliHLTTPCPadArray::FindClusterCandidates()
-{
-  //see header file for documentation
-  if(fNSigmaThreshold>0){
-    for(Int_t row=0;row<fNumberOfRows;row++){
-      for(Int_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
-       fRowPadVector[row][pad]->SetNSigmaThreshold(fNSigmaThreshold);
-       fRowPadVector[row][pad]->FindClusterCandidates();
-      }
-    }
-  }
-  else if(fSignalThreshold>0){
-    for(Int_t row=0;row<fNumberOfRows;row++){
-      for(Int_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
-       fRowPadVector[row][pad]->SetSignalThreshold(fSignalThreshold);
-       fRowPadVector[row][pad]->FindClusterCandidates();
-      }
-    }
-  }
-  else{
-    for(Int_t row=0;row<fNumberOfRows;row++){
-      for(Int_t pad=0;pad<fNumberOfPadsInRow[row];pad++){
-       fRowPadVector[row][pad]->FindClusterCandidates();
-      }
-    }
-  }
-}
-Int_t AliHLTTPCPadArray::GetActivePads(AliHLTTPCActivePads * activePads,Int_t maxActivePads){
-  //see header file for documentation
-
-  Int_t counter=0;
-  for(Int_t row=0;row<fNumberOfRows;row++){
-    for(Int_t pad=0;pad<fNumberOfPadsInRow[row]-1;pad++){
-      if(fRowPadVector[row][pad]->fClusterCandidates.size()>0){
-       Int_t rowOffset=AliHLTTPCTransform::GetFirstRow(fPatch);
-       if (fPatch>=2) rowOffset-=AliHLTTPCTransform::GetFirstRow(2);
-       AliHLTTPCActivePads tmpAP;
-       tmpAP.fRow=row+rowOffset;
-       tmpAP.fPad=pad;
-       activePads[counter]= tmpAP;
-       counter++;
-       if(counter>=maxActivePads){
-         return counter;
-       }
-      }
-       
-    }
-  }  
-  return counter;
-}
diff --git a/HLT/TPCLib/AliHLTTPCPadArray.h b/HLT/TPCLib/AliHLTTPCPadArray.h
deleted file mode 100644 (file)
index 7743ce8..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-// -*- Mode: C++ -*-
-// @(#) $Id$
-
-#ifndef ALIHLTTPCPADARRAY_H
-#define ALIHLTTPCPADARRAY_H
-/* This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- * See cxx source for full Copyright notice                               */
-
-/** @file   AliHLTTPCPadArray.h
-    @author Kenneth Aamodt
-    @date   
-    @brief  Class containing arrays of TPC Pads.
-*/
-
-// see below for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
-#include "AliHLTLogging.h"
-#include "AliHLTTPCTransform.h"
-#include "AliHLTTPCClusters.h"
-#include <vector>
-
-typedef Int_t AliHLTTPCSignal_t;
-class AliHLTTPCDigitReader;
-class AliHLTTPCPad;
-
-/**
- * @class AliHLTTPCPadArray
- * TODO
- */
-
-class AliHLTTPCPadArray : public AliHLTLogging {
-
-public:
-
-  /**
-   * Data exchange structure to propagate the information about
-   * active pads from the component carrying out the selection.
-   * Currently it's the AliHLTTPCClusterFinderComponent, but the code
-   * is encapsulated into AliHLTTPCPad/AliHLTTPCPadArray.
-   *
-   * Data type: @ref AliHLTTPCDefinitions::fgkActivePadsDataType
-   * {ACTIVPAD,TPC }
-   */
-  struct AliHLTTPCActivePads
-  {
-    UInt_t fRow;           //row value
-    UInt_t fPad;           //pad value
-  };
-  typedef struct AliHLTTPCActivePads AliHLTTPCActivePads; //!
-
-
-  /** standard constructor */
-  AliHLTTPCPadArray();
-
-  /** 
-   * Constructor
-   * @param patch   Patch number, either use this constructor or 
-   * use the default constructor and the SetPatch method
-   *
-   */
-  AliHLTTPCPadArray(Int_t patch);
-
-  /** standard destructor */
-  virtual ~AliHLTTPCPadArray();
-
-  /**
-   * Initialize the pad vector for the patch set.
-   *@param mode Switch to keep raw data or not
-   */
-  Int_t InitializeVector(Int_t mode);
-
-  /**
-   * Deinitialize the pad vector for the patch set.
-   */
-  Int_t DeInitializeVector();
-  
-  /**
-   * Loop over all pads setting their data array to -1.
-   */
-  void DataToDefault();
-  
-  /**
-   * Set the patch number.
-   */
-  void SetPatch(Int_t patch);
-
-  /**
-   * Get the patch number.
-   */
-  Int_t GetPatch(){return fPatch;}
-
-  /**
-   * Set the digit reader.
-   */
-  void SetDigitReader(AliHLTTPCDigitReader* digitReader);
-
-  /**
-   * Reads the data, and set it in the Pad objects.
-   */
-  Int_t ReadData(Int_t mode);
-
-  /**
-   * Retuns number of pads in this row.
-   */
-  Int_t GetNumberOfPads(Int_t row) const {return fNumberOfPadsInRow[row];}
-
-  /**
-   * Loop over all pads, checking for clustercandidates.
-   */
-  void FindClusterCandidates();
-  
-  /**
-   *
-   * Loop over all pads looking for clusters, if cluster candidates on two neighbouring
-   * pads have a mean time difference of <match it is said to be a cluster.
-   *
-   */
-  void FindClusters(Int_t match);
-
-  /**
-   * Print the values of the cluster, used for debugging purposes.
-   */
-  void PrintClusters();
-
-  /**
-   * Set the Signal Threshold
-   */
-  void SetSignalThreshold(Int_t i){fSignalThreshold=i;}
-
-  /**
-   * Set the nSigma threshold
-   */
-  void SetNSigmaThreshold(Double_t i){fNSigmaThreshold=i;}
-
-
-  /**
-   * Loop over all pads adding pads with signal to active pads
-   * Returns number of active pads
-   *
-   */
-  Int_t GetActivePads(AliHLTTPCActivePads* activePads, Int_t maxActivePads);
-
-  typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
-
-  vector<AliHLTTPCPadVector> fRowPadVector;                        //! transient
-
-  vector<AliHLTTPCClusters> fClusters;                             //! transient
-
-private:
-  /** copy constructor prohibited */
-  AliHLTTPCPadArray(const AliHLTTPCPadArray&);
-  /** assignment operator prohibited */
-  AliHLTTPCPadArray& operator=(const AliHLTTPCPadArray&);
-
-  /** The patch number */
-  Int_t fPatch;                                                    //! transient
-
-  Int_t fFirstRow;                                                 //! transient
-
-  Int_t fLastRow;                                                  //! transient
-
-  //TODO: I suggest making the following UInt_t if it is never supposed to be negative. Will do!
-  /* total charge of Cluster threshold*/
-  Int_t fThreshold;                                                //! transient
-
-  //TODO: I suggest making the following UInt_t if it is never supposed to be negative.
-  Int_t fSignalThreshold;                                                //! transient
-
-  //TODO: I suggest making the following UInt_t if it is never supposed to be negative.
-  Double_t fNSigmaThreshold;                                                //! transient
-
-  Int_t* fNumberOfPadsInRow;                                       //! transient
-
-  Int_t fNumberOfRows;                                             //! transient
-
-  AliHLTTPCDigitReader* fDigitReader;                              //! transient
-
-  ClassDef(AliHLTTPCPadArray, 0);
-};
-#endif // ALIHLTTPCPADARRAY_H
index 30ca97f..5ed8487 100755 (executable)
@@ -33,13 +33,13 @@ using namespace std;
 #include "AliHLTTPCDigitReaderDecoder.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCDefinitions.h"
-#include "AliHLTTPCPad.h"
 #include "AliHLTTPCDigitData.h"
 #include <cstdlib>
 #include <cerrno>
 #include "TString.h"
 #include <sys/time.h>
 
+
 AliHLTTPCZeroSuppressionComponent gAliHLTTPCZeroSuppressionComponent;
 
 /** ROOT macro for the implementation of ROOT specific class methods */
@@ -47,25 +47,27 @@ ClassImp(AliHLTTPCZeroSuppressionComponent)
 
 AliHLTTPCZeroSuppressionComponent::AliHLTTPCZeroSuppressionComponent()
     :
-    fNTimeBins(0),
+    fDigitReader(NULL),
+    fRowPadVector(),
+    fNumberOfPadsInRow(NULL),
+    fNumberOfRows(0),
+    fCurrentPatch(0),
+    fFirstRow(0),
+    fLastRow(0),
     fStartTimeBin(0),
     fEndTimeBin(AliHLTTPCTransform::GetNTimeBins()),
+    fNTimeBins(0),
     fNRMSThreshold(0),
     fSignalThreshold(0),
     fMinimumNumberOfSignals(AliHLTTPCTransform::GetNTimeBins()/2),
     fOldRCUFormat(0),
     fSortPads(0),
-    fRowPadVector(),
-    fDigitReader(NULL),
     fVectorInitialized(kFALSE),
-    fNumberOfPadsInRow(NULL),
-    fNumberOfRows(0),
-    fCurrentPatch(0),
-    fFirstRow(0),
-    fLastRow(0),
     fValueBelowAverage(5),
     fLeftTimeBin(5),
-    fRightTimeBin(5)
+    fRightTimeBin(5),
+    fGetActivePads(kFALSE),
+    fHwAddressList()
 {
   // see header file for class documentation
   // or
@@ -124,7 +126,7 @@ void AliHLTTPCZeroSuppressionComponent::GetOutputDataSize( unsigned long& constB
 {
   // see header file for class documentation
   constBase=0;
-  inputMultiplier=1.0;
+  inputMultiplier=2.0;
 }
 
 AliHLTComponent* AliHLTTPCZeroSuppressionComponent::Spawn()
@@ -188,7 +190,9 @@ int AliHLTTPCZeroSuppressionComponent::DoInit( int argc, const char** argv )
 
     // -- last timebin
     if ( !strcmp( argv[i], "end-timebin" ) ) {
-      fEndTimeBin = strtoul( argv[i+1], &cpErr ,0);
+      if(strtoul( argv[i+1], &cpErr ,0)<=(UInt_t)AliHLTTPCTransform::GetNTimeBins()){
+       fEndTimeBin = strtoul( argv[i+1], &cpErr ,0);
+      }
       if ( *cpErr ) {
        HLTError("Cannot convert end-timebin specifier '%s'.", argv[i+1]);
        return EINVAL;
@@ -271,6 +275,8 @@ int AliHLTTPCZeroSuppressionComponent::DoInit( int argc, const char** argv )
   HLTDebug("using AliHLTTPCDigitReaderDecoder");
   fDigitReader = new AliHLTTPCDigitReaderDecoder();
 
+  fHwAddressList.clear();
+
   return 0;
 }
 
@@ -293,14 +299,12 @@ Int_t AliHLTTPCZeroSuppressionComponent::DeInitializePadArray()
     }
     fRowPadVector.clear();
   }
-  
   return 1;
 } 
 
 void AliHLTTPCZeroSuppressionComponent::InitializePadArray(){
   // see header file for class documentation
-  //  HLTInfo("InitializingPadArray");
-  if(fCurrentPatch>5||fCurrentPatch<0){
+  if(fCurrentPatch>5){
     HLTFatal("Patch is not set");
     return;
   }
@@ -309,7 +313,7 @@ void AliHLTTPCZeroSuppressionComponent::InitializePadArray(){
   fLastRow = AliHLTTPCTransform::GetLastRow(fCurrentPatch);
 
   fNumberOfRows=fLastRow-fFirstRow+1;
-  fNumberOfPadsInRow= new UInt_t[fNumberOfRows];
+  fNumberOfPadsInRow= new Int_t[fNumberOfRows];
 
   memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows));
 
@@ -335,13 +339,16 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
 {
   // see header file for class documentation
 
-  //  HLTInfo("Entering DoEvent in ZeroSuppression");
+  //  HLTInfo("Entered DoEvent in AliHLTTPCZeroSuppressionComponent");
 
   //  == init iter (pointer to datablock)
   const AliHLTComponentBlockData* iter = NULL;
   unsigned long ndx;
   //  HLTInfo("Number of blocks: ",evtData.fBlockCnt);
 
+  Bool_t wasInput = 0;
+
+  fHwAddressList.clear();
   //reading the data
   for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     {
@@ -364,6 +371,7 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
        continue;
       }
 
+      wasInput = 1;
 
       UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
       UInt_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
@@ -377,25 +385,25 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
 
       //Here the reading of the data and the zerosuppression takes place
       while(fDigitReader->NextChannel()){//Pad
-       UInt_t row=(UInt_t)fDigitReader->GetRow();
-       UInt_t pad=(UInt_t)fDigitReader->GetPad();
+       Int_t row=fDigitReader->GetRow();
+       Int_t pad=fDigitReader->GetPad();
        if(row==1000 || pad==1000){
          continue;
        }
-       if(row>=fNumberOfRows){
+       if(row>=fNumberOfRows||row<0){
          continue;
        }
-       else if(pad>=fNumberOfPadsInRow[row]){
+       else if(pad>=fNumberOfPadsInRow[row]||pad<0){
            continue;
        }  
-          AliHLTTPCPad *tmpPad = fRowPadVector[row][pad];
        
-       //seg fault in here!!!!!!!!!!!!!
-
+       AliHLTTPCPad *tmpPad = fRowPadVector[row][pad];
+       tmpPad->SetDataToDefault();
+       
        //reading data to pad
        while(fDigitReader->NextBunch()){
          const UInt_t *bunchData= fDigitReader->GetSignals();
-         UInt_t time=fDigitReader->GetTime();
+         Int_t time=fDigitReader->GetTime();
          for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){
            if(bunchData[i]>0){// disregarding 0 data.
              if(time+i>=fStartTimeBin && time+i<=fEndTimeBin){
@@ -404,13 +412,16 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
            }
          }
        }
-       if(tmpPad->GetNAddedSignals()>=fMinimumNumberOfSignals){
+       if(tmpPad->GetNAddedSignals()>=(UInt_t)fMinimumNumberOfSignals){
+         fHwAddressList.push_back(fDigitReader->GetAltroBlockHWaddr());
          tmpPad->ZeroSuppress(fNRMSThreshold, fSignalThreshold, fMinimumNumberOfSignals, fStartTimeBin, fEndTimeBin, fLeftTimeBin, fRightTimeBin, fValueBelowAverage);
        }
       }
     }
   Int_t nAdded=0;
 
+  HLTDebug("Max numberof signals: %d",size/sizeof(Int_t));
+
   //writing to output
   AliHLTUInt8_t* outBPtr;
   UInt_t* outPtr;
@@ -429,10 +440,9 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
       AliHLTTPCPad * zeroSuppressedPad= fRowPadVector[row][pad];
       Int_t currentTime=0;
       Int_t bunchSize=0;
-      Int_t signal=0;
       Bool_t newPad=kTRUE;
       UInt_t *nBunches=NULL;
-      while(zeroSuppressedPad->GetNextGoodSignal(currentTime, bunchSize)){
+      while(zeroSuppressedPad->GetNextGoodSignal(currentTime, bunchSize,0)){
        if(newPad){
          (*numberOfChannels)++;
          
@@ -474,18 +484,25 @@ int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData&
          blockOutputSize += sizeof(UInt_t);
        }
       }
+      zeroSuppressedPad->SetDataToDefault();
     }
   }
 
-  AliHLTComponentBlockData bd;
-  FillBlockData( bd );
-  bd.fOffset = outputSize-blockOutputSize;
-  bd.fSize = blockOutputSize;
-  bd.fSpecification = iter->fSpecification;
-  Logging( kHLTLogDebug, "HLT::TPCZeroSuppressionComponent::DoEvent", "Event received", 
-          "Event 0x%08LX (%Lu) output data block %lu of %lu bytes at offset %lu",
-          evtData.fEventID, evtData.fEventID, ndx, blockOutputSize, outputSize-blockOutputSize );
-  outputBlocks.push_back( bd );
+  if( wasInput ){
+
+    AliHLTComponentBlockData bd;
+    FillBlockData( bd );
+    bd.fOffset = outputSize-blockOutputSize;
+    bd.fSize = blockOutputSize;
+    bd.fSpecification = iter->fSpecification;
+    Logging( kHLTLogDebug, "HLT::TPCZeroSuppressionComponent::DoEvent", "Event received", 
+            "Event 0x%08LX (%Lu) output data block %lu of %lu bytes at offset %lu",
+            evtData.fEventID, evtData.fEventID, ndx, blockOutputSize, outputSize-blockOutputSize );
+    outputBlocks.push_back( bd );
+  }
+  else{
+    size=0;
+  }
   
   return 0;
 }
index e6b0521..27cd823 100755 (executable)
@@ -22,6 +22,7 @@
 
 #include "AliHLTProcessor.h"
 #include "AliHLTTPCPad.h"
+#include "AliHLTDataTypes.h"
 
 class AliHLTTPCDigitReader;
 
@@ -89,42 +90,78 @@ class AliHLTTPCZeroSuppressionComponent : public AliHLTProcessor
 
     private:
 
-       /** copy constructor prohibited */
-       AliHLTTPCZeroSuppressionComponent(const AliHLTTPCZeroSuppressionComponent&);
+      /** copy constructor prohibited */
+      AliHLTTPCZeroSuppressionComponent(const AliHLTTPCZeroSuppressionComponent&);
        
-       /** assignment operator prohibited */
-       AliHLTTPCZeroSuppressionComponent& operator=(const AliHLTTPCZeroSuppressionComponent&);
+      /** assignment operator prohibited */
+      AliHLTTPCZeroSuppressionComponent& operator=(const AliHLTTPCZeroSuppressionComponent&);
        
-       /** the reader object for data decoding */
-       AliHLTTPCDigitReader* fDigitReader;                                               //!transient
-       
-       
-      typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
+      /** the reader object for data decoding */
+      AliHLTTPCDigitReader* fDigitReader;                              //!transient
 
+      /** Vector of pointers to pad objects */
+      typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
+      
+      /** 2D vector of pointers to pad objects (vector of vectors)*/
       vector<AliHLTTPCPadVector> fRowPadVector;                        //! transient
       
-      UInt_t* fNumberOfPadsInRow;                                      //! transient
+      /** Array containing number of pads in the different rows */
+      Int_t* fNumberOfPadsInRow;                                      //! transient
       
-      UInt_t fNumberOfRows;                                            //! transient
+      /** Number of rows the patch has */
+      Int_t fNumberOfRows;                                            //! transient
 
+      /** Current patch number */
       UInt_t fCurrentPatch;                                            //! transient
+
+      /** First row in patch */
       UInt_t fFirstRow;                                                //! transient
+
+      /** Last row in patch */
       UInt_t fLastRow;                                                 //! transient
       
+      /** First timebin to include in zerosuppression */
+      Int_t fStartTimeBin;                                             //! transient
+
+      /** Lasr timebin to include in zerosuppression */
+      Int_t fEndTimeBin;                                               //! transient
+
+      /** Number of timebins */
+      Int_t fNTimeBins;                                                //! transient
+
+      /** Number of RMS the signal has to be larger than */
+      Double_t fNRMSThreshold;                                         //! transient
 
-      Int_t fStartTimeBin;                                            //! transient
-      Int_t fEndTimeBin;                                              //! transient
-      Int_t fNTimeBins;                                               //! transient
-      Double_t fNRMSThreshold;                                           //! transient
-      Int_t fSignalThreshold;                                         //! transient
-      Int_t fMinimumNumberOfSignals;                                  //! transient
+      /** Signal threshold (signal has to be greater than average + this number) */
+      Int_t fSignalThreshold;                                          //! transient
+
+      /** Minimum number of signals to do zerosuppression */
+      Int_t fMinimumNumberOfSignals;                                   //! transient
+
+      /** OldRCUFormat flag */
       UInt_t fOldRCUFormat;                                            //! transient
+
+      /** Sort pads flag */
       Bool_t fSortPads;                                                //! transient
+
+      /** Flag to check if the 2d vector is initialized */
       Bool_t fVectorInitialized;                                       //! transient
 
+      /** Value below average (useful for noisy pads to get the tails of a signal) */
       Int_t fValueBelowAverage;                                        //! transient
+
+      /** Number of timebins to look left(decreasing time direction) for tails */
       Int_t fLeftTimeBin;                                              //! transient
+
+      /** Number of timebins to look right(increasing time direction) for tails */
       Int_t fRightTimeBin;                                             //! transient
+
+      /** Flag to switch on active pads selection */
+      Bool_t fGetActivePads;                                           //! transient
+
+      /** Vector of active pad hardware addresses */
+      vector<Int_t> fHwAddressList;                                    //! transient
+
       ClassDef(AliHLTTPCZeroSuppressionComponent, 0)  
     };
 #endif
index d85a60a..4431fc3 100644 (file)
@@ -36,7 +36,6 @@ CLASS_HDRS:=          AliHLTTPCTransform.h \
                AliHLTTPCGlobalMerger.h \
                AliHLTTPCInterMerger.h \
                AliHLTTPCPad.h \
-               AliHLTTPCPadArray.h \
                AliHLTTPCDefinitions.h \
                AliHLTTPCRawDataUnpackerComponent.h \
                AliHLTTPCClusterFinderComponent.h \