X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliCaloRawAnalyzerFastFit.cxx;h=dd45f5cd9fcc1795496e14390fd9ed16b3cd9442;hb=7fbe62cf657f095d678bc8a7d5d89a61283552c0;hp=d6d87382967689f8794e66dcc0b135a10a8734d7;hpb=48a2e3ebe899a9de2bec7aef06e3953496595331;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliCaloRawAnalyzerFastFit.cxx b/EMCAL/AliCaloRawAnalyzerFastFit.cxx index d6d87382967..dd45f5cd9fc 100644 --- a/EMCAL/AliCaloRawAnalyzerFastFit.cxx +++ b/EMCAL/AliCaloRawAnalyzerFastFit.cxx @@ -1,3 +1,4 @@ +// -*- mode: c++ -*- /************************************************************************** * This file is property of and copyright by the Experimental Nuclear * * Physics Group, Dep. of Physics * @@ -27,16 +28,22 @@ #include "AliCaloFastAltroFitv0.h" #include "AliCaloFitResults.h" #include "AliCaloBunchInfo.h" - +#include "TMath.h" #include + using namespace std; +#include "AliCaloConstants.h" +//using namespace CaloConstants::FitAlgorithm; +//using namespace CaloConstants::ReturnCodes; + ClassImp( AliCaloRawAnalyzerFastFit ) AliCaloRawAnalyzerFastFit::AliCaloRawAnalyzerFastFit() : AliCaloRawAnalyzer("Fast Fit (Alexei)", "FF") { // Comment + fAlgo= Algo::kFastFit; for(int i=0; i < 1008; i++) { @@ -64,23 +71,22 @@ AliCaloRawAnalyzerFastFit::Evaluate( const vector &bunchvector if( index >= 0) { Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index)) , altrocfg1, altrocfg2, fReversed ); - int first; - int last; - int maxrev = maxampindex - bunchvector.at(index).GetStartBin(); + Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(), fReversed ); short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1); - double maxf = maxamp - ped; - - if ( maxf > fAmpCut ) + if( maxf < fAmpCut || ( maxamp - ped) > fOverflowCut ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then) { + return AliCaloFitResults( maxamp, ped, Algo::kCrude, maxf, timebinOffset); + } + else if ( maxf >= fAmpCut ) // no if statement needed really; keep for readability + { + int first = 0; + int last = 0; + int maxrev = maxampindex - bunchvector.at(index).GetStartBin(); + SelectSubarray( fReversed, bunchvector.at(index).GetLength(), maxrev , &first, &last); int nsamples = last - first + 1; - //amp = dAmp; - // time = dTime * GetRawFormatTimeBinWidth(); - - // int length = bunchvector.at(index).GetLength(); - if( ( nsamples ) >= fNsampleCut ) { Double_t ordered[1008]; @@ -89,32 +95,36 @@ AliCaloRawAnalyzerFastFit::Evaluate( const vector &bunchvector { ordered[i] = fReversed[first + i]; } - /* - cout << __FILE__ << __LINE__ << "!!!!!!! USING these samples" << endl; - for(int i=0; i < nsamples ; i++ ) - { - ordered[i] = fReversed[first + nsamples -i -1]; - cout << ordered[i] << "\t" ; - } - cout << __FILE__ << __LINE__ << "!!!!!!! Done printing" << endl; - */ Double_t eSignal = 1; // nominal 1 ADC error Double_t dAmp = maxf; Double_t eAmp = 0; - Double_t dTime = 0; + Double_t dTime0 = 0; Double_t eTime = 0; Double_t chi2 = 0; Double_t dTau = 2.35; // time-bin units AliCaloFastAltroFitv0::FastFit(fXAxis, ordered , nsamples, - eSignal, dTau, dAmp, eAmp, dTime, eTime, chi2); + eSignal, dTau, dAmp, eAmp, dTime0, eTime, chi2); - return AliCaloFitResults(maxamp, ped, -1, dAmp, dTime+timebinOffset, chi2, -3 ); + Double_t dTimeMax = dTime0 + timebinOffset - (maxrev - first) // abs. t0 + + dTau; // +tau, makes sum tmax + return AliCaloFitResults(maxamp, ped, Ret::kFitPar, dAmp, dTimeMax, timebinOffset, chi2, Ret::kDummy, + Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); + } // samplecut + else + { + Float_t chi2 = CalculateChi2(maxf, maxrev, first, last); + Int_t ndf = last - first - 1; // nsamples - 2 + return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, timebinOffset, + timebinOffset, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); } + } // ampcut + } // bunch index + + return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid ); - } - } + // return AliCaloFitResults( kInvalid , kInvalid, + // kInvalid, kInvalid, kInvalid ); - return AliCaloFitResults(9999 , 9999 , 9999, 9999, 9999, 9999, 9999 ); }