]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetHadronCorrectionv1.cxx
adding JETAN and FASTJETAN development libs for new i/o of tracks/particles for the...
[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;
1dfd2819 55 for (Int_t i = 0; i < 8; i++) fPar[i] = 0.;
e36a3f22 56}
57
58AliJetHadronCorrectionv1*
59AliJetHadronCorrectionv1::Instance()
60{
61 // return pointer to global instance. Instantiate if needed
62 if (! fgHadrCorr) fgHadrCorr = new AliJetHadronCorrectionv1();
63 return fgHadrCorr;
64}
65
1240edf5 66void AliJetHadronCorrectionv1::SetGeometry2(const AliJetDummyGeo *geometry)
4a01bb2c 67{
68 // Initialise EMCAL geometry
69 if (!geometry)
70 {
71 SetParameters();
5006b1a5 72// commented out since geometry is 0x0 after null check
73// fSamplingFraction = geometry->GetSampling();
4a01bb2c 74 }else
75 {
76 SetParameters(geometry->GetName());
77 fSamplingFraction = geometry->GetSampling();
4a01bb2c 78 }
79 return;
80}
81
82/*
83###########################################################################
84###########################################################################
85
86This will have to be modified with the inclusion of the new EMCAL geometry
87That means I guess a new study of the hadron correction...
88
89Geometry : SHISH...
90
91###########################################################################
92###########################################################################
93*/
94
e59b9a1c 95void AliJetHadronCorrectionv1::SetGeometry(TString /*name*/,Double_t fs)
4a01bb2c 96{
97 // Initialise EMCAL geometry
e36a3f22 98 fSamplingFraction = fs;
99
100 /*
4a01bb2c 101 if ( name == "" ||
102 name == "EMCAL_5655_21" ||
103 name == "EMCALArch1a" ||
104 name == "EMCALArch1aN" ||
105 name == "G56_2_55_19" ||
106 name == "G56_2_55_19_104_14" )
e36a3f22 107 { // set parameters to this hadron correction
4a01bb2c 108 cout<<"HC parameters!"<<endl;
e36a3f22 109 for (Int_t i=0;i<6;i++)
110 {
111 fPar[i] = fgParLookup[i][0];
112 cout <<fPar[i]<<endl;
113 }
114 }else if( name == "EMCAL_6564_21" ||
115 name == "G65_2_64_19" )
116 {
117 cout<<"HC parameters!"<<endl;
118 for (Int_t i=0;i<6;i++)
119 {
120 fPar[i] = fgParLookup[i][1];
121 cout <<fPar[i]<<endl;
122 }
123 }else
124 {
125 printf("Geometry not defined in hadron correction\n");
126 }
127 */
4a01bb2c 128
4a01bb2c 129}
4a01bb2c 130
e36a3f22 131// Double_t AliJetHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
e59b9a1c 132Double_t AliJetHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
4a01bb2c 133{
134 // Return parametrised energy response
135 Double_t etai = TMath::Abs(eta);
e36a3f22 136
137 if(etai < etaGrid[1]) {
138 for (Int_t i=0;i<8;i++)
139 {
140 fPar[i] = fgParLookup[i][1];
141 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
142 }
143 } else if(etai >= etaGrid[1] && etai <= etaGrid[HCPARAMETERS-2]) {
144 for (Int_t i=0;i<8;i++)
145 {
146 fPar[i] = fgParLookup[i][0];
147 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
148 }
149 } else {
150 for (Int_t i=0;i<8;i++)
151 {
152 fPar[i] = fgParLookup[i][2];
153 // cout << "fPar[" << i << "]: " << fPar[i] << endl;
154 }
155
156 }
157
158 Double_t value = fPar[5]*pow(etai,3) +
159 fPar[0]*pow(etai,2) +
160 fPar[1]*etai +
161 fPar[2]*etai*pmom +
162 fPar[3]*pmom +
163 fPar[4] +
164 fPar[6]*pow(pmom,2) +
165 fPar[7]*pow(pmom,3);
166
4a01bb2c 167 return fSamplingFraction*value;
168
169}
e36a3f22 170
1240edf5 171void AliJetHadronCorrectionv1::TrackPositionEMCal(const AliAODTrack* track,Double_t &eta, Double_t &phi)
e36a3f22 172{
1240edf5 173// Return track position on EMCal
e36a3f22 174 AliAODPid* pid = (AliAODPid*) track->GetDetPid();
175
176 if(pid) {
177 Double_t emcpos[3];
178 pid->GetEMCALPosition(emcpos);
179 TVector3 tpos(emcpos[0],emcpos[1],emcpos[2]);
180
181 eta = tpos.Eta();
182 phi = tpos.Phi();
183
184 }
185
186}