Line data Source code
1 : // $Id$
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 : #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
22 : #include <cmath>
23 : #include "AliHLTCaloUtilities.h"
24 :
25 : //using std::cout;
26 : //using std::endl;
27 :
28 6 : ClassImp(AliHLTPHOSRawAnalyzerPeakFinder)
29 :
30 :
31 : /**
32 : * The AliHLTPHOSPeakfinder class is the class for extracting the basic signal parameters
33 : * "timing" and "energy" from the PHOS raw data. Physical data will for a given readout channel be
34 : * a sequense of ADC digitized 10 bit integer values, however for performance reasons all values used in
35 : * calculation is of type double.
36 : **/
37 0 : AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(),
38 0 : fTVectorPtr(0),
39 0 : fAVectorPtr(0),
40 0 : fTVectorSize(0),
41 0 : fAVectorSize(0)
42 0 : {
43 :
44 0 : }
45 :
46 :
47 : //___________________________________________________________________
48 : AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
49 0 : {
50 :
51 0 : } //end AliHLTPHOSRawAnalyzerPeakFinder
52 :
53 :
54 : void
55 : AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size)
56 : {
57 0 : fTVectorSize = size;
58 :
59 0 : if(fTVectorPtr != 0)
60 : {
61 0 : delete fTVectorPtr;
62 : }
63 :
64 0 : fTVectorPtr = new Double_t[size];
65 :
66 0 : for(int i=0; i< size; i++)
67 : {
68 0 : fTVectorPtr[i] = tVec[i];
69 : }
70 0 : }
71 :
72 :
73 : void
74 : AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
75 : {
76 : //comment
77 0 : fAVectorSize = size;
78 :
79 0 : if(fAVectorPtr != 0)
80 : {
81 0 : delete fAVectorPtr;
82 : }
83 :
84 0 : fAVectorPtr = new Double_t[size];
85 :
86 0 : for(int i=0; i< size; i++)
87 : {
88 0 : fAVectorPtr[i] = aVec[i];
89 : }
90 0 : }
91 :
92 : void
93 : AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
94 : {
95 : //comment
96 0 : fDTof = 0;
97 0 : fDAmpl = 0;
98 : Int_t tmpLength;
99 :
100 0 : if(fTVectorPtr == 0 || fAVectorPtr == 0)
101 : {
102 :
103 : }
104 : else
105 : {
106 0 : if(length < fTVectorSize)
107 : {
108 : tmpLength = length;
109 0 : }
110 : else
111 : {
112 : tmpLength = fTVectorSize;
113 : }
114 :
115 0 : for(int i=0; i < tmpLength; i++)
116 : {
117 0 : fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i];
118 : }
119 :
120 0 : for(int i=0; i < tmpLength; i++)
121 : {
122 0 : fDTof += fTVectorPtr[i]*fDoubleDataPtr[i];
123 : }
124 :
125 0 : if(fDAmpl > 900)
126 : {
127 0 : double tmpMax = AliHLTCaloUtilities::MaxValue(fDoubleDataPtr, tmpLength);
128 :
129 0 : if(tmpMax == 1023)
130 : {
131 0 : fDAmpl = tmpMax;
132 0 : }
133 0 : }
134 0 : fDTof = fDTof/fDAmpl;
135 : }
136 0 : } //end Evaluate
137 :
138 :
139 :
140 :
|