]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new TPC cluster finder algorithm based on channel/bunch access added (Kenneth)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Feb 2008 10:58:31 +0000 (10:58 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Feb 2008 10:58:31 +0000 (10:58 +0000)
HLT/TPCLib/AliHLTTPCClusterFinder.cxx
HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
HLT/TPCLib/AliHLTTPCMapping.cxx
HLT/TPCLib/AliHLTTPCPad.cxx
HLT/TPCLib/AliHLTTPCPad.h
HLT/TPCLib/AliHLTTPCPadArray.cxx
HLT/TPCLib/AliHLTTPCPadArray.h
HLT/TPCLib/AliHLTTPCTransform.cxx

index b22ecceb830ea1b4fee1cb76155bc202b73de50b..97bc743331670174e2cde1c47da527db12b6c680 100644 (file)
@@ -35,6 +35,7 @@
 #include "AliHLTTPCMemHandler.h"
 #include "AliHLTTPCPad.h"
 #include "AliHLTTPCPadArray.h"
+#include <sys/time.h>
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -144,14 +145,27 @@ AliHLTTPCClusterFinder::AliHLTTPCClusterFinder()
   fOccupancyLimit(1.0),
   fPadArray(NULL),
   fUnsorted(0),
-  fActivePads()
+  fActivePads(),
+  fNumberOfPadsInRow(NULL),
+  fNumberOfRows(0),
+  fRowPadVector(),
+  fClusters(),
+  fVectorInitialized(kFALSE),
+  fRowOfFirstCandidate(0)
 {
-  //constructor
+  //constructor  
 }
 
 AliHLTTPCClusterFinder::~AliHLTTPCClusterFinder()
 {
   //destructor
+  if(fVectorInitialized){
+    DeInitializePadArray();
+  }
+  if(fNumberOfPadsInRow){
+    delete [] fNumberOfPadsInRow;
+    fNumberOfPadsInRow=NULL;
+  }
 }
  
 void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t nmaxpoints)
@@ -165,6 +179,52 @@ void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, I
   fLastRow = lastrow;
 }
 
+void AliHLTTPCClusterFinder::InitializePadArray(){
+  // see header file for class documentation
+  
+  if(fCurrentPatch>5||fCurrentPatch<0){
+    HLTFatal("Patch is not set");
+    return;
+  }
+
+  HLTDebug("Patch number=%d",fCurrentPatch);
+
+  fFirstRow = AliHLTTPCTransform::GetFirstRow(fCurrentPatch);
+  fLastRow = AliHLTTPCTransform::GetLastRow(fCurrentPatch);
+
+  fNumberOfRows=fLastRow-fFirstRow+1;
+  fNumberOfPadsInRow= new UInt_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(2);
+      tmpPad->SetID(i,j);
+      tmpRow.push_back(tmpPad);
+    }
+    fRowPadVector.push_back(tmpRow);
+  }
+  fVectorInitialized=kTRUE;
+}
+
+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++){
+      delete fRowPadVector[i][j];
+      fRowPadVector[i][j]=NULL;
+    }
+    fRowPadVector[i].clear();
+  }
+  fRowPadVector.clear();
+  return 1;
+} 
+
+
 void AliHLTTPCClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t nmaxpoints)
 {
   //init slice
@@ -322,15 +382,15 @@ 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 (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);
@@ -610,7 +670,7 @@ void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliClusterData *list)
        }
       }
       if(fStdout==kTRUE)
-       cout<<"WriteCluster: padrow "<<fCurrentRow<<" pad "<<fpad << " +- "<<fpad2<<" time "<<ftime<<" +- "<<ftime2<<" charge "<<list[j].fTotalCharge<<endl;
+       HLTInfo("WriteCluster: padrow %d pad %d +- %d time +- %d charge %d",fCurrentRow, fpad, fpad2, ftime, ftime2, list[j].fTotalCharge);
       
       if(!fRawSP){
        AliHLTTPCTransform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
@@ -656,7 +716,6 @@ void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliClusterData *list)
       fSpacePointData[counter].fTrackID[1] = trackID[1];
       fSpacePointData[counter].fTrackID[2] = trackID[2];
 
-      //cout<<"padrow "<<fCurrentRow<<" pad "<<(Int_t)rint(fpad)<<" time "<<(Int_t)rint(ftime)<<" Trackid "<<trackID[0]<<endl;
 #endif
       
       fNClusters++;
