]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
code cleanup in TPC Krypton CF (Kenneth)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Apr 2008 20:16:08 +0000 (20:16 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Apr 2008 20:16:08 +0000 (20:16 +0000)
HLT/TPCLib/AliHLTTPCClusterFinder.cxx
HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCKryptonClusterFinder.cxx
HLT/TPCLib/AliHLTTPCKryptonClusterFinder.h
HLT/TPCLib/AliHLTTPCKryptonClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCKryptonClusterFinderComponent.h

index 37c2c101a26d9832442a50f60acc7b360f6c3c21..6f73426afb626e09a5e14e6ac3302eef1115fdbc 100644 (file)
@@ -5,8 +5,7 @@
  * This file is property of and copyright by the ALICE HLT Project        * 
  * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Primary Authors: Anders Vestbo, Constantin Loizides, Jochen Thaeder    *
- *                  Kenneth Aamodt <kenneth.aamodt@student.uib.no>        *
+ * Primary Authors: Kenneth Aamodt, Kalliopi Kanaki                       *
  *                  for The ALICE HLT Project.                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
@@ -19,8 +18,7 @@
  **************************************************************************/
 
 /** @file   AliHLTTPCClusterFinder.cxx
-    @author Anders Vestbo, Constantin Loizides, Jochen Thaeder
-           Kenneth Aamodt kenneth.aamodt@student.uib.no
+    @author Kenneth Aamodt, Kalliopi Kanaki
     @date   
     @brief  Cluster Finder for the TPC
 */
index f466ef7093af402cb82726298dca54d74adc00e4..69afcd8f774bd44d4d857d44b9f6b2b0ff33017b 100644 (file)
@@ -82,7 +82,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   void InitializePadArray();
   Int_t DeInitializePadArray();
   Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
- private
+ protected
   /** copy constructor prohibited */
   AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&);
   /** assignment operator prohibited */
index 4c7f13b96e0cf842c4f695321c8931cbb648daa0..e84467134c06148cacec77d91213232738aa8b32 100644 (file)
@@ -3,8 +3,7 @@
  * This file is property of and copyright by the ALICE HLT Project        * 
  * ALICE Experiment at CERN, All rights reserved.                         *
  *                                                                        *
- * Primary Authors: Anders Vestbo, Constantin Loizides, Jochen Thaeder    *
- *                  Kenneth Aamodt <kenneth.aamodt@student.uib.no>        *
+ * Primary Authors: Kenneth Aamodt <kenneth.aamodt@student.uib.no>        *
  *                  for The ALICE HLT Project.                            *
  *                                                                        *
  * Permission to use, copy, modify and distribute this software and its   *
  **************************************************************************/
 
 /** @file    AliHLTTPCKryptonClusterFinder.cxx
-    @author  Kenneth Aamodt kenneth.aamodt@student.uib.no
+    @author  Kenneth Aamodt, Kalliopi Kanaki
     @date   
     @brief  Krypton Cluster Finder for the TPC
 */
 
 #include "AliHLTTPCDigitReader.h"
-#include "AliHLTTPCRootTypes.h"
-#include "AliHLTTPCLogging.h"
 #include "AliHLTTPCKryptonClusterFinder.h"
-#include "AliHLTTPCDigitData.h"
 #include "AliHLTTPCTransform.h"
-#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCMemHandler.h"
-#include "AliHLTTPCPad.h"
-#include <sys/time.h>
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -40,102 +32,13 @@ using namespace std;
 ClassImp(AliHLTTPCKryptonClusterFinder)
 
 AliHLTTPCKryptonClusterFinder::AliHLTTPCKryptonClusterFinder()
-  :
-  fSpacePointData(NULL),
-  fDigitReader(NULL),
-  fPtr(NULL),
-  fSize(0),
-  fFirstRow(0),
-  fLastRow(0),
-  fCurrentRow(0),
-  fCurrentSlice(0),
-  fCurrentPatch(0),
-  fMatch(1),
-  fThreshold(10),
-  fNClusters(0),
-  fMaxNClusters(0),
-  fXYErr(0.2),
-  fZErr(0.3),
-  fVectorInitialized(kFALSE),
-  fRowPadVector(),
-  fClusters(),
-  fTimebinsInBunch(),
-  fIndexOfBunchStart(),
-  fNumberOfPadsInRow(NULL),
-  fNumberOfRows(0),
-  fRowOfFirstCandidate(0)
+  : AliHLTTPCClusterFinder(),
+    fTimebinsInBunch(),
+    fIndexOfBunchStart()
 {
   //constructor  
 }
 
