]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
removing the HLT autoconf build system, however keep on using that for the
[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
22
23
24 #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
25 //#include <iostream>
26 #include <cmath>
27 #include "AliHLTCaloUtilities.h" 
28
29 using std::cout;
30 using std::endl;
31
32 ClassImp(AliHLTPHOSRawAnalyzerPeakFinder) 
33
34
35
36 /**
37  * The AliHLTPHOSPeakfinder class is the class for extracting the basic signal parameters
38  * "timing" and "energy" from the PHOS 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  **/
42 AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder():AliHLTPHOSRawAnalyzer(), 
43                                                                    fTVectorPtr(0), 
44                                                                    fAVectorPtr(0), 
45                                                                    fTVectorSize(0), 
46                                                                    fAVectorSize(0)
47 //  fUtilitiesPtr(0)
48 {
49   //  fUtilitiesPtr = new  AliHLTPHOSUtilities(); 
50   //  cout <<"PeakFinder:You cannot invoke the Fitter without arguments"<<endl;;
51 }
52
53
54 //___________________________________________________________________
55 AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
56 {
57
58 } //end AliHLTPHOSRawAnalyzerPeakFinder
59
60
61
62 void 
63 AliHLTPHOSRawAnalyzerPeakFinder::SetTVector(Double_t *tVec, Int_t size)
64 {
65   fTVectorSize = size;
66
67   if(fTVectorPtr != 0)
68     {
69       delete fTVectorPtr;
70     }
71   
72   fTVectorPtr = new Double_t[size];
73
74   for(int i=0; i< size; i++)
75     {
76       fTVectorPtr[i] = tVec[i];
77     }
78 }
79
80
81 //___________________________________________________________________
82 void
83 AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
84 {
85     
86   fAVectorSize = size;
87
88   if(fAVectorPtr != 0)
89     {
90       delete fAVectorPtr;
91     }
92   
93   fAVectorPtr = new Double_t[size];
94
95   for(int i=0; i< size; i++)
96     {
97       fAVectorPtr[i] = aVec[i];
98     }
99 }
100
101
102
103 //___________________________________________________________________
104 void 
105 AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t /*start*/, Int_t length)
106 {
107   fDTof = 0;
108   fDAmpl = 0;
109   Int_t tmpLength;
110
111   if(fTVectorPtr == 0 || fAVectorPtr == 0)
112     {
113
114     }
115   else
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]*fIntDataPtr[i]; removed 18 april 2008    
129           fDAmpl += fAVectorPtr[i]*fDoubleDataPtr[i];   
130         }
131
132       for(int i=0; i < tmpLength; i++)
133         {   
134           //  fDTof += fTVectorPtr[i]*fIntDataPtr[i];  removed 18 april 2008   
135           fDTof += fTVectorPtr[i]*fDoubleDataPtr[i]; 
136         }
137       
138       if(fDAmpl > 900)
139         {
140           //      Double_t tmpMax = MaxValue(const_cast<unsigned int*>(fIntDataPtr), tmpLength);  removed 18 april 2008   
141           double tmpMax = fUtilitiesPtr->MaxValue(fDoubleDataPtr, tmpLength); 
142
143           if(tmpMax == 1023)
144             {
145               fDAmpl = tmpMax;
146             }
147         }
148
149       fDTof = fDTof/fDAmpl;
150
151     }
152 } //end Evaluate
153
154
155
156