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 *
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 *
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 **************************************************************************/
20 // Extraction of Amplitude and peak
21 // position using specila algorithm
22 // from Alexei Pavlinov
26 #include "AliCaloRawAnalyzerFastFit.h"
27 #include "AliCaloFastAltroFitv0.h"
28 #include "AliCaloFitResults.h"
29 #include "AliCaloBunchInfo.h"
35 ClassImp( AliCaloRawAnalyzerFastFit )
37 AliCaloRawAnalyzerFastFit::AliCaloRawAnalyzerFastFit() : AliCaloRawAnalyzer("Fast Fit (Alexei)")
41 for(int i=0; i < 1008; i++)
48 AliCaloRawAnalyzerFastFit::~AliCaloRawAnalyzerFastFit()
55 AliCaloRawAnalyzerFastFit::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
56 const UInt_t altrocfg1, const UInt_t altrocfg2 )
60 short maxampindex; //index of maximum amplitude
61 short maxamp; //Maximum amplitude
62 int index = SelectBunch( bunchvector, &maxampindex, &maxamp );
66 Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed );
69 int maxrev = maxampindex - bunchvector.at(index).GetStartBin();
71 double maxf = maxamp - ped;
75 SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev , &first, &last);
76 int nsamples = last - first;
79 // time = dTime * GetRawFormatTimeBinWidth();
81 // int length = bunchvector.at(index).GetLength();
83 if( ( nsamples ) >= fNsampleCut )
85 Double_t ordered[1008];
87 for(int i=0; i < nsamples ; i++ )
89 ordered[i] = fReversed[first + i];
92 cout << __FILE__ << __LINE__ << "!!!!!!! USING these samples" << endl;
93 for(int i=0; i < nsamples ; i++ )
95 ordered[i] = fReversed[first + nsamples -i -1];
96 cout << ordered[i] << "\t" ;
98 cout << __FILE__ << __LINE__ << "!!!!!!! Done printing" << endl;
101 Double_t eSignal = 1; // nominal 1 ADC error
102 Double_t dAmp = maxf;
107 Double_t dTau = 2.35; // time-bin units
109 // AliCaloFastAltroFitv0::FastFit(fXAxis, &fReversed[first] , nsamples,
110 // eSignal, fTau, dAmp, eAmp, dTime, eTime, chi2);
112 AliCaloFastAltroFitv0::FastFit(fXAxis, ordered , nsamples,
113 eSignal, dTau, dAmp, eAmp, dTime, eTime, chi2);
115 // return AliCaloFitResults( maxamp, ped , -1, fAmpA[tmpindex], tof, -2, -3 );
116 return AliCaloFitResults(maxamp, ped, -1, dAmp, dTime*100E-9, -2, -3 );
122 return AliCaloFitResults(9999 , 9999 , 9999, 9999, 9999, 9999, 9999 );