]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
Coding conventions and minor fixes
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinder.cxx
1 /**************************************************************************
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.*
7  * Contributors are mentioned in the code where appropriate.              *
8  * Please report bugs to perthi@fys.uio.no                                * 
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"
20 //#include <iostream>
21 #include <cmath>
22
23
24 using std::cout;
25 using std::endl;
26
27 ClassImp(AliHLTPHOSRawAnalyzerPeakFinder) 
28
29
30   //AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder(const AliHLTPHOSRawAnalyzerPeakFinder&):AliHLTPHOSRawAnalyzer() , fTVectorPtr(0), fAVectorPtr(0), fTVectorSize(0), fAVectorSize(0)
31   //{
32
33
34   //}
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  **/
43 AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(), fTVectorPtr(0), fAVectorPtr(0), fTVectorSize(0), fAVectorSize(0)
44 {
45   //  cout <<"PeakFinder:You cannot invoke the Fitter without arguments"<<endl;;
46 }
47
48
49 //___________________________________________________________________
50 AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
51 {
52
53 } //end AliHLTPHOSRawAnalyzerPeakFinder
54
55
56
57 void 
58 AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size)
59 {
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     }
73 }
74
75
76 //___________________________________________________________________
77 void
78 AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
79 {
80     
81   fAVectorSize = size;
82
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     }
94 }
95
96
97
98 //___________________________________________________________________
99 void 
100 AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
101 {
102   fDTof = 0;
103   fDAmpl = 0;
104   Int_t tmpLength;
105
106   //  cout << "AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(), dumping data" << endl; 
107
108   //  DumpData(fIntDataPtr, length, 16);
109
110   if(fTVectorPtr == 0 || fAVectorPtr == 0)
111     {
112
113     }
114   else
115     {
116
117       if(length <  fTVectorSize)
118         {
119           tmpLength = length;
120         }
121       else
122         {
123           tmpLength = fTVectorSize;
124         }
125       
126       for(int i=0; i < tmpLength; i++)
127         {  
128           //      fDAmpl += fAVectorPtr[i]*fFloatDataPtr[i];    
129           fDAmpl += fAVectorPtr[i]*fIntDataPtr[i];   
130           
131         }
132
133       for(int i=0; i < tmpLength; i++)
134         {   
135           //      fDTof += fTVectorPtr[i]*fFloatDataPtr[i]; 
136           fDTof += fTVectorPtr[i]*fIntDataPtr[i]; 
137         }
138       
139       if(fDAmpl > 900)
140         {
141
142           Double_t tmpMax = MaxValue(const_cast<unsigned int*>(fIntDataPtr), tmpLength); 
143
144           
145           if(tmpMax == 1023)
146             {
147               fDAmpl = tmpMax;
148             }
149         }
150
151       fDTof = fDTof/fDAmpl;
152
153     }
154 } //end Evaluate
155
156
157
158