AliRoot Core  edcc906 (edcc906)
AliEMCALRawResponse.cxx
Go to the documentation of this file.
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 *
5  * *
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 *
9  * *
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  **************************************************************************/
18 
19 #include "TF1.h"
20 #include "TMath.h"
21 #include <TRandom.h>
22 
23 #include "AliEMCALRawResponse.h"
24 #include "AliCaloConstants.h"
25 
26 using namespace CALO;
27 using namespace EMCAL;
28 using namespace ALTRO;
29 
30 Double_t AliEMCALRawResponse::fgTimeTrigger = 600E-9 ; // the time of the trigger as approximately seen in the data
31 Int_t AliEMCALRawResponse::fgThreshold = 1; // store ADC values avobe this limit
32 Int_t AliEMCALRawResponse::fgPedestalValue = 0 ; // pedestal value for digits2raw, default generate ZS data
33 Double_t AliEMCALRawResponse::fgFEENoise = 3.; // 3 ADC channels of noise (sampled)
34 
36 ClassImp(AliEMCALRawResponse) ;
38 
39 
41 {
42  //comment
43 }
44 
46 {
47 
48 }
49 
59 Double_t
60 AliEMCALRawResponse::RawResponseFunction(Double_t *x, Double_t *par)
61 {
62  Double_t signal = 0.;
63  Double_t tau = par[2];
64  Double_t n = par[3];
65  Double_t ped = par[4];
66  Double_t xx = ( x[0] - par[1] + tau ) / tau ;
67 
68  if (xx <= 0)
69  signal = ped ;
70  else
71  signal = ped + par[0] * TMath::Power(xx , n) * TMath::Exp(n * (1 - xx )) ;
72 
73  return signal ;
74 }
75 
88 Bool_t
89 AliEMCALRawResponse::RawSampledResponse(Double_t dtime, Double_t damp,
90  Int_t * adcH, Int_t * adcL, Int_t keyErr)
91 {
92  Bool_t lowGain = kFALSE ;
93 
94  Double_t time = dtime;
95  // If time decalibration not applied
96  if(dtime < 100E-9) time+=fgTimeTrigger;
97 
98  TF1 signalF("signal", RawResponseFunction, 0, TIMEBINS, 5);
99  signalF.SetParameter(0, damp) ;
100  signalF.SetParameter(1, time / TIMEBINWITH) ;
101  signalF.SetParameter(2, TAU) ; // 2.35, approximate shaping time
102  signalF.SetParameter(3, ORDER); // 2, order of shaping stages
103  signalF.SetParameter(4, fgPedestalValue);
104 
105  Double_t signal=0.0, noise=0.0;
106  for (Int_t iTime = 0; iTime < TIMEBINS; iTime++)
107  {
108  signal = signalF.Eval(iTime) ;
109 
110  if(keyErr>0)
111  {
112  noise = gRandom->Gaus(0.,fgFEENoise);
113  signal += noise;
114  }
115 
116  adcH[iTime] = static_cast<Int_t>(signal + 0.5) ;
117 
118  if ( adcH[iTime] > MAXBINVALUE ) // larger than 10 bits
119  {
120  adcH[iTime] = MAXBINVALUE ;
121  lowGain = kTRUE ;
122  }
123 
124  signal /= HGLGFACTOR;
125 
126  adcL[iTime] = static_cast<Int_t>(signal + 0.5) ;
127 
128  if ( adcL[iTime] > MAXBINVALUE ) // larger than 10 bits
129  adcL[iTime] = MAXBINVALUE ;
130  } // time bin loop
131 
132  return lowGain ;
133 }
134 
const Double_t fgFEENoise
const int MAXBINVALUE
Max possible ALTRO ADC value ( 10 bit )
const double TIMEBINWITH
each sample is 100 ns
static Int_t fgThreshold
Store ADC values avobe this limit demanded by AliAltoBuffer::WriteChannel()
const double TAU
Approximate shaping time.
const Double_t fgTimeTrigger
static Double_t fgTimeTrigger
Time shift of the digit, apply only if not done at digitization level.
const double HGLGFACTOR
energy transion low/high gaing
Double_t RawResponseFunction(Double_t *x, Double_t *par)
Response function.
const int ORDER
Order of shaping stages of the signal conditioning unit.
static Bool_t RawSampledResponse(Double_t dtime, Double_t damp, Int_t *adcH, Int_t *adcL, Int_t keyErr=0)
static Double_t fgFEENoise
Electronics noise in ADC units, apply only if not done at digitization level.
const int TIMEBINS
number of sampling bins of the raw RO signal (we typically use 15-50; max is 1k+) ...
static Double_t RawResponseFunction(Double_t *x, Double_t *par)
Handling of digits to raw data transformation.
static Int_t fgPedestalValue
Pedestal value, apply only if not done at digitization level.