-AliHLTTPCKryptonClusterFinder::~AliHLTTPCKryptonClusterFinder()
-{
-  //destructor
-  if(fVectorInitialized){
-    DeInitializePadArray();
-  }
-  if(fNumberOfPadsInRow){
-    delete [] fNumberOfPadsInRow;
-    fNumberOfPadsInRow=NULL;
-  }
-}
-void AliHLTTPCKryptonClusterFinder::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(UInt_t i=0;i<fNumberOfRows;i++){
-    fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow);
-    AliHLTTPCPadVector tmpRow;
-    for(UInt_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 AliHLTTPCKryptonClusterFinder::DeInitializePadArray()
-{
-  // see header file for class documentation
-  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;
-    }
-    fRowPadVector[i].clear();
-  }
-  fRowPadVector.clear();
-  return 1;
-} 
-
-void AliHLTTPCKryptonClusterFinder::InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t nmaxpoints)
-{
-  //init slice
-  fNClusters = 0;
-  fMaxNClusters = nmaxpoints;
-  fCurrentSlice = slice;
-  fCurrentPatch = patch;
-  fFirstRow = firstrow;
-  fLastRow = lastrow;
-}
-
 void AliHLTTPCKryptonClusterFinder::ReBunch(const UInt_t *bunchData , Int_t bunchSize){
   fTimebinsInBunch.clear();
   fIndexOfBunchStart.clear();
@@ -169,7 +72,7 @@ void AliHLTTPCKryptonClusterFinder::ReadDataUnsorted(void* ptr,unsigned long siz
 
   if(!fVectorInitialized){
     InitializePadArray();
-  }
+   }
 
   fDigitReader->InitBlock(fPtr,fSize,fFirstRow,fLastRow,fCurrentPatch,fCurrentSlice);
   
@@ -214,39 +117,7 @@ void AliHLTTPCKryptonClusterFinder::ReadDataUnsorted(void* ptr,unsigned long siz
   }
 }
 
-Bool_t AliHLTTPCKryptonClusterFinder::ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* cluster,Int_t nextPadToRead){
-  //Checking if we have a match on the next pad
-  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;
-      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<(Int_t)fNumberOfPadsInRow[fRowOfFirstCandidate]){
-       nextPad=fRowPadVector[fRowOfFirstCandidate][nextPadToRead];
-       ComparePads(nextPad,cluster,nextPadToRead);
-      }
-      else{
-       return kFALSE;
-      }
-    }
-    else{
-      return kFALSE;
-    }
-  }
-  return kFALSE;
-}
-
-void AliHLTTPCKryptonClusterFinder::FindNormalClusters()
+void AliHLTTPCKryptonClusterFinder::FindRowClusters()
 {
   // see header file for function documentation
 
@@ -298,7 +169,6 @@ void AliHLTTPCKryptonClusterFinder::FindKryptonClusters()
       }
 
       if(tmpCluster->fRowNumber==nextCluster->fRowNumber-1){//Checks if the row numbers are ok (next to eachother)
-       //      if(abs((Int_t)(tmpCluster->fPad/tmpCluster->fTotalCharge) - (Int_t)(nextCluster->fPad/nextCluster->fTotalCharge))<3){ // checks if the pad numbers are ok
        if(abs((Int_t)(tmpCluster->fPad) - (Int_t)(nextCluster->fPad))<3){ // checks if the pad numbers are ok
          if(abs((Int_t)tmpCluster->fMean-(Int_t)nextCluster->fMean)<2){
            tmpCluster->fMean=nextCluster->fMean;
@@ -353,18 +223,3 @@ void AliHLTTPCKryptonClusterFinder::CheckForCandidateOnPreviousPad(AliHLTTPCClus
     }
   }
 }
-
-void AliHLTTPCKryptonClusterFinder::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:");
-  }
-}
index 12f5a3e282425d50c2c2e3965b03beb2c46b555c..840ef91bbff8a63303faab5531b00c493d2aadb0 100644 (file)
@@ -7,10 +7,9 @@
  * See cxx source for full Copyright notice                               */
 
 /** @file   AliHLTTPCKryptonClusterFinder.h
-    @author Anders Vestbo, Constantin Loizides, Jochen Thaeder
-           Kenneth Aamodt kenneth.aamodt@student.uib.no
+    @author Kenneth Aamodt kenneth.aamodt@student.uib.no
     @date   
-    @brief  Cluster Finder for the TPC
+    @brief  Krypton Cluster Finder for the TPC
 */
 
 // see below for class documentation
 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 
 
-#include "AliHLTLogging.h"
-#include "AliHLTTPCPad.h"
+//#include "AliHLTLogging.h"
+//#include "AliHLTTPCPad.h"
+#include "AliHLTTPCClusterFinder.h"
 class AliHLTTPCSpacePointData;
 class AliHLTTPCDigitReader;
 