@@ -673,7 +732,6 @@ void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
   AliHLTTPCDigitRowData *rowPt = (AliHLTTPCDigitRowData*)fDigitRowData;
   
   trackID[0]=trackID[1]=trackID[2]=-2;
-  //cout<<"Looking for pad "<<pad<<" time "<<time<<endl;
   for(Int_t i=fFirstRow; i<=fLastRow; i++){
     if(rowPt->fRow < (UInt_t)fCurrentRow){
       AliHLTTPCMemHandler::UpdateRowPointer(rowPt);
@@ -690,7 +748,6 @@ void AliHLTTPCClusterFinder::GetTrackID(Int_t pad,Int_t time,Int_t *trackID)
       trackID[1] = digPt[j].fTrackID[1];
       trackID[2] = digPt[j].fTrackID[2];
       
-      //cout<<"Reading row "<<fCurrentRow<<" pad "<<cpad<<" time "<<ctime<<" trackID "<<digPt[j].fTrackID[0]<<endl;
       break;
     }
     break;
@@ -706,50 +763,142 @@ void AliHLTTPCClusterFinder::SetPadArray(AliHLTTPCPadArray * padArray)
   fPadArray=padArray;
 }
 
-void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size)
+void AliHLTTPCClusterFinder::ReadDataUnsorted(void* ptr,unsigned long size, Int_t mode)
 {
   //set input pointer
   fPtr = (UChar_t*)ptr;
   fSize = size;
 
-  fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
-
-  fPadArray->SetDigitReader(fDigitReader);
+  if(!fVectorInitialized){
+    InitializePadArray();
+  }
 
-  if(fSignalThreshold>0){
-    fPadArray->SetSignalThreshold(fSignalThreshold);
+  fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
+  while(fDigitReader->NextChannel()){
+    UInt_t row=fDigitReader->GetRow();
+    UInt_t pad=fDigitReader->GetPad();
+    fRowPadVector[row][pad]->ClearCandidates();
+    while(fDigitReader->NextBunch()){
+      if(fDigitReader->GetBunchSize()>1){//to remove single timebin values, this will have to change at some point
+       const UInt_t *bunchData= fDigitReader->GetSignals();
+       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;
+         candidate.fRowNumber=row;
+       }
+       fRowPadVector[row][pad]->AddClusterCandidate(candidate);
+      }
+    }
   }
-  if(fNSigmaThreshold>0){
-    fPadArray->SetNSigmaThreshold(fNSigmaThreshold);
+}
+
+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++){
+    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;
+      cluster->fTotalCharge+=candidate->fTotalCharge;
+      cluster->fTime += candidate->fTime;
+      cluster->fTime2 += candidate->fTime2;
+      cluster->fPad+=candidate->fPad;
+      cluster->fPad2=candidate->fPad2;
+      cluster->fLastMergedPad=candidate->fPad;
+
+      //setting the matched pad to used
+      nextPad->fUsedClusterCandidates[candidateNumber]=1;
+      nextPadToRead++;
+      if(nextPadToRead<fNumberOfPadsInRow[fRowOfFirstCandidate]){
+       nextPad=fRowPadVector[fRowOfFirstCandidate][nextPadToRead];
+       ComparePads(nextPad,cluster,nextPadToRead);
+      }
+      else{
+       return kFALSE;
+      }
+    }
+    else{
+      return kFALSE;
+    }
   }
