]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliJetHadronCorrectionv1.cxx
Dixed a crash when no proper files/data to display (Mikolaj)
[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
18// Author : magali.estienne@ires.in2p3.fr
19//===============================================================
20// Author : Mark Horner (LBL/UCT)
21
22// --- Standard library ---
23#include "Riostream.h"
24#include "TMath.h"
25
26// --- AliRoot header files ---
27//#include "../EMCAL/AliJetGeometry.h"
38a7f6db 28#include "AliJetDummyGeo.h"
4a01bb2c 29#include "AliJetHadronCorrectionv1.h"
30
31ClassImp(AliJetHadronCorrectionv1)
32
33Double_t AliJetHadronCorrectionv1::fgParLookup[HCPARAMETERS][HCPARAMETERSETS] =
34{
35 {-2.82271e-4 , -2.39954e-4},
36 {2.50796e-2 , 2.07172e-2},
37 {1.02861e-3 , 1.48576e-3},
38 {2.11539e-2 , -1.38473-2},
39 {2.27003e-2 , 2.78252e-2},
40 {1.65078e-6 , 1.51821e-6}
41};
42
43AliJetHadronCorrectionv1* AliJetHadronCorrectionv1::fgHadrCorr = 0;
44
38a7f6db 45void AliJetHadronCorrectionv1::SetGeometry(AliJetDummyGeo *geometry)
4a01bb2c 46{
47 // Initialise EMCAL geometry
48 if (!geometry)
49 {
50 SetParameters();
51 fSamplingFraction = geometry->GetSampling();
52 cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl;
53 }else
54 {
55 SetParameters(geometry->GetName());
56 fSamplingFraction = geometry->GetSampling();
57 cout<<"Setting the sampling fraction to :"<<fSamplingFraction<<endl;
58 }
59 return;
60}
61
62/*
63###########################################################################
64###########################################################################
65
66This will have to be modified with the inclusion of the new EMCAL geometry
67That means I guess a new study of the hadron correction...
68
69Geometry : SHISH...
70
71###########################################################################
72###########################################################################
73*/
74
75
76
77
78void AliJetHadronCorrectionv1::SetGeometry(TString name,Double_t fs)
79{
80 // Initialise EMCAL geometry
81 cout << "Setting sampling fraction to "<<fSamplingFraction<<endl;
82 fSamplingFraction = fs;
83 if ( name == "" ||
84 name == "EMCAL_5655_21" ||
85 name == "EMCALArch1a" ||
86 name == "EMCALArch1aN" ||
87 name == "G56_2_55_19" ||
88 name == "G56_2_55_19_104_14" )
89 { // set parameters to this hadron correction
90 cout<<"HC parameters!"<<endl;
91 for (Int_t i=0;i<6;i++)
92 {
93 fPar[i] = fgParLookup[i][0];
94 cout <<fPar[i]<<endl;
95 }
96 }else if( name == "EMCAL_6564_21" ||
97 name == "G65_2_64_19" )
98 {
99 cout<<"HC parameters!"<<endl;
100 for (Int_t i=0;i<6;i++)
101 {
102 fPar[i] = fgParLookup[i][1];
103 cout <<fPar[i]<<endl;
104 }
105 }else
106 {
107 printf("Geometry not defined in hadron correction\n");
108 }
109
110}
111
9e4cc50d 112AliJetHadronCorrectionv1::AliJetHadronCorrectionv1()
113 :AliJetHadronCorrection(),
114 fSamplingFraction(0)
115{
116}
4a01bb2c 117
118AliJetHadronCorrectionv1::AliJetHadronCorrectionv1(const char *name,const char *title)
9e4cc50d 119 :AliJetHadronCorrection(name, title),
120 fSamplingFraction(0)
4a01bb2c 121{
122 fgHadrCorr = this;
123}
124
125/*
126AliJetHadronCorrectionv1::AliJetHadronCorrectionv1(const char *name,const char *title,AliJetGeometry *geometry)
127{
128
129 fHadrCorr = this;
130 SetGeometry(geometry);
131
132}
133*/
134
135AliJetHadronCorrectionv1*
136AliJetHadronCorrectionv1::Instance()
137{
138 // return pointer to global instance. Instantiate if needed
139 if (! fgHadrCorr) new AliJetHadronCorrectionv1();
140 return fgHadrCorr;
141}
142
143Double_t
144AliJetHadronCorrectionv1::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/)
145{
146 // Return parametrised energy response
147 Double_t etai = TMath::Abs(eta);
148 Double_t value = fPar[5]*pmom*pmom*pmom+ fPar[0]*pmom*pmom+fPar[1]*pmom +fPar[2]*pmom*etai +fPar[3]*etai + fPar[4];
149 return fSamplingFraction*value;
150
151}