]>
Commit | Line | Data |
---|---|---|
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 | ||
04751caa | 21 | |
ee5be070 | 22 | |
23 | ||
cbab66dd | 24 | #include "AliHLTPHOSRawAnalyzerPeakFinder.h" |
43dd7c5e | 25 | //#include <iostream> |
68d9caee | 26 | #include <cmath> |
1a53578c | 27 | #include "AliHLTCaloUtilities.h" |
43dd7c5e | 28 | |
cbab66dd | 29 | using std::cout; |
30 | using std::endl; | |
31 | ||
32 | ClassImp(AliHLTPHOSRawAnalyzerPeakFinder) | |
33 | ||
34 | ||
cbab66dd | 35 | |
36 | /** | |
37 | * The AliHLTPHOSPeakfinder class is the class for extracting the basic signal parameters | |
38 | * "timing" and "energy" from the PHOS raw data. Physical data will for a given readout channel be | |
39 | * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in | |
40 | * calculation is of type double. | |
41 | **/ | |
2589c3a3 | 42 | AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(), |
43 | fTVectorPtr(0), | |
44 | fAVectorPtr(0), | |
45 | fTVectorSize(0), | |
46 | fAVectorSize(0) | |
47 | // fUtilitiesPtr(0) | |
cbab66dd | 48 | { |
2589c3a3 | 49 | // fUtilitiesPtr = new AliHLTPHOSUtilities(); |
a764d59b | 50 | // cout <<"PeakFinder:You cannot invoke the Fitter without arguments"<<endl;; |
cbab66dd | 51 | } |
52 | ||
53 | ||
d504c864 | 54 | //___________________________________________________________________ |
cbab66dd | 55 | AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder() |
56 | { | |
57 | ||
58 | } //end AliHLTPHOSRawAnalyzerPeakFinder | |
59 | ||
43dd7c5e | 60 | |
61 | ||
cbab66dd | 62 | void |
68d9caee | 63 | AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size) |
cbab66dd | 64 | { |
68d9caee | 65 | fTVectorSize = size; |
66 | ||
67 | if(fTVectorPtr != 0) | |
68 | { | |
69 | delete fTVectorPtr; | |
70 | } | |
71 | ||
72 | fTVectorPtr = new Double_t[size]; | |
73 | ||
74 | for(int i=0; i< size; i++) | |
75 | { | |
76 | fTVectorPtr[i] = tVec[i]; | |
77 | } | |
cbab66dd | 78 | } |
79 | ||
68d9caee | 80 | |
d504c864 | 81 | //___________________________________________________________________ |
cbab66dd | 82 | void |
68d9caee | 83 | AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size) |
cbab66dd | 84 | { |
68d9caee | 85 | |
86 | fAVectorSize = size; | |
cbab66dd | 87 | |
68d9caee | 88 | if(fAVectorPtr != 0) |
89 | { | |
90 | delete fAVectorPtr; | |
91 | } | |
92 | ||
93 | fAVectorPtr = new Double_t[size]; | |
94 | ||
95 | for(int i=0; i< size; i++) | |
96 | { | |
97 | fAVectorPtr[i] = aVec[i]; | |
98 | } | |
cbab66dd | 99 | } |
100 | ||
d504c864 | 101 | |
43dd7c5e | 102 | |
d504c864 | 103 | //___________________________________________________________________ |
cbab66dd | 104 | void |
1804b020 | 105 | AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length) |
cbab66dd | 106 | { |
107 | fDTof = 0; | |
108 | fDAmpl = 0; | |
68d9caee | 109 | Int_t tmpLength; |
cbab66dd | 110 | |
68d9caee | 111 | if(fTVectorPtr == 0 || fAVectorPtr == 0) |
cbab66dd | 112 | { |
d504c864 | 113 | |
cbab66dd | 114 | } |
115 | else | |
116 | { | |
68d9caee | 117 | if(length < fTVectorSize) |
118 | { | |
119 | tmpLength = length; | |
120 | } | |
121 | else | |
122 | { | |
123 | tmpLength = fTVectorSize; | |
124 | } | |
cbab66dd | 125 | |
68d9caee | 126 | for(int i=0; i < tmpLength; i++) |
cbab66dd | 127 | { |
04751caa | 128 | //fDAmpl += fAVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008 |
129 | fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i]; | |
cbab66dd | 130 | } |
68d9caee | 131 | |
132 | for(int i=0; i < tmpLength; i++) | |
cbab66dd | 133 | { |
04751caa | 134 | // fDTof += fTVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008 |
135 | fDTof += fTVectorPtr[i]*fDoubleDataPtr[i]; | |
68d9caee | 136 | } |
137 | ||
68d9caee | 138 | if(fDAmpl > 900) |
139 | { | |
04751caa | 140 | // Double_t tmpMax = MaxValue(const_cast<unsigned int*>(fIntDataPtr), tmpLength); removed 18 april 2008 |
2589c3a3 | 141 | double tmpMax = fUtilitiesPtr->MaxValue(fDoubleDataPtr, tmpLength); |
939c67e7 | 142 | |
68d9caee | 143 | if(tmpMax == 1023) |
144 | { | |
145 | fDAmpl = tmpMax; | |
146 | } | |
cbab66dd | 147 | } |
148 | ||
149 | fDTof = fDTof/fDAmpl; | |
68d9caee | 150 | |
cbab66dd | 151 | } |
6447f0b5 | 152 | } //end Evaluate |
cbab66dd | 153 | |
154 | ||
155 | ||
156 |