]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
- fixing warnings
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinder.cxx
CommitLineData
1b41ab20 1// $Id$
2
cbab66dd 3/**************************************************************************
6447f0b5 4 * This file is property of and copyright by the Experimental Nuclear *
5 * Physics Group, Dep. of Physics *
6 * University of Oslo, Norway, 2007 *
7 * *
8 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
cbab66dd 9 * Contributors are mentioned in the code where appropriate. *
6447f0b5 10 * Please report bugs to perthi@fys.uio.no *
cbab66dd 11 * *
12 * Permission to use, copy, modify and distribute this software and its *
13 * documentation strictly for non-commercial purposes is hereby granted *
14 * without fee, provided that the above copyright notice appears in all *
15 * copies and that both the copyright notice and this permission notice *
16 * appear in the supporting documentation. The authors make no claims *
17 * about the suitability of this software for any purpose. It is *
18 * provided "as is" without express or implied warranty. *
19 **************************************************************************/
20
21#include "AliHLTPHOSRawAnalyzerPeakFinder.h"
68d9caee 22#include <cmath>
1a53578c 23#include "AliHLTCaloUtilities.h"
43dd7c5e 24
9a055ce7 25//using std::cout;
26//using std::endl;
cbab66dd 27
28ClassImp(AliHLTPHOSRawAnalyzerPeakFinder)
29
30
cbab66dd 31/**
32 * The AliHLTPHOSPeakfinder class is the class for extracting the basic signal parameters
33 * "timing" and "energy" from the PHOS raw data. Physical data will for a given readout channel be
34 * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in
35 * calculation is of type double.
36 **/
2589c3a3 37AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(),
38 fTVectorPtr(0),
39 fAVectorPtr(0),
40 fTVectorSize(0),
41 fAVectorSize(0)
cbab66dd 42{
7da2979b 43
cbab66dd 44}
45
46
d504c864 47//___________________________________________________________________
cbab66dd 48AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
49{
50
51} //end AliHLTPHOSRawAnalyzerPeakFinder
52
43dd7c5e 53
cbab66dd 54void
68d9caee 55AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size)
cbab66dd 56{
68d9caee 57 fTVectorSize = size;
58
59 if(fTVectorPtr != 0)
60 {
61 delete fTVectorPtr;
62 }
63
64 fTVectorPtr = new Double_t[size];
65
66 for(int i=0; i< size; i++)
67 {
68 fTVectorPtr[i] = tVec[i];
69 }
cbab66dd 70}
71
68d9caee 72
cbab66dd 73void
68d9caee 74AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
cbab66dd 75{
9a055ce7 76 //comment
68d9caee 77 fAVectorSize = size;
cbab66dd 78
68d9caee 79 if(fAVectorPtr != 0)
80 {
81 delete fAVectorPtr;
82 }
83
84 fAVectorPtr = new Double_t[size];
85
86 for(int i=0; i< size; i++)
87 {
88 fAVectorPtr[i] = aVec[i];
89 }
cbab66dd 90}
91
cbab66dd 92void
1804b020 93AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
cbab66dd 94{
9a055ce7 95 //comment
cbab66dd 96 fDTof = 0;
97 fDAmpl = 0;
68d9caee 98 Int_t tmpLength;
cbab66dd 99
68d9caee 100 if(fTVectorPtr == 0 || fAVectorPtr == 0)
cbab66dd 101 {
d504c864 102
cbab66dd 103 }
104 else
105 {
68d9caee 106 if(length < fTVectorSize)
107 {
108 tmpLength = length;
109 }
110 else
111 {
112 tmpLength = fTVectorSize;
113 }
cbab66dd 114
68d9caee 115 for(int i=0; i < tmpLength; i++)
cbab66dd 116 {
04751caa 117 fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i];
cbab66dd 118 }
68d9caee 119
120 for(int i=0; i < tmpLength; i++)
cbab66dd 121 {
04751caa 122 fDTof += fTVectorPtr[i]*fDoubleDataPtr[i];
68d9caee 123 }
124
68d9caee 125 if(fDAmpl > 900)
126 {
7da2979b 127 double tmpMax = AliHLTCaloUtilities::MaxValue(fDoubleDataPtr, tmpLength);
939c67e7 128
68d9caee 129 if(tmpMax == 1023)
130 {
131 fDAmpl = tmpMax;
132 }
cbab66dd 133 }
cbab66dd 134 fDTof = fDTof/fDAmpl;
135 }
6447f0b5 136} //end Evaluate
cbab66dd 137
138
139
140