-  fPadArray->ReadData();
+  return kFALSE;
 }
 
 void AliHLTTPCClusterFinder::FindClusters()
 {
   // see header file for function documentation
-  fPadArray->FindClusterCandidates();
-  fPadArray->FindClusters(fMatch);
-
-  AliClusterData * clusterlist = new AliClusterData[fPadArray->fClusters.size()]; //Clusterlist
-  for(unsigned int i=0;i<fPadArray->fClusters.size();i++){
-    clusterlist[i].fTotalCharge = fPadArray->fClusters[i].fTotalCharge;
-    clusterlist[i].fPad = fPadArray->fClusters[i].fPad;
-    clusterlist[i].fPad2 = fPadArray->fClusters[i].fPad2;
-    clusterlist[i].fTime = fPadArray->fClusters[i].fTime;
-    clusterlist[i].fTime2 = fPadArray->fClusters[i].fTime2;
-    clusterlist[i].fMean = fPadArray->fClusters[i].fMean;
-    clusterlist[i].fFlags = fPadArray->fClusters[i].fFlags;
-    clusterlist[i].fChargeFalling = fPadArray->fClusters[i].fChargeFalling;
-    clusterlist[i].fLastCharge = fPadArray->fClusters[i].fLastCharge;
-    clusterlist[i].fLastMergedPad = fPadArray->fClusters[i].fLastMergedPad;
-    clusterlist[i].fRow = fPadArray->fClusters[i].fRowNumber;
+
+  AliHLTTPCClusters* tmpCandidate=NULL;
+  for(Int_t row=0;row<fNumberOfRows;row++){
+    fRowOfFirstCandidate=row;
+    for(Int_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]){
+         continue;
+       }
+       tmpCandidate=&tmpPad->fClusterCandidates[candidate];
+       UInt_t tmpTotalCharge=tmpCandidate->fTotalCharge;
+       ComparePads(fRowPadVector[row][pad+1],tmpCandidate,pad+1);
+       if(tmpCandidate->fTotalCharge>tmpTotalCharge){
+         //we have a cluster
+         fClusters.push_back(*tmpCandidate);
+       }
+      }
+    }
   }
-  WriteClusters(fPadArray->fClusters.size(),clusterlist);
+
+  HLTInfo("Found %d clusters.",fClusters.size());
+
+  //TODO:  Change so it stores AliHLTTPCSpacePointData directly, instead of this copying
+  
+  AliClusterData * clusterlist = new AliClusterData[fClusters.size()]; //Clusterlist
+  for(unsigned int i=0;i<fClusters.size();i++){
+    clusterlist[i].fTotalCharge = fClusters[i].fTotalCharge;
+    clusterlist[i].fPad = fClusters[i].fPad;
+    clusterlist[i].fPad2 = fClusters[i].fPad2;
+    clusterlist[i].fTime = fClusters[i].fTime;
+    clusterlist[i].fTime2 = fClusters[i].fTime2;
+    clusterlist[i].fMean = fClusters[i].fMean;
+    clusterlist[i].fFlags = fClusters[i].fFlags;
+    clusterlist[i].fChargeFalling = fClusters[i].fChargeFalling;
+    clusterlist[i].fLastCharge = fClusters[i].fLastCharge;
+    clusterlist[i].fLastMergedPad = fClusters[i].fLastMergedPad;
+    clusterlist[i].fRow = fClusters[i].fRowNumber;
+  }
+  //  PrintClusters();
+  WriteClusters(fClusters.size(),clusterlist);
   delete [] clusterlist;
-  fPadArray->DataToDefault();
+  fClusters.clear();
 }
 
+void AliHLTTPCClusterFinder::PrintClusters()
+{
+  // see header file for class documentation
+  for(size_t i=0;i<fClusters.size();i++){
+    HLTInfo("Cluster number: %d",i);
+    HLTInfo("Row: %d \t Pad: %d",fClusters[i].fRowNumber,fClusters[i].fFirstPad);
+    HLTInfo("Total Charge:   %d",fClusters[i].fTotalCharge);
+    HLTInfo("fPad:           %d",fClusters[i].fPad);
+    HLTInfo("PadError:       %d",fClusters[i].fPad2);
+    HLTInfo("TimeMean:       %d",fClusters[i].fTime);
+    HLTInfo("TimeError:      %d",fClusters[i].fTime2);
+    HLTInfo("EndOfCluster:");
+  }
+}
+
+/*
+
 Int_t AliHLTTPCClusterFinder::GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads)
 {
   // see header file for function documentation
@@ -766,7 +915,7 @@ Int_t AliHLTTPCClusterFinder::GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePa
 
   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
@@ -822,8 +971,8 @@ void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *li
        }
       }
       if(fStdout==kTRUE)
-       cout<<"WriteCluster: padrow "<<fCurrentRow<<" pad "<<fpad << " +- "<<fpad2<<" time "<<ftime<<" +- "<<ftime2<<" charge "<<list[j].fTotalCharge<<endl;
-      
+       HLTInfo("WriteCluster: padrow %d pad %d +- %d time +- %d charge %d",fCurrentRow, fpad, fpad2, ftime, ftime2, list[j].fTotalCharge);
+
       if(!fRawSP){
        AliHLTTPCTransform::Slice2Sector(fCurrentSlice,fCurrentRow,thissector,thisrow);
        AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,fpad,ftime);
@@ -868,7 +1017,6 @@ void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliHLTTPCClusters *li
       fSpacePointData[counter].fTrackID[1] = trackID[1];
       fSpacePointData[counter].fTrackID[2] = trackID[2];
 
-      //cout<<"padrow "<<fCurrentRow<<" pad "<<(Int_t)rint(fpad)<<" time "<<(Int_t)rint(ftime)<<" Trackid "<<trackID[0]<<endl;
 #endif
       
       fNClusters++;
index 8baa31faefd3be38609748b7aec1ff4276dbf8be..e1147fdc66561c86027307a2dfa6d70e45d6ea42 100644 (file)
@@ -58,7 +58,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
 
   void SetOutputArray(AliHLTTPCSpacePointData *pt);
   void WriteClusters(Int_t n_clusters,AliClusterData *list);
-
+  void PrintClusters();
   void SetXYError(Float_t f) {fXYErr=f;}
   void SetZError(Float_t f) {fZErr=f;}
   void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
@@ -75,12 +75,15 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
 
   //----------------------------------Methods for the new unsorted way of reading data ----------
   void SetPadArray(AliHLTTPCPadArray *padArray);
-  void ReadDataUnsorted(void* ptr,unsigned long size);
+  void ReadDataUnsorted(void* ptr,unsigned long size, Int_t mode);
   void FindClusters();
-  Int_t GetActivePads(AliHLTTPCPadArray::AliHLTTPCActivePads* activePads,Int_t maxActivePads);
+  //  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;}
+  void InitializePadArray();
+  Int_t DeInitializePadArray();
+  Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
  private: 
   /** copy constructor prohibited */
   AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&);
