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