cbab66dd |
1 | #include "AliHLTPHOSRawAnalyzer.h" |
2 | #include <iostream> |
3 | |
4 | using std::cout; |
5 | using std::endl; |
6 | |
7 | |
8 | |
9 | AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer():fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), n(99999) |
10 | { |
11 | |
12 | |
13 | } |
14 | |
15 | AliHLTPHOSRawAnalyzer::~AliHLTPHOSRawAnalyzer() |
16 | { |
17 | |
18 | } |
19 | |
20 | AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(AliHLTPHOSRawAnalyzer const&):fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), n(99999) |
21 | { |
22 | |
23 | } |
24 | |
25 | /** |
26 | * Main constructor |
27 | * @param dataPtr Data array for wich a subarray will be taken to perform the fit |
28 | * @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time |
29 | **/ |
30 | AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(double *dtaPtr, double fs):fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), n(99999) |
31 | { |
32 | fFloatDataPtr = dtaPtr; |
33 | fSampleFrequency = fs; |
34 | } //end |
35 | |
36 | |
37 | /** |
38 | * Attemps to level the basline to zero. |
39 | * The baseline will be calculated from the pretrigger samples and subtracted from the |
40 | * data array. |
41 | * If pretrigger samples are not present then the basline correction will be incorrect. |
42 | * @param dataPtr array for wich to correct the basline |
43 | * @param N the number of pretrigger samples used to calculate the baseline. |
44 | **/ |
45 | void |
46 | AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, int N) |
47 | { |
48 | fFloatDataPtr = dataPtr; |
49 | n=N; |
50 | cout << "Baseline correction not yet implemeted" << endl; |
51 | } //end BaselineCorrection |
52 | |
53 | |
54 | /** |
55 | * Shifts the basline with the amount given by baselineValue |
56 | * If pretrigger samples are not present then the basline correction will be incorrect. |
57 | * @param dataPtr array for wich to correct the basline |
58 | * @param BaslineValue the basline value to subtract.. |
59 | **/ |
60 | void |
61 | AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, double baselineValue) |
62 | { |
63 | fFloatDataPtr = dataPtr; |
64 | printf("\nbaselineValue = %f\n", baselineValue); |
65 | cout << "Baseline correction not yet implemeted" << endl; |
66 | } //end BaslineCorrection |
67 | |
68 | |
69 | /** |
70 | * Gives the timing in entities of sample indexes |
71 | * Physical time is found by multiplying with the sampling intervall (Ts). |
72 | **/ |
73 | float |
74 | AliHLTPHOSRawAnalyzer::GetTiming() |
75 | { |
76 | return fDTof; |
77 | } //end GetTiming |
78 | |
79 | |
80 | /** |
81 | * Gives the time in entities of ADC channels (quantization levels). |
82 | * Absolute enrgy is found by multiplying with offline calibration constants. |
83 | **/ |
84 | float |
85 | AliHLTPHOSRawAnalyzer::GetEnergy() |
86 | { |
87 | return fDAmpl; |
88 | } //end GetEnergy |
89 | |
90 | |
91 | /** |
92 | * Set data array. Overrides data data array set in the constructor. |
93 | **/ |
94 | void |
95 | AliHLTPHOSRawAnalyzer::SetData(double *data) |
96 | { |
97 | // double *dta; |
98 | // dta = data; |
99 | fFloatDataPtr = data; |
100 | // cout << "Set data not yet implemented" << endl; |
101 | } |
102 | |
103 | void |
104 | AliHLTPHOSRawAnalyzer::SetSampleFreq(double freq) |
105 | { |
106 | |
107 | } |
108 | |
109 | int |
110 | AliHLTPHOSRawAnalyzer::FindStartIndex(double treshold) |
111 | { |
112 | printf("\ntreshold = %f \n", treshold); |
113 | cout << "Find Start index not yet implemented" << endl; |
114 | return 0; |
115 | } //end FindStartIndex |
116 | |
117 | |
118 | /** |
119 | * This function applies only to the Chi and Least mean square fit. An initial guess is made |
120 | * based on the average of the first 5 samples and the first value exeeding this value. |
121 | **/ |
122 | void |
123 | AliHLTPHOSRawAnalyzer::MakeInitialGuess() |
124 | { |
125 | cout << "Make initial guess not yet implemeted" << endl; |
126 | } |
127 | |
128 | |
129 | /** |
130 | * This function applies only to the Chi and Least mean square fit. An initial guess is made |
131 | * based on the average of the first 5 samples and the first value exeeding threshold + this value. |
132 | * @param treshold The index of the first value above treshold is ntaken to be the first value. |
133 | **/ |
134 | void |
135 | AliHLTPHOSRawAnalyzer::MakeInitialGuess(int treshold) |
136 | { |
137 | printf("\ntreshold = %d\n", treshold); |
138 | cout << "Make initial guess not yet implemeted" << endl; |
139 | } |