@@ -120,6 +123,19 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   AliHLTTPCPadArray * fPadArray; //! transient
 
   Int_t fUnsorted;       // enable for processing of unsorted digit data
+  Bool_t fVectorInitialized;
+
+  typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
+
+  vector<AliHLTTPCPadVector> fRowPadVector;                        //! transient
+
+  vector<AliHLTTPCClusters> fClusters;                             //! transient
+  
+  UInt_t* fNumberOfPadsInRow;                                      //! transient
+  
+  UInt_t fNumberOfRows;                                            //! transient
+  
+  UInt_t fRowOfFirstCandidate;
 
   /** list of active pads if PadArray is not used */
   vector<AliHLTTPCPadArray::AliHLTTPCActivePads> fActivePads; //!transient
@@ -128,6 +144,6 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
 #endif
   
-  ClassDef(AliHLTTPCClusterFinder,3) //Fast cluster finder
+  ClassDef(AliHLTTPCClusterFinder,4) //Fast cluster finder
 };
 #endif
index 9b7490cc8440bbec30254bbbf39a8ba9b8031700..e171856925cbfb891bdfada48f4436918e2a3c63 100644 (file)
@@ -37,6 +37,7 @@ using namespace std;
 #include "AliHLTTPCDigitReaderPacked.h"
 #include "AliHLTTPCDigitReaderUnpacked.h"
 #include "AliHLTTPCDigitReaderRaw.h"
+#include "AliHLTTPCDigitReaderDecoder.h"
 #include "AliHLTTPCClusterFinder.h"
 #include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCClusterDataFormat.h"
@@ -55,20 +56,21 @@ using namespace std;
 // 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);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(0);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(1);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentDecoder(2);
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCClusterFinderComponent)
 
-AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(bool packed)
+AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   :
   fClusterFinder(NULL),
   fReader(NULL),
   fClusterDeconv(true),
   fXYClusterError(-1),
   fZClusterError(-1),
-  fPackedSwitch(packed),
+  fModeSwitch(mode),
   fUnsorted(0),
   fPatch(0),
   fPadArray(NULL),
@@ -92,17 +94,34 @@ AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
 {
   // see header file for class documentation
-  if (fPackedSwitch) return "TPCClusterFinderPacked";
-  else return "TPCClusterFinderUnpacked";
+  switch(fModeSwitch){
+  case 0:
+    return "TPCClusterFinderPacked";
+    break;
+  case 1:
+    return "TPCClusterFinderUnpacked";
+    break;
+  case 2:
+    return "TPCClusterFinderDecoder";
+    break;
+  }
 }
 
 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 );
-   
+  switch(fModeSwitch){
+  case 0:
+    list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+    break;
+  case 1:
+    list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
+    break;
+  case 2:
+    list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+    break;
+  }
 }
 
 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
