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