Cleaned usage of TClonesArrays in the loader
[u/mrichter/AliRoot.git] / EMCAL / macros / RecParamDB / AliEMCALSetRecParamCDB.C
CommitLineData
3a8be91c 1// Script to create reconstruction parameters and store them into CDB
2// Author: Yuri Kharlov
3
4/* $Id$ */
5
6#if !defined(__CINT__)
7#include "TControlBar.h"
8#include "TString.h"
9
10#include "AliEMCALRecParam.h"
11#include "AliCDBMetaData.h"
12#include "AliCDBId.h"
13#include "AliCDBEntry.h"
14#include "AliCDBManager.h"
15#include "AliCDBStorage.h"
16#endif
17
18
88cf6bfb 19void AliEMCALSetRecParamCDB(AliRecoParam::EventSpecie_t default = AliRecoParam::kLowMult)
3a8be91c 20{
1e7c9b89 21
3a8be91c 22 // Create an object AliEMCALRecParam and store it to OCDB
1e7c9b89 23
413e6b81 24 //Activate CDB storage
25 AliCDBManager* cdb = AliCDBManager::Instance();
3aa21746 26 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
1e7c9b89 27
3a8be91c 28 // Create reconstruction parameter object and set parameter values
413e6b81 29 TObjArray* recParamArray = new TObjArray();
1e7c9b89 30
c8a7579b 31 {
32 //default
1e7c9b89 33 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetDefaultParameters();
e658398a 34 AliEMCALRecParam *recParamDB = GetLowMultiplicityParameters();
35 recParamDB->SetName("Default - p+p");
36 recParamDB->SetTitle("Default - p+p");
c8a7579b 37 //Add to the recParamArray
38 recParamDB->SetEventSpecie(AliRecoParam::kDefault);
39 recParamArray->AddLast(recParamDB);
88cf6bfb 40
c8a7579b 41 }
1e7c9b89 42
413e6b81 43 //Add other options here, if desired, for
44 //Cosmic, LowMult and HighMult type events
45 //and add them to the array
1e7c9b89 46
c8a7579b 47 {
48 //For now, default is Pb+Pb, but let's add it again as
49 //the "high mult" version too...
1e7c9b89 50 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetHighFluxParam();
51 AliEMCALRecParam *recParamDB = GetHighMultiplicityParameters();
52 recParamDB->SetName("High Flux - Pb+Pb");
53 recParamDB->SetTitle("High Flux - Pb+Pb");
c8a7579b 54 recParamDB->SetEventSpecie(AliRecoParam::kHighMult);
55 recParamArray->AddLast(recParamDB);
56 }
1e7c9b89 57
c8a7579b 58 {
59 //Low multiplicity parameter modifications:
1e7c9b89 60 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetLowFluxParam();
61 AliEMCALRecParam *recParamDB = GetLowMultiplicityParameters();
62 recParamDB->SetName("Low Flux - p+p");
63 recParamDB->SetTitle("Low Flux - p+p");
c8a7579b 64 recParamDB->SetEventSpecie(AliRecoParam::kLowMult);
65 recParamArray->AddLast(recParamDB);
66
67 }
1e7c9b89 68
98cf874d 69 {
1e7c9b89 70 //Cosmic parameter modifications (same as low multiplicity):
71 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetLowFluxParam();
72 AliEMCALRecParam *recParamDB = GetLowMultiplicityParameters();
73 recParamDB->SetName("Cosmic");
74 recParamDB->SetTitle("Cosmic");
75 recParamDB->SetEventSpecie(AliRecoParam::kCosmic);
76 recParamArray->AddLast(recParamDB);
77
98cf874d 78 }
1e7c9b89 79
98cf874d 80 {
1e7c9b89 81 //Calib parameter modifications (same as low multiplicity):
82 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetLowFluxParam();
83 AliEMCALRecParam *recParamDB = GetLowMultiplicityParameters();
84 recParamDB->SetName("Calibration - LED");
85 recParamDB->SetTitle("Calibration - LED");
86 recParamDB->SetEventSpecie(AliRecoParam::kCalib);
87 recParamArray->AddLast(recParamDB);
88
89 }
90
413e6b81 91 //Set the default version in the array
92 Bool_t defaultIsSet = kFALSE;
93 for(Int_t i = 0; i < recParamArray->GetEntriesFast(); i++) {
94 AliDetectorRecoParam* param = (AliDetectorRecoParam*)recParamArray->UncheckedAt(i);
95 if(!param) continue;
96 if(default & param->GetEventSpecie()) {
97 param->SetAsDefault();
98 defaultIsSet = kTRUE;
99 }
100 }
1e7c9b89 101
413e6b81 102 if(!defaultIsSet) {
103 AliError("The default reconstruction parameters are not set! Exiting...");
3a8be91c 104 return;
105 }
1e7c9b89 106
413e6b81 107 // Store calibration data into database
108 AliCDBMetaData *md = new AliCDBMetaData();
109 md->SetResponsible("J. Klay");
110 md->SetComment("Reconstruction Parameters: EMCAL");
111 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
112 md->SetBeamPeriod(0);
113
114 AliCDBId id("EMCAL/Calib/RecoParam",0,AliCDBRunRange::Infinity());
c8a7579b 115 cdb->GetDefaultStorage()->Put(recParamArray, id, md);
1e7c9b89 116
413e6b81 117 return;
3a8be91c 118}
1e7c9b89 119
120//-----------------------------------------------------------------------------
121AliEMCALRecParam* GetHighMultiplicityParameters()
122{
123 //Set here the high flux/multiplicity ("Pb+Pb") parameters for the reconstruction
124 //Right now it should be the same settings as with
125 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetHighFluxParam();
126 //or
127 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetDefaultParameters();
128
129 AliEMCALRecParam* params = AliEMCALRecParam::GetDefaultParameters();
130
131 //Clusterization
132 params->SetClusteringThreshold(0.5);
133 params->SetW0(4.5);
134 params->SetMinECut(0.45);
135 params->SetUnfold(kFALSE);
136 params->SetLocMaxCut(0.03);
829ba234 137 params->SetTimeCut(100e-9);//100 ns
138 //Simulation
9dce5a21 139 //params->SetTimeMin(5e-9);//100 ns
140 //params->SetTimeMax(50e-9);//100 ns
829ba234 141 //Real Data
64c98165 142 params->SetTimeMin(525e-9);//100 ns
143 params->SetTimeMax(725e-9);//100 ns
829ba234 144
1e7c9b89 145 //Track matching
146 params->SetTrkCutX(6.0);
147 params->SetTrkCutY(6.0);
148 params->SetTrkCutZ(6.0);
149 params->SetTrkCutR(10.0);
150 params->SetTrkCutAlphaMin(-50.0);
151 params->SetTrkCutAlphaMax( 50.0);
152 params->SetTrkCutNITS(3.0);
153 params->SetTrkCutNTPC(20.0);
154 params->SetTrkCutAngle(10000.0); // i.e. exclude this for the moment
155
156 //PID
157
158 // as a first step, all array elements are initialized to 0.0
159 Int_t i, j;
160 for (i = 0; i < 6; i++) {
161 params->SetGammaEnergyProb(i,0.);
162 params->SetHadronEnergyProb(i,0.);
163 params->SetPiZeroEnergyProb(i,0.);
164
165 for (j = 0; j < 6; j++) {
166
167 params->SetGamma(i,j,0.);
168 params->SetHadron(i,j,0.);
169 params->SetPiZero(i,j, 0.);
170 params->SetGamma1to10(i,j,0.);
171 params->SetHadron1to10(i,j,0.);
172 }
173 }
174
175 params->SetGamma(0,0, -7.656908e-01);
176 params->SetGamma(0,1, 2.352536e-01);
177 params->SetGamma(0,2, 1.555996e-02);
178 params->SetGamma(0,3, 2.243525e-04);
179 params->SetGamma(0,4, -2.560087e-06);
180
181 params->SetGamma(1,0, 6.500216e+00);
182 params->SetGamma(1,1, -2.564958e-01);
183 params->SetGamma(1,2, 1.967894e-01);
184 params->SetGamma(1,3, -3.982273e-04);
185 params->SetGamma(1,4, 2.797737e-06);
186
187 params->SetGamma(2,0, 2.416489e+00);
188 params->SetGamma(2,1, -1.601258e-01);
189 params->SetGamma(2,2, 3.126839e-02);
190 params->SetGamma(2,3, 3.387532e-04);
191 params->SetGamma(2,4, -4.089145e-06);
192
193 params->SetGamma(3,0, 0.);
194 params->SetGamma(3,1, -2.696008e+00);
195 params->SetGamma(3,2, 6.920305e-01);
196 params->SetGamma(3,3, -2.281122e-03);
197 params->SetGamma(3,4, 0.);
198
199 params->SetGamma(4,0, 2.281564e-01);
200 params->SetGamma(4,1, -7.575040e-02);
201 params->SetGamma(4,2, 3.813423e-01);
202 params->SetGamma(4,3, -1.243854e-04);
203 params->SetGamma(4,4, 1.232045e-06);
204
205 params->SetGamma(5,0, -3.290107e-01);
206 params->SetGamma(5,1, 3.707545e-02);
207 params->SetGamma(5,2, 2.917397e-03);
208 params->SetGamma(5,3, 4.695306e-05);
209 params->SetGamma(5,4, -3.572981e-07);
210
211 params->SetHadron(0,0, 1.519112e-01);
212 params->SetHadron(0,1, -8.267603e-02);
213 params->SetHadron(0,2, 1.914574e-02);
214 params->SetHadron(0,3, -2.677921e-04);
215 params->SetHadron(0,4, 5.447939e-06);
216
217 params->SetHadron(1,0, 0.);
218 params->SetHadron(1,1, -7.549870e-02);
219 params->SetHadron(1,2, 3.930087e-01);
220 params->SetHadron(1,3, -2.368500e-03);
221 params->SetHadron(1,4, 0.);
222
223 params->SetHadron(2,0, 0.);
224 params->SetHadron(2,1, -2.463152e-02);
225 params->SetHadron(2,2, 1.349257e-01);
226 params->SetHadron(2,3, -1.089440e-03);
227 params->SetHadron(2,4, 0.);
228
229 params->SetHadron(3,0, 0.);
230 params->SetHadron(3,1, 5.101560e-01);
231 params->SetHadron(3,2, 1.458679e-01);
232 params->SetHadron(3,3, 4.903068e-04);
233 params->SetHadron(3,4, 0.);
234
235 params->SetHadron(4,0, 0.);
236 params->SetHadron(4,1, -6.693943e-03);
237 params->SetHadron(4,2, 2.444753e-01);
238 params->SetHadron(4,3, -5.553749e-05);
239 params->SetHadron(4,4, 0.);
240
241 params->SetHadron(5,0, -4.414030e-01);
242 params->SetHadron(5,1, 2.292277e-01);
243 params->SetHadron(5,2, -2.433737e-02);
244 params->SetHadron(5,3, 1.758422e-03);
245 params->SetHadron(5,4, -3.001493e-05);
246
247 params->SetPiZero(0,0, 5.072157e-01);
248 params->SetPiZero(0,1, -5.352747e-01);
249 params->SetPiZero(0,2, 8.499259e-02);
250 params->SetPiZero(0,3, -3.687401e-03);
251 params->SetPiZero(0,4, 5.482280e-05);
252
253 params->SetPiZero(1,0, 4.590137e+02);
254 params->SetPiZero(1,1, -7.079341e+01);
255 params->SetPiZero(1,2, 4.990735e+00);
256 params->SetPiZero(1,3, -1.241302e-01);
257 params->SetPiZero(1,4, 1.065772e-03);
258
259 params->SetPiZero(2,0, 1.376415e+02);
260 params->SetPiZero(2,1, -3.031577e+01);
261 params->SetPiZero(2,2, 2.474338e+00);
262 params->SetPiZero(2,3, -6.903410e-02);
263 params->SetPiZero(2,4, 6.244089e-04);
264
265 params->SetPiZero(3,0, 0.);
266 params->SetPiZero(3,1, 1.145983e+00);
267 params->SetPiZero(3,2, -2.476052e-01);
268 params->SetPiZero(3,3, 1.367373e-02);
269 params->SetPiZero(3,4, 0.);
270
271 params->SetPiZero(4,0, -2.097586e+02);
272 params->SetPiZero(4,1, 6.300800e+01);
273 params->SetPiZero(4,2, -4.038906e+00);
274 params->SetPiZero(4,3, 1.088543e-01);
275 params->SetPiZero(4,4, -9.362485e-04);
276
277 params->SetPiZero(5,0, -1.671477e+01);
278 params->SetPiZero(5,1, 2.995415e+00);
279 params->SetPiZero(5,2, -6.040360e-02);
280 params->SetPiZero(5,3, -6.137459e-04);
281 params->SetPiZero(5,4, 1.847328e-05);
282
283 // High flux ones pp
284
285 params->SetHadronEnergyProb(0, 0.);
286 params->SetHadronEnergyProb(1, 0.);
287 params->SetHadronEnergyProb(2, 6.188452e-02);
288 params->SetHadronEnergyProb(3, 2.030230e+00);
289 params->SetHadronEnergyProb(4, -6.402242e-02);
290
291 // raw signal fitting
292 params->SetHighLowGainFactor(16.);
293 params->SetOrderParameter(2);
294 params->SetTau(2.35);
295 params->SetNoiseThreshold(3);
296 params->SetNPedSamples(5);
64c98165 297 params->SetRemoveBadChannels(kTRUE);
298 params->SetFittingAlgorithm(AliEMCALRawUtils::kStandard);
299 params->SetFALTROUsage(kTRUE);
300 params->SetLEDFit(kFALSE);
301
1e7c9b89 302 return params ;
303}
304
305//-----------------------------------------------------------------------------
306AliEMCALRecParam* GetLowMultiplicityParameters()
307{
308 // Set here the low flux/multiplicity ("p+p") parameters for the reconstruction
309 //Right now it should be the same settings as with
310 //AliEMCALRecParam *recParamDB = AliEMCALRecParam::GetLowFluxParam();
311
312 AliEMCALRecParam* params = AliEMCALRecParam::GetDefaultParameters();
e658398a 313 params->SetClusteringThreshold(0.1); // 100 MeV
1e7c9b89 314 params->SetMinECut(0.01); //10 MeV
9dce5a21 315 params->SetTimeCut(100e-9);//100 ns
316 //Simulation
317 //params->SetTimeMin(5e-9);//100 ns
318 //params->SetTimeMax(50e-9);//100 ns
319 //Real Data
64c98165 320 params->SetTimeMin(525e-9);//100 ns
321 params->SetTimeMax(725e-9);//100 ns
9dce5a21 322
1e7c9b89 323 //PID parameters for pp implemented
324 // as a first step, all array elements are initialized to 0.0
325 Int_t i, j;
326 for (i = 0; i < 6; i++) {
327 for (j = 0; j < 6; j++) {
328 params->SetGamma(i,j,0.);
329 params->SetGamma1to10(i,j,0.);
330 params->SetHadron(i,j,0.);
331 params->SetHadron1to10(i,j,0.);
332 params->SetPiZero(i,j,0.);
333
334 }
335 params->SetGammaEnergyProb(i,0.); // not yet implemented
336 params->SetHadronEnergyProb(i,0.);
337 params->SetPiZeroEnergyProb(i,0.); // not yet implemented
338 }
339
340 params->SetGamma(0,0, -7.656908e-01);
341 params->SetGamma(0,1, 2.352536e-01);
342 params->SetGamma(0,2, 1.555996e-02);
343 params->SetGamma(0,3, 2.243525e-04);
344 params->SetGamma(0,4, -2.560087e-06);
345
346 params->SetGamma(1,0, 6.500216e+00);
347 params->SetGamma(1,1, -2.564958e-01);
348 params->SetGamma(1,2, 1.967894e-01);
349 params->SetGamma(1,3, -3.982273e-04);
350 params->SetGamma(1,4, 2.797737e-06);
351
352 params->SetGamma(2,0, 2.416489e+00);
353 params->SetGamma(2,1, -1.601258e-01);
354 params->SetGamma(2,2, 3.126839e-02);
355 params->SetGamma(2,3, 3.387532e-04);
356 params->SetGamma(2,4, -4.089145e-06);
357
358 params->SetGamma(3,0,0.);
359 params->SetGamma(3,1,-2.696008e+00);
360 params->SetGamma(3,2, 6.920305e-01);
361 params->SetGamma(3,3,-2.281122e-03);
362 params->SetGamma(3,4,0.);
363
364 params->SetGamma(4,0, 2.281564e-01);
365 params->SetGamma(4,1, -7.575040e-02);
366 params->SetGamma(4,2, 3.813423e-01);
367 params->SetGamma(4,3, -1.243854e-04);
368 params->SetGamma(4,4, 1.232045e-06);
369
370 params->SetGamma(5,0, -3.290107e-01);
371 params->SetGamma(5,1, 3.707545e-02);
372 params->SetGamma(5,2, 2.917397e-03);
373 params->SetGamma(5,3, 4.695306e-05);
374 params->SetGamma(5,4, -3.572981e-07);
375
376 params->SetHadron(0,0, 9.482243e-01);
377 params->SetHadron(0,1, -2.780896e-01);
378 params->SetHadron(0,2, 2.223507e-02);
379 params->SetHadron(0,3, 7.294263e-04);
380 params->SetHadron(0,4, -5.665872e-06);
381
382 params->SetHadron(1,0, 0.);
383 params->SetHadron(1,1, 0.);
384 params->SetHadron(1,2, 2.483298e-01);
385 params->SetHadron(1,3, 0.);
386 params->SetHadron(1,4, 0.);
387
388 params->SetHadron(2,0, -5.601199e+00);
389 params->SetHadron(2,1, 2.097382e+00);
390 params->SetHadron(2,2, -2.307965e-01);
391 params->SetHadron(2,3, 9.206871e-03);
392 params->SetHadron(2,4, -8.887548e-05);
393
394 params->SetHadron(3,0, 6.543101e+00);
395 params->SetHadron(3,1, -2.305203e+00);
396 params->SetHadron(3,2, 2.761673e-01);
397 params->SetHadron(3,3, -5.465855e-03);
398 params->SetHadron(3,4, 2.784329e-05);
399
400 params->SetHadron(4,0, -2.443530e+01);
401 params->SetHadron(4,1, 8.902578e+00);
402 params->SetHadron(4,2, -5.265901e-01);
403 params->SetHadron(4,3, 2.549111e-02);
404 params->SetHadron(4,4, -2.196801e-04);
405
406 params->SetHadron(5,0, 2.102007e-01);
407 params->SetHadron(5,1, -3.844418e-02);
408 params->SetHadron(5,2, 1.234682e-01);
409 params->SetHadron(5,3, -3.866733e-03);
410 params->SetHadron(5,4, 3.362719e-05);
411
412 params->SetPiZero(0,0, 5.07215e-01);
413 params->SetPiZero(0,1, -5.35274e-01);
414 params->SetPiZero(0,2, 8.49925e-02);
415 params->SetPiZero(0,3, -3.68740e-03);
416 params->SetPiZero(0,4, 5.48228e-05);
417
418 params->SetPiZero(1,0, 4.590137e+02);
419 params->SetPiZero(1,1, -7.079341e+01);
420 params->SetPiZero(1,2, 4.990735e+00);
421 params->SetPiZero(1,3, -1.241302e-01);
422 params->SetPiZero(1,4, 1.065772e-03);
423
424 params->SetPiZero(2,0, 1.376415e+02);
425 params->SetPiZero(2,1, -3.031577e+01);
426 params->SetPiZero(2,2, 2.474338e+00);
427 params->SetPiZero(2,3, -6.903410e-02);
428 params->SetPiZero(2,4, 6.244089e-04);
429
430 params->SetPiZero(3,0, 0.);
431 params->SetPiZero(3,1, 1.145983e+00);
432 params->SetPiZero(3,2, -2.476052e-01);
433 params->SetPiZero(3,3, 1.367373e-02);
434 params->SetPiZero(3,4, 0.);
435
436 params->SetPiZero(4,0, -2.09758e+02);
437 params->SetPiZero(4,1, 6.30080e+01);
438 params->SetPiZero(4,2, -4.03890e+00);
439 params->SetPiZero(4,3, 1.08854e-01);
440 params->SetPiZero(4,4, -9.36248e-04);
441
442 params->SetPiZero(5,0, -1.671477e+01);
443 params->SetPiZero(5,1, 2.995415e+00);
444 params->SetPiZero(5,2, -6.040360e-02);
445 params->SetPiZero(5,3, -6.137459e-04);
446 params->SetPiZero(5,4, 1.847328e-05);
447
448 // params->SetHadronEnergyProb(0,0.);
449 // params->SetHadronEnergyProb(1,0.);
450 // params->SetHadronEnergyProb(2,1.);
451 // params->SetHadronEnergyProb(3,0.);
452 // params->SetHadronEnergyProb(4,0.);
453
454 params->SetHadronEnergyProb(0, 4.767543e-02);
455 params->SetHadronEnergyProb(1, -1.537523e+00);
456 params->SetHadronEnergyProb(2, 2.956727e-01);
457 params->SetHadronEnergyProb(3, -3.051022e+01);
458 params->SetHadronEnergyProb(4, -6.036931e-02);
64c98165 459
460 // raw signal fitting
461 params->SetHighLowGainFactor(16.);
462 params->SetOrderParameter(2);
463 params->SetTau(2.35);
464 params->SetNoiseThreshold(3);
465 params->SetNPedSamples(5);
466 params->SetRemoveBadChannels(kTRUE);
467 params->SetFittingAlgorithm(AliEMCALRawUtils::kStandard);
468 params->SetFALTROUsage(kTRUE);
469 params->SetLEDFit(kFALSE);
470
1e7c9b89 471 return params;
472
473}
474
475