@@ -126,14 +145,23 @@ void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBas
   // see header file for class documentation
   // XXX TODO: Find more realistic values.  
   constBase = 0;
-  if (fPackedSwitch)  inputMultiplier = (6 * 0.4);
-  else  inputMultiplier = 0.4;
+  switch(fModeSwitch){
+  case 0:
+    inputMultiplier = (6 * 0.4);
+    break;
+  case 1:
+    inputMultiplier = 0.4;
+    break;
+  case 2:
+    inputMultiplier = (6 * 0.4);
+    break;
+  }
 }
 
 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
 {
   // see header file for class documentation
-  return new AliHLTTPCClusterFinderComponent(fPackedSwitch);
+  return new AliHLTTPCClusterFinderComponent(fModeSwitch);
 }
        
 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
@@ -275,8 +303,7 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   }
 
   // Choose reader
-
-  if (fPackedSwitch) { 
+  if (fModeSwitch==0) { 
     if (rawreadermode == -2) {
       HLTDebug("using AliHLTTPCDigitReaderPacked");
       fReader = new AliHLTTPCDigitReaderPacked();
@@ -290,7 +317,8 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
        fReader->SetUnsorted(kTRUE);
       }
       fClusterFinder->SetReader(fReader);
-    } else {
+    } 
+    else {
 #if defined(HAVE_TPC_MAPPING)
       HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode);
       fReader = new AliHLTTPCDigitReaderRaw(rawreadermode);
@@ -301,12 +329,18 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
 #endif //defined(HAVE_TPC_MAPPING)
     }
   }
