]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALHadronCorrectionv1.cxx
Delete the run loader before creating a new getter
[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 #include "Riostream.h"
22 #include "TMath.h"
23 static Double_t par_look_up[HCPARAMETERS][HCPARAMETERSETS] = 
24 {  
25     {-2.82271e-4 , -2.39954e-4},   
26     {2.50796e-2  , 2.07172e-2},   
27     {1.02861e-3  , 1.48576e-3},   
28     {2.11539e-2  , -1.38473-2},   
29     {2.27003e-2  , 2.78252e-2},   
30     {1.65078e-6  , 1.51821e-6}
31 };
32
33
34
35 ClassImp(AliEMCALHadronCorrectionv1)
36
37 AliEMCALHadronCorrectionv1* AliEMCALHadronCorrectionv1::fHadrCorr = 0;
38
39 void AliEMCALHadronCorrectionv1::SetGeometry(AliEMCALGeometry *geometry)
40 {
41     if (!geometry)
42     {
43         SetParameters();
44         fSamplingFraction = geometry->GetSampling();
45         cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl; 
46     }else
47     {
48         SetParameters(geometry->GetName());
49         fSamplingFraction = geometry->GetSampling();
50         cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl; 
51     }
52     return;     
53 }       
54         
55 void AliEMCALHadronCorrectionv1::SetGeometry(TString name,Double_t fs)
56 {
57   cout << "Setting sampling fraction to "<<fSamplingFraction<<endl;     
58    fSamplingFraction = fs;      
59   if ( name == ""              ||
60        name == "EMCAL_5655_21" ||
61        name == "EMCALArch1a"   ||
62        name == "EMCALArch1aN"  ||
63        name == "G56_2_55_19"   ||
64        name == "G56_2_55_19_104_14" )
65   { // set parameters to this hadron correction
66      cout<<"HC parameters!"<<endl;
67      for (Int_t i=0;i<6;i++)
68      {
69            fPar[i] = par_look_up[i][0];  
70            cout <<fPar[i]<<endl;
71      }
72   }else if( name == "EMCAL_6564_21" ||  
73             name == "G65_2_64_19" )
74   {       
75       cout<<"HC parameters!"<<endl;
76      for (Int_t i=0;i<6;i++)
77      {
78            fPar[i] = par_look_up[i][1];  
79            cout <<fPar[i]<<endl;
80      }
81   }else
82   {
83     printf("Geometry not defined in hadron correction\n"); 
84   }       
85         
86 }       
87
88         
89 AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title) 
90                            :AliEMCALHadronCorrection(name, title)
91 {
92   fHadrCorr = this;
93 }
94
95 /*
96 AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title,AliEMCALGeometry *geometry)
97 {
98
99   fHadrCorr = this;
100   SetGeometry(geometry);  
101         
102 }       
103 */
104
105 AliEMCALHadronCorrectionv1*
106 AliEMCALHadronCorrectionv1::Instance()
107 {
108   if (! fHadrCorr) new AliEMCALHadronCorrectionv1();
109   return fHadrCorr;
110 }
111
112 Double_t 
113 AliEMCALHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
114 {
115   Double_t etai = TMath::Abs(eta); 
116   Double_t value =  fPar[5]*pmom*pmom*pmom+ fPar[0]*pmom*pmom+fPar[1]*pmom +fPar[2]*pmom*etai +fPar[3]*etai + fPar[4];
117   return fSamplingFraction*value;
118    
119 }