Coverity fix
[u/mrichter/AliRoot.git] / PHOS / AliPHOSRecoParam.cxx
CommitLineData
58f66025 1/**************************************************************************
2 * Copyright(c) 2007, 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/* $Id$ */
17
18// Base class for the PHOS reconstruction parameters.
19// Do not use in the reconstruction; use derivative classes instead.
20// Author: Boris Polichtchouk.
21
22// --- AliRoot header files ---
7e88424f 23#include "AliCDBManager.h"
24#include "AliCDBEntry.h"
0428f331 25#include "AliLog.h"
58f66025 26#include "AliPHOSRecoParam.h"
27
28ClassImp(AliPHOSRecoParam)
29
7e88424f 30TObjArray* AliPHOSRecoParam::fgkMaps =0; //ALTRO mappings
31
58f66025 32//-----------------------------------------------------------------------------
75b88769 33AliPHOSRecoParam::AliPHOSRecoParam() :
cf4e2a86 34 AliDetectorRecoParam(),
25312a8e 35 fNonLinearityParams(3),
7e88424f 36 fEMCClusteringThreshold(0.2),
37 fEMCLocMaxCut(0.03),
12dd7f10 38 fEMCRawDigitThreshold(2),
39 fEMCMinE(0.012),
7e88424f 40 fEMCW0(4.5),
41 fEMCSampleQualityCut(1.),
67637327 42 fTimeGateAmpThresh(10.),
43 fTimeGateLow(1.e-6),
25312a8e 44 fTimeGateHigh(1.e-6),
7e88424f 45 fEMCEcoreRadius(3.),
46 fEMCEcore2ESD(kFALSE),
47 fEMCSubtractPedestals(kTRUE),
48 fEMCUnfold(kTRUE),
71994f35 49 fEMCEnergyCorrectionOn(kTRUE),
379c5c09 50 fEMCFitterVersion(""),
25312a8e 51 fNonlinearityCorrVersion(""),
0428f331 52 fGlobalAltroOffset(0),
f78c9781 53 fGlobalAltroThreshold(0),
7e88424f 54 fCPVClusteringThreshold(0.0),
55 fCPVLocMaxCut(0.03),
56 fCPVMinE(0.0),
57 fCPVW0(4.0),
58 fCPVUnfold(kTRUE)
58f66025 59{
60 //Default constructor.
25312a8e 61 SetNonlinearityCorrectionVersion("Gustavo2005") ;
58f66025 62}
63
64//-----------------------------------------------------------------------------
308fb942 65AliPHOSRecoParam::AliPHOSRecoParam(const AliPHOSRecoParam& ):
cf4e2a86 66 AliDetectorRecoParam(),
25312a8e 67 fNonLinearityParams(3),
7e88424f 68 fEMCClusteringThreshold(0.2),
69 fEMCLocMaxCut(0.03),
12dd7f10 70 fEMCRawDigitThreshold(2),
71 fEMCMinE(0.012),
7e88424f 72 fEMCW0(4.5),
73 fEMCSampleQualityCut(1.),
67637327 74 fTimeGateAmpThresh(10.),
75 fTimeGateLow(1.e-6),
25312a8e 76 fTimeGateHigh(1.e-6),
7e88424f 77 fEMCEcoreRadius(3.),
78 fEMCEcore2ESD(kFALSE),
79 fEMCSubtractPedestals(kTRUE),
80 fEMCUnfold(kTRUE),
71994f35 81 fEMCEnergyCorrectionOn(kTRUE),
379c5c09 82 fEMCFitterVersion(""),
25312a8e 83 fNonlinearityCorrVersion(""),
0428f331 84 fGlobalAltroOffset(0),
f78c9781 85 fGlobalAltroThreshold(0),
7e88424f 86 fCPVClusteringThreshold(0.0),
87 fCPVLocMaxCut(0.03),
88 fCPVMinE(0.0),
89 fCPVW0(4.0),
90 fCPVUnfold(kTRUE)
58f66025 91{
92 //Copy constructor.
93}
94
95//-----------------------------------------------------------------------------
96AliPHOSRecoParam& AliPHOSRecoParam::operator = (const AliPHOSRecoParam& recoParam)
97{
98 //Assignment operator.
99
100 if(this != &recoParam) {
25312a8e 101 fNonLinearityParams = recoParam.fNonLinearityParams;
7e88424f 102 fEMCClusteringThreshold = recoParam.fEMCClusteringThreshold;
103 fEMCLocMaxCut = recoParam.fEMCLocMaxCut;
12dd7f10 104 fEMCRawDigitThreshold = recoParam.fEMCRawDigitThreshold;
7e88424f 105 fEMCMinE = recoParam.fEMCMinE;
106 fEMCW0 = recoParam.fEMCW0;
107 fEMCSampleQualityCut = recoParam.fEMCSampleQualityCut;
67637327 108 fTimeGateAmpThresh = recoParam.fTimeGateAmpThresh ;
109 fTimeGateLow = recoParam.fTimeGateLow ;
110 fTimeGateHigh = recoParam.fTimeGateHigh ;
7e88424f 111 fEMCEcoreRadius = recoParam.fEMCEcoreRadius;
112 fEMCEcore2ESD = recoParam.fEMCEcore2ESD;
113 fEMCSubtractPedestals = recoParam.fEMCSubtractPedestals;
114 fEMCUnfold = recoParam.fEMCUnfold;
71994f35 115 fEMCEnergyCorrectionOn = recoParam.fEMCEnergyCorrectionOn;
379c5c09 116 fEMCFitterVersion = recoParam.fEMCFitterVersion;
25312a8e 117 fNonlinearityCorrVersion= recoParam.fNonlinearityCorrVersion;
0428f331 118 fGlobalAltroOffset = recoParam.fGlobalAltroOffset;
f78c9781 119 fGlobalAltroThreshold = recoParam.fGlobalAltroThreshold;
7e88424f 120 fCPVClusteringThreshold = recoParam.fCPVClusteringThreshold;
121 fCPVLocMaxCut = recoParam.fCPVLocMaxCut;
122 fCPVMinE = recoParam.fCPVMinE;
123 fCPVW0 = recoParam.fCPVW0;
124 fCPVUnfold = recoParam.fCPVUnfold;
25312a8e 125 fNonLinearityParams = recoParam.fNonLinearityParams ;
58f66025 126 }
127
128 return *this;
129}
7e88424f 130
131//-----------------------------------------------------------------------------
332c745b 132void AliPHOSRecoParam::Print(Option_t * /*option*/) const
0428f331 133{
134 AliDebug(2,Form("PHOS reconstruction parameters:\n"
135 "\tEMCClusteringThreshold = %f\n"
136 "\tEMCLocMaxCut = %f\n"
12dd7f10 137 "\tEMCRawDigitThreshold = %f\n"
0428f331 138 "\tEMCMinE = %f\n"
139 "\tEMCW0 = %f\n"
140 "\tEMCSampleQualityCut = %f\n"
141 "\tEMCEcoreRadius = %f\n"
142 "\tEMCEcore2ESD = %d\n"
143 "\tEMCSubtractPedestals = %d\n"
144 "\tEMCUnfold = %d\n"
71994f35 145 "\tEMCEnergyCorrectionOn = %d\n"
379c5c09 146 "\tEMCFitterVersion = \"%s\"\n"
a675b8d6 147 "\tGlobalAltroOffset = %d\n"
f78c9781 148 "\tGlobalAltroThreshold = %d",
0428f331 149 fEMCClusteringThreshold,
150 fEMCLocMaxCut,
12dd7f10 151 fEMCRawDigitThreshold,
0428f331 152 fEMCMinE,
153 fEMCW0,
154 fEMCSampleQualityCut,
155 fEMCEcoreRadius,
156 fEMCEcore2ESD,
157 fEMCSubtractPedestals,
158 fEMCUnfold,
71994f35 159 fEMCEnergyCorrectionOn,
379c5c09 160 fEMCFitterVersion.Data(),
f78c9781 161 fGlobalAltroOffset,
162 fGlobalAltroThreshold));
0428f331 163
164}
165
166//-----------------------------------------------------------------------------
7e88424f 167AliPHOSRecoParam* AliPHOSRecoParam::GetDefaultParameters()
168{
169 //Default parameters for the reconstruction
170
171 AliPHOSRecoParam* params = new AliPHOSRecoParam();
172 return params;
173}
174
175//-----------------------------------------------------------------------------
176const TObjArray* AliPHOSRecoParam::GetMappings()
177{
178 //Returns array of AliAltroMappings for RCU0..RCU3.
179 //If not found, read it from OCDB.
180
181 //Quick check as follows:
162637e4 182 // root [0] AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
7e88424f 183 // root [1] AliCDBManager::Instance()->SetRun(1);
184 // root [2] TObjArray* maps = AliPHOSRecoParam::GetMappings();
185 // root [3] maps->Print();
186
187 if(fgkMaps) return fgkMaps;
188
189 AliCDBEntry* entry = AliCDBManager::Instance()->Get("PHOS/Calib/Mapping");
190 if(entry)
191 fgkMaps = (TObjArray*)entry->GetObject();
192
193 return fgkMaps;
194
195}
25312a8e 196//-----------------------------------------------------------------------------
197void AliPHOSRecoParam::SetNonlinearityCorrectionVersion(const char * ver){
198 //Set non-linearity correction version and adjust parameters
199
200 if(strcmp(ver,"NoCorrection")==0){
201 fNonLinearityParams.Set(1) ;
202 fNonLinearityParams.AddAt(0.,0) ;
203 fNonlinearityCorrVersion=ver ;
204 return ;
205 }
206 if(strcmp(ver,"Henrik2010")==0){
207 Float_t pars[7]={1.051,2.54e-003,-1.737e-002,5.69e-002,3.3e-001,1.42e-001,1.50e-002} ;
208 fNonLinearityParams.Set(7,pars) ;
209 fNonlinearityCorrVersion=ver ;
210 return ;
211 }
212 if(strcmp(ver,"Gustavo2005")==0){
213 Float_t pars[3]={0.0241, 1.0504, 0.000249} ;
214 fNonLinearityParams.Set(3,pars) ;
215 fNonlinearityCorrVersion=ver ;
216 return ;
217 }
218 AliError(Form("Non known correction version: %s, still using default \n",ver)) ;
219
220
221}