]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALRawResponse.cxx
MUON + CheckCompiler
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRawResponse.cxx
CommitLineData
1f847d9f 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
28using namespace CALO;
29using namespace EMCAL;
30using namespace ALTRO;
31
32Double_t AliEMCALRawResponse::fgTimeTrigger = 600E-9 ; // the time of the trigger as approximately seen in the data
33Int_t AliEMCALRawResponse::fgThreshold = 1;
34Int_t AliEMCALRawResponse::fgPedestalValue = 0; // pedestal value for digits2raw, default generate ZS data
35Double_t AliEMCALRawResponse::fgFEENoise = 3.; // 3 ADC channels of noise (sampled)
36
37
38
39ClassImp(AliEMCALRawResponse)
40
41
42AliEMCALRawResponse::AliEMCALRawResponse()
43{
44 //comment
45}
46
47AliEMCALRawResponse::~AliEMCALRawResponse()
48{
49
50}
51
52
53Double_t
54AliEMCALRawResponse::RawResponseFunction(Double_t *x, Double_t *par)
55{
56 // step response of the emcal electronincs
57 Double_t signal = 0.;
58 Double_t tau = par[2];
59 Double_t n = par[3];
60 Double_t ped = par[4];
61 Double_t xx = ( x[0] - par[1] + tau ) / tau ;
62 if (xx <= 0)
63 signal = ped ;
64 else
65 {
66 signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ;
67 }
68 return signal ;
69}
70
71
72Bool_t
73AliEMCALRawResponse::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 TF1 signalF("signal", RawResponseFunction, 0, TIMEBINS, 5);
79 signalF.SetParameter(0, damp) ;
80 signalF.SetParameter(1, (dtime + fgTimeTrigger)/ TIMEBINWITH) ;
81 signalF.SetParameter(2, TAU) ;
82 signalF.SetParameter(3, ORDER);
83 signalF.SetParameter(4, fgPedestalValue);
84
85 Double_t signal=0.0, noise=0.0;
86 for (Int_t iTime = 0; iTime < TIMEBINS; iTime++) {
87 signal = signalF.Eval(iTime) ;
88
89 if(keyErr>0) {
90 noise = gRandom->Gaus(0.,fgFEENoise);
91 signal += noise;
92 }
93
94 adcH[iTime] = static_cast<Int_t>(signal + 0.5) ;
95 if ( adcH[iTime] > MAXBINVALUE ){ // larger than 10 bits
96 adcH[iTime] = MAXBINVALUE ;
97 lowGain = kTRUE ;
98 }
99 signal /= HGLGFACTOR;
100 adcL[iTime] = static_cast<Int_t>(signal + 0.5) ;
101 if ( adcL[iTime] > MAXBINVALUE ) // larger than 10 bits
102 adcL[iTime] = MAXBINVALUE ;
103 }
104 return lowGain ;
105}
106