]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALHadronCorrectionv0.cxx
Transition to NewIO
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHadronCorrectionv0.cxx
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
17 /*
18 $Log$
19 Revision 1.2.4.2  2003/07/07 14:13:31  schutz
20 NewIO
21
22 Revision 1.4  2002/10/14 14:55:35  hristov
23 Merging the VirtualMC branch to the main development branch (HEAD)
24
25 Revision 1.2.6.2  2002/07/24 10:06:16  alibrary
26 Updating VirtualMC
27
28 Revision 1.3  2002/04/11 19:24:42  nilsen
29 fixed a complation warning about not brace-enclosing the sub-elements of
30 the static Double_t c[naxVariant][nPol].
31
32 Revision 1.2  2002/02/04 15:11:44  hristov
33 Use TMath::Abs instead of fabs (Alpha)
34
35 Revision 1.1  2002/01/17 23:52:43  morsch
36 First commit.
37
38 */
39
40
41 #include "AliEMCALHadronCorrectionv0.h"
42
43 const Int_t maxVariant = 8;  // size eta grid
44 const Int_t nVec = 10;       // size momentum grid
45 const Int_t nPol = 4;        // number coefficients of polinom
46 static Double_t etaGrid[maxVariant]={ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.67};
47 static Double_t pGrid[nVec]={ 0.2, 0.5, 1.0, 2.0, 3.0, 5.0,10.0,15.0,25.0,40.0};
48 // c[][] - first index for eta, second for momentum 
49 static Double_t c[maxVariant][nPol] ={
50     {1.305705e-01, 3.725653e-01, -1.219962e-02, 1.806235e-04},
51     {1.296153e-01, 3.827408e-01, -1.238640e-02, 1.822804e-04},
52     {1.337690e-01, 3.797454e-01, -1.245227e-02, 1.848243e-04},
53     {1.395796e-01, 3.623994e-01, -9.196803e-03, 1.243278e-04},
54     {1.457184e-01, 3.753655e-01, -1.035324e-02, 1.473447e-04},
55     {1.329164e-01, 4.219044e-01, -1.310515e-02, 1.948883e-04},
56     {8.136581e-02, 4.646087e-01, -1.531917e-02, 2.274749e-04},
57     {1.119836e-01, 4.262497e-01, -1.160125e-02, 1.628738e-04} };
58
59 ClassImp(AliEMCALHadronCorrectionv0)
60
61 AliEMCALHadronCorrectionv0* AliEMCALHadronCorrectionv0::fHadrCorr = 0;
62
63 AliEMCALHadronCorrectionv0::AliEMCALHadronCorrectionv0(const char *name,const char *title) 
64                            :AliEMCALHadronCorrection(name, title)
65 {
66   fHadrCorr = this;
67 }
68
69 AliEMCALHadronCorrectionv0*
70 AliEMCALHadronCorrectionv0::Instance()
71 {
72   fHadrCorr = new AliEMCALHadronCorrectionv0();
73   return fHadrCorr;
74 }
75
76 Double_t 
77 AliEMCALHadronCorrectionv0::GetEnergy(const Double_t pmom,const Double_t eta,const Int_t gid)
78 {
79   Int_t iEta=0; // index 
80   Double_t etaw = TMath::Abs(eta);
81   if(etaw > etaGrid[maxVariant-1]) etaw = etaGrid[maxVariant-1];
82   for(Int_t i=0; i<maxVariant; i++) if(eta>=etaGrid[i]) {iEta = i; break;}
83
84   Double_t e[2], y, pw = pmom;
85   if(pmom > pGrid[nVec-1]) pw = pGrid[nVec-1];
86   for(Int_t i=0; i<2; i++){ // e for two eta value
87     e[i] = c[iEta][0];
88     y = 1.;
89     for(Int_t j=1; j<nPol; j++){
90       y *= pw;
91       e[i] += c[iEta][j]*y;
92     }
93     if(i==0) iEta ++;
94   }
95
96   Double_t deta = etaGrid[iEta] - etaGrid[iEta-1];
97   Double_t a = (e[1] - e[0])/deta; // slope 
98   Double_t energy = e[0] + a*(eta-etaGrid[iEta-1]);
99   return energy;
100 }