]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
Updated branch aliroot-master, development and master to
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinder.cxx
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 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 AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(), 
38                                                                    fTVectorPtr(0), 
39                                                                    fAVectorPtr(0), 
40                                                                    fTVectorSize(0), 
41                                                                    fAVectorSize(0)
42 {
43
44 }
45
46
47 //___________________________________________________________________
48 AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
49 {
50
51 } //end AliHLTPHOSRawAnalyzerPeakFinder
52
53
54 void 
55 AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size)
56 {
57   fTVectorSize = size;
58
59   if(fTVectorPtr != 0)
60     {
61       delete fTVectorPtr;
62     }
63   
64   fTVectorPtr = new Double_t[size];
65
66   for(int i=0; i< size; i++)
67     {
68       fTVectorPtr[i] = tVec[i];
69     }
70 }
71
72
73 void
74 AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
75 {
76   //comment
77   fAVectorSize = size;
78
79   if(fAVectorPtr != 0)
80     {
81       delete fAVectorPtr;
82     }
83   
84   fAVectorPtr = new Double_t[size];
85
86   for(int i=0; i< size; i++)
87     {
88       fAVectorPtr[i] = aVec[i];
89     }
90 }
91
92 void 
93 AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
94 {
95   //comment
96   fDTof = 0;
97   fDAmpl = 0;
98   Int_t tmpLength;
99
100   if(fTVectorPtr == 0 || fAVectorPtr == 0)
101     {
102
103     }
104   else
105     {
106       if(length <  fTVectorSize)
107         {
108           tmpLength = length;
109         }
110       else
111         {
112           tmpLength = fTVectorSize;
113         }
114       
115       for(int i=0; i < tmpLength; i++)
116         {  
117           fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i];   
118         }
119
120       for(int i=0; i < tmpLength; i++)
121         {   
122           fDTof += fTVectorPtr[i]*fDoubleDataPtr[i]; 
123         }
124       
125       if(fDAmpl > 900)
126         {
127           double tmpMax = AliHLTCaloUtilities::MaxValue(fDoubleDataPtr, tmpLength); 
128
129           if(tmpMax == 1023)
130             {
131               fDAmpl = tmpMax;
132             }
133         }
134       fDTof = fDTof/fDAmpl;
135     }
136 } //end Evaluate
137
138
139
140