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