]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx
Removing redundant class
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzer.cxx
1 // $Id$
2
3 /**************************************************************************
4  * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved.      *
5  *                                                                        *
6  * Author: Per Thomas Hille for the ALICE HLT Project.                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18
19 #include "AliHLTPHOSRawAnalyzer.h"
20 #include "AliHLTPHOSUtilities.h" 
21
22 AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer(): //AliHLTPHOSBase(),   
23                                                  //      fDoCorrectBaselineUsingFirstFiveSamples(false),
24                                                  fDoCorrectBaselineUsingFirstFiveSamples(true),
25                                                  fDoubleDataPtr(0), 
26                                                  fIntDataPtr(0), 
27                                                  fShortDataPtr(0),
28                                                  fSampleFrequency(10),
29                                                  fDTofGuess(-1),
30                                                  fDAmplGuess(-1),
31                                                  fTau(2), 
32                                                  fDTof(99999), 
33                                                  fDAmpl(99999),
34                                                  fStartIndex(0),
35                                                  fUseShortValues(false),
36                                                  fUtilitiesPtr(0)
37
38 {
39   //  fIntDataPtr = new UInt_t[1008];
40
41   //  fDoubleDataPtr;   
42   fUtilitiesPtr = new  AliHLTPHOSUtilities(); 
43 }
44
45 AliHLTPHOSRawAnalyzer::~AliHLTPHOSRawAnalyzer()
46 {
47   //  delete[] fIntDataPtr;
48 }
49
50
51
52
53
54 /**
55 * Main constructor
56 * param dtaPtr Data array for wich a subarray will be taken to perform the fit
57 * @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time
58 **/
59 AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(double * /*dtaPtr*/, double fs): //AliHLTPHOSBase(), 
60                                                                               fDoCorrectBaselineUsingFirstFiveSamples(false),
61                                                                               fDoubleDataPtr(0), 
62                                                                               fIntDataPtr(0), 
63                                                                               fShortDataPtr(0),
64                                                                               fSampleFrequency(10),
65                                                                               fDTofGuess(-1),
66                                                                               fDAmplGuess(-1),
67                                                                               fTau(2), 
68                                                                               fDTof(99999), 
69                                                                               fDAmpl(99999),
70                                                                               fStartIndex(0),
71                                                                               fUseShortValues(false),
72                                                                               fUtilitiesPtr(0)
73                                                                               
74 {
75   fSampleFrequency = fs;
76 } //end  
77
78
79
80 void 
81 AliHLTPHOSRawAnalyzer::SetCorrectBaselineUsingFirstFiveSamples()
82 {
83   fDoCorrectBaselineUsingFirstFiveSamples = true;
84 }
85  
86
87 void 
88 //AliHLTPHOSRawAnalyzer::CorrectBaselineUsingFirstFiveSamples(double *data, int length)
89 //AliHLTPHOSRawAnalyzer::CorrectBaselineUsingFirstFiveSamples(int *data, int length)
90 AliHLTPHOSRawAnalyzer::CorrectBaselineUsingFirstFiveSamples(UInt_t */*data*/, const int /*length*/)
91 {
92   //  cout << "AliHLTPHOSRawAnalyzer::CorrectBaselineUsingFirstFiveSamples" << endl;
93
94   //CRAP PTH
95   /*
96   
97   unsigned int sumOfFirstFiveSamples = 0;
98
99   for(int i=0; i< 5; i++)
100     {
101       sumOfFirstFiveSamples += data[i];
102     }
103
104   unsigned int valueToSubtract = sumOfFirstFiveSamples/5;
105
106   for(int j = 0; j < length; j++)
107     {
108       if( (int)(data[j] - valueToSubtract) > 0)
109         {
110           data[j] = data[j] - valueToSubtract;
111         }
112       else
113         {
114           data[j] = 0;
115         }
116     }
117   */
118 }
119
120
121
122 // /**
123 // * Attemps to level the basline to zero.
124 // * The baseline will be calculated from the pretrigger samples and subtracted from the 
125 // * data array. 
126 // * If pretrigger samples are not present then the basline correction will be incorrect. 
127 // * @param dataPtr array for wich to correct the basline 
128 // * @param N the number of pretrigger samples used to calculate the baseline.
129 // **/
130 // void 
131 // AliHLTPHOSRawAnalyzer::BaselineCorrection(double * /*dataPtr*/, int /*N*/)
132 // {
133
134 // } //end BaselineCorrection
135
136
137 /**
138 * Shifts the baseline with the amount given by baselineValue
139 * If pretrigger samples are not present then the basline correction will be incorrect. 
140 * @param dataPtr array for wich to correct the basline 
141 * @param baselineValue the basline value to subtract..
142 **/
143 void 
144 AliHLTPHOSRawAnalyzer::BaselineCorrection(double * /*dataPtr*/, double /*baselineValue*/)
145 {
146
147 } //end BaslineCorrection
148
149
150 /**
151  * Gives the timing in entities of sample indexes
152  * Physical time is found by multiplying  with the sampling intervall (Ts).
153  **/
154 float
155 AliHLTPHOSRawAnalyzer::GetTiming() const 
156 {
157   return fDTof;
158 } //end GetTiming
159
160
161 /**
162  * Gives the time in entities of ADC channels (quantization levels).  
163  * Absolute enrgy is found by multiplying with offline calibration constants.
164  **/
165 float
166 AliHLTPHOSRawAnalyzer::GetEnergy() const
167 {
168   return fDAmpl;
169 } //end GetEnergy
170
171
172
173 /**
174  * Set data array. Overrides data data array set in the constructor.
175  **/
176  void 
177
178  AliHLTPHOSRawAnalyzer::SetData(const UInt_t *data, const int length) 
179  // AliHLTPHOSRawAnalyzer::SetData(UInt_t *data, const int length) 
180 // AliHLTPHOSRawAnalyzer::SetData(int *data, const int length) 
181  {
182    fIntDataPtr = const_cast<UInt_t *>(data);
183
184    if(fDoCorrectBaselineUsingFirstFiveSamples == true)
185      {
186        CorrectBaselineUsingFirstFiveSamples(fIntDataPtr, length);
187      }
188
189    //   fIntDataPtr = data;
190
191  }
192
193 void
194  AliHLTPHOSRawAnalyzer::SetData(const UShort_t *data, const int length) 
195  // AliHLTPHOSRawAnalyzer::SetData(UInt_t *data, const int length) 
196 // AliHLTPHOSRawAnalyzer::SetData(int *data, const int length) 
197  {
198
199    fShortDataPtr = const_cast<UShort_t *>(data);
200    fUseShortValues = true;
201    if(fDoCorrectBaselineUsingFirstFiveSamples == true)
202      {
203        CorrectBaselineUsingFirstFiveSamples(fIntDataPtr, length);
204      }
205
206    //   fIntDataPtr = data;
207
208  }
209
210
211
212
213 /**
214  * Set data array. Overrides data data array set in the constructor.
215  **/
216 // void 
217 // //AliHLTPHOSRawAnalyzer::SetData(const double *data) 
218 // AliHLTPHOSRawAnalyzer::SetData(double *data, const int length) 
219 // {
220 //   if(fDoCorrectBaselineUsingFirstFiveSamples == true)
221 //     {
222 //       CorrectBaselineUsingFirstFiveSamples(data, length);
223 //     }
224
225
226 //   fDoubleDataPtr = data;
227 // }
228
229
230
231 void 
232 AliHLTPHOSRawAnalyzer::SetSampleFreq(double freq)
233 {
234   fSampleFrequency = freq;
235 }
236
237 int 
238 AliHLTPHOSRawAnalyzer::FindStartIndex(double /*treshold*/)
239 {
240   // cout << "Find Start index not yet implemented" << endl;
241   return 0;
242 } //end FindStartIndex
243
244
245 /**
246  * This function applies only to the Chi and Least mean square fit. An initial guess is made
247  * based on the average of the first 5 samples and the first value exeeding this value.
248  **/
249 void 
250 AliHLTPHOSRawAnalyzer::MakeInitialGuess()
251 {
252   //  cout << "Make initial guess not yet implemeted" << endl;
253 }
254
255
256 /**
257  * This function applies only to the Chi and Least mean square fit. An initial guess is made
258  * based on the average of the first 5 samples and the first value exeeding threshold + this value.
259  * @param treshold The index of the first value above treshold is ntaken to be the first value.
260  **/
261 void 
262 AliHLTPHOSRawAnalyzer::MakeInitialGuess(int /*treshold*/)
263 {
264   //  cout << "Make initial guess not yet implemeted" << endl;  
265 }
266
267
268 void
269 AliHLTPHOSRawAnalyzer::SetStartIndex(int index)
270 {
271   fStartIndex = index;
272 }
273
274
275
276 void 
277 AliHLTPHOSRawAnalyzer::SetTVector(Double_t * /*tVector*/, Int_t /*size*/)
278 {
279   //  cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetTVector:  You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
280 }
281
282
283
284 void
285 AliHLTPHOSRawAnalyzer::SetAVector(Double_t * /*aVector*/, Int_t /*size*/)
286 {
287   // cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetAVector:  You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
288 }
289
290