]>
Commit | Line | Data |
---|---|---|
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> |
3551db50 | 32 | |
2745a409 | 33 | #include "AliCDBManager.h" |
2745a409 | 34 | #include "AliCDBEntry.h" |
35 | #include "AliLog.h" | |
3551db50 | 36 | |
37 | #include "AliTRDcalibDB.h" | |
3551db50 | 38 | |
7754cd1f | 39 | #include "Cal/AliTRDCalROC.h" |
7754cd1f | 40 | #include "Cal/AliTRDCalPad.h" |
41 | #include "Cal/AliTRDCalDet.h" | |
aa617684 | 42 | #include "Cal/AliTRDCalFEE.h" |
720a0a16 | 43 | #include "Cal/AliTRDCalPID.h" |
7754cd1f | 44 | #include "Cal/AliTRDCalMonitoring.h" |
7754cd1f | 45 | #include "Cal/AliTRDCalChamberStatus.h" |
7754cd1f | 46 | #include "Cal/AliTRDCalPadStatus.h" |
47 | #include "Cal/AliTRDCalSingleChamberStatus.h" | |
3551db50 | 48 | |
49 | ClassImp(AliTRDcalibDB) | |
50 | ||
2745a409 | 51 | AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0; |
52 | Bool_t AliTRDcalibDB::fgTerminated = kFALSE; | |
3551db50 | 53 | |
54 | //_ singleton implementation __________________________________________________ | |
55 | AliTRDcalibDB* AliTRDcalibDB::Instance() | |
56 | { | |
57 | // | |
58 | // Singleton implementation | |
59 | // Returns an instance of this class, it is created if neccessary | |
63a700c6 | 60 | // |
3551db50 | 61 | |
6d50f529 | 62 | if (fgTerminated != kFALSE) { |
3551db50 | 63 | return 0; |
6d50f529 | 64 | } |
3551db50 | 65 | |
6d50f529 | 66 | if (fgInstance == 0) { |
3551db50 | 67 | fgInstance = new AliTRDcalibDB(); |
6d50f529 | 68 | } |
e254cad1 | 69 | |
3551db50 | 70 | return fgInstance; |
4e009ce4 | 71 | |
3551db50 | 72 | } |
73 | ||
2745a409 | 74 | //_____________________________________________________________________________ |
3551db50 | 75 | void AliTRDcalibDB::Terminate() |
76 | { | |
77 | // | |
78 | // Singleton implementation | |
6bf5f0ce | 79 | // Deletes the instance of this class and sets the terminated flag, |
80 | // instances cannot be requested anymore | |
3551db50 | 81 | // This function can be called several times. |
82 | // | |
83 | ||
84 | fgTerminated = kTRUE; | |
85 | ||
6d50f529 | 86 | if (fgInstance != 0) { |
3551db50 | 87 | delete fgInstance; |
88 | fgInstance = 0; | |
89 | } | |
2745a409 | 90 | |
3551db50 | 91 | } |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | AliTRDcalibDB::AliTRDcalibDB() | |
2745a409 | 95 | :TObject() |
96 | ,fRun(-1) | |
6d50f529 | 97 | ,fPRFsmp(0) |
98 | ,fPRFbin(0) | |
99 | ,fPRFlo(0) | |
100 | ,fPRFhi(0) | |
101 | ,fPRFwid(0) | |
102 | ,fPRFpad(0) | |
3551db50 | 103 | { |
104 | // | |
2745a409 | 105 | // Default constructor |
3551db50 | 106 | // |
2745a409 | 107 | // TODO Default runnumber is set to 0, this should be changed later |
108 | // to an invalid value (e.g. -1) to prevent | |
3551db50 | 109 | // TODO invalid calibration data to be used. |
2745a409 | 110 | // |
111 | ||
95867fd1 | 112 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 | 113 | fCDBCache[i] = 0; |
114 | fCDBEntries[i] = 0; | |
115 | } | |
3551db50 | 116 | |
2745a409 | 117 | // Create the sampled PRF |
118 | SamplePRF(); | |
d4c6453d | 119 | |
2745a409 | 120 | } |
121 | ||
122 | //_____________________________________________________________________________ | |
123 | AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c) | |
124 | :TObject(c) | |
6d50f529 | 125 | ,fRun(-1) |
126 | ,fPRFsmp(0) | |
127 | ,fPRFbin(0) | |
128 | ,fPRFlo(0) | |
129 | ,fPRFhi(0) | |
130 | ,fPRFwid(0) | |
131 | ,fPRFpad(0) | |
2745a409 | 132 | { |
133 | // | |
134 | // Copy constructor (not that it make any sense for a singleton...) | |
135 | // | |
136 | ||
95867fd1 | 137 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 | 138 | fCDBCache[i] = 0; |
3551db50 | 139 | fCDBEntries[i] = 0; |
140 | } | |
6a739e92 | 141 | |
142 | // Create the sampled PRF | |
143 | SamplePRF(); | |
2745a409 | 144 | |
145 | } | |
146 | ||
147 | //_____________________________________________________________________________ | |
148 | AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c) | |
149 | { | |
150 | // | |
151 | // Assignment operator (same as above ...) | |
152 | // | |
153 | ||
154 | if (this != &c) { | |
155 | AliFatal("No assignment operator defined"); | |
156 | } | |
4e009ce4 | 157 | |
2745a409 | 158 | return *this; |
159 | ||
acba9bad | 160 | } |
3551db50 | 161 | |
162 | //_____________________________________________________________________________ | |
163 | AliTRDcalibDB::~AliTRDcalibDB() | |
164 | { | |
165 | // | |
166 | // destructor | |
167 | // | |
168 | ||
6d50f529 | 169 | if (fPRFsmp) { |
170 | delete [] fPRFsmp; | |
171 | fPRFsmp = 0; | |
6a739e92 | 172 | } |
173 | ||
3551db50 | 174 | Invalidate(); |
2745a409 | 175 | |
acba9bad | 176 | } |
3551db50 | 177 | |
63a700c6 | 178 | //_caching functions____________________________________________________________ |
95867fd1 | 179 | const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id) |
63a700c6 | 180 | { |
2745a409 | 181 | // |
182 | // Retrieves a cdb object with the given id. The objects are cached as | |
183 | // long as the run number is not changed. | |
184 | // | |
185 | // Put together the available objects here by using the lines | |
186 | // a) For usual calibration objects: | |
187 | // case kID<Name> : | |
188 | // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>"); | |
189 | // break; | |
190 | // See function CacheCDBEntry for details. | |
191 | // and | |
192 | // b) For calibration data which depends on two objects: One containing | |
193 | // a value per detector and one the local fluctuations per pad: | |
194 | // case kID<Name> : | |
195 | // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>"); | |
196 | // break; | |
197 | // See function CacheMergeCDBEntry for details. | |
198 | // | |
63a700c6 | 199 | |
6d50f529 | 200 | switch (id) { |
2745a409 | 201 | |
202 | // Parameters defined per pad and chamber | |
203 | case kIDVdriftPad : | |
6d50f529 | 204 | return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift"); |
2745a409 | 205 | break; |
206 | case kIDVdriftChamber : | |
6d50f529 | 207 | return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift"); |
2745a409 | 208 | break; |
209 | case kIDT0Pad : | |
6d50f529 | 210 | return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0"); |
2745a409 | 211 | break; |
212 | case kIDT0Chamber : | |
6d50f529 | 213 | return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0"); |
2745a409 | 214 | break; |
215 | case kIDGainFactorPad : | |
6d50f529 | 216 | return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor"); |
2745a409 | 217 | break; |
218 | case kIDGainFactorChamber : | |
6d50f529 | 219 | return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor"); |
2745a409 | 220 | break; |
df83a620 | 221 | case kIDNoiseChamber : |
222 | return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise"); | |
223 | break; | |
224 | case kIDNoisePad : | |
225 | return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise"); | |
226 | break; | |
227 | ||
2745a409 | 228 | |
229 | // Parameters defined per pad | |
230 | case kIDPRFWidth : | |
6d50f529 | 231 | return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth"); |
2745a409 | 232 | break; |
233 | ||
234 | // Status values | |
2745a409 | 235 | case kIDChamberStatus : |
6d50f529 | 236 | return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus"); |
2745a409 | 237 | break; |
2745a409 | 238 | case kIDPadStatus : |
6d50f529 | 239 | return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus"); |
2745a409 | 240 | break; |
241 | ||
242 | // Global parameters | |
243 | case kIDMonitoringData : | |
6d50f529 | 244 | return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData"); |
2745a409 | 245 | break; |
aa617684 | 246 | case kIDFEE : |
247 | return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE"); | |
2745a409 | 248 | break; |
44dbae42 | 249 | case kIDPIDNN : |
250 | return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN"); | |
2745a409 | 251 | case kIDPIDLQ : |
6d50f529 | 252 | return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ"); |
2745a409 | 253 | break; |
a7ac01d2 | 254 | case kIDRecoParam : |
255 | return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam"); | |
256 | break; | |
2745a409 | 257 | |
258 | } | |
259 | ||
260 | return 0; | |
261 | ||
63a700c6 | 262 | } |
263 | ||
264 | //_____________________________________________________________________________ | |
95867fd1 | 265 | AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath) |
63a700c6 | 266 | { |
267 | // | |
268 | // Retrieves an entry with path <cdbPath> from the CDB. | |
269 | // | |
270 | ||
95867fd1 | 271 | AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun); |
2745a409 | 272 | if (!entry) { |
a7ac01d2 | 273 | AliError(Form("Failed to get entry: %s",cdbPath)); |
63a700c6 | 274 | return 0; |
275 | } | |
276 | ||
63a700c6 | 277 | return entry; |
2745a409 | 278 | |
63a700c6 | 279 | } |
280 | ||
281 | //_____________________________________________________________________________ | |
95867fd1 | 282 | const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath) |
63a700c6 | 283 | { |
284 | // | |
285 | // Caches the entry <id> with cdb path <cdbPath> | |
286 | // | |
287 | ||
2745a409 | 288 | if (!fCDBCache[id]) { |
63a700c6 | 289 | fCDBEntries[id] = GetCDBEntry(cdbPath); |
95867fd1 | 290 | if (fCDBEntries[id]) { |
63a700c6 | 291 | fCDBCache[id] = fCDBEntries[id]->GetObject(); |
95867fd1 | 292 | } |
63a700c6 | 293 | } |
95867fd1 | 294 | |
63a700c6 | 295 | return fCDBCache[id]; |
2745a409 | 296 | |
63a700c6 | 297 | } |
298 | ||
3551db50 | 299 | //_____________________________________________________________________________ |
300 | void AliTRDcalibDB::SetRun(Long64_t run) | |
301 | { | |
302 | // | |
7754cd1f | 303 | // Sets current run number. Calibration data is read from the corresponding file. |
3551db50 | 304 | // When the run number changes the caching is invalidated. |
305 | // | |
7754cd1f | 306 | |
6d50f529 | 307 | if (fRun == run) { |
3551db50 | 308 | return; |
6d50f529 | 309 | } |
7754cd1f | 310 | |
3551db50 | 311 | fRun = run; |
95867fd1 | 312 | |
3551db50 | 313 | Invalidate(); |
2745a409 | 314 | |
3551db50 | 315 | } |
7754cd1f | 316 | |
3551db50 | 317 | //_____________________________________________________________________________ |
318 | void AliTRDcalibDB::Invalidate() | |
319 | { | |
320 | // | |
321 | // Invalidates cache (when run number is changed). | |
322 | // | |
323 | ||
95867fd1 | 324 | for (Int_t i = 0; i < kCDBCacheSize; ++i) { |
2745a409 | 325 | if (fCDBEntries[i]) { |
326 | if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) { | |
11f5dd43 | 327 | if ((fCDBEntries[i]->IsOwner() == kFALSE) && |
328 | (fCDBCache[i])) { | |
e254cad1 | 329 | delete fCDBCache[i]; |
2745a409 | 330 | } |
e254cad1 | 331 | delete fCDBEntries[i]; |
332 | } | |
3551db50 | 333 | fCDBEntries[i] = 0; |
2745a409 | 334 | fCDBCache[i] = 0; |
3551db50 | 335 | } |
336 | } | |
2745a409 | 337 | |
df83a620 | 338 | } |
339 | //_____________________________________________________________________________ | |
340 | Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row) | |
341 | { | |
342 | // | |
343 | // Returns the noise level in ADC counts for the given pad. | |
344 | // | |
345 | ||
346 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
347 | (GetCachedCDBObject(kIDNoisePad)); | |
348 | if (!calPad) { | |
349 | return -1; | |
350 | } | |
351 | ||
352 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
353 | if (!roc) { | |
354 | return -1; | |
355 | } | |
356 | ||
357 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
358 | (GetCachedCDBObject(kIDNoiseChamber)); | |
359 | if (!calChamber) { | |
360 | return -1; | |
361 | } | |
362 | ||
363 | return calChamber->GetValue(det) * roc->GetValue(col,row); | |
364 | ||
365 | } | |
366 | ||
367 | //_____________________________________________________________________________ | |
368 | AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det) | |
369 | { | |
370 | // | |
371 | // Returns the Vdrift calibration object for a given ROC | |
372 | // containing one number per pad | |
373 | // | |
374 | ||
375 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
376 | (GetCachedCDBObject(kIDNoisePad)); | |
377 | if (!calPad) { | |
378 | return 0; | |
379 | } | |
380 | ||
381 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
382 | if (!roc) { | |
383 | return 0; | |
384 | } | |
385 | else { | |
386 | return roc; | |
387 | } | |
388 | ||
389 | } | |
390 | ||
391 | //_____________________________________________________________________________ | |
392 | const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet() | |
393 | { | |
394 | // | |
395 | // Returns the Vdrift calibration object | |
396 | // containing one number per detector | |
397 | // | |
398 | ||
399 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
400 | (GetCachedCDBObject(kIDNoiseChamber)); | |
401 | if (!calChamber) { | |
402 | return 0; | |
403 | } | |
404 | else { | |
405 | return calChamber; | |
406 | } | |
407 | ||
3551db50 | 408 | } |
409 | ||
3551db50 | 410 | //_____________________________________________________________________________ |
411 | Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) | |
412 | { | |
413 | // | |
414 | // Returns the drift velocity for the given pad. | |
415 | // | |
7754cd1f | 416 | |
95867fd1 | 417 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 | 418 | (GetCachedCDBObject(kIDVdriftPad)); |
419 | if (!calPad) { | |
3551db50 | 420 | return -1; |
6d50f529 | 421 | } |
3551db50 | 422 | |
95867fd1 | 423 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 | 424 | if (!roc) { |
3551db50 | 425 | return -1; |
6d50f529 | 426 | } |
3551db50 | 427 | |
95867fd1 | 428 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 429 | (GetCachedCDBObject(kIDVdriftChamber)); |
430 | if (!calChamber) { | |
7754cd1f | 431 | return -1; |
6d50f529 | 432 | } |
7754cd1f | 433 | |
95867fd1 | 434 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
2745a409 | 435 | |
7754cd1f | 436 | } |
afb9f880 | 437 | |
438 | //_____________________________________________________________________________ | |
439 | AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det) | |
440 | { | |
441 | // | |
442 | // Returns the Vdrift calibration object for a given ROC | |
443 | // containing one number per pad | |
444 | // | |
445 | ||
446 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
447 | (GetCachedCDBObject(kIDVdriftPad)); | |
448 | if (!calPad) { | |
449 | return 0; | |
450 | } | |
451 | ||
452 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
453 | if (!roc) { | |
454 | return 0; | |
455 | } | |
456 | else { | |
457 | return roc; | |
458 | } | |
459 | ||
460 | } | |
461 | ||
462 | //_____________________________________________________________________________ | |
463 | const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet() | |
464 | { | |
465 | // | |
466 | // Returns the Vdrift calibration object | |
467 | // containing one number per detector | |
468 | // | |
469 | ||
470 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
471 | (GetCachedCDBObject(kIDVdriftChamber)); | |
472 | if (!calChamber) { | |
473 | return 0; | |
474 | } | |
475 | else { | |
476 | return calChamber; | |
477 | } | |
478 | ||
479 | } | |
7754cd1f | 480 | |
481 | //_____________________________________________________________________________ | |
482 | Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det) | |
483 | { | |
484 | // | |
485 | // Returns the average drift velocity for the given detector | |
486 | // | |
487 | ||
95867fd1 | 488 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 489 | (GetCachedCDBObject(kIDVdriftChamber)); |
490 | if (!calDet) { | |
7754cd1f | 491 | return -1; |
6d50f529 | 492 | } |
7754cd1f | 493 | |
494 | return calDet->GetValue(det); | |
2745a409 | 495 | |
acba9bad | 496 | } |
3551db50 | 497 | |
498 | //_____________________________________________________________________________ | |
499 | Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) | |
500 | { | |
501 | // | |
502 | // Returns t0 for the given pad. | |
503 | // | |
504 | ||
d4c6453d | 505 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
506 | (GetCachedCDBObject(kIDT0Pad)); | |
6d50f529 | 507 | if (!calPad) { |
3551db50 | 508 | return -1; |
6d50f529 | 509 | } |
3551db50 | 510 | |
d4c6453d | 511 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 | 512 | if (!roc) { |
3551db50 | 513 | return -1; |
6d50f529 | 514 | } |
3551db50 | 515 | |
d4c6453d | 516 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
517 | (GetCachedCDBObject(kIDT0Chamber)); | |
6d50f529 | 518 | if (!calChamber) { |
7754cd1f | 519 | return -1; |
6d50f529 | 520 | } |
7754cd1f | 521 | |
8d786fb8 | 522 | return calChamber->GetValue(det) + roc->GetValue(col,row); |
2745a409 | 523 | |
7754cd1f | 524 | } |
afb9f880 | 525 | |
56178ff4 | 526 | //_____________________________________________________________________________ |
527 | AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det) | |
528 | { | |
529 | // | |
530 | // Returns the t0 calibration object for a given ROC | |
531 | // containing one number per pad | |
532 | // | |
533 | ||
534 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
535 | (GetCachedCDBObject(kIDT0Pad)); | |
536 | if (!calPad) { | |
537 | return 0; | |
538 | } | |
539 | ||
540 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
541 | if (!roc) { | |
542 | return 0; | |
543 | } | |
544 | else { | |
545 | return roc; | |
546 | } | |
547 | ||
548 | } | |
549 | ||
550 | //_____________________________________________________________________________ | |
551 | const AliTRDCalDet *AliTRDcalibDB::GetT0Det() | |
552 | { | |
553 | // | |
554 | // Returns the t0 calibration object | |
555 | // containing one number per detector | |
556 | // | |
557 | ||
558 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
559 | (GetCachedCDBObject(kIDT0Chamber)); | |
560 | if (!calChamber) { | |
561 | return 0; | |
562 | } | |
563 | else { | |
564 | return calChamber; | |
565 | } | |
566 | ||
567 | } | |
568 | ||
7754cd1f | 569 | //_____________________________________________________________________________ |
570 | Float_t AliTRDcalibDB::GetT0Average(Int_t det) | |
571 | { | |
572 | // | |
573 | // Returns the average t0 for the given detector | |
574 | // | |
575 | ||
5aba4f09 | 576 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
577 | (GetCachedCDBObject(kIDT0Pad)); | |
578 | if (!calPad) { | |
579 | return -1; | |
580 | } | |
581 | ||
582 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
583 | if (!roc) { | |
584 | return -1; | |
585 | } | |
586 | ||
95867fd1 | 587 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 588 | (GetCachedCDBObject(kIDT0Chamber)); |
589 | if (!calDet) { | |
7754cd1f | 590 | return -1; |
6d50f529 | 591 | } |
7754cd1f | 592 | |
5aba4f09 | 593 | Double_t mean = 0.0; |
594 | for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) { | |
595 | mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels(); | |
596 | } | |
597 | ||
598 | return mean; | |
2745a409 | 599 | |
acba9bad | 600 | } |
3551db50 | 601 | |
602 | //_____________________________________________________________________________ | |
603 | Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) | |
604 | { | |
605 | // | |
606 | // Returns the gain factor for the given pad. | |
607 | // | |
608 | ||
95867fd1 | 609 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 | 610 | (GetCachedCDBObject(kIDGainFactorPad)); |
611 | if (!calPad) { | |
3551db50 | 612 | return -1; |
6d50f529 | 613 | } |
3551db50 | 614 | |
95867fd1 | 615 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
56178ff4 | 616 | if (!roc) { |
3551db50 | 617 | return -1; |
56178ff4 | 618 | } |
3551db50 | 619 | |
95867fd1 | 620 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 621 | (GetCachedCDBObject(kIDGainFactorChamber)); |
622 | if (!calChamber) { | |
7754cd1f | 623 | return -1; |
6d50f529 | 624 | } |
7754cd1f | 625 | |
95867fd1 | 626 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
2745a409 | 627 | |
7754cd1f | 628 | } |
629 | ||
56178ff4 | 630 | //_____________________________________________________________________________ |
631 | AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det) | |
632 | { | |
633 | // | |
634 | // Returns the gain factor calibration object for a given ROC | |
56178ff4 | 635 | // |
636 | ||
637 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
638 | (GetCachedCDBObject(kIDGainFactorPad)); | |
639 | if (!calPad) { | |
640 | return 0; | |
641 | } | |
642 | ||
643 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
644 | if (!roc) { | |
645 | return 0; | |
646 | } | |
647 | else { | |
648 | return roc; | |
649 | } | |
650 | ||
651 | } | |
652 | ||
653 | //_____________________________________________________________________________ | |
654 | const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet() | |
655 | { | |
656 | // | |
657 | // Returns the gain factor calibration object | |
658 | // containing one number per detector | |
659 | // | |
660 | ||
661 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
662 | (GetCachedCDBObject(kIDGainFactorChamber)); | |
663 | if (!calChamber) { | |
664 | return 0; | |
665 | } | |
666 | else { | |
667 | return calChamber; | |
668 | } | |
669 | ||
670 | } | |
671 | ||
7754cd1f | 672 | //_____________________________________________________________________________ |
673 | Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) | |
674 | { | |
675 | // | |
676 | // Returns the average gain factor for the given detector | |
677 | // | |
678 | ||
95867fd1 | 679 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 680 | (GetCachedCDBObject(kIDGainFactorChamber)); |
681 | if (!calDet) { | |
7754cd1f | 682 | return -1; |
6d50f529 | 683 | } |
7754cd1f | 684 | |
685 | return calDet->GetValue(det); | |
2745a409 | 686 | |
acba9bad | 687 | } |
6a739e92 | 688 | |
524fc8fa | 689 | //_____________________________________________________________________________ |
690 | AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det) | |
691 | { | |
692 | // | |
693 | // Returns the PRF calibration object for a given ROC | |
694 | // containing one number per pad | |
695 | // | |
696 | ||
697 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
698 | (GetCachedCDBObject(kIDPRFWidth)); | |
699 | if (!calPad) { | |
700 | return 0; | |
701 | } | |
702 | ||
703 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
704 | if (!roc) { | |
705 | return 0; | |
706 | } | |
707 | else { | |
708 | return roc; | |
709 | } | |
710 | ||
711 | } | |
712 | ||
6a739e92 | 713 | //_____________________________________________________________________________ |
714 | Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) | |
715 | { | |
716 | // | |
717 | // Returns the PRF width for the given pad. | |
718 | // | |
719 | ||
95867fd1 | 720 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 | 721 | (GetCachedCDBObject(kIDPRFWidth)); |
722 | if (!calPad) { | |
6a739e92 | 723 | return -1; |
6d50f529 | 724 | } |
6a739e92 | 725 | |
95867fd1 | 726 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 | 727 | if (!roc) { |
6a739e92 | 728 | return -1; |
6d50f529 | 729 | } |
6a739e92 | 730 | |
95867fd1 | 731 | return roc->GetValue(col,row); |
2745a409 | 732 | |
acba9bad | 733 | } |
3551db50 | 734 | |
735 | //_____________________________________________________________________________ | |
736 | Int_t AliTRDcalibDB::GetNumberOfTimeBins() | |
737 | { | |
738 | // | |
739 | // Returns the number of time bins which are read-out. | |
740 | // | |
7754cd1f | 741 | |
aa617684 | 742 | const AliTRDCalFEE *calFEE = dynamic_cast<const AliTRDCalFEE *> |
743 | (GetCachedCDBObject(kIDFEE)); | |
744 | if (!calFEE) { | |
7754cd1f | 745 | return -1; |
6d50f529 | 746 | } |
7754cd1f | 747 | |
aa617684 | 748 | return calFEE->GetNumberOfTimeBins(); |
2745a409 | 749 | |
3551db50 | 750 | } |
751 | ||
7754cd1f | 752 | //_____________________________________________________________________________ |
753 | Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) | |
754 | { | |
755 | // | |
756 | // Returns the status of the given pad | |
757 | // | |
758 | ||
aa617684 | 759 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
760 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 761 | if (!cal) { |
7754cd1f | 762 | return -1; |
6d50f529 | 763 | } |
7754cd1f | 764 | |
95867fd1 | 765 | const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); |
6d50f529 | 766 | if (!roc) { |
7754cd1f | 767 | return -1; |
6d50f529 | 768 | } |
7754cd1f | 769 | |
95867fd1 | 770 | return roc->GetStatus(col,row); |
2745a409 | 771 | |
7754cd1f | 772 | } |
773 | ||
0e09df31 | 774 | //_____________________________________________________________________________ |
775 | AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det) | |
776 | { | |
777 | // | |
778 | // Returns the pad status calibration object for a given ROC | |
779 | // | |
780 | ||
781 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> | |
782 | (GetCachedCDBObject(kIDPadStatus)); | |
783 | if (!cal) { | |
784 | return 0; | |
785 | } | |
786 | ||
787 | AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); | |
788 | if (!roc) { | |
789 | return 0; | |
790 | } | |
791 | else { | |
792 | return roc; | |
793 | } | |
794 | ||
795 | } | |
796 | ||
7754cd1f | 797 | //_____________________________________________________________________________ |
798 | Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) | |
799 | { | |
800 | // | |
801 | // Returns the status of the given chamber | |
802 | // | |
803 | ||
95867fd1 | 804 | const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *> |
6d50f529 | 805 | (GetCachedCDBObject(kIDChamberStatus)); |
806 | if (!cal) { | |
7754cd1f | 807 | return -1; |
6d50f529 | 808 | } |
7754cd1f | 809 | |
810 | return cal->GetStatus(det); | |
2745a409 | 811 | |
7754cd1f | 812 | } |
813 | ||
a7ac01d2 | 814 | //_____________________________________________________________________________ |
815 | AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/) | |
816 | { | |
be28462a | 817 | // |
818 | // Returns the TRD reconstruction parameters from the OCDB | |
819 | // | |
820 | ||
a7ac01d2 | 821 | const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam)); |
be28462a | 822 | if (!recos) return 0x0; |
a7ac01d2 | 823 | |
824 | // calculate entry based on event type info | |
825 | Int_t n = 0; //f(eventtype[0], eventtype[1], ....) | |
be28462a | 826 | |
a7ac01d2 | 827 | return (AliTRDrecoParam*)recos->UncheckedAt(n); |
a7ac01d2 | 828 | |
be28462a | 829 | } |
a7ac01d2 | 830 | |
7754cd1f | 831 | //_____________________________________________________________________________ |
832 | Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) | |
833 | { | |
834 | // | |
835 | // Returns status, see name of functions for details ;-) | |
836 | // | |
837 | ||
95867fd1 | 838 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
839 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 840 | if (!cal) { |
7754cd1f | 841 | return -1; |
6d50f529 | 842 | } |
7754cd1f | 843 | |
95867fd1 | 844 | return cal->IsMasked(det,col,row); |
2745a409 | 845 | |
7754cd1f | 846 | } |
847 | ||
848 | //_____________________________________________________________________________ | |
849 | Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row) | |
850 | { | |
851 | // | |
852 | // Returns status, see name of functions for details ;-) | |
853 | // | |
854 | ||
95867fd1 | 855 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
856 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 857 | if (!cal) { |
7754cd1f | 858 | return -1; |
6d50f529 | 859 | } |
7754cd1f | 860 | |
95867fd1 | 861 | return cal->IsBridgedLeft(det,col,row); |
2745a409 | 862 | |
7754cd1f | 863 | } |
864 | ||
865 | //_____________________________________________________________________________ | |
866 | Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) | |
867 | { | |
868 | // | |
869 | // Returns status, see name of functions for details ;-) | |
870 | // | |
871 | ||
95867fd1 | 872 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> |
873 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 874 | if (!cal) { |
7754cd1f | 875 | return -1; |
6d50f529 | 876 | } |
7754cd1f | 877 | |
95867fd1 | 878 | return cal->IsBridgedRight(det,col,row); |
2745a409 | 879 | |
7754cd1f | 880 | } |
881 | ||
fa7427d0 | 882 | //_____________________________________________________________________________ |
883 | Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row) | |
884 | { | |
885 | // | |
886 | // Returns status, see name of functions for details ;-) | |
887 | // | |
888 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> | |
889 | (GetCachedCDBObject(kIDPadStatus)); | |
890 | if (!cal) { | |
891 | return -1; | |
892 | } | |
893 | ||
894 | return cal->IsNotConnected(det,col,row); | |
895 | ||
896 | } | |
897 | ||
7754cd1f | 898 | //_____________________________________________________________________________ |
899 | Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det) | |
900 | { | |
901 | // | |
902 | // Returns status, see name of functions for details ;-) | |
903 | // | |
904 | ||
95867fd1 | 905 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
906 | (GetCachedCDBObject(kIDChamberStatus)); | |
6d50f529 | 907 | if (!cal) { |
7754cd1f | 908 | return -1; |
6d50f529 | 909 | } |
7754cd1f | 910 | |
911 | return cal->IsInstalled(det); | |
2745a409 | 912 | |
7754cd1f | 913 | } |
914 | ||
915 | //_____________________________________________________________________________ | |
916 | Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det) | |
917 | { | |
918 | // | |
919 | // Returns status, see name of functions for details ;-) | |
920 | // | |
921 | ||
95867fd1 | 922 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
923 | (GetCachedCDBObject(kIDChamberStatus)); | |
6d50f529 | 924 | if (!cal) { |
7754cd1f | 925 | return -1; |
6d50f529 | 926 | } |
7754cd1f | 927 | |
928 | return cal->IsMasked(det); | |
2745a409 | 929 | |
7754cd1f | 930 | } |
931 | ||
cc7cef99 | 932 | //_____________________________________________________________________________ |
0d83b3a5 | 933 | const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method) |
cc7cef99 | 934 | { |
935 | // | |
936 | // Returns the object storing the distributions for PID with likelihood | |
937 | // | |
9a96f175 | 938 | |
939 | switch(method) { | |
0d83b3a5 | 940 | case AliTRDpidUtil::kLQ: |
4ba1d6ae | 941 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ)); |
0d83b3a5 | 942 | case AliTRDpidUtil::kNN: |
4ba1d6ae | 943 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN)); |
543691ea | 944 | case AliTRDpidUtil::kESD: |
945 | return 0x0; // To avoid compiler warnings | |
9a96f175 | 946 | } |
947 | ||
10f75631 | 948 | return 0x0; |
2745a409 | 949 | |
cc7cef99 | 950 | } |
951 | ||
7754cd1f | 952 | //_____________________________________________________________________________ |
d4c6453d | 953 | const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject() |
7754cd1f | 954 | { |
955 | // | |
956 | // Returns the object storing the monitoring data | |
957 | // | |
958 | ||
d4c6453d | 959 | return dynamic_cast<const AliTRDCalMonitoring *> |
960 | (GetCachedCDBObject(kIDMonitoringData)); | |
1b95a37b | 961 | |
7754cd1f | 962 | } |
963 | ||
6a739e92 | 964 | //_____________________________________________________________________________ |
965 | void AliTRDcalibDB::SamplePRF() | |
966 | { | |
967 | // | |
2745a409 | 968 | // Samples the pad response function (should maybe go somewhere else ...) |
6a739e92 | 969 | // |
970 | ||
971 | const Int_t kPRFbin = 61; | |
972 | ||
053767a4 | 973 | Float_t prf[kNlayer][kPRFbin] = { |
6d50f529 | 974 | {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, |
6a739e92 | 975 | 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02, |
976 | 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01, | |
977 | 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01, | |
978 | 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01, | |
979 | 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01, | |
980 | 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01, | |
981 | 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01, | |
982 | 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01, | |
983 | 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01, | |
984 | 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01, | |
985 | 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01, | |
986 | 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01, | |
987 | 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02, | |
988 | 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02, | |
989 | 2.9037e-02}, | |
990 | {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02, | |
991 | 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02, | |
992 | 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01, | |
993 | 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01, | |
994 | 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01, | |
995 | 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01, | |
996 | 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01, | |
997 | 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01, | |
998 | 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01, | |
999 | 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01, | |
1000 | 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01, | |
1001 | 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01, | |
1002 | 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01, | |
1003 | 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02, | |
1004 | 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02, | |
1005 | 2.5478e-02}, | |
1006 | {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02, | |
1007 | 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02, | |
1008 | 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01, | |
1009 | 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01, | |
1010 | 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01, | |
1011 | 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01, | |
1012 | 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01, | |
1013 | 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01, | |
1014 | 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01, | |
1015 | 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01, | |
1016 | 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01, | |
1017 | 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01, | |
1018 | 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02, | |
1019 | 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02, | |
1020 | 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02, | |
1021 | 2.2363e-02}, | |
1022 | {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02, | |
1023 | 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02, | |
1024 | 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01, | |
1025 | 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01, | |
1026 | 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01, | |
1027 | 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01, | |
1028 | 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01, | |
1029 | 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01, | |
1030 | 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01, | |
1031 | 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01, | |
1032 | 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01, | |
1033 | 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01, | |
1034 | 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02, | |
1035 | 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02, | |
1036 | 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02, | |
1037 | 1.9635e-02}, | |
1038 | {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02, | |
1039 | 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02, | |
1040 | 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01, | |
1041 | 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01, | |
1042 | 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01, | |
1043 | 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01, | |
1044 | 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01, | |
1045 | 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01, | |
1046 | 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01, | |
1047 | 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01, | |
1048 | 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01, | |
1049 | 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01, | |
1050 | 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02, | |
1051 | 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02, | |
1052 | 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02, | |
1053 | 1.7224e-02}, | |
1054 | {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02, | |
1055 | 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02, | |
1056 | 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01, | |
1057 | 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01, | |
1058 | 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01, | |
1059 | 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01, | |
1060 | 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01, | |
1061 | 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01, | |
1062 | 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01, | |
1063 | 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01, | |
1064 | 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01, | |
1065 | 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01, | |
1066 | 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02, | |
1067 | 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02, | |
1068 | 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02, | |
1069 | 1.5096e-02}}; | |
1070 | ||
1071 | // More sampling precision with linear interpolation | |
6d50f529 | 1072 | fPRFlo = -1.5; |
1073 | fPRFhi = 1.5; | |
6a739e92 | 1074 | Float_t pad[kPRFbin]; |
1075 | Int_t sPRFbin = kPRFbin; | |
6d50f529 | 1076 | Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin); |
6a739e92 | 1077 | for (Int_t iPad = 0; iPad < sPRFbin; iPad++) { |
6d50f529 | 1078 | pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo; |
6a739e92 | 1079 | } |
6d50f529 | 1080 | fPRFbin = 500; |
1081 | fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin); | |
1082 | fPRFpad = ((Int_t) (1.0 / fPRFwid)); | |
6a739e92 | 1083 | |
6d50f529 | 1084 | if (fPRFsmp) delete [] fPRFsmp; |
053767a4 | 1085 | fPRFsmp = new Float_t[kNlayer*fPRFbin]; |
6a739e92 | 1086 | |
1087 | Int_t ipos1; | |
1088 | Int_t ipos2; | |
1089 | Float_t diff; | |
1090 | ||
053767a4 | 1091 | for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) { |
6a739e92 | 1092 | |
6d50f529 | 1093 | for (Int_t iBin = 0; iBin < fPRFbin; iBin++) { |
6a739e92 | 1094 | |
6d50f529 | 1095 | Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo; |
6a739e92 | 1096 | ipos1 = ipos2 = 0; |
1097 | diff = 0; | |
1098 | do { | |
1099 | diff = bin - pad[ipos2++]; | |
1100 | } while ((diff > 0) && (ipos2 < kPRFbin)); | |
1101 | if (ipos2 == kPRFbin) { | |
053767a4 | 1102 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 | 1103 | } |
1104 | else if (ipos2 == 1) { | |
053767a4 | 1105 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 | 1106 | } |
1107 | else { | |
1108 | ipos2--; | |
1109 | if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1; | |
1110 | ipos1 = ipos2 - 1; | |
053767a4 | 1111 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2] |
1112 | + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1]) | |
1113 | / sPRFwid; | |
6a739e92 | 1114 | } |
1115 | ||
1116 | } | |
1117 | } | |
1118 | ||
1119 | } | |
1120 | ||
1121 | //_____________________________________________________________________________ | |
1122 | Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist | |
eb52b657 | 1123 | , Int_t layer, Double_t *pad) const |
6a739e92 | 1124 | { |
1125 | // | |
1126 | // Applies the pad response | |
56178ff4 | 1127 | // So far this is the fixed parametrization and should be replaced by |
1128 | // something dependent on calibration values | |
6a739e92 | 1129 | // |
1130 | ||
eb52b657 | 1131 | Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid)); |
053767a4 | 1132 | Int_t iOff = layer * fPRFbin; |
6a739e92 | 1133 | |
6d50f529 | 1134 | Int_t iBin0 = iBin - fPRFpad + iOff; |
6a739e92 | 1135 | Int_t iBin1 = iBin + iOff; |
6d50f529 | 1136 | Int_t iBin2 = iBin + fPRFpad + iOff; |
6a739e92 | 1137 | |
1138 | pad[0] = 0.0; | |
1139 | pad[1] = 0.0; | |
1140 | pad[2] = 0.0; | |
053767a4 | 1141 | if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) { |
6a739e92 | 1142 | |
1143 | if (iBin0 >= 0) { | |
6d50f529 | 1144 | pad[0] = signal * fPRFsmp[iBin0]; |
6a739e92 | 1145 | } |
6d50f529 | 1146 | pad[1] = signal * fPRFsmp[iBin1]; |
053767a4 | 1147 | if (iBin2 < (fPRFbin*kNlayer)) { |
6d50f529 | 1148 | pad[2] = signal * fPRFsmp[iBin2]; |
6a739e92 | 1149 | } |
1150 | ||
1151 | return 1; | |
1152 | ||
1153 | } | |
1154 | else { | |
1155 | ||
1156 | return 0; | |
1157 | ||
1158 | } | |
ab0a4106 | 1159 | |
3551db50 | 1160 | } |
543691ea | 1161 |