LCOV - code coverage report
Current view: top level - EMCAL/EMCALraw - AliCaloRawAnalyzerFastFit.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 43 2.3 %
Date: 2016-06-14 17:26:59 Functions: 1 4 25.0 %

          Line data    Source code
       1             : // -*- mode: c++ -*-
       2             : /**************************************************************************
       3             :  * This file is property of and copyright by the Experimental Nuclear     *
       4             :  * Physics Group, Dep. of Physics                                         *
       5             :  * University of Oslo, Norway, 2007                                       *
       6             :  *                                                                        *
       7             :  * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
       8             :  * Contributors are mentioned in the code where appropriate.              *
       9             :  * Please report bugs to perthi@fys.uio.no                                *
      10             :  *                                                                        *
      11             :  * Permission to use, copy, modify and distribute this software and its   *
      12             :  * documentation strictly for non-commercial purposes is hereby granted   *
      13             :  * without fee, provided that the above copyright notice appears in all   *
      14             :  * copies and that both the copyright notice and this permission notice   *
      15             :  * appear in the supporting documentation. The authors make no claims     *
      16             :  * about the suitability of this software for any purpose. It is          *
      17             :  * provided "as is" without express or implied warranty.                  *
      18             :  **************************************************************************/
      19             : 
      20             : 
      21             : // Extraction of Amplitude and peak
      22             : // position using special algorithm
      23             : // from Alexei Pavlinov
      24             : // ----------------
      25             : // ----------------
      26             : 
      27             : #include "AliCaloRawAnalyzerFastFit.h"
      28             : #include "AliCaloFastAltroFitv0.h"
      29             : #include "AliCaloFitResults.h"
      30             : #include "AliCaloBunchInfo.h"
      31             : #include "TMath.h"
      32             : #include <iostream>
      33             : 
      34             : using namespace std;
      35             : #include "AliCaloConstants.h"
      36             : 
      37          42 : ClassImp( AliCaloRawAnalyzerFastFit )
      38             : 
      39             : 
      40           0 : AliCaloRawAnalyzerFastFit::AliCaloRawAnalyzerFastFit() : AliCaloRawAnalyzerFitter("Fast Fit (Alexei)", "FF")
      41           0 : {
      42             :   // Constructor
      43           0 :   fAlgo= Algo::kFastFit;
      44           0 : }
      45             : 
      46             : AliCaloFitResults 
      47             : AliCaloRawAnalyzerFastFit::Evaluate( const vector<AliCaloBunchInfo> &bunchvector, 
      48             :                                      UInt_t altrocfg1, UInt_t altrocfg2 )
      49             : {
      50             :   // Execute algorithm
      51             :   
      52           0 :   short maxampindex; //index of maximum amplitude
      53           0 :   short maxamp; //Maximum amplitude
      54           0 :   int index = SelectBunch( bunchvector,  &maxampindex,  &maxamp );
      55             :   
      56           0 :   if( index >= 0)
      57             :   {
      58           0 :     Float_t ped = ReverseAndSubtractPed( &(bunchvector.at(index))  ,  altrocfg1, altrocfg2, fReversed  );
      59           0 :     Float_t maxf = TMath::MaxElement( bunchvector.at(index).GetLength(),  fReversed );
      60           0 :     short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1);
      61           0 :     Float_t time = (timebinOffset*TIMEBINWITH)-fL1Phase;
      62           0 :     if(  maxf < fAmpCut  ||  maxamp > fOverflowCut  ) // (maxamp - ped) > fOverflowCut = Close to saturation (use low gain then)
      63             :     {
      64           0 :       return  AliCaloFitResults( maxamp, ped, Algo::kCrude, maxf, time, (int)time, 0, 0, Ret::kDummy); //Time scale 19/08/2014 (Antônio)
      65             :     }
      66           0 :     else if ( maxf >= fAmpCut ) // no if statement needed really; keep for readability
      67             :     {
      68           0 :       int first = 0;
      69           0 :       int last = 0;
      70           0 :       int maxrev =  maxampindex -  bunchvector.at(index).GetStartBin();
      71             :       
      72           0 :       SelectSubarray( fReversed,  bunchvector.at(index).GetLength(), maxrev , &first, &last, fFitArrayCut);
      73             :       
      74           0 :       int nsamples =  last - first + 1;
      75             :       
      76           0 :       if( ( nsamples  )  >= fNsampleCut )
      77             :             {
      78           0 :               Double_t ordered[1008];
      79             :         
      80           0 :               for(int i=0; i < nsamples ; i++ )
      81             :         {
      82           0 :           ordered[i] = fReversed[first + i];
      83             :         }
      84             :         
      85             :               Double_t eSignal = 1; // nominal 1 ADC error
      86           0 :               Double_t dAmp = maxf;
      87           0 :               Double_t eAmp = 0;
      88           0 :               Double_t dTime0 = 0;
      89           0 :               Double_t eTime = 0;
      90           0 :               Double_t chi2 = 0;
      91             :               Double_t dTau = 2.35; // time-bin units
      92             :               
      93           0 :               AliCaloFastAltroFitv0::FastFit(fXaxis, ordered , nsamples,
      94             :                                        eSignal, dTau, dAmp, eAmp, dTime0, eTime, chi2);
      95           0 :               Double_t dTimeMax = dTime0 + timebinOffset - (maxrev - first) // abs. t0
      96           0 :         + dTau; // +tau, makes sum tmax
      97           0 :           Float_t timemax = (dTimeMax*TIMEBINWITH)-fL1Phase;
      98           0 :               return AliCaloFitResults(maxamp,ped,Ret::kFitPar,dAmp,timemax,(int)timemax,chi2,Ret::kDummy,Ret::kDummy,AliCaloFitSubarray(index,maxrev,first,last)); //Time scale 19/08/2014 (Antônio)
      99           0 :             } // samplecut
     100             :       else
     101             :             {
     102             :         
     103           0 :               Float_t chi2 = CalculateChi2(maxf, maxrev, first, last);
     104           0 :               Int_t ndf = last - first - 1; // nsamples - 2
     105           0 :               return AliCaloFitResults( maxamp, ped, Ret::kCrude, maxf, time, (int)time, chi2, ndf, Ret::kDummy, AliCaloFitSubarray(index, maxrev, first, last) ); //Time scale 19/08/2014 (Antônio)
     106             :             }
     107           0 :     } // ampcut
     108           0 :   } // bunch index
     109             :   
     110           0 :   return AliCaloFitResults( Ret::kInvalid , Ret::kInvalid );
     111           0 : }

Generated by: LCOV version 1.11