]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetHadronCorrectionv1.cxx
New class to extract pt distribution of given particle from pt distribution of a...
[u/mrichter/AliRoot.git] / JETAN / AliJetHadronCorrectionv1.cxx
CommitLineData
4a01bb2c 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// To be modified for hadron correction using particle ID and track merging
e36a3f22 18// Author : magali.estienne@subatech.in2p3.fr
4a01bb2c 19//===============================================================
20// Author : Mark Horner (LBL/UCT)
21
22// --- Standard library ---
23#include "Riostream.h"
24#include "TMath.h"
25
26// --- AliRoot header files ---
e36a3f22 27#include "AliAODTrack.h"
38a7f6db 28#include "AliJetDummyGeo.h"
4a01bb2c 29#include "AliJetHadronCorrectionv1.h"
30
e36a3f22 31static Double_t etaGrid[HCPARAMETERS]={ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.67};
32
4a01bb2c 33ClassImp(AliJetHadronCorrectionv1)
34
35Double_t AliJetHadronCorrectionv1::fgParLookup[HCPARAMETERS][HCPARAMETERSETS] =
36{
e36a3f22 37
38 {7.52624e-2 , 9.80119e-2 , 1.29086e-2},
39 {-2.07449e-2 , 2.22951e-2 , 8.31971e-2},
40 {-3.64861e-4 , -3.65680e-03 , -3.07148e-02},
41 {5.35252e-3 , 5.12234e-03 , 2.25559e-02},
42 {1.27106e-1 , 1.25248e-01 , 1.06352e-01},
43 {-6.72909e-2 , 9.78677e-01 , -1.35909e-01},
44 {-3.80660e-5 , -2.77522e-05 , -2.05218e-05},
45 {1.54855e-7 , 1.00604e-07 , 1.02481e-07}
4a01bb2c 46};
47
48AliJetHadronCorrectionv1* AliJetHadronCorrectionv1::fgHadrCorr = 0;
49
e36a3f22 50AliJetHadronCorrectionv1::AliJetHadronCorrectionv1(const char *name,const char *title)
51 :AliJetHadronCorrection(name, title),
52 fSamplingFraction(0)
53{
54 fgHadrCorr = this;
55}
56
57AliJetHadronCorrectionv1*
58AliJetHadronCorrectionv1::Instance()
59{
60 // return pointer to global instance. Instantiate if needed
61 if (! fgHadrCorr) fgHadrCorr = new AliJetHadronCorrectionv1();
62 return fgHadrCorr;
63}
64
65void AliJetHadronCorrectionv1::SetGeometry2(AliJetDummyGeo *geometry)
4a01bb2c 66{
67 // Initialise EMCAL geometry
68 if (!geometry)
69 {
70 SetParameters();
71 fSamplingFraction = geometry->GetSampling();
4a01bb2c 72 }else
73 {
74 SetParameters(geometry->GetName());
75 fSamplingFraction = geometry->GetSampling();
4a01bb2c 76 }
77 return;
78}
79
80/*
81###########################################################################
82###########################################################################
83
84This will have to be modified with the inclusion of the new EMCAL geometry
85That means I guess a new study of the hadron correction...
86
87Geometry : SHISH...
88
89###########################################################################
90###########################################################################
91*/
92
e59b9a1c 93void AliJetHadronCorrectionv1::SetGeometry(TString /*name*/,Double_t fs)
4a01bb2c 94{
95 // Initialise EMCAL geometry
e36a3f22 96 fSamplingFraction = fs;
97
98 /*
4a01bb2c 99 if ( name == "" ||
100 name == "EMCAL_5655_21" ||
101 name == "EMCALArch1a" ||
102 name == "EMCALArch1aN" ||
103 name == "G56_2_55_19" ||
104 name == "G56_2_55_19_104_14" )
e36a3f22 105 { // set parameters to this hadron correction
4a01bb2c 106 cout<<"HC parameters!"<<endl;
e36a3f22 107 for (Int_t i=0;i<6;i++)
108 {
109 fPar[i] = fgParLookup[i][0];
110 cout <<fPar[i]<<endl;
111 }
112 }else if( name == "EMCAL_6564_21" ||
113 name == "G65_2_64_19" )
114 {
115 cout<<"HC parameters!"<<endl;
116 for (Int_t i=0;i<6;i++)
117 {
118 fPar[i] = fgParLookup[i][1];
119 cout <<fPar[i]<<endl;
120 }
121 }else
122 {
123 printf("Geometry not defined in hadron correction\n");
124 }
125 */
4a01bb2c 126
4a01bb2c 127}
4a01bb2c 128
e36a3f22 129// Double_t AliJetHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
e59b9a1c 130Double_t AliJetHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
4a01bb2c 131{
132 // Return parametrised energy response
133 Double_t etai = TMath::Abs(eta);
e36a3f22 134
135 if(etai < etaGrid[1]) {
136 for (Int_t i=0;i<8;i++)
137 {
138 fPar[i] = fgParLookup[i][1];
139 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
140 }
141 } else if(etai >= etaGrid[1] && etai <= etaGrid[HCPARAMETERS-2]) {
142 for (Int_t i=0;i<8;i++)
143 {
144 fPar[i] = fgParLookup[i][0];
145 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
146 }
147 } else {
148 for (Int_t i=0;i<8;i++)
149 {
150 fPar[i] = fgParLookup[i][2];
151 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
152 }
153
154 }
155
156 Double_t value = fPar[5]*pow(etai,3) +
157 fPar[0]*pow(etai,2) +
158 fPar[1]*etai +
159 fPar[2]*etai*pmom +
160 fPar[3]*pmom +
161 fPar[4] +
162 fPar[6]*pow(pmom,2) +
163 fPar[7]*pow(pmom,3);
164
4a01bb2c 165 return fSamplingFraction*value;
166
167}
e36a3f22 168
169void AliJetHadronCorrectionv1::TrackPositionEMCal(AliAODTrack* track,Double_t &eta, Double_t &phi)
170{
171 AliAODPid* pid = (AliAODPid*) track->GetDetPid();
172
173 if(pid) {
174 Double_t emcpos[3];
175 pid->GetEMCALPosition(emcpos);
176 TVector3 tpos(emcpos[0],emcpos[1],emcpos[2]);
177
178 eta = tpos.Eta();
179 phi = tpos.Phi();
180
181 }
182
183}