]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliCaloRawAnalyzerFastFit.cxx
Fixing a warning
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerFastFit.cxx
CommitLineData
e37e3c84 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
20// Extraction of Amplitude and peak
21// position using specila algorithm
22// from Alexei Pavlinov
23// ----------------
24// ----------------
25
26#include "AliCaloRawAnalyzerFastFit.h"
27#include "AliCaloFastAltroFitv0.h"
28#include "AliCaloFitResults.h"
29#include "AliCaloBunchInfo.h"
f57baa2d 30#include "TMath.h"
e37e3c84 31#include <iostream>
32
33using namespace std;
34
35ClassImp( AliCaloRawAnalyzerFastFit )
36
48a2e3eb 37AliCaloRawAnalyzerFastFit::AliCaloRawAnalyzerFastFit() : AliCaloRawAnalyzer("Fast Fit (Alexei)", "FF")
e37e3c84 38{
39 // Comment
40
41 for(int i=0; i < 1008; i++)
42 {
43 fXAxis[i] = i;
44 }
45
46}
47
48AliCaloRawAnalyzerFastFit::~AliCaloRawAnalyzerFastFit()
49{
50
51}
52
53
54AliCaloFitResults
55AliCaloRawAnalyzerFastFit::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
56 const UInt_t altrocfg1, const UInt_t altrocfg2 )
57{
58 // Comment
59
60 short maxampindex; //index of maximum amplitude
61 short maxamp; //Maximum amplitude
62 int index = SelectBunch( bunchvector, &maxampindex, &maxamp );
63
64 if( index >= 0)
65 {
66 Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed );
f57baa2d 67 int first = 0;
68 int last = 0;
69 Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed );
e37e3c84 70 int maxrev = maxampindex - bunchvector.at(index).GetStartBin();
3b8fd9fe 71 short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1);
e37e3c84 72 if ( maxf > fAmpCut )
73 {
74 SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev , &first, &last);
3b8fd9fe 75 int nsamples = last - first + 1;
e37e3c84 76
e37e3c84 77 if( ( nsamples ) >= fNsampleCut )
78 {
79 Double_t ordered[1008];
80
e211d601 81 for(int i=0; i < nsamples ; i++ )
82 {
83 ordered[i] = fReversed[first + i];
84 }
e37e3c84 85
86 Double_t eSignal = 1; // nominal 1 ADC error
87 Double_t dAmp = maxf;
88 Double_t eAmp = 0;
507751ce 89 Double_t dTime0 = 0;
e37e3c84 90 Double_t eTime = 0;
91 Double_t chi2 = 0;
e211d601 92 Double_t dTau = 2.35; // time-bin units
e37e3c84 93
e37e3c84 94 AliCaloFastAltroFitv0::FastFit(fXAxis, ordered , nsamples,
507751ce 95 eSignal, dTau, dAmp, eAmp, dTime0, eTime, chi2);
e37e3c84 96
507751ce 97 Double_t dTimeMax = dTime0 + timebinOffset - (maxrev - first) // abs. t0
98 + dTau; // +tau, makes sum tmax
99 return AliCaloFitResults(maxamp, ped, AliCaloFitResults::kFitPar, dAmp, dTimeMax, timebinOffset, chi2, AliCaloFitResults::kDummy,
f57baa2d 100 AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
101 } // samplecut
102 else
103 {
507751ce 104 return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kCrude, maxf, timebinOffset);
e37e3c84 105 }
f57baa2d 106 } // ampcut
107 else
108 {
507751ce 109 return AliCaloFitResults( maxamp , ped, AliCaloFitResults::kCrude, maxf, timebinOffset);
e37e3c84 110 }
f57baa2d 111 } // bunch index
112
113 return AliCaloFitResults(AliCaloFitResults::kInvalid , AliCaloFitResults::kInvalid);
e37e3c84 114}