-class AliHLTTPCKryptonClusterFinder : public AliHLTLogging {
+class AliHLTTPCKryptonClusterFinder : public AliHLTTPCClusterFinder {
 
  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 fMean;          //mean in time
-    UInt_t fFlags;         //different flags
-    UInt_t fChargeFalling; //for deconvolution
-    UInt_t fLastCharge;    //for deconvolution
-    UInt_t fLastMergedPad; //dont merge twice per pad
-    Int_t fRow;             //row value
-  };
-  typedef struct AliClusterData AliClusterData; //!
-
   /** standard constructor */
   AliHLTTPCKryptonClusterFinder();
   /** destructor */
-  virtual ~AliHLTTPCKryptonClusterFinder();
-
-  void InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t maxpoints);
+  //  virtual ~AliHLTTPCKryptonClusterFinder();
 
-  void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;}
+  void ReBunch(const UInt_t * bunchData,Int_t bunchSize);
 
-  void PrintClusters();
+  void ReadDataUnsorted(void* ptr,unsigned long size);
 
-  Int_t GetNumberOfClusters() const {return fNClusters;}
+  void FindRowClusters();
 
-  void ReBunch(const UInt_t * bunchData,Int_t bunchSize);
-  void ReadDataUnsorted(void* ptr,unsigned long size);
-  void FindNormalClusters();
   void FindKryptonClusters();
+
   void CheckForCandidateOnPreviousPad(AliHLTTPCClusters* tmpCluster);
-  void SetPatch(Int_t patch){fCurrentPatch=patch;}
-  void InitializePadArray();
-  Int_t DeInitializePadArray();
-  Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
+
+  //  Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
+
  private: 
   /** copy constructor prohibited */
   AliHLTTPCKryptonClusterFinder(const AliHLTTPCKryptonClusterFinder&);
   /** assignment operator prohibited */
   AliHLTTPCKryptonClusterFinder& operator=(const AliHLTTPCKryptonClusterFinder&);
 
-  AliHLTTPCSpacePointData *fSpacePointData; //! array of space points
-  AliHLTTPCDigitReader *fDigitReader;       //! reader instance
-
-  UChar_t* fPtr;   //! pointer to packed block
-  unsigned long fSize; //packed block size
-
-  Int_t fFirstRow;       //first row
-  Int_t fLastRow;        //last row
-  Int_t fCurrentRow;     //current active row
-  Int_t fCurrentSlice;   //current slice
-  Int_t fCurrentPatch;   //current patch
-  Int_t fMatch;          //size of match
-  UInt_t fThreshold;      //Threshold on total charge for krypton cluster
-
-  Int_t fNClusters;      //number of found clusters
-  Int_t fMaxNClusters;   //max. number of clusters
-  Float_t fXYErr;        //fixed error in XY
-  Float_t fZErr;         //fixed error in Z
-  
-  Bool_t fVectorInitialized;
-
-  typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
-
-  vector<AliHLTTPCPadVector> fRowPadVector;                        //! transient
-
-  vector<AliHLTTPCClusters> fClusters;                             //! transient
-  
   vector<Int_t> fTimebinsInBunch;                                  //! transient
 
   vector<Int_t> fIndexOfBunchStart;                                //! transient
 
-  UInt_t* fNumberOfPadsInRow;                                      //! transient
-  
-  UInt_t fNumberOfRows;                                            //! transient
-  
-  UInt_t fRowOfFirstCandidate;
-
   ClassDef(AliHLTTPCKryptonClusterFinder,0) //Fast cluster finder
 };
 #endif
index 8d4dfd0198586c76525f68083da3b6d533575359..8cd3c25981157682d391283fad54e9871a484756 100644 (file)
@@ -42,6 +42,7 @@ using namespace std;
 #include "AliHLTTPCDefinitions.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
+#include "TH1F.h"
 
 #include <cstdlib>
 #include <cerrno>
@@ -56,7 +57,7 @@ ClassImp(AliHLTTPCKryptonClusterFinderComponent)
 
 AliHLTTPCKryptonClusterFinderComponent::AliHLTTPCKryptonClusterFinderComponent()
   :