-  else {
+  else if(fModeSwitch==1){
     HLTDebug("using AliHLTTPCDigitReaderUnpacked");
     fReader = new AliHLTTPCDigitReaderUnpacked();
     fClusterFinder->SetReader(fReader);
   }
-
+  else if(fModeSwitch==2){
+    fReader = new AliHLTTPCDigitReaderDecoder();
+    fClusterFinder->SetReader(fReader);
+  }
+  else{
+    HLTFatal("No mode set for clusterfindercomponent");
+  }
   // if pp-run use occupancy limit else set to 1. ==> use all 
   if ( !fClusterDeconv )
     fClusterFinder->SetOccupancyLimit(occulimit);
@@ -378,7 +412,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       offset = tSize;
 
 
-      if (fPackedSwitch) {
+      if (fModeSwitch==0 || fModeSwitch==2) {
        HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
                 evtData.fEventID, evtData.fEventID, 
                 DataType2Text( iter->fDataType).c_str(), 
@@ -395,7 +429,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
             iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
 
       }
-      else {
+      else if(fModeSwitch==1){
        HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
                 evtData.fEventID, evtData.fEventID, 
                 DataType2Text( iter->fDataType).c_str(), 
@@ -409,22 +443,29 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
       row[0] = AliHLTTPCTransform::GetFirstRow( patch );
       row[1] = AliHLTTPCTransform::GetLastRow( patch );
-       
+
+
       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;
-       }
+       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;
 
@@ -434,31 +475,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
        
       if(fUnsorted){
+       fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize, fModeSwitch);
 
-
-       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{
@@ -487,26 +505,27 @@ 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);
+      /*      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 );
+             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;
-      }
+             tSize+=activePadsSize;
+             outBPtr += activePadsSize;
+             outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
+             }
+      */
  
 
       if ( tSize > size )
index 327c89575a850441cf9ff2ebe4408c2ca63dbdcf..5ad2e7829c605cf4ebf68deadfed7084e0c2861b 100644 (file)
@@ -54,7 +54,7 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
          * constructor 
          * @param packed    whether to use the packed or unpacked reader 
          */
-       AliHLTTPCClusterFinderComponent(bool packed);
+       AliHLTTPCClusterFinderComponent(int mode);
        /** destructor */
        virtual ~AliHLTTPCClusterFinderComponent();
 
@@ -104,10 +104,11 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
       float fZClusterError; //!transient
       /**
        * switch to indicated the reader
-       * use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType"
-       * use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType"
+       * 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 fPackedSwitch;                                                           // see above
+      Int_t fModeSwitch;                                                           // see above
       
       /*
        * Reads the data the new unsorted way if true
index e479aa420bd66770fd0d5731d4232cb01d240568..c879e12ee611930f1c2ae1bf5bc70642926072a5 100644 (file)
@@ -1,5 +1,4 @@
 // $Id$
-
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        * 
  * ALICE Experiment at CERN, All rights reserved.                         *
@@ -182,7 +181,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
@@ -197,7 +196,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
@@ -212,7 +211,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
@@ -227,7 +226,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
@@ -242,7 +241,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
@@ -257,7 +256,7 @@ void AliHLTTPCMapping::InitializeMap(UInt_t patch)
            break;
          }
          while(inFile>>hwAdd && inFile>>row && inFile>>pad){
-           if (hwAdd>=fMaxHWAdd) {
+           if (hwAdd>fMaxHWAdd) {
              HLTFatal("hardware address exceeds max hwAddress %d, mapping file %s corrupted?", fMaxHWAdd);
              break;
            }
index 2fd0212d6033bdaa1a19daa4987b00a010853ea0..22f5dbd52fb782aa1eff0303d3c255f702a95a4c 100644 (file)
@@ -74,7 +74,8 @@ AliHLTTPCPad::AliHLTTPCPad()
   fSignalPositionArray(NULL),
   fSizeOfSignalPositionArray(0),
   fNSigmaThreshold(0),
-  fSignalThreshold(0)
+  fSignalThreshold(0),
+  fModeSwitch(0)
 {
   // see header file for class documentation
   // or
@@ -84,12 +85,46 @@ AliHLTTPCPad::AliHLTTPCPad()
   //  HLTInfo("Entering default constructor");
   fDataSignals= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
   memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
-
+  
   fSignalPositionArray= new AliHLTTPCSignal_t[AliHLTTPCTransform::GetNTimeBins()];
   memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
   fSizeOfSignalPositionArray=0;
 }
 
+AliHLTTPCPad::AliHLTTPCPad(Int_t mode)
+  :
+  fClusterCandidates(0),
+  fUsedClusterCandidates(0),
+  fRowNo(-1),
+  fPadNo(-1),
+  fThreshold(0),
+  fAverage(-1),
+  fNofEvents(0),
+  fSum(0),
+  fCount(0),
+  fTotal(0),
+  fBLMax(-1),
+  fBLMaxBin(-1),
+  fBLMin(-1),
+  fBLMinBin(-1),
+  fFirstBLBin(0),
+  fNofBins(0),
+  fReadPos(0),
+  fpRawData(NULL),
+  fDataSignals(NULL),
+  fSignalPositionArray(NULL),
+  fSizeOfSignalPositionArray(0),
+  fNSigmaThreshold(0),
+  fSignalThreshold(0),
+  fModeSwitch(mode)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
 AliHLTTPCPad::AliHLTTPCPad(Int_t offset, Int_t nofBins)
   :
   fClusterCandidates(),
@@ -449,14 +484,22 @@ void AliHLTTPCPad::PrintRawData()
   cout<<"bins: "<<AliHLTTPCTransform::GetNTimeBins()<<endl;
 }
 
+void AliHLTTPCPad::ClearCandidates(){
+  fClusterCandidates.clear();
+  fUsedClusterCandidates.clear();
+}
+
 void AliHLTTPCPad::SetDataToDefault()
 {
   // see header file for class documentation
-  if(fpRawData){
+  /*
+    if(fpRawData){
     memset( fDataSignals, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
     memset( fSignalPositionArray, 0xFF, sizeof(Int_t)*(AliHLTTPCTransform::GetNTimeBins()));
     fSizeOfSignalPositionArray=0;
   }
+  */
+  fClusterCandidates.clear();
 }
 
 void AliHLTTPCPad::SetDataSignal(Int_t bin,Int_t signal)
@@ -623,6 +666,10 @@ void AliHLTTPCPad::ZeroSuppress(Double_t nSigma = 3,Int_t threshold = 20 ,Int_t
     } 
   }
 }
