]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRawAnalyzer.cxx
eff C++
[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"
43dd7c5e 17//#include <iostream>
cbab66dd 18
43dd7c5e 19//using std::cout;
20//using std::endl;
cbab66dd 21
43dd7c5e 22AliHLTPHOSRawAnalyzer:: AliHLTPHOSRawAnalyzer(): AliHLTPHOSBase(), fIntDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999)
cbab66dd 23{
e086ee30 24 fIntDataPtr = new UInt_t[1008];
cbab66dd 25}
26
27AliHLTPHOSRawAnalyzer::~AliHLTPHOSRawAnalyzer()
28{
29
30}
31
43dd7c5e 32/*
e086ee30 33AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(AliHLTPHOSRawAnalyzer const&):fIntDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), fStartIndex(0)
cbab66dd 34{
35
36}
43dd7c5e 37*/
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**/
43dd7c5e 45AliHLTPHOSRawAnalyzer::AliHLTPHOSRawAnalyzer(double *dtaPtr, double fs): AliHLTPHOSBase(), fIntDataPtr(0), fSampleFrequency(10), fTau(2), fDTof(99999), fDAmpl(99999), fStartIndex(0)
cbab66dd 46{
cbab66dd 47 fSampleFrequency = fs;
48} //end
49
50
51/**
52* Attemps to level the basline to zero.
53* The baseline will be calculated from the pretrigger samples and subtracted from the
54* data array.
55* If pretrigger samples are not present then the basline correction will be incorrect.
56* @param dataPtr array for wich to correct the basline
57* @param N the number of pretrigger samples used to calculate the baseline.
58**/
59void
60AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, int N)
61{
cbab66dd 62 cout << "Baseline correction not yet implemeted" << endl;
63} //end BaselineCorrection
64
65
66/**
ee1684e6 67* Shifts the baseline with the amount given by baselineValue
cbab66dd 68* If pretrigger samples are not present then the basline correction will be incorrect.
69* @param dataPtr array for wich to correct the basline
d504c864 70* @param baselineValue the basline value to subtract..
cbab66dd 71**/
72void
73AliHLTPHOSRawAnalyzer::BaselineCorrection(double *dataPtr, double baselineValue)
74{
cbab66dd 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
e086ee30 102/**
103 * Set data array. Overrides data data array set in the constructor.
104 **/
e086ee30 105void
106AliHLTPHOSRawAnalyzer::SetData(UInt_t *data)
107{
e086ee30 108 fIntDataPtr = data;
109}
110
cbab66dd 111/**
112 * Set data array. Overrides data data array set in the constructor.
113 **/
114void
115AliHLTPHOSRawAnalyzer::SetData(double *data)
116{
cbab66dd 117 fFloatDataPtr = data;
cbab66dd 118}
119
e086ee30 120
121
cbab66dd 122void
123AliHLTPHOSRawAnalyzer::SetSampleFreq(double freq)
124{
a4a2a400 125 fSampleFrequency = freq;
cbab66dd 126}
127
128int
129AliHLTPHOSRawAnalyzer::FindStartIndex(double treshold)
130{
cbab66dd 131 cout << "Find Start index not yet implemented" << endl;
132 return 0;
133} //end FindStartIndex
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 this value.
139 **/
140void
141AliHLTPHOSRawAnalyzer::MakeInitialGuess()
142{
143 cout << "Make initial guess not yet implemeted" << endl;
144}
145
146
147/**
148 * This function applies only to the Chi and Least mean square fit. An initial guess is made
149 * based on the average of the first 5 samples and the first value exeeding threshold + this value.
150 * @param treshold The index of the first value above treshold is ntaken to be the first value.
151 **/
152void
153AliHLTPHOSRawAnalyzer::MakeInitialGuess(int treshold)
154{
cbab66dd 155 cout << "Make initial guess not yet implemeted" << endl;
156}
68d9caee 157
158void
159AliHLTPHOSRawAnalyzer::SetStartIndex(int index)
160{
161 fStartIndex = index;
162}
163
d504c864 164
43dd7c5e 165
68d9caee 166void
167AliHLTPHOSRawAnalyzer::SetTVector(Double_t *tVector, Int_t size)
168{
169 cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetTVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
170}
171
172
43dd7c5e 173
68d9caee 174void
175AliHLTPHOSRawAnalyzer::SetAVector(Double_t *aVector, Int_t size)
176{
177 cout <<"ERROR: AliHLTPHOSRawAnalyzer::SetAVector: You cannot set the peakfindervector here, must be set in derived class peakfinder"<<endl;
178}
179
180
e086ee30 181
182/*
43dd7c5e 183UInt_t
184AliHLTPHOSRawAnalyzer::GetMaxValue(UInt_t *dta, Int_t size) const
68d9caee 185{
186
187 Double_t tmpMax = 0;
188
189 for(int i = 0; i < size; i++)
190 {
191 if(dta[i] > tmpMax)
192 {
193 tmpMax = dta[i];
194 }
68d9caee 195 }
196
197 return tmpMax;
198
199}
e086ee30 200*/