]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliCaloRawAnalyzerCrude.cxx
01ba11031872274591e87548482663a957690481
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerCrude.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 // Evaluation of amplitude
20 // as max sample value - pedestal
21 // Not veru accurate, but very robust
22 // --------------
23 // --------------
24
25 #include "AliCaloRawAnalyzerCrude.h"
26 #include "AliCaloFitResults.h"
27 #include "AliCaloBunchInfo.h"
28
29 using namespace std;
30
31 ClassImp(AliCaloRawAnalyzerCrude)  
32
33
34 AliCaloRawAnalyzerCrude::AliCaloRawAnalyzerCrude() : AliCaloRawAnalyzer("Crude", "Crude")
35 {
36
37 }
38
39
40 AliCaloRawAnalyzerCrude::~AliCaloRawAnalyzerCrude()
41 {
42
43 }
44
45
46 AliCaloFitResults
47 AliCaloRawAnalyzerCrude::Evaluate(const vector<AliCaloBunchInfo> &bunchvector, const UInt_t /*altrocfg1*/,  const UInt_t /*altrocfg2*/)
48 {
49   // Evaluation of signal parameters
50   if( bunchvector.size()  <=  0 )
51     {
52       return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid);
53     }
54
55   Int_t amp = 0;
56   Int_t tof = -99;
57   const UShort_t *sig;
58   
59   double ped = EvaluatePedestal( bunchvector.at(0).GetData(), bunchvector.at(0).GetLength() ) ;
60
61   for( unsigned int i= 0; i < bunchvector.size(); ++i)
62     {
63       sig = bunchvector.at(i).GetData();
64       int length = bunchvector.at(i).GetLength(); 
65       
66       for(int j = 0; j < length; j ++)
67         if( sig[j] > amp  )
68           {
69             amp   = sig[j];
70             tof   = bunchvector.at(i).GetStartBin() - j;                     
71           }
72     }
73
74   //:EvaluatePedestal(const UShort_t * const data, const int length )
75   //  double ped = EvaluatePedestal(sig, length) ;
76   return  AliCaloFitResults(amp, ped, AliCaloFitResults::kCrude, amp - ped, tof);
77   
78 } //end Crude
79
80