]>
Commit | Line | Data |
---|---|---|
0a211711 | 1 | /************************************************************************** |
2 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Per Thomas Hille for the ALICE HLT Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
cbab66dd | 16 | #include "AliHLTPHOSRawAnalyzer.h" |
cbab66dd | 17 | |
cbab66dd | 18 | |
b444d727 | 19 | AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer(): AliHLTPHOSBase(), |
20 | fFloatDataPtr(0), | |
21 | fIntDataPtr(0), | |
22 | fSampleFrequency(10), | |
23 | fDTofGuess(-1), | |
24 | fDAmplGuess(-1), | |
25 | fTau(2), | |
26 | fDTof(99999), | |
27 | fDAmpl(99999), | |
28 | fStartIndex(0) | |
cbab66dd | 29 | { |
e086ee30 | 30 | fIntDataPtr = new UInt_t[1008]; |
cbab66dd | 31 | } |
32 | ||
33 | AliHLTPHOSRawAnalyzer::~AliHLTPHOSRawAnalyzer() | |
34 | { | |
9c9d15d6 | 35 | delete[] fIntDataPtr; |
cbab66dd | 36 | } |
37 | ||
43dd7c5e | 38 | |
cbab66dd | 39 | |
40 | /** | |
41 | * Main constructor | |
d504c864 | 42 | * @param dtaPtr Data array for wich a subarray will be taken to perform the fit |
cbab66dd | 43 | * @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time |
44 | **/ | |
b444d727 | 45 | AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(double * /*dtaPtr*/, double fs): AliHLTPHOSBase(), |
46 | fFloatDataPtr(0), | |
47 | fIntDataPtr(0), | |
48 | fSampleFrequency(10), | |
49 | fDTofGuess(-1), | |
50 | fDAmplGuess(-1), | |
51 | fTau(2), | |
52 | fDTof(99999), | |
53 | fDAmpl(99999), | |
54 | fStartIndex(0) | |
cbab66dd | 55 | { |
cbab66dd | 56 | fSampleFrequency = fs; |
57 | } //end | |
58 | ||
59 | ||
60 | /** | |
61 | * Attemps to level the basline to zero. | |
62 | * The baseline will be calculated from the pretrigger samples and subtracted from the | |
63 | * data array. | |
64 | * If pretrigger samples are not present then the basline correction will be incorrect. | |
65 | * @param dataPtr array for wich to correct the basline | |
66 | * @param N the number of pretrigger samples used to calculate the baseline. | |
67 | **/ | |
68 | void | |
1804b020 | 69 | AliHLTPHOSRawAnalyzer::BaselineCorrection(double * /*dataPtr*/, int /*N*/) |
cbab66dd | 70 | { |
8efbf5fe | 71 | |
cbab66dd | 72 | } //end BaselineCorrection |
73 | ||
74 | ||
75 | /** | |
ee1684e6 | 76 | * Shifts the baseline with the amount given by baselineValue |
cbab66dd | 77 | * If pretrigger samples are not present then the basline correction will be incorrect. |
78 | * @param dataPtr array for wich to correct the basline | |
d504c864 | 79 | * @param baselineValue the basline value to subtract.. |
cbab66dd | 80 | **/ |
81 | void | |
1804b020 | 82 | AliHLTPHOSRawAnalyzer::BaselineCorrection(double * /*dataPtr*/, double baselineValue) |
cbab66dd | 83 | { |
8efbf5fe | 84 | |
cbab66dd | 85 | } //end BaslineCorrection |
86 | ||
87 | ||
88 | /** | |
89 | * Gives the timing in entities of sample indexes | |
90 | * Physical time is found by multiplying with the sampling intervall (Ts). | |
91 | **/ | |
92 | float | |
d504c864 | 93 | AliHLTPHOSRawAnalyzer::GetTiming() const |
cbab66dd | 94 | { |
95 | return fDTof; | |
96 | } //end GetTiming | |
97 | ||
98 | ||
99 | /** | |
100 | * Gives the time in entities of ADC channels (quantization levels). | |
101 | * Absolute enrgy is found by multiplying with offline calibration constants. | |
102 | **/ | |
103 | float | |
d504c864 | 104 | AliHLTPHOSRawAnalyzer::GetEnergy() const |
cbab66dd | 105 | { |
106 | return fDAmpl; | |
107 | } //end GetEnergy | |
108 | ||
109 | ||
e086ee30 | 110 | /** |
111 | * Set data array. Overrides data data array set in the constructor. | |
112 | **/ | |
e086ee30 | 113 | void |
939c67e7 | 114 | AliHLTPHOSRawAnalyzer::SetData(const UInt_t *data) |
e086ee30 | 115 | { |
e086ee30 | 116 | fIntDataPtr = data; |
117 | } | |
118 | ||
cbab66dd | 119 | /** |
120 | * Set data array. Overrides data data array set in the constructor. | |
121 | **/ | |
122 | void | |
939c67e7 | 123 | AliHLTPHOSRawAnalyzer::SetData(const double *data) |
cbab66dd | 124 | { |
cbab66dd | 125 | fFloatDataPtr = data; |
cbab66dd | 126 | } |
127 | ||
e086ee30 | 128 | |
129 | ||
cbab66dd | 130 | void |
131 | AliHLTPHOSRawAnalyzer::SetSampleFreq(double freq) | |
132 | { | |
a4a2a400 | 133 | fSampleFrequency = freq; |
cbab66dd | 134 | } |
135 | ||
136 | int | |
1804b020 | 137 | AliHLTPHOSRawAnalyzer::FindStartIndex(double /*treshold*/) |
cbab66dd | 138 | { |
8efbf5fe | 139 | // cout << "Find Start index not yet implemented" << endl; |
cbab66dd | 140 | return 0; |
141 | } //end FindStartIndex | |
142 | ||
143 | ||
144 | /** | |
145 | * This function applies only to the Chi and Least mean square fit. An initial guess is made | |
146 | * based on the average of the first 5 samples and the first value exeeding this value. | |
147 | **/ | |
148 | void | |
149 | AliHLTPHOSRawAnalyzer::MakeInitialGuess() | |
150 | { | |
8efbf5fe | 151 | // cout << "Make initial guess not yet implemeted" << endl; |
cbab66dd | 152 | } |
153 | ||
154 | ||
155 | /** | |
156 | * This function applies only to the Chi and Least mean square fit. An initial guess is made | |
157 | * based on the average of the first 5 samples and the first value exeeding threshold + this value. | |
158 | * @param treshold The index of the first value above treshold is ntaken to be the first value. | |
159 | **/ | |
160 | void | |
1804b020 | 161 | AliHLTPHOSRawAnalyzer::MakeInitialGuess(int /*treshold*/) |
cbab66dd | 162 | { |
8efbf5fe | 163 | // cout << "Make initial guess not yet implemeted" << endl; |
cbab66dd | 164 | } |
68d9caee | 165 | |
dbd79fad | 166 | |
68d9caee | 167 | void |
168 | AliHLTPHOSRawAnalyzer::SetStartIndex(int index) | |
169 | { | |
170 | fStartIndex = index; | |
171 | } | |
172 | ||
d504c864 | 173 | |
43dd7c5e | 174 | |
68d9caee | 175 | void |
1804b020 | 176 | AliHLTPHOSRawAnalyzer::SetTVector(Double_t * /*tVector*/, Int_t /*size*/) |
68d9caee | 177 | { |
8efbf5fe | 178 | // cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetTVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl; |
68d9caee | 179 | } |
180 | ||
181 | ||
43dd7c5e | 182 | |
68d9caee | 183 | void |
1804b020 | 184 | AliHLTPHOSRawAnalyzer::SetAVector(Double_t * /*aVector*/, Int_t /*size*/) |
68d9caee | 185 | { |
8efbf5fe | 186 | // cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetAVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl; |
68d9caee | 187 | } |
188 | ||
68d9caee | 189 |