3551db50 |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // |
20 | // Class providing the calibration parameters by accessing the CDB // |
21 | // // |
2745a409 |
22 | // Request an instance with AliTRDcalibDB::Instance() // |
3551db50 |
23 | // If a new event is processed set the event number with SetRun // |
24 | // Then request the calibration data // |
25 | // // |
2745a409 |
26 | // Author: // |
27 | // Jan Fiete Grosse-Oetringhaus (Jan.Fiete.Grosse-Oetringhaus@cern.ch) // |
28 | // // |
3551db50 |
29 | /////////////////////////////////////////////////////////////////////////////// |
30 | |
a7ac01d2 |
31 | #include <TClonesArray.h> |
e232d349 |
32 | #include <TObjArray.h> |
3551db50 |
33 | |
2745a409 |
34 | #include "AliCDBManager.h" |
2745a409 |
35 | #include "AliCDBEntry.h" |
36 | #include "AliLog.h" |
3551db50 |
37 | |
51a0ce25 |
38 | #include "AliTRDPIDReference.h" |
3551db50 |
39 | #include "AliTRDcalibDB.h" |
eda91732 |
40 | #include "AliTRDCommonParam.h" |
3551db50 |
41 | |
7754cd1f |
42 | #include "Cal/AliTRDCalROC.h" |
7754cd1f |
43 | #include "Cal/AliTRDCalPad.h" |
44 | #include "Cal/AliTRDCalDet.h" |
e232d349 |
45 | #include "Cal/AliTRDCalDCS.h" |
d6a1ec13 |
46 | #include "Cal/AliTRDCalDCSv2.h" |
ea3eaa08 |
47 | #include "Cal/AliTRDCalDCSFEEv2.h" |
720a0a16 |
48 | #include "Cal/AliTRDCalPID.h" |
7754cd1f |
49 | #include "Cal/AliTRDCalMonitoring.h" |
7754cd1f |
50 | #include "Cal/AliTRDCalChamberStatus.h" |
7754cd1f |
51 | #include "Cal/AliTRDCalPadStatus.h" |
52 | #include "Cal/AliTRDCalSingleChamberStatus.h" |
9dcc64cc |
53 | #include "Cal/AliTRDCalTrkAttach.h" |
ea3eaa08 |
54 | #include "Cal/AliTRDCalOnlineGainTable.h" |
3551db50 |
55 | |
56 | ClassImp(AliTRDcalibDB) |
57 | |
2745a409 |
58 | AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0; |
59 | Bool_t AliTRDcalibDB::fgTerminated = kFALSE; |
3551db50 |
60 | |
61 | //_ singleton implementation __________________________________________________ |
62 | AliTRDcalibDB* AliTRDcalibDB::Instance() |
63 | { |
64 | // |
65 | // Singleton implementation |
66 | // Returns an instance of this class, it is created if neccessary |
63a700c6 |
67 | // |
3551db50 |
68 | |
6d50f529 |
69 | if (fgTerminated != kFALSE) { |
3551db50 |
70 | return 0; |
6d50f529 |
71 | } |
3551db50 |
72 | |
6d50f529 |
73 | if (fgInstance == 0) { |
3551db50 |
74 | fgInstance = new AliTRDcalibDB(); |
6d50f529 |
75 | } |
e254cad1 |
76 | |
3551db50 |
77 | return fgInstance; |
4e009ce4 |
78 | |
3551db50 |
79 | } |
80 | |
2745a409 |
81 | //_____________________________________________________________________________ |
3551db50 |
82 | void AliTRDcalibDB::Terminate() |
83 | { |
84 | // |
85 | // Singleton implementation |
6bf5f0ce |
86 | // Deletes the instance of this class and sets the terminated flag, |
87 | // instances cannot be requested anymore |
3551db50 |
88 | // This function can be called several times. |
89 | // |
90 | |
91 | fgTerminated = kTRUE; |
92 | |
6d50f529 |
93 | if (fgInstance != 0) { |
3551db50 |
94 | delete fgInstance; |
95 | fgInstance = 0; |
96 | } |
2745a409 |
97 | |
3551db50 |
98 | } |
99 | |
100 | //_____________________________________________________________________________ |
101 | AliTRDcalibDB::AliTRDcalibDB() |
2745a409 |
102 | :TObject() |
103 | ,fRun(-1) |
6d50f529 |
104 | ,fPRFsmp(0) |
105 | ,fPRFbin(0) |
106 | ,fPRFlo(0) |
107 | ,fPRFhi(0) |
108 | ,fPRFwid(0) |
109 | ,fPRFpad(0) |
9dcc64cc |
110 | ,fPIDResponse(NULL) |
ea3eaa08 |
111 | ,fOnlineGainTableID(0) |
3551db50 |
112 | { |
113 | // |
2745a409 |
114 | // Default constructor |
3551db50 |
115 | // |
2745a409 |
116 | // TODO Default runnumber is set to 0, this should be changed later |
117 | // to an invalid value (e.g. -1) to prevent |
3551db50 |
118 | // TODO invalid calibration data to be used. |
2745a409 |
119 | // |
120 | |
95867fd1 |
121 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 |
122 | fCDBCache[i] = 0; |
123 | fCDBEntries[i] = 0; |
124 | } |
3551db50 |
125 | |
2745a409 |
126 | // Create the sampled PRF |
127 | SamplePRF(); |
d4c6453d |
128 | |
2745a409 |
129 | } |
130 | |
131 | //_____________________________________________________________________________ |
132 | AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c) |
133 | :TObject(c) |
6d50f529 |
134 | ,fRun(-1) |
135 | ,fPRFsmp(0) |
136 | ,fPRFbin(0) |
137 | ,fPRFlo(0) |
138 | ,fPRFhi(0) |
139 | ,fPRFwid(0) |
140 | ,fPRFpad(0) |
9dcc64cc |
141 | ,fPIDResponse(NULL) |
ea3eaa08 |
142 | ,fOnlineGainTableID(0) |
2745a409 |
143 | { |
144 | // |
145 | // Copy constructor (not that it make any sense for a singleton...) |
146 | // |
147 | |
95867fd1 |
148 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 |
149 | fCDBCache[i] = 0; |
3551db50 |
150 | fCDBEntries[i] = 0; |
151 | } |
6a739e92 |
152 | |
153 | // Create the sampled PRF |
154 | SamplePRF(); |
2745a409 |
155 | |
156 | } |
157 | |
158 | //_____________________________________________________________________________ |
159 | AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c) |
160 | { |
161 | // |
162 | // Assignment operator (same as above ...) |
163 | // |
164 | |
165 | if (this != &c) { |
166 | AliFatal("No assignment operator defined"); |
167 | } |
4e009ce4 |
168 | |
2745a409 |
169 | return *this; |
170 | |
acba9bad |
171 | } |
3551db50 |
172 | |
173 | //_____________________________________________________________________________ |
174 | AliTRDcalibDB::~AliTRDcalibDB() |
175 | { |
176 | // |
177 | // destructor |
178 | // |
179 | |
6d50f529 |
180 | if (fPRFsmp) { |
181 | delete [] fPRFsmp; |
182 | fPRFsmp = 0; |
6a739e92 |
183 | } |
ea3eaa08 |
184 | |
185 | if (fPIDResponse) { |
186 | delete fPIDResponse; |
187 | fPIDResponse = 0x0; |
188 | } |
6a739e92 |
189 | |
3551db50 |
190 | Invalidate(); |
2745a409 |
191 | |
acba9bad |
192 | } |
3551db50 |
193 | |
63a700c6 |
194 | //_caching functions____________________________________________________________ |
95867fd1 |
195 | const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id) |
63a700c6 |
196 | { |
2745a409 |
197 | // |
198 | // Retrieves a cdb object with the given id. The objects are cached as |
199 | // long as the run number is not changed. |
200 | // |
201 | // Put together the available objects here by using the lines |
202 | // a) For usual calibration objects: |
203 | // case kID<Name> : |
204 | // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>"); |
205 | // break; |
206 | // See function CacheCDBEntry for details. |
207 | // and |
208 | // b) For calibration data which depends on two objects: One containing |
209 | // a value per detector and one the local fluctuations per pad: |
210 | // case kID<Name> : |
211 | // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>"); |
212 | // break; |
213 | // See function CacheMergeCDBEntry for details. |
214 | // |
63a700c6 |
215 | |
6d50f529 |
216 | switch (id) { |
2745a409 |
217 | |
218 | // Parameters defined per pad and chamber |
219 | case kIDVdriftPad : |
6d50f529 |
220 | return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift"); |
2745a409 |
221 | break; |
222 | case kIDVdriftChamber : |
6d50f529 |
223 | return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift"); |
2745a409 |
224 | break; |
eda91732 |
225 | case kIDExBChamber : |
226 | return CacheCDBEntry(kIDExBChamber ,"TRD/Calib/ChamberExB"); |
227 | break; |
2745a409 |
228 | case kIDT0Pad : |
6d50f529 |
229 | return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0"); |
2745a409 |
230 | break; |
231 | case kIDT0Chamber : |
6d50f529 |
232 | return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0"); |
2745a409 |
233 | break; |
234 | case kIDGainFactorPad : |
6d50f529 |
235 | return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor"); |
2745a409 |
236 | break; |
237 | case kIDGainFactorChamber : |
6d50f529 |
238 | return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor"); |
2745a409 |
239 | break; |
ea3eaa08 |
240 | |
241 | case kIDOnlineGainFactor : |
242 | switch(GetOnlineGainTableID()) { |
243 | case 0: |
244 | // For testing purposes only !!! |
245 | AliInfo("No gain table name from OCDB. Use default table!"); |
246 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01"); |
247 | break; |
248 | case 1: |
249 | // Online gain table ID 1 |
250 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01"); |
251 | break; |
412d07b9 |
252 | case 2: |
253 | // Online gain table ID 2 |
254 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2011-01"); |
255 | break; |
256 | case 3: |
257 | // Online gain table ID 3 |
258 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2011-01"); |
259 | break; |
3abf1c06 |
260 | case 4: |
261 | // Online gain table ID 4 |
262 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-02"); |
263 | break; |
4a05be5f |
264 | case 5: |
265 | // Online gain table ID 5 |
266 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-03"); |
267 | break; |
268 | case 6: |
269 | // Online gain table ID 6 |
270 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2012-01"); |
271 | break; |
272 | case 7: |
273 | // Online gain table ID 7 |
274 | return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2012-01"); |
275 | break; |
ea3eaa08 |
276 | } |
277 | break; |
278 | |
df83a620 |
279 | case kIDNoiseChamber : |
ea3eaa08 |
280 | return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise"); |
df83a620 |
281 | break; |
282 | case kIDNoisePad : |
ea3eaa08 |
283 | return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise"); |
df83a620 |
284 | break; |
285 | |
2745a409 |
286 | // Parameters defined per pad |
287 | case kIDPRFWidth : |
6d50f529 |
288 | return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth"); |
2745a409 |
289 | break; |
290 | |
291 | // Status values |
2745a409 |
292 | case kIDChamberStatus : |
6d50f529 |
293 | return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus"); |
2745a409 |
294 | break; |
2745a409 |
295 | case kIDPadStatus : |
6d50f529 |
296 | return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus"); |
2745a409 |
297 | break; |
298 | |
299 | // Global parameters |
300 | case kIDMonitoringData : |
6d50f529 |
301 | return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData"); |
2745a409 |
302 | break; |
aa617684 |
303 | case kIDFEE : |
304 | return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE"); |
2745a409 |
305 | break; |
e232d349 |
306 | case kIDDCS : |
5f481838 |
307 | return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS"); |
e232d349 |
308 | break; |
44dbae42 |
309 | case kIDPIDNN : |
310 | return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN"); |
ea3eaa08 |
311 | break; |
2745a409 |
312 | case kIDPIDLQ : |
6d50f529 |
313 | return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ"); |
2745a409 |
314 | break; |
9dcc64cc |
315 | case kIDPIDLQ1D: |
316 | return CacheCDBEntry(kIDPIDLQ1D ,"TRD/Calib/PIDLQ1D"); |
317 | break; |
a7ac01d2 |
318 | case kIDRecoParam : |
9dcc64cc |
319 | return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam"); |
320 | break; |
321 | case kIDAttach : |
322 | return CacheCDBEntry(kIDAttach ,"TRD/Calib/TrkAttach"); |
a7ac01d2 |
323 | break; |
e2a1c98b |
324 | case kIDPHQ : |
325 | return CacheCDBEntry(kIDPHQ ,"TRD/Calib/PHQ"); |
326 | break; |
2745a409 |
327 | } |
328 | |
329 | return 0; |
330 | |
63a700c6 |
331 | } |
332 | |
333 | //_____________________________________________________________________________ |
95867fd1 |
334 | AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath) |
63a700c6 |
335 | { |
336 | // |
337 | // Retrieves an entry with path <cdbPath> from the CDB. |
338 | // |
339 | |
95867fd1 |
340 | AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun); |
2745a409 |
341 | if (!entry) { |
a7ac01d2 |
342 | AliError(Form("Failed to get entry: %s",cdbPath)); |
63a700c6 |
343 | return 0; |
344 | } |
345 | |
63a700c6 |
346 | return entry; |
2745a409 |
347 | |
63a700c6 |
348 | } |
349 | |
350 | //_____________________________________________________________________________ |
95867fd1 |
351 | const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath) |
63a700c6 |
352 | { |
353 | // |
354 | // Caches the entry <id> with cdb path <cdbPath> |
355 | // |
d6a1ec13 |
356 | |
2745a409 |
357 | if (!fCDBCache[id]) { |
63a700c6 |
358 | fCDBEntries[id] = GetCDBEntry(cdbPath); |
95867fd1 |
359 | if (fCDBEntries[id]) { |
63a700c6 |
360 | fCDBCache[id] = fCDBEntries[id]->GetObject(); |
95867fd1 |
361 | } |
d6a1ec13 |
362 | } |
363 | |
63a700c6 |
364 | return fCDBCache[id]; |
ea3eaa08 |
365 | |
63a700c6 |
366 | } |
367 | |
3551db50 |
368 | //_____________________________________________________________________________ |
369 | void AliTRDcalibDB::SetRun(Long64_t run) |
370 | { |
371 | // |
7754cd1f |
372 | // Sets current run number. Calibration data is read from the corresponding file. |
3551db50 |
373 | // When the run number changes the caching is invalidated. |
374 | // |
7754cd1f |
375 | |
6d50f529 |
376 | if (fRun == run) { |
3551db50 |
377 | return; |
6d50f529 |
378 | } |
7754cd1f |
379 | |
3551db50 |
380 | fRun = run; |
95867fd1 |
381 | |
3551db50 |
382 | Invalidate(); |
2745a409 |
383 | |
3551db50 |
384 | } |
7754cd1f |
385 | |
3551db50 |
386 | //_____________________________________________________________________________ |
387 | void AliTRDcalibDB::Invalidate() |
388 | { |
389 | // |
390 | // Invalidates cache (when run number is changed). |
391 | // |
392 | |
95867fd1 |
393 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 |
394 | if (fCDBEntries[i]) { |
395 | if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) { |
11f5dd43 |
396 | if ((fCDBEntries[i]->IsOwner() == kFALSE) && |
397 | (fCDBCache[i])) { |
e254cad1 |
398 | delete fCDBCache[i]; |
2745a409 |
399 | } |
e254cad1 |
400 | delete fCDBEntries[i]; |
401 | } |
3551db50 |
402 | fCDBEntries[i] = 0; |
2745a409 |
403 | fCDBCache[i] = 0; |
3551db50 |
404 | } |
405 | } |
2745a409 |
406 | |
ea3eaa08 |
407 | fOnlineGainTableID = 0; |
408 | |
df83a620 |
409 | } |
ea3eaa08 |
410 | |
df83a620 |
411 | //_____________________________________________________________________________ |
412 | Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row) |
413 | { |
414 | // |
415 | // Returns the noise level in ADC counts for the given pad. |
416 | // |
417 | |
418 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
419 | (GetCachedCDBObject(kIDNoisePad)); |
420 | if (!calPad) { |
421 | return -1; |
422 | } |
423 | |
424 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
425 | if (!roc) { |
426 | return -1; |
427 | } |
428 | |
429 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
430 | (GetCachedCDBObject(kIDNoiseChamber)); |
431 | if (!calChamber) { |
432 | return -1; |
433 | } |
434 | |
435 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
436 | |
437 | } |
438 | |
439 | //_____________________________________________________________________________ |
440 | AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det) |
441 | { |
442 | // |
443 | // Returns the Vdrift calibration object for a given ROC |
444 | // containing one number per pad |
445 | // |
446 | |
447 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
448 | (GetCachedCDBObject(kIDNoisePad)); |
449 | if (!calPad) { |
450 | return 0; |
451 | } |
452 | |
453 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
454 | if (!roc) { |
455 | return 0; |
456 | } |
457 | else { |
458 | return roc; |
459 | } |
460 | |
461 | } |
462 | |
463 | //_____________________________________________________________________________ |
464 | const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet() |
465 | { |
466 | // |
467 | // Returns the Vdrift calibration object |
468 | // containing one number per detector |
469 | // |
470 | |
471 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
472 | (GetCachedCDBObject(kIDNoiseChamber)); |
473 | if (!calChamber) { |
474 | return 0; |
475 | } |
476 | else { |
477 | return calChamber; |
478 | } |
479 | |
3551db50 |
480 | } |
481 | |
3551db50 |
482 | //_____________________________________________________________________________ |
483 | Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) |
484 | { |
485 | // |
486 | // Returns the drift velocity for the given pad. |
487 | // |
7754cd1f |
488 | |
95867fd1 |
489 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 |
490 | (GetCachedCDBObject(kIDVdriftPad)); |
491 | if (!calPad) { |
3551db50 |
492 | return -1; |
6d50f529 |
493 | } |
3551db50 |
494 | |
95867fd1 |
495 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 |
496 | if (!roc) { |
3551db50 |
497 | return -1; |
6d50f529 |
498 | } |
3551db50 |
499 | |
95867fd1 |
500 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
6d50f529 |
501 | (GetCachedCDBObject(kIDVdriftChamber)); |
502 | if (!calChamber) { |
7754cd1f |
503 | return -1; |
6d50f529 |
504 | } |
7754cd1f |
505 | |
95867fd1 |
506 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
2745a409 |
507 | |
7754cd1f |
508 | } |
afb9f880 |
509 | |
510 | //_____________________________________________________________________________ |
511 | AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det) |
512 | { |
513 | // |
514 | // Returns the Vdrift calibration object for a given ROC |
515 | // containing one number per pad |
516 | // |
517 | |
518 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
519 | (GetCachedCDBObject(kIDVdriftPad)); |
520 | if (!calPad) { |
521 | return 0; |
522 | } |
523 | |
524 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
525 | if (!roc) { |
526 | return 0; |
527 | } |
528 | else { |
529 | return roc; |
530 | } |
531 | |
532 | } |
533 | |
534 | //_____________________________________________________________________________ |
535 | const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet() |
536 | { |
537 | // |
538 | // Returns the Vdrift calibration object |
539 | // containing one number per detector |
540 | // |
541 | |
542 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
543 | (GetCachedCDBObject(kIDVdriftChamber)); |
544 | if (!calChamber) { |
545 | return 0; |
546 | } |
547 | else { |
548 | return calChamber; |
549 | } |
550 | |
551 | } |
7754cd1f |
552 | |
e2a1c98b |
553 | //_____________________________________________________________________________ |
554 | TObjArray * AliTRDcalibDB::GetPHQ() |
555 | { |
556 | // |
557 | //return PHQ calibration object |
558 | // |
559 | TObjArray *arr = (TObjArray *) (GetCachedCDBObject(kIDPHQ)); |
560 | return arr; |
561 | } |
562 | |
7754cd1f |
563 | //_____________________________________________________________________________ |
564 | Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det) |
565 | { |
566 | // |
567 | // Returns the average drift velocity for the given detector |
568 | // |
569 | |
95867fd1 |
570 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 |
571 | (GetCachedCDBObject(kIDVdriftChamber)); |
572 | if (!calDet) { |
7754cd1f |
573 | return -1; |
6d50f529 |
574 | } |
7754cd1f |
575 | |
576 | return calDet->GetValue(det); |
2745a409 |
577 | |
acba9bad |
578 | } |
eda91732 |
579 | //_____________________________________________________________________________ |
580 | const AliTRDCalDet *AliTRDcalibDB::GetExBDet() |
581 | { |
582 | // |
583 | // Returns the exB calibration object |
584 | // containing one number per detector |
585 | // |
586 | |
587 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> (GetCachedCDBObject(kIDExBChamber)); |
588 | |
589 | Double_t meanexb = 100.0; |
590 | if (calChamber) meanexb = calChamber->GetMean(); |
591 | //printf("mean %f\n",meanexb); |
3551db50 |
592 | |
eda91732 |
593 | if ((!calChamber) || (meanexb > 70.0)) { |
594 | |
595 | const AliTRDCalDet *calChambervdrift = dynamic_cast<const AliTRDCalDet *> |
596 | (GetCachedCDBObject(kIDVdriftChamber)); |
597 | if (!calChambervdrift) { |
598 | return 0; |
599 | } |
600 | else { |
601 | AliTRDCalDet *calDetExB = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)"); |
602 | for(Int_t k = 0; k < 540; k++){ |
603 | calDetExB->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(calChambervdrift->GetValue(k))); |
eda91732 |
604 | } |
605 | return calDetExB; |
606 | } |
607 | } |
608 | else return calChamber; |
609 | |
610 | } |
3551db50 |
611 | //_____________________________________________________________________________ |
612 | Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) |
613 | { |
614 | // |
615 | // Returns t0 for the given pad. |
616 | // |
617 | |
d4c6453d |
618 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
619 | (GetCachedCDBObject(kIDT0Pad)); |
6d50f529 |
620 | if (!calPad) { |
3551db50 |
621 | return -1; |
6d50f529 |
622 | } |
3551db50 |
623 | |
d4c6453d |
624 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 |
625 | if (!roc) { |
3551db50 |
626 | return -1; |
6d50f529 |
627 | } |
3551db50 |
628 | |
d4c6453d |
629 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
630 | (GetCachedCDBObject(kIDT0Chamber)); |
6d50f529 |
631 | if (!calChamber) { |
7754cd1f |
632 | return -1; |
6d50f529 |
633 | } |
7754cd1f |
634 | |
8d786fb8 |
635 | return calChamber->GetValue(det) + roc->GetValue(col,row); |
2745a409 |
636 | |
7754cd1f |
637 | } |
afb9f880 |
638 | |
56178ff4 |
639 | //_____________________________________________________________________________ |
640 | AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det) |
641 | { |
642 | // |
643 | // Returns the t0 calibration object for a given ROC |
644 | // containing one number per pad |
645 | // |
646 | |
647 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
648 | (GetCachedCDBObject(kIDT0Pad)); |
649 | if (!calPad) { |
650 | return 0; |
651 | } |
652 | |
653 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
654 | if (!roc) { |
655 | return 0; |
656 | } |
657 | else { |
658 | return roc; |
659 | } |
660 | |
661 | } |
662 | |
663 | //_____________________________________________________________________________ |
664 | const AliTRDCalDet *AliTRDcalibDB::GetT0Det() |
665 | { |
666 | // |
667 | // Returns the t0 calibration object |
668 | // containing one number per detector |
669 | // |
670 | |
671 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
672 | (GetCachedCDBObject(kIDT0Chamber)); |
673 | if (!calChamber) { |
674 | return 0; |
675 | } |
676 | else { |
677 | return calChamber; |
678 | } |
679 | |
680 | } |
681 | |
7754cd1f |
682 | //_____________________________________________________________________________ |
683 | Float_t AliTRDcalibDB::GetT0Average(Int_t det) |
684 | { |
685 | // |
686 | // Returns the average t0 for the given detector |
687 | // |
688 | |
5aba4f09 |
689 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
690 | (GetCachedCDBObject(kIDT0Pad)); |
691 | if (!calPad) { |
692 | return -1; |
693 | } |
694 | |
695 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
696 | if (!roc) { |
697 | return -1; |
698 | } |
699 | |
95867fd1 |
700 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 |
701 | (GetCachedCDBObject(kIDT0Chamber)); |
702 | if (!calDet) { |
7754cd1f |
703 | return -1; |
6d50f529 |
704 | } |
7754cd1f |
705 | |
4eb02ab1 |
706 | Double_t sum = 0.0; |
5aba4f09 |
707 | for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) { |
4eb02ab1 |
708 | sum += roc->GetValue(channel); |
5aba4f09 |
709 | } |
4eb02ab1 |
710 | sum /= roc->GetNchannels(); |
711 | sum += calDet->GetValue(det); |
712 | return sum; |
2745a409 |
713 | |
acba9bad |
714 | } |
3551db50 |
715 | |
716 | //_____________________________________________________________________________ |
717 | Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) |
718 | { |
719 | // |
720 | // Returns the gain factor for the given pad. |
721 | // |
722 | |
95867fd1 |
723 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 |
724 | (GetCachedCDBObject(kIDGainFactorPad)); |
725 | if (!calPad) { |
3551db50 |
726 | return -1; |
6d50f529 |
727 | } |
3551db50 |
728 | |
95867fd1 |
729 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
56178ff4 |
730 | if (!roc) { |
3551db50 |
731 | return -1; |
56178ff4 |
732 | } |
3551db50 |
733 | |
95867fd1 |
734 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
6d50f529 |
735 | (GetCachedCDBObject(kIDGainFactorChamber)); |
736 | if (!calChamber) { |
7754cd1f |
737 | return -1; |
6d50f529 |
738 | } |
7754cd1f |
739 | |
95867fd1 |
740 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
2745a409 |
741 | |
7754cd1f |
742 | } |
743 | |
ea3eaa08 |
744 | //_____________________________________________________________________________ |
745 | AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det) |
746 | { |
747 | // |
748 | // Returns the online gain factor table for a given ROC. |
749 | // |
750 | |
751 | const AliTRDCalOnlineGainTable *calOnline |
752 | = dynamic_cast<const AliTRDCalOnlineGainTable *> |
753 | (GetCachedCDBObject(kIDOnlineGainFactor)); |
754 | if (!calOnline) { |
755 | return 0x0; |
756 | } |
757 | |
758 | return calOnline->GetGainTableROC(det); |
759 | |
760 | } |
761 | |
762 | //_____________________________________________________________________________ |
763 | Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row) |
764 | { |
765 | // |
766 | // Returns the online gain factor for the given pad. |
767 | // |
768 | |
769 | const AliTRDCalOnlineGainTable *calOnline |
770 | = dynamic_cast<const AliTRDCalOnlineGainTable *> |
771 | (GetCachedCDBObject(kIDOnlineGainFactor)); |
772 | if (!calOnline) { |
773 | return -1; |
774 | } |
775 | |
776 | return calOnline->GetGainCorrectionFactor(det,row,col); |
777 | |
778 | } |
779 | |
56178ff4 |
780 | //_____________________________________________________________________________ |
781 | AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det) |
782 | { |
783 | // |
784 | // Returns the gain factor calibration object for a given ROC |
56178ff4 |
785 | // |
786 | |
787 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
788 | (GetCachedCDBObject(kIDGainFactorPad)); |
789 | if (!calPad) { |
790 | return 0; |
791 | } |
792 | |
793 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
794 | if (!roc) { |
795 | return 0; |
796 | } |
797 | else { |
798 | return roc; |
799 | } |
800 | |
801 | } |
802 | |
803 | //_____________________________________________________________________________ |
804 | const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet() |
805 | { |
806 | // |
807 | // Returns the gain factor calibration object |
808 | // containing one number per detector |
809 | // |
810 | |
811 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
812 | (GetCachedCDBObject(kIDGainFactorChamber)); |
813 | if (!calChamber) { |
814 | return 0; |
815 | } |
816 | else { |
817 | return calChamber; |
818 | } |
819 | |
820 | } |
821 | |
7754cd1f |
822 | //_____________________________________________________________________________ |
823 | Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) |
824 | { |
825 | // |
826 | // Returns the average gain factor for the given detector |
827 | // |
828 | |
95867fd1 |
829 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 |
830 | (GetCachedCDBObject(kIDGainFactorChamber)); |
831 | if (!calDet) { |
7754cd1f |
832 | return -1; |
6d50f529 |
833 | } |
7754cd1f |
834 | |
835 | return calDet->GetValue(det); |
2745a409 |
836 | |
acba9bad |
837 | } |
6a739e92 |
838 | |
524fc8fa |
839 | //_____________________________________________________________________________ |
840 | AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det) |
841 | { |
842 | // |
843 | // Returns the PRF calibration object for a given ROC |
844 | // containing one number per pad |
845 | // |
846 | |
847 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
848 | (GetCachedCDBObject(kIDPRFWidth)); |
849 | if (!calPad) { |
850 | return 0; |
851 | } |
852 | |
853 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
854 | if (!roc) { |
855 | return 0; |
856 | } |
857 | else { |
858 | return roc; |
859 | } |
860 | |
861 | } |
862 | |
6a739e92 |
863 | //_____________________________________________________________________________ |
864 | Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) |
865 | { |
866 | // |
867 | // Returns the PRF width for the given pad. |
868 | // |
869 | |
95867fd1 |
870 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 |
871 | (GetCachedCDBObject(kIDPRFWidth)); |
872 | if (!calPad) { |
6a739e92 |
873 | return -1; |
6d50f529 |
874 | } |
6a739e92 |
875 | |
95867fd1 |
876 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 |
877 | if (!roc) { |
6a739e92 |
878 | return -1; |
6d50f529 |
879 | } |
6a739e92 |
880 | |
95867fd1 |
881 | return roc->GetValue(col,row); |
2745a409 |
882 | |
acba9bad |
883 | } |
3551db50 |
884 | |
885 | //_____________________________________________________________________________ |
f1dcad37 |
886 | Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS() |
3551db50 |
887 | { |
e232d349 |
888 | // |
889 | // Returns Number of time bins from the DCS |
890 | // |
f1dcad37 |
891 | |
c6f7c6cb |
892 | Int_t nMixed = -2; // not the same number for all chambers |
893 | Int_t nUndef = -1; // default value - has not been set! |
894 | Int_t nTbSor = nUndef; |
895 | Int_t nTbEor = nUndef; |
d6a1ec13 |
896 | Int_t calver = 0; // Check CalDCS version |
c6f7c6cb |
897 | |
e232d349 |
898 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
c6f7c6cb |
899 | if (!dcsArr) { |
900 | AliError("No DCS object found!"); |
901 | return nUndef; |
e232d349 |
902 | } |
c6f7c6cb |
903 | |
d6a1ec13 |
904 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
905 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; |
0eaf9c74 |
906 | |
d6a1ec13 |
907 | if (calver == 1) { |
908 | // DCS object |
909 | const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); |
910 | const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); |
911 | if (!calDCSsor) { |
912 | // the SOR file is mandatory |
913 | AliError("NO SOR AliTRDCalDCS object found in CDB file!"); |
914 | return nUndef; |
915 | } |
916 | if (!calDCSeor) { |
917 | // this can happen if the run is shorter than a couple of seconds. |
918 | AliWarning("NO EOR AliTRDCalDCS object found in CDB file."); |
7a6352a6 |
919 | } |
c6f7c6cb |
920 | |
d6a1ec13 |
921 | // get the numbers |
922 | nTbSor = calDCSsor->GetGlobalNumberOfTimeBins(); |
923 | if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins(); |
924 | |
925 | } else if (calver == 2) { |
926 | // DCSv2 object |
927 | const AliTRDCalDCSv2 *calDCSsorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(0)); |
928 | const AliTRDCalDCSv2 *calDCSeorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(1)); |
929 | if (!calDCSsorv2) { |
930 | // the SOR file is mandatory |
931 | AliError("NO SOR AliTRDCalDCSv2 object found in CDB file!"); |
932 | return nUndef; |
933 | } |
934 | if (!calDCSeorv2) { |
935 | // this can happen if the run is shorter than a couple of seconds. |
936 | AliWarning("NO EOR AliTRDCalDCSv2 object found in CDB file."); |
7a6352a6 |
937 | } |
c6f7c6cb |
938 | |
d6a1ec13 |
939 | // get the numbers |
940 | nTbSor = calDCSsorv2->GetGlobalNumberOfTimeBins(); |
941 | if (calDCSeorv2) nTbEor = calDCSeorv2->GetGlobalNumberOfTimeBins(); |
942 | |
943 | } else AliError("NO DCS/DCSv2 OCDB entry found!"); |
c6f7c6cb |
944 | |
945 | // if they're the same return the value |
946 | // -2 means mixed, -1: no data, >= 0: good number of time bins |
947 | if (nTbSor == nTbEor) return nTbSor; |
948 | |
949 | // if they're differing: |
950 | if (nTbSor == nMixed || nTbEor == nMixed) { |
951 | AliWarning("Inconsistent number of time bins found!"); |
952 | return nMixed; |
e232d349 |
953 | } |
d6a1ec13 |
954 | |
c6f7c6cb |
955 | // one is undefined, the other ok -> return that one |
956 | if (nTbSor == nUndef) return nTbEor; |
957 | if (nTbEor == nUndef) return nTbSor; |
958 | |
959 | // only remains: two different numbers >= 0 |
960 | return nMixed; |
ea3eaa08 |
961 | |
e232d349 |
962 | } |
963 | |
964 | //_____________________________________________________________________________ |
f1dcad37 |
965 | void AliTRDcalibDB::GetFilterType(TString &filterType) |
966 | { |
967 | // |
968 | // Returns the filter type |
969 | // |
970 | |
e232d349 |
971 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
972 | if(!dcsArr){ |
973 | filterType = ""; |
974 | return; |
975 | } |
d6a1ec13 |
976 | |
977 | Int_t esor = 0; // Take SOR |
978 | Int_t calver = 0; // Check CalDCS version |
979 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
980 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; |
981 | |
ea3eaa08 |
982 | if (calver == 1) { |
983 | |
d6a1ec13 |
984 | // DCS object |
985 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); |
986 | if(!calDCS){ |
987 | filterType = ""; |
988 | return; |
989 | } |
990 | filterType = calDCS->GetGlobalFilterType(); |
ea3eaa08 |
991 | |
992 | } |
993 | else if (calver == 2) { |
994 | |
d6a1ec13 |
995 | // DCSv2 object |
996 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); |
997 | if(!calDCSv2){ |
998 | filterType = ""; |
999 | return; |
1000 | } |
1001 | filterType = calDCSv2->GetGlobalFilterType(); |
ea3eaa08 |
1002 | |
1003 | } |
1004 | else { |
1005 | |
1006 | AliError("NO DCS/DCSv2 OCDB entry found!"); |
1007 | |
1008 | } |
d6a1ec13 |
1009 | |
af086c5e |
1010 | } |
1011 | |
1012 | //_____________________________________________________________________________ |
ea3eaa08 |
1013 | Int_t AliTRDcalibDB::GetOnlineGainTableID() |
1014 | { |
1015 | // |
1016 | // Get the gain table ID from the DCS |
1017 | // |
1018 | |
1019 | if (fOnlineGainTableID > 0) { |
1020 | return fOnlineGainTableID; |
1021 | } |
1022 | |
1023 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
1024 | if (!dcsArr){ |
1025 | return -1; |
1026 | } |
1027 | |
1028 | Int_t esor = 0; // Take SOR |
1029 | Int_t calver = 0; // Check CalDCS version |
1030 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
1031 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; |
1032 | |
1033 | if (calver == 1) { |
1034 | |
1035 | // No data for old DCS object available, anyway |
1036 | return -1; |
1037 | |
1038 | } |
1039 | else if (calver == 2) { |
1040 | |
1041 | // DCSv2 object |
1042 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); |
1043 | if(!calDCSv2){ |
1044 | return -1; |
1045 | } |
1046 | |
1047 | TString tableName = ""; |
1048 | for (Int_t i = 0; i < 540; i++) { |
1049 | const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0); |
1050 | tableName = calDCSFEEv2->GetGainTableName(); |
1051 | if (tableName.Length() > 0) { |
1052 | break; |
1053 | } |
1054 | } |
412d07b9 |
1055 | if (tableName.CompareTo("Krypton_2011-01") == 0) { |
ea3eaa08 |
1056 | fOnlineGainTableID = 1; |
1057 | return fOnlineGainTableID; |
1058 | } |
412d07b9 |
1059 | if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0) { |
1060 | fOnlineGainTableID = 2; |
1061 | return fOnlineGainTableID; |
1062 | } |
1063 | if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2011-01") == 0) { |
1064 | fOnlineGainTableID = 3; |
1065 | return fOnlineGainTableID; |
1066 | } |
3abf1c06 |
1067 | if (tableName.CompareTo("Krypton_2011-02") == 0) { |
1068 | fOnlineGainTableID = 4; |
1069 | return fOnlineGainTableID; |
1070 | } |
4a05be5f |
1071 | if (tableName.CompareTo("Krypton_2011-03") == 0) { |
1072 | fOnlineGainTableID = 5; |
1073 | return fOnlineGainTableID; |
1074 | } |
1075 | if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2012-01") == 0) { |
1076 | fOnlineGainTableID = 6; |
1077 | return fOnlineGainTableID; |
1078 | } |
1079 | if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2012-01") == 0) { |
1080 | fOnlineGainTableID = 7; |
1081 | return fOnlineGainTableID; |
1082 | } |
ea3eaa08 |
1083 | |
1084 | } |
1085 | else { |
1086 | |
1087 | AliError("NO DCS/DCSv2 OCDB entry found!"); |
1088 | return -1; |
1089 | |
1090 | } |
1091 | |
45b38fb0 |
1092 | return -1; |
1093 | |
ea3eaa08 |
1094 | } |
1095 | |
1096 | //_____________________________________________________________________________ |
1097 | void AliTRDcalibDB::GetGlobalConfiguration(TString &config) |
1098 | { |
af086c5e |
1099 | // |
1100 | // Get Configuration from the DCS |
1101 | // |
d6a1ec13 |
1102 | |
af086c5e |
1103 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
1104 | if(!dcsArr){ |
1105 | config = ""; |
1106 | return; |
1107 | } |
d6a1ec13 |
1108 | |
1109 | Int_t esor = 0; // Take SOR |
1110 | Int_t calver = 0; // Check CalDCS version |
1111 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
1112 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; |
1113 | |
ea3eaa08 |
1114 | if (calver == 1) { |
1115 | |
d6a1ec13 |
1116 | // DCS object |
ea3eaa08 |
1117 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); |
d6a1ec13 |
1118 | if(!calDCS){ |
1119 | config = ""; |
1120 | return; |
1121 | } |
1122 | config = calDCS->GetGlobalConfigName(); |
ea3eaa08 |
1123 | |
1124 | } |
1125 | else if (calver == 2) { |
1126 | |
d6a1ec13 |
1127 | // DCSv2 object |
1128 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); |
1129 | if(!calDCSv2){ |
1130 | config = ""; |
1131 | return; |
1132 | } |
1133 | config = calDCSv2->GetGlobalConfigName(); |
ea3eaa08 |
1134 | |
1135 | } |
1136 | else { |
1137 | |
1138 | AliError("NO DCS/DCSv2 OCDB entry found!"); |
1139 | |
1140 | } |
d6a1ec13 |
1141 | |
af086c5e |
1142 | } |
f1dcad37 |
1143 | |
f8059b39 |
1144 | //_____________________________________________________________________________ |
1145 | void AliTRDcalibDB::GetGlobalConfigurationVersion(TString &version) |
1146 | { |
1147 | // |
1148 | // Get Version of Configuration from the DCS |
1149 | // |
1150 | |
1151 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
1152 | if(!dcsArr){ |
1153 | version = ""; |
1154 | return; |
1155 | } |
1156 | |
1157 | Int_t esor = 0; // Take SOR |
1158 | Int_t calver = 0; // Check CalDCS version |
1159 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
1160 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; |
1161 | |
1162 | if (calver == 1) { |
1163 | |
1164 | // DCS object |
1165 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); |
1166 | if(!calDCS){ |
1167 | version = ""; |
1168 | return; |
1169 | } |
1170 | version = calDCS->GetGlobalConfigVersion(); |
1171 | |
1172 | } |
1173 | else if (calver == 2) { |
1174 | |
1175 | // DCSv2 object |
1176 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); |
1177 | if(!calDCSv2){ |
1178 | version = ""; |
1179 | return; |
1180 | } |
1181 | version = calDCSv2->GetGlobalConfigVersion(); |
1182 | |
1183 | } |
1184 | else { |
1185 | |
1186 | AliError("NO DCS/DCSv2 OCDB entry found!"); |
1187 | |
1188 | } |
1189 | |
1190 | } |
1191 | |
af086c5e |
1192 | //_____________________________________________________________________________ |
1193 | Bool_t AliTRDcalibDB::HasOnlineFilterPedestal() |
1194 | { |
1195 | // |
1196 | // Checks whether pedestal filter was applied online |
1197 | // |
ea3eaa08 |
1198 | |
af086c5e |
1199 | TString cname; |
ea3eaa08 |
1200 | |
af086c5e |
1201 | // Temporary: Get the filter config from the configuration name |
1202 | GetGlobalConfiguration(cname); |
1203 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); |
ea3eaa08 |
1204 | |
af086c5e |
1205 | // TString filterconfig; |
1206 | //GetFilterType(filterconfig); |
ea3eaa08 |
1207 | |
af086c5e |
1208 | return filterconfig.Contains("p"); |
ea3eaa08 |
1209 | |
af086c5e |
1210 | } |
1211 | |
1212 | //_____________________________________________________________________________ |
ea3eaa08 |
1213 | Bool_t AliTRDcalibDB::HasOnlineFilterGain() |
1214 | { |
af086c5e |
1215 | // |
1216 | // Checks whether online gain filter was applied |
1217 | // |
ea3eaa08 |
1218 | |
af086c5e |
1219 | TString cname; |
ea3eaa08 |
1220 | |
af086c5e |
1221 | // Temporary: Get the filter config from the configuration name |
1222 | GetGlobalConfiguration(cname); |
1223 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); |
ea3eaa08 |
1224 | |
af086c5e |
1225 | //TString filterconfig; |
1226 | //GetFilterType(filterconfig); |
ea3eaa08 |
1227 | |
af086c5e |
1228 | return filterconfig.Contains("g"); |
ea3eaa08 |
1229 | |
af086c5e |
1230 | } |
1231 | |
1232 | //_____________________________________________________________________________ |
ea3eaa08 |
1233 | Bool_t AliTRDcalibDB::HasOnlineTailCancellation() |
1234 | { |
af086c5e |
1235 | // |
1236 | // Checks whether online tail cancellation was applied |
1237 | // |
ea3eaa08 |
1238 | |
af086c5e |
1239 | TString cname; |
ea3eaa08 |
1240 | |
af086c5e |
1241 | // Temporary: Get the filter config from the configuration name |
1242 | GetGlobalConfiguration(cname); |
1243 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); |
ea3eaa08 |
1244 | |
af086c5e |
1245 | //TString filterconfig; |
1246 | //GetFilterType(filterconfig); |
ea3eaa08 |
1247 | |
af086c5e |
1248 | return filterconfig.Contains("t"); |
ea3eaa08 |
1249 | |
e232d349 |
1250 | } |
1251 | |
7754cd1f |
1252 | //_____________________________________________________________________________ |
1253 | Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) |
1254 | { |
1255 | // |
1256 | // Returns the status of the given pad |
1257 | // |
1258 | |
aa617684 |
1259 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1260 | (GetCachedCDBObject(kIDPadStatus)); |
6d50f529 |
1261 | if (!cal) { |
7754cd1f |
1262 | return -1; |
6d50f529 |
1263 | } |
7754cd1f |
1264 | |
95867fd1 |
1265 | const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); |
6d50f529 |
1266 | if (!roc) { |
7754cd1f |
1267 | return -1; |
6d50f529 |
1268 | } |
7754cd1f |
1269 | |
95867fd1 |
1270 | return roc->GetStatus(col,row); |
2745a409 |
1271 | |
7754cd1f |
1272 | } |
1273 | |
0e09df31 |
1274 | //_____________________________________________________________________________ |
1275 | AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det) |
1276 | { |
1277 | // |
1278 | // Returns the pad status calibration object for a given ROC |
1279 | // |
1280 | |
1281 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1282 | (GetCachedCDBObject(kIDPadStatus)); |
1283 | if (!cal) { |
1284 | return 0; |
1285 | } |
1286 | |
1287 | AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); |
1288 | if (!roc) { |
1289 | return 0; |
1290 | } |
1291 | else { |
1292 | return roc; |
1293 | } |
1294 | |
1295 | } |
1296 | |
7754cd1f |
1297 | //_____________________________________________________________________________ |
1298 | Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) |
1299 | { |
1300 | // |
1301 | // Returns the status of the given chamber |
1302 | // |
1303 | |
95867fd1 |
1304 | const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *> |
6d50f529 |
1305 | (GetCachedCDBObject(kIDChamberStatus)); |
1306 | if (!cal) { |
7754cd1f |
1307 | return -1; |
6d50f529 |
1308 | } |
7754cd1f |
1309 | |
1310 | return cal->GetStatus(det); |
2745a409 |
1311 | |
7754cd1f |
1312 | } |
1313 | |
a7ac01d2 |
1314 | //_____________________________________________________________________________ |
1315 | AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/) |
1316 | { |
be28462a |
1317 | // |
1318 | // Returns the TRD reconstruction parameters from the OCDB |
1319 | // |
1320 | |
a7ac01d2 |
1321 | const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam)); |
be28462a |
1322 | if (!recos) return 0x0; |
a7ac01d2 |
1323 | |
1324 | // calculate entry based on event type info |
1325 | Int_t n = 0; //f(eventtype[0], eventtype[1], ....) |
be28462a |
1326 | |
ea3eaa08 |
1327 | return (AliTRDrecoParam *) recos->UncheckedAt(n); |
a7ac01d2 |
1328 | |
be28462a |
1329 | } |
a7ac01d2 |
1330 | |
7754cd1f |
1331 | //_____________________________________________________________________________ |
1332 | Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) |
1333 | { |
1334 | // |
1335 | // Returns status, see name of functions for details ;-) |
1336 | // |
1337 | |
95867fd1 |
1338 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1339 | (GetCachedCDBObject(kIDPadStatus)); |
6d50f529 |
1340 | if (!cal) { |
7754cd1f |
1341 | return -1; |
6d50f529 |
1342 | } |
7754cd1f |
1343 | |
95867fd1 |
1344 | return cal->IsMasked(det,col,row); |
2745a409 |
1345 | |
7754cd1f |
1346 | } |
1347 | |
1348 | //_____________________________________________________________________________ |
1349 | Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row) |
1350 | { |
1351 | // |
1352 | // Returns status, see name of functions for details ;-) |
1353 | // |
1354 | |
95867fd1 |
1355 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1356 | (GetCachedCDBObject(kIDPadStatus)); |
6d50f529 |
1357 | if (!cal) { |
7754cd1f |
1358 | return -1; |
6d50f529 |
1359 | } |
7754cd1f |
1360 | |
95867fd1 |
1361 | return cal->IsBridgedLeft(det,col,row); |
2745a409 |
1362 | |
7754cd1f |
1363 | } |
1364 | |
1365 | //_____________________________________________________________________________ |
1366 | Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) |
1367 | { |
1368 | // |
1369 | // Returns status, see name of functions for details ;-) |
1370 | // |
1371 | |
95867fd1 |
1372 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> |
1373 | (GetCachedCDBObject(kIDPadStatus)); |
6d50f529 |
1374 | if (!cal) { |
7754cd1f |
1375 | return -1; |
6d50f529 |
1376 | } |
7754cd1f |
1377 | |
95867fd1 |
1378 | return cal->IsBridgedRight(det,col,row); |
2745a409 |
1379 | |
7754cd1f |
1380 | } |
1381 | |
fa7427d0 |
1382 | //_____________________________________________________________________________ |
1383 | Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row) |
1384 | { |
1385 | // |
1386 | // Returns status, see name of functions for details ;-) |
1387 | // |
f1dcad37 |
1388 | |
fa7427d0 |
1389 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> |
1390 | (GetCachedCDBObject(kIDPadStatus)); |
1391 | if (!cal) { |
1392 | return -1; |
1393 | } |
1394 | |
1395 | return cal->IsNotConnected(det,col,row); |
1396 | |
1397 | } |
1398 | |
7754cd1f |
1399 | //_____________________________________________________________________________ |
eda91732 |
1400 | Bool_t AliTRDcalibDB::IsChamberGood(Int_t det) |
1401 | { |
1402 | // |
1403 | // Returns status, see name of functions for details ;-) |
1404 | // |
1405 | |
1406 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1407 | (GetCachedCDBObject(kIDChamberStatus)); |
1408 | if (!cal) { |
1409 | return -1; |
1410 | } |
1411 | |
1412 | return cal->IsGood(det); |
1413 | |
1414 | } |
1415 | |
1416 | //_____________________________________________________________________________ |
1417 | Bool_t AliTRDcalibDB::IsChamberNoData(Int_t det) |
7754cd1f |
1418 | { |
1419 | // |
1420 | // Returns status, see name of functions for details ;-) |
1421 | // |
1422 | |
95867fd1 |
1423 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1424 | (GetCachedCDBObject(kIDChamberStatus)); |
6d50f529 |
1425 | if (!cal) { |
7754cd1f |
1426 | return -1; |
6d50f529 |
1427 | } |
7754cd1f |
1428 | |
eda91732 |
1429 | return cal->IsNoData(det); |
2745a409 |
1430 | |
7754cd1f |
1431 | } |
1432 | |
1433 | //_____________________________________________________________________________ |
eda91732 |
1434 | Bool_t AliTRDcalibDB::IsHalfChamberNoData(Int_t det, Int_t side) |
7754cd1f |
1435 | { |
1436 | // |
1437 | // Returns status, see name of functions for details ;-) |
1438 | // |
1439 | |
95867fd1 |
1440 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1441 | (GetCachedCDBObject(kIDChamberStatus)); |
6d50f529 |
1442 | if (!cal) { |
7754cd1f |
1443 | return -1; |
6d50f529 |
1444 | } |
7754cd1f |
1445 | |
eda91732 |
1446 | return side > 0 ? cal->IsNoDataSideB(det) : cal->IsNoDataSideA(det); |
2745a409 |
1447 | |
7754cd1f |
1448 | } |
ea3eaa08 |
1449 | |
7a6352a6 |
1450 | //_____________________________________________________________________________ |
eda91732 |
1451 | Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det) |
ea3eaa08 |
1452 | { |
7a6352a6 |
1453 | // |
1454 | // Returns status, see name of functions for details ;-) |
1455 | // |
7754cd1f |
1456 | |
7a6352a6 |
1457 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1458 | (GetCachedCDBObject(kIDChamberStatus)); |
1459 | if (!cal) { |
1460 | return -1; |
1461 | } |
1462 | |
eda91732 |
1463 | return cal->IsBadCalibrated(det); |
7a6352a6 |
1464 | |
1465 | } |
ea3eaa08 |
1466 | |
cc7cef99 |
1467 | //_____________________________________________________________________________ |
0d83b3a5 |
1468 | const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method) |
cc7cef99 |
1469 | { |
1470 | // |
1471 | // Returns the object storing the distributions for PID with likelihood |
1472 | // |
9a96f175 |
1473 | |
1474 | switch(method) { |
0d83b3a5 |
1475 | case AliTRDpidUtil::kLQ: |
4ba1d6ae |
1476 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ)); |
0d83b3a5 |
1477 | case AliTRDpidUtil::kNN: |
4ba1d6ae |
1478 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN)); |
543691ea |
1479 | case AliTRDpidUtil::kESD: |
1480 | return 0x0; // To avoid compiler warnings |
9a96f175 |
1481 | } |
1482 | |
10f75631 |
1483 | return 0x0; |
2745a409 |
1484 | |
cc7cef99 |
1485 | } |
1486 | |
9dcc64cc |
1487 | //_____________________________________________________________________________ |
ea3eaa08 |
1488 | AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method) |
1489 | { |
1490 | // |
1491 | // Returns the PID response object for 1D-LQ |
1492 | // |
1493 | |
1494 | if (!fPIDResponse) { |
1495 | |
9dcc64cc |
1496 | fPIDResponse = new AliTRDPIDResponse; |
ea3eaa08 |
1497 | |
9dcc64cc |
1498 | // Load Reference Histos from OCDB |
1499 | fPIDResponse->SetPIDmethod(method); |
51a0ce25 |
1500 | const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D)); |
ea3eaa08 |
1501 | |
51a0ce25 |
1502 | TIter refs(references); |
1503 | TObject *obj = NULL; |
1504 | AliTRDPIDReference *ref = NULL; |
1505 | Bool_t hasReference = kFALSE; |
ea3eaa08 |
1506 | while ((obj = refs())){ |
1507 | if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){ |
1508 | fPIDResponse->Load(ref); |
1509 | hasReference = kTRUE; |
1510 | break; |
1511 | } |
51a0ce25 |
1512 | } |
ea3eaa08 |
1513 | |
1514 | if (!hasReference) { |
1515 | AliError("Reference histograms not found in the OCDB"); |
1516 | } |
1517 | |
9dcc64cc |
1518 | } |
ea3eaa08 |
1519 | |
9dcc64cc |
1520 | return fPIDResponse; |
ea3eaa08 |
1521 | |
9dcc64cc |
1522 | } |
1523 | |
1524 | //_____________________________________________________________________________ |
1525 | const AliTRDCalTrkAttach* AliTRDcalibDB::GetAttachObject() |
1526 | { |
1527 | // |
1528 | // Returns the object storing likelihood distributions for cluster to track attachment |
1529 | // |
ea3eaa08 |
1530 | |
9dcc64cc |
1531 | return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach)); |
9dcc64cc |
1532 | |
ea3eaa08 |
1533 | } |
9dcc64cc |
1534 | |
7754cd1f |
1535 | //_____________________________________________________________________________ |
d4c6453d |
1536 | const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject() |
7754cd1f |
1537 | { |
1538 | // |
1539 | // Returns the object storing the monitoring data |
1540 | // |
1541 | |
d4c6453d |
1542 | return dynamic_cast<const AliTRDCalMonitoring *> |
1543 | (GetCachedCDBObject(kIDMonitoringData)); |
1b95a37b |
1544 | |
7754cd1f |
1545 | } |
1546 | |
6a739e92 |
1547 | //_____________________________________________________________________________ |
1548 | void AliTRDcalibDB::SamplePRF() |
1549 | { |
1550 | // |
2745a409 |
1551 | // Samples the pad response function (should maybe go somewhere else ...) |
6a739e92 |
1552 | // |
1553 | |
1554 | const Int_t kPRFbin = 61; |
1555 | |
053767a4 |
1556 | Float_t prf[kNlayer][kPRFbin] = { |
6d50f529 |
1557 | {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, |
6a739e92 |
1558 | 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02, |
1559 | 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01, |
1560 | 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01, |
1561 | 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01, |
1562 | 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01, |
1563 | 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01, |
1564 | 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01, |
1565 | 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01, |
1566 | 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01, |
1567 | 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01, |
1568 | 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01, |
1569 | 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01, |
1570 | 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02, |
1571 | 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02, |
1572 | 2.9037e-02}, |
1573 | {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02, |
1574 | 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02, |
1575 | 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01, |
1576 | 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01, |
1577 | 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01, |
1578 | 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01, |
1579 | 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01, |
1580 | 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01, |
1581 | 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01, |
1582 | 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01, |
1583 | 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01, |
1584 | 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01, |
1585 | 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01, |
1586 | 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02, |
1587 | 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02, |
1588 | 2.5478e-02}, |
1589 | {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02, |
1590 | 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02, |
1591 | 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01, |
1592 | 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01, |
1593 | 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01, |
1594 | 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01, |
1595 | 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01, |
1596 | 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01, |
1597 | 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01, |
1598 | 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01, |
1599 | 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01, |
1600 | 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01, |
1601 | 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02, |
1602 | 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02, |
1603 | 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02, |
1604 | 2.2363e-02}, |
1605 | {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02, |
1606 | 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02, |
1607 | 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01, |
1608 | 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01, |
1609 | 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01, |
1610 | 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01, |
1611 | 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01, |
1612 | 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01, |
1613 | 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01, |
1614 | 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01, |
1615 | 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01, |
1616 | 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01, |
1617 | 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02, |
1618 | 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02, |
1619 | 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02, |
1620 | 1.9635e-02}, |
1621 | {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02, |
1622 | 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02, |
1623 | 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01, |
1624 | 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01, |
1625 | 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01, |
1626 | 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01, |
1627 | 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01, |
1628 | 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01, |
1629 | 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01, |
1630 | 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01, |
1631 | 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01, |
1632 | 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01, |
1633 | 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02, |
1634 | 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02, |
1635 | 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02, |
1636 | 1.7224e-02}, |
1637 | {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02, |
1638 | 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02, |
1639 | 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01, |
1640 | 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01, |
1641 | 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01, |
1642 | 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01, |
1643 | 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01, |
1644 | 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01, |
1645 | 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01, |
1646 | 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01, |
1647 | 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01, |
1648 | 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01, |
1649 | 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02, |
1650 | 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02, |
1651 | 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02, |
1652 | 1.5096e-02}}; |
1653 | |
1654 | // More sampling precision with linear interpolation |
6d50f529 |
1655 | fPRFlo = -1.5; |
1656 | fPRFhi = 1.5; |
6a739e92 |
1657 | Float_t pad[kPRFbin]; |
1658 | Int_t sPRFbin = kPRFbin; |
6d50f529 |
1659 | Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin); |
6a739e92 |
1660 | for (Int_t iPad = 0; iPad < sPRFbin; iPad++) { |
6d50f529 |
1661 | pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo; |
6a739e92 |
1662 | } |
6d50f529 |
1663 | fPRFbin = 500; |
1664 | fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin); |
1665 | fPRFpad = ((Int_t) (1.0 / fPRFwid)); |
6a739e92 |
1666 | |
6d50f529 |
1667 | if (fPRFsmp) delete [] fPRFsmp; |
053767a4 |
1668 | fPRFsmp = new Float_t[kNlayer*fPRFbin]; |
6a739e92 |
1669 | |
1670 | Int_t ipos1; |
1671 | Int_t ipos2; |
1672 | Float_t diff; |
1673 | |
053767a4 |
1674 | for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) { |
6a739e92 |
1675 | |
6d50f529 |
1676 | for (Int_t iBin = 0; iBin < fPRFbin; iBin++) { |
6a739e92 |
1677 | |
6d50f529 |
1678 | Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo; |
6a739e92 |
1679 | ipos1 = ipos2 = 0; |
1680 | diff = 0; |
1681 | do { |
1682 | diff = bin - pad[ipos2++]; |
1683 | } while ((diff > 0) && (ipos2 < kPRFbin)); |
1684 | if (ipos2 == kPRFbin) { |
053767a4 |
1685 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 |
1686 | } |
1687 | else if (ipos2 == 1) { |
053767a4 |
1688 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 |
1689 | } |
1690 | else { |
1691 | ipos2--; |
1692 | if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1; |
1693 | ipos1 = ipos2 - 1; |
053767a4 |
1694 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2] |
1695 | + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1]) |
1696 | / sPRFwid; |
6a739e92 |
1697 | } |
1698 | |
1699 | } |
1700 | } |
1701 | |
1702 | } |
1703 | |
1704 | //_____________________________________________________________________________ |
1705 | Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist |
eb52b657 |
1706 | , Int_t layer, Double_t *pad) const |
6a739e92 |
1707 | { |
1708 | // |
1709 | // Applies the pad response |
56178ff4 |
1710 | // So far this is the fixed parametrization and should be replaced by |
1711 | // something dependent on calibration values |
6a739e92 |
1712 | // |
1713 | |
eb52b657 |
1714 | Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid)); |
053767a4 |
1715 | Int_t iOff = layer * fPRFbin; |
6a739e92 |
1716 | |
6d50f529 |
1717 | Int_t iBin0 = iBin - fPRFpad + iOff; |
6a739e92 |
1718 | Int_t iBin1 = iBin + iOff; |
6d50f529 |
1719 | Int_t iBin2 = iBin + fPRFpad + iOff; |
6a739e92 |
1720 | |
1721 | pad[0] = 0.0; |
1722 | pad[1] = 0.0; |
1723 | pad[2] = 0.0; |
053767a4 |
1724 | if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) { |
6a739e92 |
1725 | |
1726 | if (iBin0 >= 0) { |
6d50f529 |
1727 | pad[0] = signal * fPRFsmp[iBin0]; |
6a739e92 |
1728 | } |
6d50f529 |
1729 | pad[1] = signal * fPRFsmp[iBin1]; |
053767a4 |
1730 | if (iBin2 < (fPRFbin*kNlayer)) { |
6d50f529 |
1731 | pad[2] = signal * fPRFsmp[iBin2]; |
6a739e92 |
1732 | } |
1733 | |
1734 | return 1; |
1735 | |
1736 | } |
1737 | else { |
1738 | |
1739 | return 0; |
1740 | |
1741 | } |
ab0a4106 |
1742 | |
3551db50 |
1743 | } |
7a6352a6 |
1744 | |
1745 | |