]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinder.cxx
moving all definitions to AliHLTPHOSDefinitions
[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 using std::cout;
24 using std::endl;
25
26 ClassImp(AliHLTPHOSRawAnalyzerPeakFinder) 
27
28
29 AliHLTPHOSRawAnalyzerPeakFinder::AliHLTPHOSRawAnalyzerPeakFinder(const AliHLTPHOSRawAnalyzerPeakFinder&):AliHLTPHOSRawAnalyzer() , fTVectorPtr(0), fAVectorPtr(0), fTVectorSize(0), fAVectorSize(0)
30 {
31
32
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(), fTVectorPtr(0), fAVectorPtr(0), fTVectorSize(0), fAVectorSize(0)
43 {
44   //  cout <<"PeakFinder:You cannot invoke the Fitter without arguments"<<endl;;
45 }
46
47
48 //___________________________________________________________________
49 AliHLTPHOSRawAnalyzerPeakFinder::~AliHLTPHOSRawAnalyzerPeakFinder()
50 {
51
52 } //end AliHLTPHOSRawAnalyzerPeakFinder
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 //___________________________________________________________________
74 void
75 AliHLTPHOSRawAnalyzerPeakFinder::SetAVector(Double_t *aVec, Int_t size)
76 {
77     
78   fAVectorSize = size;
79
80   if(fAVectorPtr != 0)
81     {
82       delete fAVectorPtr;
83     }
84   
85   fAVectorPtr = new Double_t[size];
86
87   for(int i=0; i< size; i++)
88     {
89       fAVectorPtr[i] = aVec[i];
90     }
91 }
92
93
94 //___________________________________________________________________
95 void 
96 AliHLTPHOSRawAnalyzerPeakFinder::Evaluate(Int_t start, Int_t length)
97 {
98   fDTof = 0;
99   fDAmpl = 0;
100   Int_t tmpLength;
101
102   if(fTVectorPtr == 0 || fAVectorPtr == 0)
103     {
104
105     }
106   else
107     {
108
109       if(length <  fTVectorSize)
110         {
111           tmpLength = length;
112         }
113       else
114         {
115           tmpLength = fTVectorSize;
116         }
117       
118       for(int i=0; i < tmpLength; i++)
119         {  
120           //      fDAmpl += fAVectorPtr[i]*fFloatDataPtr[i];    
121           fDAmpl += fAVectorPtr[i]*fIntDataPtr[i];   
122         }
123
124       for(int i=0; i < tmpLength; i++)
125         {   
126           //      fDTof += fTVectorPtr[i]*fFloatDataPtr[i]; 
127           fDTof += fTVectorPtr[i]*fIntDataPtr[i]; 
128         }
129       
130       if(fDAmpl > 900)
131         {
132           //      Double_t tmpMax = GetMaxValue(fFloatDataPtr, tmpLength);
133           Double_t tmpMax = GetMaxValue(fIntDataPtr, tmpLength);
134                                  
135           if(tmpMax == 1023)
136             {
137               fDAmpl = tmpMax;
138             }
139         }
140
141       fDTof = fDTof/fDAmpl;
142
143     }
144 } //end Evaluate
145
146
147
148