]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCClusterFinder.h
debug output removed
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCClusterFinder.h
index 5eea963763a516c0d48a68ac36a7857d4d260793..d16f5258a54e26ae052fa2ffaed9bc3428d101f5 100644 (file)
@@ -1,25 +1,32 @@
-// @(#) $Id$
-// Original: AliHLTClustFinderNew.h,v 1.13 2004/06/18 10:55:26 loizides 
+//-*- Mode: C++ -*-
+// $Id$
 
-#ifndef AliHLTTPC_CLUSTERFINDER
-#define AliHLTTPC_CLUSTERFINDER
+#ifndef ALIHLTTPCCLUSTERFINDER_H
+#define ALIHLTTPCCLUSTERFINDER_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   AliHLTTPCClusterFinder.h
-    @author Anders Vestbo, Constantin Loizides
-           Kenneth Aamodt kenneth.aamodt@student.uib.no
-    @brief  Cluster Finder for the TPC
-*/
+/ @file   AliHLTTPCClusterFinder.h
+//  @author Anders Vestbo, Constantin Loizides
+//         Kenneth Aamodt kenneth.aamodt@student.uib.no
+//  @brief  HLT Cluster Finder for the TPC
+//  @note
 
 #include "AliHLTLogging.h"
 #include <vector>
+#include "AliHLTTPCTransform.h"
+#include "AliHLTTPCDigitData.h"
+#include "AliHLTTPCDigitReader.h"
+#include "AliTPCRecoParam.h"
+#include "AliHLTTPCClusterMCData.h"
+#include "AliHLTTPCRawCluster.h"
 
 class AliHLTTPCPad;
 class AliHLTTPCSpacePointData;
-class AliHLTTPCDigitReader;
 class AliHLTTPCClusters;
+class AliTPCTransform;
+class AliTPCParam;
 
 /**
  * @class AliHLTTPCClusterFinder
@@ -115,57 +122,101 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
     UInt_t fLastCharge;    //for deconvolution
     UInt_t fLastMergedPad; //dont merge twice per pad
     Int_t fRow;             //row value
+    UInt_t fQMax;           //qmax
   };
   typedef struct AliClusterData AliClusterData; //!
 
+  static Bool_t CompareWeights( const AliHLTTPCClusterMCWeight &mc1,  const AliHLTTPCClusterMCWeight &mc2 ){ return mc1.fWeight > mc2.fWeight; }
+  
+
   /** standard constructor */
   AliHLTTPCClusterFinder();
+
   /** destructor */
   virtual ~AliHLTTPCClusterFinder();
 
-  void Read(void* ptr,unsigned long size);
-
-  void InitSlice(Int_t slice,Int_t patch,Int_t firstrow, Int_t lastrow,Int_t maxpoints);
+  /** Initialize the slice */
   void InitSlice(Int_t slice,Int_t patch,Int_t maxpoints);
-  void ProcessDigits();
 
+  /** Initializes the pad array (vector)*/
+  void InitializePadArray();
+
+  /** Deinitialize the pad array (vector)*/
+  Int_t DeInitializePadArray();
+
+  /** Read the data in unsorted format, storing the clustercandidates */
+  void ReadDataUnsorted(void* ptr,unsigned long size);
+
+  /** Read the data in unsorted format, and deconvolute the signals for each pad in time direction */
+  void ReadDataUnsortedDeconvoluteTime(void* ptr,unsigned long size);
+
+  /** Loops over all rows finding the clusters */
+  void FindClusters();
+
+  /** Compare two neighbouring pads for matching clustercandidates */
+  Bool_t ComparePads(AliHLTTPCPad *nextPad,AliHLTTPCClusters* candidate,Int_t nextPadToRead);
+  
+  /**  Fills the hw address list */
+  Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
+
+ /**  Fills the mc info */
+  Int_t FillOutputMCInfo(AliHLTTPCClusterMCLabel * outputMCInfo, Int_t maxNumberOfClusterMCInfo);
+
+  Int_t FillOutputRaw(AliHLTTPCRawCluster* rawClusters, unsigned sizeInByte) const;
+
+  /** Set the pointer to the outputbuffer */
   void SetOutputArray(AliHLTTPCSpacePointData *pt);
+
+  /** Returns the number of clusters */
+  Int_t GetNumberOfClusters() const {return fNClusters;}
+
+  /** Returns the Ocuppancy limit */
+  Float_t GetOccupancyLimit() const {return fOccupancyLimit;}
+  
+  // setters
+  void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
+  void SetDeconvPad(Bool_t f) {fDeconvPad=f;}
+  void SetDeconvTime(Bool_t f) {fDeconvTime=f;}
+  void SetUnsorted(Int_t unsorted){fUnsorted=unsorted;}
+  void SetPatch(Int_t patch){fCurrentPatch=patch;}
+  void SetDoPadSelection(Bool_t input){fDoPadSelection=input;}
+  void SetLastTimeBin(Int_t ltb){fLastTimeBin=ltb;}
+  void SetFirstTimeBin(Int_t ftb){fFirstTimeBin=ftb;}
+  void SetReleaseMemory( Bool_t v ){ fReleaseMemory = v;}
+  void UpdateLastTimeBin(){fLastTimeBin=AliHLTTPCTransform::GetNTimeBins();}
+
+//---------------------------------- Under this line the old sorted clusterfinder functions can be found --------------------------------
+  void Read(void* ptr,unsigned long size);
+  void ProcessDigits();
   void WriteClusters(Int_t n_clusters,AliClusterData *list);
+  void WriteClusters(Int_t nclusters,AliHLTTPCClusters *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;}
   void SetThreshold(UInt_t i) {fThreshold=i;}
   void SetOccupancyLimit(Float_t f) {fOccupancyLimit=f;}
