]>
Commit | Line | Data |
---|---|---|
3800a654 | 1 | // $Id: AliHLTCALORawAnalyzerPeakFinder.cxx 29824 2008-11-10 13:43:55Z richterm $ |
178dd351 | 2 | |
3 | /************************************************************************** | |
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.* | |
9 | * Contributors are mentioned in the code where appropriate. * | |
10 | * Please report bugs to perthi@fys.uio.no * | |
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 | ||
22 | ||
23 | ||
24 | #include "AliHLTCaloRawAnalyzerPeakFinder.h" | |
25 | //#include <iostream> | |
26 | #include <cmath> | |
27 | #include "AliHLTCaloUtilities.h" | |
28 | ||
29 | using std::cout; | |
30 | using std::endl; | |
31 | ||
4f4b7ba4 | 32 | ClassImp(AliHLTCaloRawAnalyzerPeakFinder) |
178dd351 | 33 | |
34 | ||
35 | ||
36 | /** | |
4f4b7ba4 | 37 | * The AliHLTCaloRawAnalyzerPeakfinder class is the class for extracting the basic signal parameters |
178dd351 | 38 | * "timing" and "energy" from the Calorimeter's 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 | **/ | |
4f4b7ba4 | 42 | |
178dd351 | 43 | AliHLTCaloRawAnalyzerPeakFinder::AliHLTCaloRawAnalyzerPeakFinder():AliHLTCaloRawAnalyzer(), |
44 | fTVectorPtr(0), | |
45 | fAVectorPtr(0), | |
46 | fTVectorSize(0), | |
47 | fAVectorSize(0) | |
48 | // fUtilitiesPtr(0) | |
49 | { | |
50 | // fUtilitiesPtr = new AliHLTCaloUtilities(); | |
51 | // cout <<"PeakFinder:You cannot invoke the Fitter without arguments"<<endl;; | |
52 | } | |
53 | ||
54 | ||
55 | //___________________________________________________________________ | |
56 | AliHLTCaloRawAnalyzerPeakFinder::~AliHLTCaloRawAnalyzerPeakFinder() | |
57 | { | |
58 | ||
59 | } //end AliHLTCaloRawAnalyzerPeakFinder | |
60 | ||
61 | ||
62 | ||
63 | void | |
64 | AliHLTCaloRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size) | |
65 | { | |
66 | fTVectorSize = size; | |
67 | ||
68 | if(fTVectorPtr != 0) | |
69 | { | |
70 | delete fTVectorPtr; | |
71 | } | |
72 | ||
73 | fTVectorPtr = new Double_t[size]; | |
74 | ||
75 | for(int i=0; i< size; i++) | |
76 | { | |
77 | fTVectorPtr[i] = tVec[i]; | |
78 | } | |
79 | } | |
80 | ||
81 | ||
82 | //___________________________________________________________________ | |
83 | void | |
84 | AliHLTCaloRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size) | |
85 | { | |
86 | ||
87 | fAVectorSize = size; | |
88 | ||
89 | if(fAVectorPtr != 0) | |
90 | { | |
91 | delete fAVectorPtr; | |
92 | } | |
93 | ||
94 | fAVectorPtr = new Double_t[size]; | |
95 | ||
96 | for(int i=0; i< size; i++) | |
97 | { | |
98 | fAVectorPtr[i] = aVec[i]; | |
99 | } | |
100 | } | |
101 | ||
102 | ||
103 | ||
104 | //___________________________________________________________________ | |
105 | void | |
106 | AliHLTCaloRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length) | |
107 | { | |
108 | fDTof = 0; | |
109 | fDAmpl = 0; | |
110 | Int_t tmpLength; | |
111 | ||
112 | if(fTVectorPtr == 0 || fAVectorPtr == 0) | |
113 | { | |
114 | ||
115 | } | |
116 | else | |
117 | { | |
118 | if(length < fTVectorSize) | |
119 | { | |
120 | tmpLength = length; | |
121 | } | |
122 | else | |
123 | { | |
124 | tmpLength = fTVectorSize; | |
125 | } | |
126 | ||
127 | for(int i=0; i < tmpLength; i++) | |
128 | { | |
129 | //fDAmpl += fAVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008 | |
e8d13b89 | 130 | fDAmpl += fAVectorPtr[i]*fShortDataPtr[i]; |
178dd351 | 131 | } |
132 | ||
133 | for(int i=0; i < tmpLength; i++) | |
134 | { | |
135 | // fDTof += fTVectorPtr[i]*fIntDataPtr[i]; removed 18 april 2008 | |
e8d13b89 | 136 | fDTof += fTVectorPtr[i]*fShortDataPtr[i]; |
178dd351 | 137 | } |
138 | ||
139 | if(fDAmpl > 900) | |
140 | { | |
141 | // Double_t tmpMax = MaxValue(const_cast<unsigned int*>(fIntDataPtr), tmpLength); removed 18 april 2008 | |
e8d13b89 | 142 | double tmpMax = fUtilitiesPtr->MaxValue(fShortDataPtr, tmpLength); |
178dd351 | 143 | |
144 | if(tmpMax == 1023) | |
145 | { | |
146 | fDAmpl = tmpMax; | |
147 | } | |
148 | } | |
149 | ||
150 | fDTof = fDTof/fDAmpl; | |
151 | ||
152 | } | |
153 | } //end Evaluate | |
154 | ||
155 | ||
156 | ||
157 |