]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/misc/AliL3VHDLClusterFinder.h
New version of SPD raw-data reconstruction. The format now correponds to the actual...
[u/mrichter/AliRoot.git] / HLT / misc / AliL3VHDLClusterFinder.h
1 // @(#) $Id$
2 // Author: Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
3 //- Copyright & copy ALICE HLT Group
4 // See the implementation file for the detailed description
5
6 #ifndef AliL3VHDLClusterFinder_H
7 #define AliL3VHDLClusterFinder_H
8
9 #include "AliL3AltroMemHandler.h"
10
11 struct VHDLClusterData
12 {
13   UInt_t fTotalCharge; //total charge
14   UInt_t fPad;   //mean in pad
15   UInt_t fTime;  //mean in time
16   UInt_t fPad2;  //for error in XY direction
17   UInt_t fTime2; //for error in Z  direction
18   UInt_t fMean;  //mean for comparism
19   UInt_t fMerge; //number of merges
20   UShort_t fRow;     //row of cluster
21   UShort_t fLastPad; //last pad on merge
22   UInt_t fChargeFalling; //for deconvolution
23   UInt_t fLastCharge;    //for deconvolution
24 };
25 typedef struct VHDLClusterData VCData;
26
27 //size of ring buffer
28 #define N_mem 2500
29 //size of cluster list
30 #define N_clmem 5000
31
32
33 class AliL3VHDLClusterFinder 
34 {
35  public:
36   AliL3VHDLClusterFinder();
37   virtual ~AliL3VHDLClusterFinder();
38   
39   void ProcessDigits();
40
41   void SetXYError(Float_t f) {fXYErr=f;}
42   void SetZError(Float_t f) {fZErr=f;}
43   void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
44   void SetThreshold(UInt_t i=10) {fThreshold=i;}
45   void SetMatchWidth(UInt_t i=4) {fMatch=i;}
46   void SetMergeMinimum(UInt_t i=1) {fMinMerge=i;}
47   void SetSTDOutput(Bool_t f=kFALSE) {fstdout=f;}  
48   void SetCalcErr(Bool_t f=kTRUE) {fcalcerr=f;}
49   void SetASCIIInput(FILE *f){fAltromem.SetASCIIInput(f);}
50
51   Int_t GetNumberOfClusters() const {return fNClusters;}
52   
53  private:
54   AliL3AltroMemHandler fAltromem; //! pointer to the ALTRO memory?
55   VCData fSeq; //! C-structure containing the data sequence
56   VCData fSeqs[N_clmem]; //! array of C-structures containg the data sequence
57   UShort_t fPList[N_mem]; // pad list
58   UShort_t fRow,fNRow; // current row and number of rows
59   UChar_t  fPad,fNPad; // current pad and number of pads
60   UShort_t fRP,fWP,fOP,fEP,fFP; //pointer in ringbuffer
61   UShort_t fLast,fFirst;        //free area in memory
62
63   Int_t fTC; //totalcharge
64   Int_t fMT; //mean in time
65   Int_t fST; //sigma in time
66   Int_t fSM; //seq. mean
67
68   Bool_t fDeconvTime; // deconvoluted time
69   Bool_t fDeconvPad;  // deconvoluted pad
70   Bool_t fstdout;     // output flag
71   Bool_t fcalcerr;    // flag to calculate errors
72   Float_t fXYErr;     // error in XY
73   Float_t fZErr;      // error in Z
74
75   Int_t fMatch;       //match distance
76   UInt_t fThreshold;  //threshold for cluster
77   UInt_t fMinMerge;   //minimum number of merges for cluster
78   Int_t fNClusters;   //number of found clusters
79
80 #ifdef VHDLDEBUG
81   FILE *fdeb; //! file for debug
82 #endif
83
84   void Clear();
85   void ClearSeq(UShort_t i);
86   void FreeSeq(UShort_t i);
87   void IncPointer(UShort_t &p,Short_t add=1,UShort_t N=N_mem);
88   void IncWPointer();
89   void IncRPointer();
90   void NextFreeIndex();
91   void FlushMemory();
92   void PrepareMemory();
93   void OutputMemory();
94   void CompareSeq();
95   void MergeSeq();
96   void InsertSeq();
97   void MakeSequence();
98   void ProcessSequence();
99   //void WriteClusters(Int_t n_clusters,ClusterData *list);
100
101   ClassDef(AliL3VHDLClusterFinder,1)
102
103 };
104
105 #endif