-  fClusterFinder(NULL),
+  fKryptonClusterFinder(NULL),
   fReader(NULL)
 {
   // see header file for class documentation
@@ -98,7 +99,7 @@ int AliHLTTPCKryptonClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDa
 {
   // see header file for class documentation
   tgtList.clear();
-  tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  tgtList.push_back(kAliHLTDataTypeHistogram);
   return tgtList.size();
 }
 
@@ -119,10 +120,10 @@ AliHLTComponent* AliHLTTPCKryptonClusterFinderComponent::Spawn()
 int AliHLTTPCKryptonClusterFinderComponent::DoInit( int argc, const char** argv )
 {
   // see header file for class documentation
-  if ( fClusterFinder )
+  if ( fKryptonClusterFinder )
     return EINPROGRESS;
 
-  fClusterFinder = new AliHLTTPCKryptonClusterFinder();
+  fKryptonClusterFinder = new AliHLTTPCKryptonClusterFinder();
 
   Int_t i = 0;
 
@@ -136,7 +137,7 @@ int AliHLTTPCKryptonClusterFinderComponent::DoInit( int argc, const char** argv
   }
 
   fReader = new AliHLTTPCDigitReaderDecoder();
-  fClusterFinder->SetReader(fReader);
+  fKryptonClusterFinder->SetReader(fReader);
  
   return 0;
 }
@@ -145,9 +146,9 @@ int AliHLTTPCKryptonClusterFinderComponent::DoDeinit()
 {
   // see header file for class documentation
 
-  if ( fClusterFinder )
-    delete fClusterFinder;
-  fClusterFinder = NULL;
+  if ( fKryptonClusterFinder )
+    delete fKryptonClusterFinder;
+  fKryptonClusterFinder = NULL;
  
   if ( fReader )
     delete fReader;
@@ -169,17 +170,25 @@ int AliHLTTPCKryptonClusterFinderComponent::DoEvent( const AliHLTComponentEventD
   unsigned long ndx;
 
   //  == OUTdatatype pointer
-  AliHLTTPCClusterData* outPtr;
+  TH1F* outPtr;
 
   AliHLTUInt8_t* outBPtr;
   UInt_t offset, mysize, nSize, tSize = 0;
 
+    
+
   outBPtr = outputPtr;
-  outPtr = (AliHLTTPCClusterData*)outBPtr;
+  outPtr = (TH1F*)outBPtr;
 
   Int_t slice, patch, row[2];
   unsigned long maxPoints, realPoints = 0;
 
+  //warnings!!!
+  nSize=0;
+  realPoints=0;
+  maxPoints=0;
+  //end warnings
+
   for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     {
       iter = blocks+ndx;
@@ -209,35 +218,30 @@ int AliHLTTPCKryptonClusterFinderComponent::DoEvent( const AliHLTComponentEventD
       row[1] = AliHLTTPCTransform::GetLastRow( patch );
 
 
-      fClusterFinder->SetPatch(patch);
-
-      outPtr = (AliHLTTPCClusterData*)outBPtr;
-
-      maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
+      fKryptonClusterFinder->SetPatch(patch);
 
-      fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
+      fKryptonClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
        
-      fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
+      fKryptonClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
       
-      fClusterFinder->FindNormalClusters();
+      fKryptonClusterFinder->FindRowClusters();
+
+      fKryptonClusterFinder->FindKryptonClusters();
+
+
 
-      fClusterFinder->FindKryptonClusters();
 
-      realPoints = fClusterFinder->GetNumberOfClusters();
-       
-    
       AliHLTComponentBlockData bd;
       FillBlockData( bd );
       bd.fOffset = offset;
       bd.fSize = mysize;
       bd.fSpecification = iter->fSpecification;
-      bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
-      //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
+      bd.fDataType = kAliHLTDataTypeHistogram;
       outputBlocks.push_back( bd );
   
       tSize += mysize;
       outBPtr += mysize;
-      outPtr = (AliHLTTPCClusterData*)outBPtr;
+      outPtr = (TH1F*)outBPtr;
   
   
       if ( tSize > size )
index bf7d5cb5089c336686a28fc525dc7082e94647c1..ed5c972418c64e06a335c7bb2b27b9ff15770656 100644 (file)
@@ -8,9 +8,9 @@
  * See cxx source for full Copyright notice                               */
 
 /** @file   AliHLTTPCKryptonClusterFinderComponent.h
-    @author Timm Steinbeck, Matthias Richter, Jochen Thaeder
+    @author Kenneth Aamodt, Kalliopi Kanaki
     @date   
-    @brief  The TPC cluster finder component.
+    @brief  The TPC krypton cluster finder component.
 */
 
 // see below for class documentation
@@ -35,7 +35,6 @@ class AliHLTTPCKryptonClusterFinderComponent : public AliHLTProcessor
 
         /**
          * constructor 
-         * @param mode    input type see e.g. @ref kClusterFinderUnpacked
          */
        AliHLTTPCKryptonClusterFinderComponent();
        /** destructor */
@@ -78,11 +77,10 @@ class AliHLTTPCKryptonClusterFinderComponent : public AliHLTProcessor
        /** assignment operator prohibited */
        AliHLTTPCKryptonClusterFinderComponent& operator=(const AliHLTTPCKryptonClusterFinderComponent&);
        /** the cluster finder object */
-       AliHLTTPCKryptonClusterFinder* fClusterFinder;                                      //!transient
+       AliHLTTPCKryptonClusterFinder* fKryptonClusterFinder;                               //!transient
        /** the reader object for data decoding */
        AliHLTTPCDigitReader* fReader;                                                      //!transient
 
        ClassDef(AliHLTTPCKryptonClusterFinderComponent, 0)
-
 };
 #endif