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