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