LCOV - code coverage report
Current view: top level - EMCAL/EMCALraw - AliEMCALRawResponse.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 25 35 71.4 %
Date: 2016-06-14 17:26:59 Functions: 3 8 37.5 %

          Line data    Source code
       1             : // -*- mode: c++ -*-
       2             : 
       3             : /**************************************************************************
       4             :  * This file is property of and copyright by the Experimental Nuclear     *
       5             :  * Physics Group, Dep. of Physics                                         *
       6             :  * University of Oslo, Norway, 2007                                       *
       7             :  *                                                                        *
       8             :  * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
       9             :  * Contributors are mentioned in the code where appropriate.              *
      10             :  * Please report bugs to perthi@fys.uio.no                                *
      11             :  *                                                                        *
      12             :  * Permission to use, copy, modify and distribute this software and its   *
      13             :  * documentation strictly for non-commercial purposes is hereby granted   *
      14             :  * without fee, provided that the above copyright notice appears in all   *
      15             :  * copies and that both the copyright notice and this permission notice   *
      16             :  * appear in the supporting documentation. The authors make no claims     *
      17             :  * about the suitability of this software for any purpose. It is          *
      18             :  * provided "as is" without express or implied warranty.                  *
      19             :  **************************************************************************/
      20             : 
      21             : #include "TF1.h"
      22             : #include "TMath.h"
      23             : #include <TRandom.h>
      24             : 
      25             : #include "AliEMCALRawResponse.h"
      26             : #include "AliCaloConstants.h"
      27             : 
      28             : using namespace CALO;
      29             : using namespace EMCAL;
      30             : using namespace ALTRO;
      31             : 
      32             : Double_t AliEMCALRawResponse::fgTimeTrigger  = 600E-9 ;   // the time of the trigger as approximately seen in the data
      33             : Int_t    AliEMCALRawResponse::fgThreshold         = 1;
      34             : Int_t    AliEMCALRawResponse::fgPedestalValue     = 0;  // pedestal value for digits2raw, default generate ZS data
      35             : Double_t AliEMCALRawResponse::fgFEENoise          = 3.; // 3 ADC channels of noise (sampled)
      36             : 
      37             : 
      38             : 
      39          42 : ClassImp(AliEMCALRawResponse)
      40             : 
      41             : 
      42             : AliEMCALRawResponse::AliEMCALRawResponse()
      43           0 : {
      44             :   //comment
      45           0 : }
      46             : 
      47             : AliEMCALRawResponse::~AliEMCALRawResponse()
      48           0 : {
      49             : 
      50           0 : }
      51             : 
      52             : 
      53             : Double_t 
      54             : AliEMCALRawResponse::RawResponseFunction(Double_t *x, Double_t *par)
      55             : {
      56             :   // step response of the emcal electronincs
      57             :   Double_t signal = 0.;
      58       75210 :   Double_t tau    = par[2];
      59       37605 :   Double_t n      = par[3];
      60       37605 :   Double_t ped    = par[4];
      61       37605 :   Double_t xx     = ( x[0] - par[1] + tau ) / tau ;
      62       37605 :   if (xx <= 0) 
      63         232 :     signal = ped ;  
      64             :   else 
      65             :     {  
      66       37373 :       signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ; 
      67             :     }
      68       37605 :   return signal ;  
      69             : }
      70             : 
      71             : 
      72             : Bool_t  
      73             : AliEMCALRawResponse::RawSampledResponse(const Double_t dtime, const Double_t damp, Int_t * adcH, 
      74             :                                             Int_t * adcL, const Int_t keyErr)
      75             : {
      76             :   // step response of the emcal electronincs
      77             :   Bool_t lowGain = kFALSE ; 
      78         116 :   TF1 signalF("signal", RawResponseFunction, 0, TIMEBINS, 5);
      79          58 :   signalF.SetParameter(0, damp) ; 
      80          58 :   signalF.SetParameter(1, (dtime + fgTimeTrigger)/ TIMEBINWITH) ; 
      81          58 :   signalF.SetParameter(2, TAU) ; 
      82          58 :   signalF.SetParameter(3, ORDER);
      83          58 :   signalF.SetParameter(4, fgPedestalValue);
      84             :         
      85             :   Double_t signal=0.0, noise=0.0;
      86       29812 :   for (Int_t iTime = 0; iTime <  TIMEBINS; iTime++) {
      87       14848 :     signal = signalF.Eval(iTime) ;  
      88             :     
      89       14848 :     if(keyErr>0) {
      90           0 :       noise = gRandom->Gaus(0.,fgFEENoise);
      91           0 :       signal += noise; 
      92           0 :     }
      93             :           
      94       14848 :     adcH[iTime] =  static_cast<Int_t>(signal + 0.5) ;
      95       14848 :     if ( adcH[iTime] > MAXBINVALUE ){  // larger than 10 bits 
      96           0 :       adcH[iTime] = MAXBINVALUE ;
      97             :       lowGain = kTRUE ; 
      98           0 :     }
      99       14848 :     signal /= HGLGFACTOR;
     100       14848 :     adcL[iTime] =  static_cast<Int_t>(signal + 0.5) ;
     101       14848 :     if ( adcL[iTime] > MAXBINVALUE )  // larger than 10 bits 
     102           0 :       adcL[iTime] = MAXBINVALUE ;
     103             :   }
     104          58 :   return lowGain ; 
     105          58 : }
     106             : 

Generated by: LCOV version 1.11