Line data Source code
1 : //-*- Mode: C++ -*-
2 : // $Id: AliHLTPHOSFourier.h 34951 2009-09-23 14:35:38Z phille $
3 :
4 : #ifndef ALIHLTCALOFOURIER_H
5 : #define ALIHLTCALOFOURIER_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"
28 :
29 : // #include "AliHLTCaloConstant.h"
30 :
31 : #include "AliHLTCaloConstants.h"
32 :
33 : #include <iostream>
34 :
35 : #include "AliHLTCaloRcuFFTDataStruct.h"
36 :
37 : //using namespace PhosHLTConst;
38 : //using namespace CaloHLTConst;
39 :
40 : using namespace std;
41 :
42 : #define SAMPLING_FREQUENCY 10
43 :
44 : class AliHLTCaloFourier
45 : {
46 : public:
47 : AliHLTCaloFourier();
48 : virtual ~AliHLTCaloFourier();
49 : AliHLTCaloRcuFFTDataStruct GetPSD();
50 : void ProcessFourier(const Int_t *data, const int length, const int z, const int x, const int gain, const int event =-1);
51 :
52 0 : int GetDataSize() {return fFixedDataSize;};
53 : private:
54 : void Init();
55 : void Int2Double(const Int_t *inputarray, double *outputarray, const int size);
56 : bool CheckSignal(const Int_t *data, const int length);
57 :
58 : double EvaluateMagnitude(const double re, const double im);
59 :
60 : // double *fAccumulateFFTsAll[N_GAINS];
61 : // int fNFFTsAll[N_GAINS];
62 : // double *fAccumulateFFTs [N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
63 : // int fNFFTs[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
64 :
65 : void ResetEventPSD(const int gain);
66 : TVirtualFFT *fFFT_own;
67 :
68 : double *fFFTInputArray;
69 : double *fFFTOutputArray;
70 : bool fIsFirstChannel;
71 : int fFixedDataSize;
72 :
73 : // AliHLTCaloRcuFFTDataStruct fFFTOupuStruct[N_GAINS];
74 : AliHLTCaloRcuFFTDataStruct fFFTOupuStruct;
75 :
76 : int fCurrentEvent;
77 :
78 : template<typename T>
79 : T Max(T *array, int N) const
80 : {
81 : T tmpMax = 0;
82 :
83 0 : for(int i = 0; i < N; i++)
84 : {
85 0 : if(array[i] > tmpMax)
86 : {
87 : tmpMax = array[i];
88 0 : }
89 : }
90 :
91 0 : return tmpMax;
92 : }
93 :
94 :
95 : template<typename T>
96 : T Min(T *array, int N) const
97 : {
98 :
99 0 : T tmpMin = Max(array , N);
100 :
101 : // T tmpMin = 100;
102 :
103 0 : for(int i = 0; i < N; i++)
104 : {
105 0 : if(array[i] < tmpMin)
106 : {
107 : tmpMin = array[i];
108 0 : }
109 : }
110 :
111 0 : return tmpMin;
112 : }
113 :
114 :
115 : AliHLTCaloFourier(const AliHLTCaloFourier&);
116 : AliHLTCaloFourier & operator=(const AliHLTCaloFourier&){return *this;};
117 :
118 :
119 :
120 6 : ClassDef(AliHLTCaloFourier, 1);
121 : };
122 :
123 : #endif
124 :
125 : // AliHLTCaloRcuAltroPatternTestComponent(const AliHLTCaloRcuAltroPatternTestComponent &);
126 : // AliHLTCaloRcuAltroPatternTestComponent & operator = (const AliHLTCaloRcuAltroPatternTestComponent &);
|