]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
Correction. Previous histos were empty.
[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
cbab66dd 25using std::cout;
26using std::endl;
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
d504c864 73//___________________________________________________________________
cbab66dd 74void
68d9caee 75AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
cbab66dd 76{
68d9caee 77
78 fAVectorSize = size;
cbab66dd 79
68d9caee 80 if(fAVectorPtr != 0)
81 {
82 delete fAVectorPtr;
83 }
84
85 fAVectorPtr = new Double_t[size];
86
87 for(int i=0; i< size; i++)
88 {
89 fAVectorPtr[i] = aVec[i];
90 }
cbab66dd 91}
92
d504c864 93
43dd7c5e 94
d504c864 95//___________________________________________________________________
cbab66dd 96void
1804b020 97AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
cbab66dd 98{
99 fDTof = 0;
100 fDAmpl = 0;
68d9caee 101 Int_t tmpLength;
cbab66dd 102
68d9caee 103 if(fTVectorPtr == 0 || fAVectorPtr == 0)
cbab66dd 104 {
d504c864 105
cbab66dd 106 }
107 else
108 {
68d9caee 109 if(length < fTVectorSize)
110 {
111 tmpLength = length;
112 }
113 else
114 {
115 tmpLength = fTVectorSize;
116 }
cbab66dd 117
68d9caee 118 for(int i=0; i < tmpLength; i++)
cbab66dd 119 {
04751caa 120 //fDAmpl += fAVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008
121 fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i];
cbab66dd 122 }
68d9caee 123
124 for(int i=0; i < tmpLength; i++)
cbab66dd 125 {
04751caa 126 // fDTof += fTVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008
127 fDTof += fTVectorPtr[i]*fDoubleDataPtr[i];
68d9caee 128 }
129
68d9caee 130 if(fDAmpl > 900)
131 {
04751caa 132 // Double_t tmpMax = MaxValue(const_cast<unsigned int*>(fIntDataPtr), tmpLength); removed 18 april 2008
7da2979b 133 double tmpMax = AliHLTCaloUtilities::MaxValue(fDoubleDataPtr, tmpLength);
939c67e7 134
68d9caee 135 if(tmpMax == 1023)
136 {
137 fDAmpl = tmpMax;
138 }
cbab66dd 139 }
140
141 fDTof = fDTof/fDAmpl;
68d9caee 142
cbab66dd 143 }
6447f0b5 144} //end Evaluate
cbab66dd 145
146
147
148