]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALHadronCorrectionv1.cxx
TRD1, 12 SM, 110 degree as default
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHadronCorrectionv1.cxx
CommitLineData
414acf4e 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"
bdade85d 21#include "Riostream.h"
561356e3 22#include "TMath.h"
65603611 23
24ClassImp(AliEMCALHadronCorrectionv1)
25
26Double_t AliEMCALHadronCorrectionv1::fgParLookup[HCPARAMETERS][HCPARAMETERSETS] =
414acf4e 27{
561356e3 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}
414acf4e 34};
35
65603611 36AliEMCALHadronCorrectionv1* AliEMCALHadronCorrectionv1::fgHadrCorr = 0;
414acf4e 37
38void AliEMCALHadronCorrectionv1::SetGeometry(AliEMCALGeometry *geometry)
39{
65603611 40 // Initialise EMCAL geometry
414acf4e 41 if (!geometry)
42 {
43 SetParameters();
561356e3 44 fSamplingFraction = geometry->GetSampling();
45 cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl;
414acf4e 46 }else
47 {
48 SetParameters(geometry->GetName());
561356e3 49 fSamplingFraction = geometry->GetSampling();
50 cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl;
414acf4e 51 }
52 return;
53}
54
bdade85d 55void AliEMCALHadronCorrectionv1::SetGeometry(TString name,Double_t fs)
414acf4e 56{
65603611 57 // Initialise EMCAL geometry
561356e3 58 cout << "Setting sampling fraction to "<<fSamplingFraction<<endl;
59 fSamplingFraction = fs;
414acf4e 60 if ( name == "" ||
61 name == "EMCAL_5655_21" ||
62 name == "EMCALArch1a" ||
63 name == "EMCALArch1aN" ||
64 name == "G56_2_55_19" ||
65 name == "G56_2_55_19_104_14" )
66 { // set parameters to this hadron correction
561356e3 67 cout<<"HC parameters!"<<endl;
414acf4e 68 for (Int_t i=0;i<6;i++)
69 {
65603611 70 fPar[i] = fgParLookup[i][0];
561356e3 71 cout <<fPar[i]<<endl;
414acf4e 72 }
73 }else if( name == "EMCAL_6564_21" ||
74 name == "G65_2_64_19" )
75 {
561356e3 76 cout<<"HC parameters!"<<endl;
414acf4e 77 for (Int_t i=0;i<6;i++)
78 {
65603611 79 fPar[i] = fgParLookup[i][1];
561356e3 80 cout <<fPar[i]<<endl;
414acf4e 81 }
82 }else
83 {
84 printf("Geometry not defined in hadron correction\n");
85 }
86
87}
88
89
90AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title)
91 :AliEMCALHadronCorrection(name, title)
92{
65603611 93 fgHadrCorr = this;
414acf4e 94}
95
96/*
97AliEMCALHadronCorrectionv1::AliEMCALHadronCorrectionv1(const char *name,const char *title,AliEMCALGeometry *geometry)
98{
99
100 fHadrCorr = this;
101 SetGeometry(geometry);
102
103}
104*/
105
106AliEMCALHadronCorrectionv1*
107AliEMCALHadronCorrectionv1::Instance()
108{
65603611 109 // return pointer to global instance. Instantiate if needed
110 if (! fgHadrCorr) new AliEMCALHadronCorrectionv1();
111 return fgHadrCorr;
414acf4e 112}
113
114Double_t
09884213 115AliEMCALHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
414acf4e 116{
65603611 117 // Return parametrised energy response
561356e3 118 Double_t etai = TMath::Abs(eta);
119 Double_t value = fPar[5]*pmom*pmom*pmom+ fPar[0]*pmom*pmom+fPar[1]*pmom +fPar[2]*pmom*etai +fPar[3]*etai + fPar[4];
120 return fSamplingFraction*value;
414acf4e 121
122}