+void AliHLTTPCPad::AddClusterCandidate(AliHLTTPCClusters candidate){
+  fClusterCandidates.push_back(candidate);
+  fUsedClusterCandidates.push_back(0);
+}
 
 void AliHLTTPCPad::FindClusterCandidates()
 {
index 3ba1fa617a7f496882c52222fc0995066d4ff6cb..148aa74bf9e0d7cc87d11bccd712c8c3b287a278 100644 (file)
@@ -42,6 +42,12 @@ public:
   /** standard constructor */
   AliHLTTPCPad();
 
+  /** 
+   * Constructor
+   * @param mode  mode determines if one need the raw data(not quite true at the moment but will be)
+   */
+  AliHLTTPCPad(Int_t mode);
+
   /** 
    * Constructor
    * @param offset   The number of bins to ignore at the beginning
@@ -248,6 +254,8 @@ public:
    */
   Int_t GetSize() const {return fNofBins;}
   
+  void ClearCandidates();
+
   /**
    * Set the data array to -1
    */
@@ -287,6 +295,12 @@ public:
    * they are stored in a cluster candidate vector.
    */
   void FindClusterCandidates();
+
+  /**
+   * Adds cluster candidate to the fClusterCandidates.
+   */
+  void AddClusterCandidate(AliHLTTPCClusters candidate);
+
   /**
    * Prints the raw data og this pad.
    */
@@ -377,6 +391,7 @@ public:
   Double_t fNSigmaThreshold;                                       //! transient
   Double_t fSignalThreshold;                                       //! transient
 
-  ClassDef(AliHLTTPCPad, 3)
+  Int_t fModeSwitch;                                               //! transient
+  ClassDef(AliHLTTPCPad, 4)
 };
 #endif // ALIHLTTPCPAD_H
index 8ac199fe8ae5d6acf7a82e2f03b786528172476c..62bf8a8c5c9c661419fcfff5c6b6d4569e978bd8 100644 (file)
@@ -88,7 +88,7 @@ AliHLTTPCPadArray::~AliHLTTPCPadArray()
   // see header file for class documentation
 }
 
-Int_t AliHLTTPCPadArray::InitializeVector()
+Int_t AliHLTTPCPadArray::InitializeVector(Int_t mode)
 {
   // see header file for class documentation
 
@@ -143,60 +143,168 @@ void AliHLTTPCPadArray::SetDigitReader(AliHLTTPCDigitReader* digitReader)
   fDigitReader=digitReader;
 }
 
-Int_t AliHLTTPCPadArray::ReadData()
+Int_t AliHLTTPCPadArray::ReadData(Int_t mode)
 {
   // see header file for class documentation
 
   switch (fPatch){
   case 0:
-    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());
+    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:
-    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()); 
+    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:
-    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());
+    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:
-    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());
+    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();
@@ -207,18 +315,73 @@ Int_t AliHLTTPCPadArray::ReadData()
        }
       }
     }
+    }
+    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:
-    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());
+    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;
@@ -461,6 +624,7 @@ void AliHLTTPCPadArray::DataToDefault()
        fRowPadVector[i][j]->SetDataToDefault();
     }
   }
+  fClusters.clear();
 }
 
 void AliHLTTPCPadArray::FindClusterCandidates()
index ef0c3d29d4e78d7d79dd0e8a50f6c5d2b4477fa2..7743ce87d3d5c5a438604a1aedcd417ffa0d800a 100644 (file)
@@ -70,8 +70,9 @@ public:
 
   /**
    * Initialize the pad vector for the patch set.
+   *@param mode Switch to keep raw data or not
    */
-  Int_t InitializeVector();
+  Int_t InitializeVector(Int_t mode);
 
   /**
    * Deinitialize the pad vector for the patch set.
@@ -101,7 +102,7 @@ public:
   /**
    * Reads the data, and set it in the Pad objects.
    */
-  Int_t ReadData();
+  Int_t ReadData(Int_t mode);
 
   /**
    * Retuns number of pads in this row.
index 34c5604c60a0b02cc43c0cf10fecc07893c524be..8811608d5ec80020ea4a33be19b8288532a2d14f 100644 (file)
@@ -100,8 +100,8 @@ Int_t AliHLTTPCTransform::fgNRows[6] = {31,33,28,27,23,20};
 #endif
 
 // The following definition is generated by MakeInitFile function
-Double_t AliHLTTPCTransform::fgBField = 0.2;
-Double_t AliHLTTPCTransform::fgSolenoidBField = 2;
+Double_t AliHLTTPCTransform::fgBField = 0.5;
+Double_t AliHLTTPCTransform::fgSolenoidBField = 5;
 Double_t AliHLTTPCTransform::fgBFieldFactor = 1;
 Int_t AliHLTTPCTransform::fgVersion = kVdefault;
 Int_t AliHLTTPCTransform::fgNTimeBins = 1024; //  = 1024; //446