Enlarging array
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHadronCorrectionv0.cxx
CommitLineData
8710bb16 1/**************************************************************************
2 * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
ee6b678f 17/* $Id$ */
8710bb16 18
19#include "AliEMCALHadronCorrectionv0.h"
20
21const Int_t maxVariant = 8; // size eta grid
22const Int_t nVec = 10; // size momentum grid
23const Int_t nPol = 4; // number coefficients of polinom
24static Double_t etaGrid[maxVariant]={ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.67};
25static Double_t pGrid[nVec]={ 0.2, 0.5, 1.0, 2.0, 3.0, 5.0,10.0,15.0,25.0,40.0};
26// c[][] - first index for eta, second for momentum
ffe2426f 27static Double_t c[maxVariant][nPol] ={
28 {1.305705e-01, 3.725653e-01, -1.219962e-02, 1.806235e-04},
29 {1.296153e-01, 3.827408e-01, -1.238640e-02, 1.822804e-04},
30 {1.337690e-01, 3.797454e-01, -1.245227e-02, 1.848243e-04},
31 {1.395796e-01, 3.623994e-01, -9.196803e-03, 1.243278e-04},
32 {1.457184e-01, 3.753655e-01, -1.035324e-02, 1.473447e-04},
33 {1.329164e-01, 4.219044e-01, -1.310515e-02, 1.948883e-04},
34 {8.136581e-02, 4.646087e-01, -1.531917e-02, 2.274749e-04},
35 {1.119836e-01, 4.262497e-01, -1.160125e-02, 1.628738e-04} };
8710bb16 36
37ClassImp(AliEMCALHadronCorrectionv0)
38
39AliEMCALHadronCorrectionv0* AliEMCALHadronCorrectionv0::fHadrCorr = 0;
40
41AliEMCALHadronCorrectionv0::AliEMCALHadronCorrectionv0(const char *name,const char *title)
42 :AliEMCALHadronCorrection(name, title)
43{
44 fHadrCorr = this;
45}
46
47AliEMCALHadronCorrectionv0*
48AliEMCALHadronCorrectionv0::Instance()
49{
50 fHadrCorr = new AliEMCALHadronCorrectionv0();
51 return fHadrCorr;
52}
53
54Double_t
09884213 55AliEMCALHadronCorrectionv0::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
8710bb16 56{
57 Int_t iEta=0; // index
2f804294 58 Double_t etaw = TMath::Abs(eta);
8710bb16 59 if(etaw > etaGrid[maxVariant-1]) etaw = etaGrid[maxVariant-1];
60 for(Int_t i=0; i<maxVariant; i++) if(eta>=etaGrid[i]) {iEta = i; break;}
61
62 Double_t e[2], y, pw = pmom;
63 if(pmom > pGrid[nVec-1]) pw = pGrid[nVec-1];
64 for(Int_t i=0; i<2; i++){ // e for two eta value
65 e[i] = c[iEta][0];
66 y = 1.;
67 for(Int_t j=1; j<nPol; j++){
68 y *= pw;
69 e[i] += c[iEta][j]*y;
70 }
71 if(i==0) iEta ++;
72 }
73
74 Double_t deta = etaGrid[iEta] - etaGrid[iEta-1];
75 Double_t a = (e[1] - e[0])/deta; // slope
76 Double_t energy = e[0] + a*(eta-etaGrid[iEta-1]);
77 return energy;
78}