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