]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALHadronCorrectionv1.cxx
e81b55d59e9da2b02012a823aacc43bea42e826e
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHadronCorrectionv1.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 // Author : Mark Horner (LBL/UCT)
18
19 #include "AliEMCALHadronCorrectionv1.h"
20 #include "AliEMCALGeometry.h"
21 static Double_t par_look_up[HCPARAMETERS][HCPARAMETERSETS] = 
22 {  
23     {-1.68945e-04 , -1.68945e-04},   
24     { 2.09684e-02 ,  2.09684e-02},   
25     {-1.45683e-04 , -1.45683e-04},   
26     { 6.64803e-03 ,  6.64803e-03},   
27     { 2.00834e-02 ,  2.00834e-02},   
28     { 9.22074e-07 ,  9.22074e-07}
29 };
30
31
32
33 ClassImp(AliEMCALHadronCorrectionv1)
34
35 AliEMCALHadronCorrectionv1* AliEMCALHadronCorrectionv1::fHadrCorr = 0;
36
37 void AliEMCALHadronCorrectionv1::SetGeometry(AliEMCALGeometry *geometry)
38 {
39     if (!geometry)
40     {
41         SetParameters();
42     }else
43     {
44         SetParameters(geometry->GetName());
45     }
46     return;     
47 }       
48         
49 void AliEMCALHadronCorrectionv1::SetGeometry(TString name)
50 {
51   if ( name == ""              ||
52        name == "EMCAL_5655_21" ||
53        name == "EMCALArch1a"   ||
54        name == "EMCALArch1aN"  ||
55        name == "G56_2_55_19"   ||
56        name == "G56_2_55_19_104_14" )
57   { // set parameters to this hadron correction
58      for (Int_t i=0;i<6;i++)
59      {
60            fPar[i] = par_look_up[i][0];  
61      }
62   }else if( name == "EMCAL_6564_21" ||  
63             name == "G65_2_64_19" )
64   {       
65      for (Int_t i=0;i<6;i++)
66      {
67            fPar[i] = par_look_up[i][1];  
68      }
69   }else
70   {
71     printf("Geometry not defined in hadron correction\n"); 
72   }       
73         
74 }       
75
76         
77 AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title) 
78                            :AliEMCALHadronCorrection(name, title)
79 {
80   fHadrCorr = this;
81 }
82
83 /*
84 AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title,AliEMCALGeometry *geometry)
85 {
86
87   fHadrCorr = this;
88   SetGeometry(geometry);  
89         
90 }       
91 */
92
93 AliEMCALHadronCorrectionv1*
94 AliEMCALHadronCorrectionv1::Instance()
95 {
96   if (! fHadrCorr) new AliEMCALHadronCorrectionv1();
97   return fHadrCorr;
98 }
99
100 Double_t 
101 AliEMCALHadronCorrectionv1::GetEnergy(const Double_t pmom,const Double_t eta,const Int_t gid)
102 {
103
104   Double_t value =  fPar[5]*pmom*pmom*pmom+ fPar[0]*pmom*pmom+fPar[1]*pmom +fPar[2]*pmom*eta +fPar[3]*eta + fPar[4];
105   return value;
106    
107 }