-  void SetSignalThreshold(Int_t i) {fSignalThreshold=i;}
-  void SetNSigmaThreshold(Double_t d) {fNSigmaThreshold=d;}
   void SetMatchWidth(UInt_t i) {fMatch=i;}
   void SetSTDOutput(Bool_t f=kFALSE) {fStdout=f;}  
   void SetCalcErr(Bool_t f=kTRUE) {fCalcerr=f;}
-  void SetRawSP(Bool_t f=kFALSE) {fRawSP=f;}
+  void SetFillRawClusters(Bool_t f=kFALSE) {fFillRawClusters=f;}
   void SetReader(AliHLTTPCDigitReader* f){fDigitReader = f;}
-  Int_t GetNumberOfClusters() const {return fNClusters;}
 
-  //----------------------------------Methods for the new unsorted way of reading data ----------
-  void ReadDataUnsorted(void* ptr,unsigned long size);
-  void FindClusters();
-  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);
+  void Set32BitFormat(Bool_t flag){f32BitFormat = flag;}
 
-  void SetDoPadSelection(Bool_t input){fDoPadSelection=input;}
-  
-  Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
+  void SetDoMC(Bool_t flag){fDoMC = flag;}
   
   vector<AliHLTUInt16_t> fClustersHWAddressVector;  //! transient
   
   typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
   
   vector<AliHLTTPCPadVector> fRowPadVector;     //! transient
+  
+  void FillMCClusterVector(vector<AliHLTTPCDigitData> *digitData);
+
+  vector<AliHLTTPCClusterMCWeight> GetClusterMCInfo() const {return fClusterMCVector;}
+
+  Bool_t UpdateCalibDB();
+
  protected: 
   /** copy constructor prohibited */
   AliHLTTPCClusterFinder(const AliHLTTPCClusterFinder&);
@@ -175,41 +226,39 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   AliHLTTPCSpacePointData *fSpacePointData; //! array of space points
   AliHLTTPCDigitReader *fDigitReader;       //! reader instance
 
-  UChar_t* fPtr;   //! pointer to packed block
-  unsigned long fSize; //packed block size
-  Bool_t fDeconvTime; //deconv in time direction
-  Bool_t fDeconvPad;  //deconv in pad direction
-  Bool_t fStdout;     //have print out in write clusters
-  Bool_t fCalcerr;    //calculate centroid sigmas
-  Bool_t fRawSP;      //store centroids in raw system
-
-
-  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 for clusters
-  /** threshold for zero suppression (applied per bin) */
-  Int_t fSignalThreshold;// see above
-  /** threshold for zero suppression 2007 December run */
-  Double_t fNSigmaThreshold; // see above
-  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
+  UChar_t* fPtr;           //! pointer to packed block
+  unsigned long fSize;     //! packed block size
+  Bool_t fDeconvTime;      //! deconv in time direction
+  Bool_t fDeconvPad;       //! deconv in pad direction
+  Bool_t fStdout;          //! have print out in write clusters
+  Bool_t fCalcerr;         //! calculate centroid sigmas
+  Bool_t fFillRawClusters; //! store centroids in raw system in separate array
+
+
+  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 for clusters
+  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
   
-  Float_t fOccupancyLimit; // Occupancy Limit
+  Float_t fOccupancyLimit;    //! Occupancy Limit
 
-  Int_t fUnsorted;       // enable for processing of unsorted digit data
-  Bool_t fVectorInitialized;
+  Int_t fUnsorted;            //! enable for processing of unsorted digit data
+  Bool_t fVectorInitialized;  //! flag to check if pad vector is initialized
+  vector<AliHLTTPCClusters> fClusters;                             //! transient
 
-  //typedef vector<AliHLTTPCPad*> AliHLTTPCPadVector;
+  vector<AliHLTTPCClusterMCLabel> fClustersMCInfo;                           //! transient
 
-  //vector<AliHLTTPCPadVector> fRowPadVector;                        //! transient
+  vector<AliHLTTPCDigitData> fMCDigits;                            //! transient
 
-  vector<AliHLTTPCClusters> fClusters;                             //! transient
+  vector<AliHLTTPCRawCluster> fRawClusters;                        //! transient
   
   UInt_t* fNumberOfPadsInRow;                                      //! transient
   
@@ -219,11 +268,34 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
 
   Bool_t fDoPadSelection;                                         //! transient
 
+  Int_t fFirstTimeBin;                                            //! transient
+  
+  Int_t fLastTimeBin;                                             //! transient
+
+  UInt_t fTotalChargeOfPreviousClusterCandidate;                   //! transient
+
+  Bool_t fChargeOfCandidatesFalling;                               //! transient
+
+  Bool_t f32BitFormat;                                             //! transient
+
+  Bool_t fDoMC;                                                    //! transient
+
+  vector<AliHLTTPCClusterMCWeight> fClusterMCVector;                               //! transient
+
+  AliTPCTransform * fOfflineTransform;                             //! transient
+
+  AliTPCParam   *fOfflineTPCParam;                                 //! transient
+
+  AliTPCRecoParam fOfflineTPCRecoParam;                            //! transient
+
+  Float_t fTimeMeanDiff;                                           //! transient
+
+  Bool_t fReleaseMemory; //! flag to release the memory after each event
 
 #ifdef do_mc
-  void GetTrackID(Int_t pad,Int_t time,Int_t *trackID);
+  void GetTrackID(Int_t pad,Int_t time,Int_t *trackID) const;
 #endif
   
-  ClassDef(AliHLTTPCClusterFinder,5) //Fast cluster finder
+  ClassDef(AliHLTTPCClusterFinder, 0) //Fast cluster finder
 };
 #endif