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