8e1f5064 |
1 | #ifndef AliL3_VHDLClusterFinder |
2 | #define AliL3_VHDLClusterFinder |
3 | |
4 | #include "AliL3RootTypes.h" |
5 | #include "AliL3Logging.h" |
6 | #include "AliL3AltroMemHandler.h" |
7 | |
8 | //#define DEBUG |
9 | |
10 | struct VHDLClusterData |
11 | { |
12 | UInt_t fTotalCharge; |
13 | UInt_t fPad; //mean in pad |
14 | UInt_t fTime; //mean in time |
15 | UInt_t fPad2; //for error in XY direction |
16 | UInt_t fTime2; //for error in Z direction |
17 | UInt_t fMean; //mean for comparism |
18 | UInt_t fMerge; //number of merges |
19 | UShort_t fRow; //row of cluster |
20 | UShort_t fLastPad; //last pad on merge |
21 | //UInt_t fChargeFalling; //for deconvolution |
22 | //UInt_t fLastCharge; //for deconvolution |
23 | }; |
24 | typedef struct VHDLClusterData VCData; |
25 | |
26 | //size of ring buffer |
27 | #define N_mem 2500 |
28 | //size of cluster list |
29 | #define N_clmem 5000 |
30 | |
31 | |
32 | class AliL3VHDLClusterFinder { |
33 | |
34 | private: |
35 | AliL3AltroMemHandler fAltromem; //! |
36 | VCData fSeq; //! |
37 | VCData fSeqs[N_clmem]; //! |
38 | UShort_t fPList[N_mem]; |
39 | UShort_t fRow,fNRow; |
40 | UChar_t fPad,fNPad; |
41 | UShort_t fRP,fWP,fOP,fEP,fFP; //pointer in ringbuffer |
42 | UShort_t fLast,fFirst; //free area in memory |
43 | |
44 | Bool_t fDeconvTime; //not used for now |
45 | Bool_t fDeconvPad; |
46 | Bool_t fstdout; |
47 | Bool_t fcalcerr; |
48 | Float_t fXYErr; |
49 | Float_t fZErr; |
50 | |
51 | Int_t fMatch; //match distance |
52 | UInt_t fThreshold; //threshold for cluster |
53 | UInt_t fMinMerge; //minimum number of merges for cluster |
54 | Int_t fNClusters; //number of found clusters |
55 | |
56 | #ifdef DEBUG |
57 | FILE *fdeb; //! |
58 | #endif |
59 | |
60 | void Clear(); |
61 | void ClearSeq(UShort_t i); |
62 | void FreeSeq(UShort_t i); |
63 | void IncPointer(UShort_t &p,Short_t add=1,UShort_t N=N_mem); |
64 | void IncWPointer(); |
65 | void IncRPointer(); |
66 | void NextFreeIndex(); |
67 | void FlushMemory(); |
68 | void PrepareMemory(); |
69 | void OutputMemory(); |
70 | void CompareSeq(); |
71 | void MergeSeq(); |
72 | void InsertSeq(); |
73 | void ProcessSequence(); |
74 | //void WriteClusters(Int_t n_clusters,ClusterData *list); |
75 | |
76 | public: |
77 | AliL3VHDLClusterFinder(); |
78 | virtual ~AliL3VHDLClusterFinder(); |
79 | |
80 | void ProcessDigits(); |
81 | |
82 | void SetXYError(Float_t f) {fXYErr=f;} |
83 | void SetZError(Float_t f) {fZErr=f;} |
84 | void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;} |
85 | void SetThreshold(UInt_t i=10) {fThreshold=i;} |
86 | void SetMatchWidth(UInt_t i=4) {fMatch=i;} |
87 | void SetMergeMinimum(UInt_t i=1) {fMinMerge=i;} |
88 | void SetSTDOutput(Bool_t f=kFALSE) {fstdout=f;} |
89 | void SetCalcErr(Bool_t f=kTRUE) {fcalcerr=f;} |
90 | void SetASCIIInput(FILE *f){fAltromem.SetASCIIInput(f);} |
91 | |
92 | Int_t GetNumberOfClusters() {return fNClusters;} |
93 | |
94 | ClassDef(AliL3VHDLClusterFinder,1) |
95 | |
96 | }; |
97 | |
98 | #endif |