]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSFourier.h
- changes to make the clusterisation work for EMCAL
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSFourier.h
CommitLineData
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"
4f4b7ba4 28#include "AliHLTPHOSConstant.h"
c51c5c6c 29#include <iostream>
30
31#include "AliHLTPHOSRcuFFTDataStruct.h"
32
33using namespace PhosHLTConst;
34using namespace std;
35
36#define SAMPLING_FREQUENCY 10
37
38class AliHLTPHOSFourier
39{
40 public:
41 AliHLTPHOSFourier();
42 virtual ~AliHLTPHOSFourier();
43 AliHLTPHOSRcuFFTDataStruct GetPSD();
44 void ProcessFourier(const Int_t *data, const int length, const int z, const int x, const int gain, const int event =-1);
45
46 int GetDataSize() {return fFixedDataSize;};
47private:
48 void Init();
49 void Int2Double(const Int_t *inputarray, double *outputarray, const int size);
50 bool CheckSignal(const Int_t *data, const int length);
51
52 double EvaluateMagnitude(const double re, const double im);
53
54 // double *fAccumulateFFTsAll[N_GAINS];
55 // int fNFFTsAll[N_GAINS];
56 // double *fAccumulateFFTs [N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
57 // int fNFFTs[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
58
59 void ResetEventPSD(const int gain);
60 TVirtualFFT *fFFT_own;
61
62 double *fFFTInputArray;
63 double *fFFTOutputArray;
64 bool fIsFirstChannel;
65 int fFixedDataSize;
66
67 // AliHLTPHOSRcuFFTDataStruct fFFTOupuStruct[N_GAINS];
68 AliHLTPHOSRcuFFTDataStruct fFFTOupuStruct;
69
70 int fCurrentEvent;
71
72 template<typename T>
73 T Max(T *array, int N) const
74 {
75 T tmpMax = 0;
76
77 for(int i = 0; i < N; i++)
78 {
79 if(array[i] > tmpMax)
80 {
81 tmpMax = array[i];
82 }
83 }
84
85 return tmpMax;
86 }
87
88
89 template<typename T>
90 T Min(T *array, int N) const
91 {
92
93 T tmpMin = Max(array , N);
94
95 // T tmpMin = 100;
96
97 for(int i = 0; i < N; i++)
98 {
99 if(array[i] < tmpMin)
100 {
101 tmpMin = array[i];
102 }
103 }
104
105 return tmpMin;
106 }
107
108
109 AliHLTPHOSFourier(const AliHLTPHOSFourier&);
110 AliHLTPHOSFourier & operator=(const AliHLTPHOSFourier&){return *this;};
111
112};
113
114#endif
115
116// AliHLTPHOSRcuAltroPatternTestComponent(const AliHLTPHOSRcuAltroPatternTestComponent &);
117// AliHLTPHOSRcuAltroPatternTestComponent & operator = (const AliHLTPHOSRcuAltroPatternTestComponent &);