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