]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx
Coding conventions & doccumentation
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzer.cxx
CommitLineData
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"
17#include <iostream>
18
19using std::cout;
20using std::endl;
21
ee1684e6 22AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer():fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999)
cbab66dd 23{
a4a2a400 24 fFloatDataPtr = new double[1008];
cbab66dd 25}
26
27AliHLTPHOSRawAnalyzer::~AliHLTPHOSRawAnalyzer()
28{
29
30}
31
ee1684e6 32AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(AliHLTPHOSRawAnalyzer const&):fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), fStartIndex(0)
cbab66dd 33{
34
35}
36
37/**
38* Main constructor
d504c864 39* @param dtaPtr Data array for wich a subarray will be taken to perform the fit
cbab66dd 40* @param fs the sampling frequency in entities of MHz. Needed in order to calculate physical time
41**/
ee1684e6 42AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(double *dtaPtr, double fs):fFloatDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), fStartIndex(0)
cbab66dd 43{
44 fFloatDataPtr = dtaPtr;
45 fSampleFrequency = fs;
46} //end
47
48
49/**
50* Attemps to level the basline to zero.
51* The baseline will be calculated from the pretrigger samples and subtracted from the
52* data array.
53* If pretrigger samples are not present then the basline correction will be incorrect.
54* @param dataPtr array for wich to correct the basline
55* @param N the number of pretrigger samples used to calculate the baseline.
56**/
57void
58AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, int N)
59{
60 fFloatDataPtr = dataPtr;
cbab66dd 61 cout << "Baseline correction not yet implemeted" << endl;
62} //end BaselineCorrection
63
64
65/**
ee1684e6 66* Shifts the baseline with the amount given by baselineValue
cbab66dd 67* If pretrigger samples are not present then the basline correction will be incorrect.
68* @param dataPtr array for wich to correct the basline
d504c864 69* @param baselineValue the basline value to subtract..
cbab66dd 70**/
71void
72AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, double baselineValue)
73{
74 fFloatDataPtr = dataPtr;
75 printf("\nbaselineValue = %f\n", baselineValue);
76 cout << "Baseline correction not yet implemeted" << endl;
77} //end BaslineCorrection
78
79
80/**
81 * Gives the timing in entities of sample indexes
82 * Physical time is found by multiplying with the sampling intervall (Ts).
83 **/
84float
d504c864 85AliHLTPHOSRawAnalyzer::GetTiming() const
cbab66dd 86{
87 return fDTof;
88} //end GetTiming
89
90
91/**
92 * Gives the time in entities of ADC channels (quantization levels).
93 * Absolute enrgy is found by multiplying with offline calibration constants.
94 **/
95float
d504c864 96AliHLTPHOSRawAnalyzer::GetEnergy() const
cbab66dd 97{
98 return fDAmpl;
99} //end GetEnergy
100
101
102/**
103 * Set data array. Overrides data data array set in the constructor.
104 **/
105void
106AliHLTPHOSRawAnalyzer::SetData(double *data)
107{
cbab66dd 108 fFloatDataPtr = data;
cbab66dd 109}
110
111void
112AliHLTPHOSRawAnalyzer::SetSampleFreq(double freq)
113{
a4a2a400 114 fSampleFrequency = freq;
cbab66dd 115}
116
117int
118AliHLTPHOSRawAnalyzer::FindStartIndex(double treshold)
119{
cbab66dd 120 cout << "Find Start index not yet implemented" << endl;
121 return 0;
122} //end FindStartIndex
123
124
125/**
126 * This function applies only to the Chi and Least mean square fit. An initial guess is made
127 * based on the average of the first 5 samples and the first value exeeding this value.
128 **/
129void
130AliHLTPHOSRawAnalyzer::MakeInitialGuess()
131{
132 cout << "Make initial guess not yet implemeted" << endl;
133}
134
135
136/**
137 * This function applies only to the Chi and Least mean square fit. An initial guess is made
138 * based on the average of the first 5 samples and the first value exeeding threshold + this value.
139 * @param treshold The index of the first value above treshold is ntaken to be the first value.
140 **/
141void
142AliHLTPHOSRawAnalyzer::MakeInitialGuess(int treshold)
143{
cbab66dd 144 cout << "Make initial guess not yet implemeted" << endl;
145}
68d9caee 146
147void
148AliHLTPHOSRawAnalyzer::SetStartIndex(int index)
149{
150 fStartIndex = index;
151}
152
d504c864 153
68d9caee 154void
155AliHLTPHOSRawAnalyzer::SetTVector(Double_t *tVector, Int_t size)
156{
157 cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetTVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
158}
159
160
161void
162AliHLTPHOSRawAnalyzer::SetAVector(Double_t *aVector, Int_t size)
163{
164 cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetAVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
165}
166
167
168Double_t
d504c864 169AliHLTPHOSRawAnalyzer::GetMaxValue(Double_t *dta, Int_t size) const
68d9caee 170{
171
172 Double_t tmpMax = 0;
173
174 for(int i = 0; i < size; i++)
175 {
176 if(dta[i] > tmpMax)
177 {
178 tmpMax = dta[i];
179 }
68d9caee 180 }
181
182 return tmpMax;
183
184}