]>
Commit | Line | Data |
---|---|---|
c51c5c6c | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
4 | #ifndef ALIHLTPHOSFOURIER_H | |
5 | #define ALIHLTPHOSFOURIER_H | |
6 | ||
7 | /************************************************************************** | |
8 | * This file is property of and copyright by the Experimental Nuclear * | |
9 | * Physics Group, Dep. of Physics * | |
10 | * University of Oslo, Norway, 2007 * | |
11 | * * | |
12 | * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.* | |
13 | * Contributors are mentioned in the code where appropriate. * | |
14 | * Please report bugs to perthi@fys.uio.no * | |
15 | * * | |
16 | * Permission to use, copy, modify and distribute this software and its * | |
17 | * documentation strictly for non-commercial purposes is hereby granted * | |
18 | * without fee, provided that the above copyright notice appears in all * | |
19 | * copies and that both the copyright notice and this permission notice * | |
20 | * appear in the supporting documentation. The authors make no claims * | |
21 | * about the suitability of this software for any purpose. It is * | |
22 | * provided "as is" without express or implied warranty. * | |
23 | **************************************************************************/ | |
24 | ||
25 | #include "Rtypes.h" | |
26 | #include "TVirtualFFT.h" | |
27 | #include "TMath.h" | |
a9c18ed8 | 28 | // #include "AliHLTPHOSConstant.h" |
c51c5c6c | 29 | #include <iostream> |
30 | ||
31 | #include "AliHLTPHOSRcuFFTDataStruct.h" | |
32 | ||
a9c18ed8 | 33 | // using namespace PhosHLTConst; |
34 | ||
c51c5c6c | 35 | using namespace std; |
36 | ||
37 | #define SAMPLING_FREQUENCY 10 | |
38 | ||
39 | class AliHLTPHOSFourier | |
40 | { | |
41 | public: | |
42 | AliHLTPHOSFourier(); | |
43 | virtual ~AliHLTPHOSFourier(); | |
44 | AliHLTPHOSRcuFFTDataStruct GetPSD(); | |
45 | void ProcessFourier(const Int_t *data, const int length, const int z, const int x, const int gain, const int event =-1); | |
46 | ||
47 | int GetDataSize() {return fFixedDataSize;}; | |
48 | private: | |
49 | void Init(); | |
50 | void Int2Double(const Int_t *inputarray, double *outputarray, const int size); | |
51 | bool CheckSignal(const Int_t *data, const int length); | |
52 | ||
53 | double EvaluateMagnitude(const double re, const double im); | |
54 | ||
55 | // double *fAccumulateFFTsAll[N_GAINS]; | |
56 | // int fNFFTsAll[N_GAINS]; | |
57 | // double *fAccumulateFFTs [N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS]; | |
58 | // int fNFFTs[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS]; | |
59 | ||
60 | void ResetEventPSD(const int gain); | |
61 | TVirtualFFT *fFFT_own; | |
62 | ||
63 | double *fFFTInputArray; | |
64 | double *fFFTOutputArray; | |
65 | bool fIsFirstChannel; | |
66 | int fFixedDataSize; | |
67 | ||
68 | // AliHLTPHOSRcuFFTDataStruct fFFTOupuStruct[N_GAINS]; | |
69 | AliHLTPHOSRcuFFTDataStruct fFFTOupuStruct; | |
70 | ||
71 | int fCurrentEvent; | |
72 | ||
73 | template<typename T> | |
74 | T Max(T *array, int N) const | |
75 | { | |
76 | T tmpMax = 0; | |
77 | ||
78 | for(int i = 0; i < N; i++) | |
79 | { | |
80 | if(array[i] > tmpMax) | |
81 | { | |
82 | tmpMax = array[i]; | |
83 | } | |
84 | } | |
85 | ||
86 | return tmpMax; | |
87 | } | |
88 | ||
89 | ||
90 | template<typename T> | |
91 | T Min(T *array, int N) const | |
92 | { | |
93 | ||
94 | T tmpMin = Max(array , N); | |
95 | ||
96 | // T tmpMin = 100; | |
97 | ||
98 | for(int i = 0; i < N; i++) | |
99 | { | |
100 | if(array[i] < tmpMin) | |
101 | { | |
102 | tmpMin = array[i]; | |
103 | } | |
104 | } | |
105 | ||
106 | return tmpMin; | |
107 | } | |
108 | ||
109 | ||
110 | AliHLTPHOSFourier(const AliHLTPHOSFourier&); | |
111 | AliHLTPHOSFourier & operator=(const AliHLTPHOSFourier&){return *this;}; | |
112 | ||
113 | }; | |
114 | ||
115 | #endif | |
116 | ||
117 | // AliHLTPHOSRcuAltroPatternTestComponent(const AliHLTPHOSRcuAltroPatternTestComponent &); | |
118 | // AliHLTPHOSRcuAltroPatternTestComponent & operator = (const AliHLTPHOSRcuAltroPatternTestComponent &); |