]>
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> |
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))); | |
eda91732 | 567 | } |
568 | return calDetExB; | |
569 | } | |
570 | } | |
571 | else return calChamber; | |
572 | ||
573 | } | |
3551db50 | 574 | //_____________________________________________________________________________ |
575 | Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) | |
576 | { | |
577 | // | |
578 | // Returns t0 for the given pad. | |
579 | // | |
580 | ||
d4c6453d | 581 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
582 | (GetCachedCDBObject(kIDT0Pad)); | |
6d50f529 | 583 | if (!calPad) { |
3551db50 | 584 | return -1; |
6d50f529 | 585 | } |
3551db50 | 586 | |
d4c6453d | 587 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 | 588 | if (!roc) { |
3551db50 | 589 | return -1; |
6d50f529 | 590 | } |
3551db50 | 591 | |
d4c6453d | 592 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
593 | (GetCachedCDBObject(kIDT0Chamber)); | |
6d50f529 | 594 | if (!calChamber) { |
7754cd1f | 595 | return -1; |
6d50f529 | 596 | } |
7754cd1f | 597 | |
8d786fb8 | 598 | return calChamber->GetValue(det) + roc->GetValue(col,row); |
2745a409 | 599 | |
7754cd1f | 600 | } |
afb9f880 | 601 | |
56178ff4 | 602 | //_____________________________________________________________________________ |
603 | AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det) | |
604 | { | |
605 | // | |
606 | // Returns the t0 calibration object for a given ROC | |
607 | // containing one number per pad | |
608 | // | |
609 | ||
610 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
611 | (GetCachedCDBObject(kIDT0Pad)); | |
612 | if (!calPad) { | |
613 | return 0; | |
614 | } | |
615 | ||
616 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
617 | if (!roc) { | |
618 | return 0; | |
619 | } | |
620 | else { | |
621 | return roc; | |
622 | } | |
623 | ||
624 | } | |
625 | ||
626 | //_____________________________________________________________________________ | |
627 | const AliTRDCalDet *AliTRDcalibDB::GetT0Det() | |
628 | { | |
629 | // | |
630 | // Returns the t0 calibration object | |
631 | // containing one number per detector | |
632 | // | |
633 | ||
634 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
635 | (GetCachedCDBObject(kIDT0Chamber)); | |
636 | if (!calChamber) { | |
637 | return 0; | |
638 | } | |
639 | else { | |
640 | return calChamber; | |
641 | } | |
642 | ||
643 | } | |
644 | ||
7754cd1f | 645 | //_____________________________________________________________________________ |
646 | Float_t AliTRDcalibDB::GetT0Average(Int_t det) | |
647 | { | |
648 | // | |
649 | // Returns the average t0 for the given detector | |
650 | // | |
651 | ||
5aba4f09 | 652 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
653 | (GetCachedCDBObject(kIDT0Pad)); | |
654 | if (!calPad) { | |
655 | return -1; | |
656 | } | |
657 | ||
658 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
659 | if (!roc) { | |
660 | return -1; | |
661 | } | |
662 | ||
95867fd1 | 663 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 664 | (GetCachedCDBObject(kIDT0Chamber)); |
665 | if (!calDet) { | |
7754cd1f | 666 | return -1; |
6d50f529 | 667 | } |
7754cd1f | 668 | |
4eb02ab1 | 669 | Double_t sum = 0.0; |
5aba4f09 | 670 | for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) { |
4eb02ab1 | 671 | sum += roc->GetValue(channel); |
5aba4f09 | 672 | } |
4eb02ab1 | 673 | sum /= roc->GetNchannels(); |
674 | sum += calDet->GetValue(det); | |
675 | return sum; | |
2745a409 | 676 | |
acba9bad | 677 | } |
3551db50 | 678 | |
679 | //_____________________________________________________________________________ | |
680 | Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) | |
681 | { | |
682 | // | |
683 | // Returns the gain factor for the given pad. | |
684 | // | |
685 | ||
95867fd1 | 686 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 | 687 | (GetCachedCDBObject(kIDGainFactorPad)); |
688 | if (!calPad) { | |
3551db50 | 689 | return -1; |
6d50f529 | 690 | } |
3551db50 | 691 | |
95867fd1 | 692 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
56178ff4 | 693 | if (!roc) { |
3551db50 | 694 | return -1; |
56178ff4 | 695 | } |
3551db50 | 696 | |
95867fd1 | 697 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 698 | (GetCachedCDBObject(kIDGainFactorChamber)); |
699 | if (!calChamber) { | |
7754cd1f | 700 | return -1; |
6d50f529 | 701 | } |
7754cd1f | 702 | |
95867fd1 | 703 | return calChamber->GetValue(det) * roc->GetValue(col,row); |
2745a409 | 704 | |
7754cd1f | 705 | } |
706 | ||
ea3eaa08 | 707 | //_____________________________________________________________________________ |
708 | AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det) | |
709 | { | |
710 | // | |
711 | // Returns the online gain factor table for a given ROC. | |
712 | // | |
713 | ||
714 | const AliTRDCalOnlineGainTable *calOnline | |
715 | = dynamic_cast<const AliTRDCalOnlineGainTable *> | |
716 | (GetCachedCDBObject(kIDOnlineGainFactor)); | |
717 | if (!calOnline) { | |
718 | return 0x0; | |
719 | } | |
720 | ||
721 | return calOnline->GetGainTableROC(det); | |
722 | ||
723 | } | |
724 | ||
725 | //_____________________________________________________________________________ | |
726 | Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row) | |
727 | { | |
728 | // | |
729 | // Returns the online gain factor for the given pad. | |
730 | // | |
731 | ||
732 | const AliTRDCalOnlineGainTable *calOnline | |
733 | = dynamic_cast<const AliTRDCalOnlineGainTable *> | |
734 | (GetCachedCDBObject(kIDOnlineGainFactor)); | |
735 | if (!calOnline) { | |
736 | return -1; | |
737 | } | |
738 | ||
739 | return calOnline->GetGainCorrectionFactor(det,row,col); | |
740 | ||
741 | } | |
742 | ||
56178ff4 | 743 | //_____________________________________________________________________________ |
744 | AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det) | |
745 | { | |
746 | // | |
747 | // Returns the gain factor calibration object for a given ROC | |
56178ff4 | 748 | // |
749 | ||
750 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
751 | (GetCachedCDBObject(kIDGainFactorPad)); | |
752 | if (!calPad) { | |
753 | return 0; | |
754 | } | |
755 | ||
756 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
757 | if (!roc) { | |
758 | return 0; | |
759 | } | |
760 | else { | |
761 | return roc; | |
762 | } | |
763 | ||
764 | } | |
765 | ||
766 | //_____________________________________________________________________________ | |
767 | const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet() | |
768 | { | |
769 | // | |
770 | // Returns the gain factor calibration object | |
771 | // containing one number per detector | |
772 | // | |
773 | ||
774 | const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> | |
775 | (GetCachedCDBObject(kIDGainFactorChamber)); | |
776 | if (!calChamber) { | |
777 | return 0; | |
778 | } | |
779 | else { | |
780 | return calChamber; | |
781 | } | |
782 | ||
783 | } | |
784 | ||
7754cd1f | 785 | //_____________________________________________________________________________ |
786 | Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) | |
787 | { | |
788 | // | |
789 | // Returns the average gain factor for the given detector | |
790 | // | |
791 | ||
95867fd1 | 792 | const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *> |
6d50f529 | 793 | (GetCachedCDBObject(kIDGainFactorChamber)); |
794 | if (!calDet) { | |
7754cd1f | 795 | return -1; |
6d50f529 | 796 | } |
7754cd1f | 797 | |
798 | return calDet->GetValue(det); | |
2745a409 | 799 | |
acba9bad | 800 | } |
6a739e92 | 801 | |
524fc8fa | 802 | //_____________________________________________________________________________ |
803 | AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det) | |
804 | { | |
805 | // | |
806 | // Returns the PRF calibration object for a given ROC | |
807 | // containing one number per pad | |
808 | // | |
809 | ||
810 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> | |
811 | (GetCachedCDBObject(kIDPRFWidth)); | |
812 | if (!calPad) { | |
813 | return 0; | |
814 | } | |
815 | ||
816 | AliTRDCalROC *roc = calPad->GetCalROC(det); | |
817 | if (!roc) { | |
818 | return 0; | |
819 | } | |
820 | else { | |
821 | return roc; | |
822 | } | |
823 | ||
824 | } | |
825 | ||
6a739e92 | 826 | //_____________________________________________________________________________ |
827 | Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) | |
828 | { | |
829 | // | |
830 | // Returns the PRF width for the given pad. | |
831 | // | |
832 | ||
95867fd1 | 833 | const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *> |
6d50f529 | 834 | (GetCachedCDBObject(kIDPRFWidth)); |
835 | if (!calPad) { | |
6a739e92 | 836 | return -1; |
6d50f529 | 837 | } |
6a739e92 | 838 | |
95867fd1 | 839 | AliTRDCalROC *roc = calPad->GetCalROC(det); |
6d50f529 | 840 | if (!roc) { |
6a739e92 | 841 | return -1; |
6d50f529 | 842 | } |
6a739e92 | 843 | |
95867fd1 | 844 | return roc->GetValue(col,row); |
2745a409 | 845 | |
acba9bad | 846 | } |
3551db50 | 847 | |
848 | //_____________________________________________________________________________ | |
f1dcad37 | 849 | Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS() |
3551db50 | 850 | { |
e232d349 | 851 | // |
852 | // Returns Number of time bins from the DCS | |
853 | // | |
f1dcad37 | 854 | |
c6f7c6cb | 855 | Int_t nMixed = -2; // not the same number for all chambers |
856 | Int_t nUndef = -1; // default value - has not been set! | |
857 | Int_t nTbSor = nUndef; | |
858 | Int_t nTbEor = nUndef; | |
d6a1ec13 | 859 | Int_t calver = 0; // Check CalDCS version |
c6f7c6cb | 860 | |
e232d349 | 861 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
c6f7c6cb | 862 | if (!dcsArr) { |
863 | AliError("No DCS object found!"); | |
864 | return nUndef; | |
e232d349 | 865 | } |
c6f7c6cb | 866 | |
d6a1ec13 | 867 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; |
868 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; | |
0eaf9c74 | 869 | |
d6a1ec13 | 870 | if (calver == 1) { |
871 | // DCS object | |
872 | const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0)); | |
873 | const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); | |
874 | if (!calDCSsor) { | |
875 | // the SOR file is mandatory | |
876 | AliError("NO SOR AliTRDCalDCS object found in CDB file!"); | |
877 | return nUndef; | |
878 | } | |
879 | if (!calDCSeor) { | |
880 | // this can happen if the run is shorter than a couple of seconds. | |
881 | AliWarning("NO EOR AliTRDCalDCS object found in CDB file."); | |
7a6352a6 | 882 | } |
c6f7c6cb | 883 | |
d6a1ec13 | 884 | // get the numbers |
885 | nTbSor = calDCSsor->GetGlobalNumberOfTimeBins(); | |
886 | if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins(); | |
887 | ||
888 | } else if (calver == 2) { | |
889 | // DCSv2 object | |
890 | const AliTRDCalDCSv2 *calDCSsorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(0)); | |
891 | const AliTRDCalDCSv2 *calDCSeorv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(1)); | |
892 | if (!calDCSsorv2) { | |
893 | // the SOR file is mandatory | |
894 | AliError("NO SOR AliTRDCalDCSv2 object found in CDB file!"); | |
895 | return nUndef; | |
896 | } | |
897 | if (!calDCSeorv2) { | |
898 | // this can happen if the run is shorter than a couple of seconds. | |
899 | AliWarning("NO EOR AliTRDCalDCSv2 object found in CDB file."); | |
7a6352a6 | 900 | } |
c6f7c6cb | 901 | |
d6a1ec13 | 902 | // get the numbers |
903 | nTbSor = calDCSsorv2->GetGlobalNumberOfTimeBins(); | |
904 | if (calDCSeorv2) nTbEor = calDCSeorv2->GetGlobalNumberOfTimeBins(); | |
905 | ||
906 | } else AliError("NO DCS/DCSv2 OCDB entry found!"); | |
c6f7c6cb | 907 | |
908 | // if they're the same return the value | |
909 | // -2 means mixed, -1: no data, >= 0: good number of time bins | |
910 | if (nTbSor == nTbEor) return nTbSor; | |
911 | ||
912 | // if they're differing: | |
913 | if (nTbSor == nMixed || nTbEor == nMixed) { | |
914 | AliWarning("Inconsistent number of time bins found!"); | |
915 | return nMixed; | |
e232d349 | 916 | } |
d6a1ec13 | 917 | |
c6f7c6cb | 918 | // one is undefined, the other ok -> return that one |
919 | if (nTbSor == nUndef) return nTbEor; | |
920 | if (nTbEor == nUndef) return nTbSor; | |
921 | ||
922 | // only remains: two different numbers >= 0 | |
923 | return nMixed; | |
ea3eaa08 | 924 | |
e232d349 | 925 | } |
926 | ||
927 | //_____________________________________________________________________________ | |
f1dcad37 | 928 | void AliTRDcalibDB::GetFilterType(TString &filterType) |
929 | { | |
930 | // | |
931 | // Returns the filter type | |
932 | // | |
933 | ||
e232d349 | 934 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
935 | if(!dcsArr){ | |
936 | filterType = ""; | |
937 | return; | |
938 | } | |
d6a1ec13 | 939 | |
940 | Int_t esor = 0; // Take SOR | |
941 | Int_t calver = 0; // Check CalDCS version | |
942 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; | |
943 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; | |
944 | ||
ea3eaa08 | 945 | if (calver == 1) { |
946 | ||
d6a1ec13 | 947 | // DCS object |
948 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); | |
949 | if(!calDCS){ | |
950 | filterType = ""; | |
951 | return; | |
952 | } | |
953 | filterType = calDCS->GetGlobalFilterType(); | |
ea3eaa08 | 954 | |
955 | } | |
956 | else if (calver == 2) { | |
957 | ||
d6a1ec13 | 958 | // DCSv2 object |
959 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); | |
960 | if(!calDCSv2){ | |
961 | filterType = ""; | |
962 | return; | |
963 | } | |
964 | filterType = calDCSv2->GetGlobalFilterType(); | |
ea3eaa08 | 965 | |
966 | } | |
967 | else { | |
968 | ||
969 | AliError("NO DCS/DCSv2 OCDB entry found!"); | |
970 | ||
971 | } | |
d6a1ec13 | 972 | |
af086c5e | 973 | } |
974 | ||
975 | //_____________________________________________________________________________ | |
ea3eaa08 | 976 | Int_t AliTRDcalibDB::GetOnlineGainTableID() |
977 | { | |
978 | // | |
979 | // Get the gain table ID from the DCS | |
980 | // | |
981 | ||
982 | if (fOnlineGainTableID > 0) { | |
983 | return fOnlineGainTableID; | |
984 | } | |
985 | ||
986 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); | |
987 | if (!dcsArr){ | |
988 | return -1; | |
989 | } | |
990 | ||
991 | Int_t esor = 0; // Take SOR | |
992 | Int_t calver = 0; // Check CalDCS version | |
993 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; | |
994 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; | |
995 | ||
996 | if (calver == 1) { | |
997 | ||
998 | // No data for old DCS object available, anyway | |
999 | return -1; | |
1000 | ||
1001 | } | |
1002 | else if (calver == 2) { | |
1003 | ||
1004 | // DCSv2 object | |
1005 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); | |
1006 | if(!calDCSv2){ | |
1007 | return -1; | |
1008 | } | |
1009 | ||
1010 | TString tableName = ""; | |
1011 | for (Int_t i = 0; i < 540; i++) { | |
1012 | const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0); | |
1013 | tableName = calDCSFEEv2->GetGainTableName(); | |
1014 | if (tableName.Length() > 0) { | |
1015 | break; | |
1016 | } | |
1017 | } | |
1018 | if (tableName.CompareTo("Krypton_2011-01") == 0) { | |
1019 | fOnlineGainTableID = 1; | |
1020 | return fOnlineGainTableID; | |
1021 | } | |
1022 | ||
1023 | } | |
1024 | else { | |
1025 | ||
1026 | AliError("NO DCS/DCSv2 OCDB entry found!"); | |
1027 | return -1; | |
1028 | ||
1029 | } | |
1030 | ||
45b38fb0 | 1031 | return -1; |
1032 | ||
ea3eaa08 | 1033 | } |
1034 | ||
1035 | //_____________________________________________________________________________ | |
1036 | void AliTRDcalibDB::GetGlobalConfiguration(TString &config) | |
1037 | { | |
af086c5e | 1038 | // |
1039 | // Get Configuration from the DCS | |
1040 | // | |
d6a1ec13 | 1041 | |
af086c5e | 1042 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); |
1043 | if(!dcsArr){ | |
1044 | config = ""; | |
1045 | return; | |
1046 | } | |
d6a1ec13 | 1047 | |
1048 | Int_t esor = 0; // Take SOR | |
1049 | Int_t calver = 0; // Check CalDCS version | |
1050 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; | |
1051 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; | |
1052 | ||
ea3eaa08 | 1053 | if (calver == 1) { |
1054 | ||
d6a1ec13 | 1055 | // DCS object |
ea3eaa08 | 1056 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); |
d6a1ec13 | 1057 | if(!calDCS){ |
1058 | config = ""; | |
1059 | return; | |
1060 | } | |
1061 | config = calDCS->GetGlobalConfigName(); | |
ea3eaa08 | 1062 | |
1063 | } | |
1064 | else if (calver == 2) { | |
1065 | ||
d6a1ec13 | 1066 | // DCSv2 object |
1067 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); | |
1068 | if(!calDCSv2){ | |
1069 | config = ""; | |
1070 | return; | |
1071 | } | |
1072 | config = calDCSv2->GetGlobalConfigName(); | |
ea3eaa08 | 1073 | |
1074 | } | |
1075 | else { | |
1076 | ||
1077 | AliError("NO DCS/DCSv2 OCDB entry found!"); | |
1078 | ||
1079 | } | |
d6a1ec13 | 1080 | |
af086c5e | 1081 | } |
f1dcad37 | 1082 | |
f8059b39 | 1083 | //_____________________________________________________________________________ |
1084 | void AliTRDcalibDB::GetGlobalConfigurationVersion(TString &version) | |
1085 | { | |
1086 | // | |
1087 | // Get Version of Configuration from the DCS | |
1088 | // | |
1089 | ||
1090 | const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS)); | |
1091 | if(!dcsArr){ | |
1092 | version = ""; | |
1093 | return; | |
1094 | } | |
1095 | ||
1096 | Int_t esor = 0; // Take SOR | |
1097 | Int_t calver = 0; // Check CalDCS version | |
1098 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1; | |
1099 | if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2; | |
1100 | ||
1101 | if (calver == 1) { | |
1102 | ||
1103 | // DCS object | |
1104 | const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor)); | |
1105 | if(!calDCS){ | |
1106 | version = ""; | |
1107 | return; | |
1108 | } | |
1109 | version = calDCS->GetGlobalConfigVersion(); | |
1110 | ||
1111 | } | |
1112 | else if (calver == 2) { | |
1113 | ||
1114 | // DCSv2 object | |
1115 | const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor)); | |
1116 | if(!calDCSv2){ | |
1117 | version = ""; | |
1118 | return; | |
1119 | } | |
1120 | version = calDCSv2->GetGlobalConfigVersion(); | |
1121 | ||
1122 | } | |
1123 | else { | |
1124 | ||
1125 | AliError("NO DCS/DCSv2 OCDB entry found!"); | |
1126 | ||
1127 | } | |
1128 | ||
1129 | } | |
1130 | ||
af086c5e | 1131 | //_____________________________________________________________________________ |
1132 | Bool_t AliTRDcalibDB::HasOnlineFilterPedestal() | |
1133 | { | |
1134 | // | |
1135 | // Checks whether pedestal filter was applied online | |
1136 | // | |
ea3eaa08 | 1137 | |
af086c5e | 1138 | TString cname; |
ea3eaa08 | 1139 | |
af086c5e | 1140 | // Temporary: Get the filter config from the configuration name |
1141 | GetGlobalConfiguration(cname); | |
1142 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); | |
ea3eaa08 | 1143 | |
af086c5e | 1144 | // TString filterconfig; |
1145 | //GetFilterType(filterconfig); | |
ea3eaa08 | 1146 | |
af086c5e | 1147 | return filterconfig.Contains("p"); |
ea3eaa08 | 1148 | |
af086c5e | 1149 | } |
1150 | ||
1151 | //_____________________________________________________________________________ | |
ea3eaa08 | 1152 | Bool_t AliTRDcalibDB::HasOnlineFilterGain() |
1153 | { | |
af086c5e | 1154 | // |
1155 | // Checks whether online gain filter was applied | |
1156 | // | |
ea3eaa08 | 1157 | |
af086c5e | 1158 | TString cname; |
ea3eaa08 | 1159 | |
af086c5e | 1160 | // Temporary: Get the filter config from the configuration name |
1161 | GetGlobalConfiguration(cname); | |
1162 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); | |
ea3eaa08 | 1163 | |
af086c5e | 1164 | //TString filterconfig; |
1165 | //GetFilterType(filterconfig); | |
ea3eaa08 | 1166 | |
af086c5e | 1167 | return filterconfig.Contains("g"); |
ea3eaa08 | 1168 | |
af086c5e | 1169 | } |
1170 | ||
1171 | //_____________________________________________________________________________ | |
ea3eaa08 | 1172 | Bool_t AliTRDcalibDB::HasOnlineTailCancellation() |
1173 | { | |
af086c5e | 1174 | // |
1175 | // Checks whether online tail cancellation was applied | |
1176 | // | |
ea3eaa08 | 1177 | |
af086c5e | 1178 | TString cname; |
ea3eaa08 | 1179 | |
af086c5e | 1180 | // Temporary: Get the filter config from the configuration name |
1181 | GetGlobalConfiguration(cname); | |
1182 | TString filterconfig = cname(cname.First("_") + 1, cname.First("-") - cname.First("_") - 1); | |
ea3eaa08 | 1183 | |
af086c5e | 1184 | //TString filterconfig; |
1185 | //GetFilterType(filterconfig); | |
ea3eaa08 | 1186 | |
af086c5e | 1187 | return filterconfig.Contains("t"); |
ea3eaa08 | 1188 | |
e232d349 | 1189 | } |
1190 | ||
7754cd1f | 1191 | //_____________________________________________________________________________ |
1192 | Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) | |
1193 | { | |
1194 | // | |
1195 | // Returns the status of the given pad | |
1196 | // | |
1197 | ||
aa617684 | 1198 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1199 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 1200 | if (!cal) { |
7754cd1f | 1201 | return -1; |
6d50f529 | 1202 | } |
7754cd1f | 1203 | |
95867fd1 | 1204 | const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); |
6d50f529 | 1205 | if (!roc) { |
7754cd1f | 1206 | return -1; |
6d50f529 | 1207 | } |
7754cd1f | 1208 | |
95867fd1 | 1209 | return roc->GetStatus(col,row); |
2745a409 | 1210 | |
7754cd1f | 1211 | } |
1212 | ||
0e09df31 | 1213 | //_____________________________________________________________________________ |
1214 | AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det) | |
1215 | { | |
1216 | // | |
1217 | // Returns the pad status calibration object for a given ROC | |
1218 | // | |
1219 | ||
1220 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> | |
1221 | (GetCachedCDBObject(kIDPadStatus)); | |
1222 | if (!cal) { | |
1223 | return 0; | |
1224 | } | |
1225 | ||
1226 | AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det); | |
1227 | if (!roc) { | |
1228 | return 0; | |
1229 | } | |
1230 | else { | |
1231 | return roc; | |
1232 | } | |
1233 | ||
1234 | } | |
1235 | ||
7754cd1f | 1236 | //_____________________________________________________________________________ |
1237 | Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) | |
1238 | { | |
1239 | // | |
1240 | // Returns the status of the given chamber | |
1241 | // | |
1242 | ||
95867fd1 | 1243 | const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *> |
6d50f529 | 1244 | (GetCachedCDBObject(kIDChamberStatus)); |
1245 | if (!cal) { | |
7754cd1f | 1246 | return -1; |
6d50f529 | 1247 | } |
7754cd1f | 1248 | |
1249 | return cal->GetStatus(det); | |
2745a409 | 1250 | |
7754cd1f | 1251 | } |
1252 | ||
a7ac01d2 | 1253 | //_____________________________________________________________________________ |
1254 | AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/) | |
1255 | { | |
be28462a | 1256 | // |
1257 | // Returns the TRD reconstruction parameters from the OCDB | |
1258 | // | |
1259 | ||
a7ac01d2 | 1260 | const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam)); |
be28462a | 1261 | if (!recos) return 0x0; |
a7ac01d2 | 1262 | |
1263 | // calculate entry based on event type info | |
1264 | Int_t n = 0; //f(eventtype[0], eventtype[1], ....) | |
be28462a | 1265 | |
ea3eaa08 | 1266 | return (AliTRDrecoParam *) recos->UncheckedAt(n); |
a7ac01d2 | 1267 | |
be28462a | 1268 | } |
a7ac01d2 | 1269 | |
7754cd1f | 1270 | //_____________________________________________________________________________ |
1271 | Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) | |
1272 | { | |
1273 | // | |
1274 | // Returns status, see name of functions for details ;-) | |
1275 | // | |
1276 | ||
95867fd1 | 1277 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1278 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 1279 | if (!cal) { |
7754cd1f | 1280 | return -1; |
6d50f529 | 1281 | } |
7754cd1f | 1282 | |
95867fd1 | 1283 | return cal->IsMasked(det,col,row); |
2745a409 | 1284 | |
7754cd1f | 1285 | } |
1286 | ||
1287 | //_____________________________________________________________________________ | |
1288 | Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row) | |
1289 | { | |
1290 | // | |
1291 | // Returns status, see name of functions for details ;-) | |
1292 | // | |
1293 | ||
95867fd1 | 1294 | const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *> |
1295 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 1296 | if (!cal) { |
7754cd1f | 1297 | return -1; |
6d50f529 | 1298 | } |
7754cd1f | 1299 | |
95867fd1 | 1300 | return cal->IsBridgedLeft(det,col,row); |
2745a409 | 1301 | |
7754cd1f | 1302 | } |
1303 | ||
1304 | //_____________________________________________________________________________ | |
1305 | Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) | |
1306 | { | |
1307 | // | |
1308 | // Returns status, see name of functions for details ;-) | |
1309 | // | |
1310 | ||
95867fd1 | 1311 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> |
1312 | (GetCachedCDBObject(kIDPadStatus)); | |
6d50f529 | 1313 | if (!cal) { |
7754cd1f | 1314 | return -1; |
6d50f529 | 1315 | } |
7754cd1f | 1316 | |
95867fd1 | 1317 | return cal->IsBridgedRight(det,col,row); |
2745a409 | 1318 | |
7754cd1f | 1319 | } |
1320 | ||
fa7427d0 | 1321 | //_____________________________________________________________________________ |
1322 | Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row) | |
1323 | { | |
1324 | // | |
1325 | // Returns status, see name of functions for details ;-) | |
1326 | // | |
f1dcad37 | 1327 | |
fa7427d0 | 1328 | const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *> |
1329 | (GetCachedCDBObject(kIDPadStatus)); | |
1330 | if (!cal) { | |
1331 | return -1; | |
1332 | } | |
1333 | ||
1334 | return cal->IsNotConnected(det,col,row); | |
1335 | ||
1336 | } | |
1337 | ||
7754cd1f | 1338 | //_____________________________________________________________________________ |
eda91732 | 1339 | Bool_t AliTRDcalibDB::IsChamberGood(Int_t det) |
1340 | { | |
1341 | // | |
1342 | // Returns status, see name of functions for details ;-) | |
1343 | // | |
1344 | ||
1345 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> | |
1346 | (GetCachedCDBObject(kIDChamberStatus)); | |
1347 | if (!cal) { | |
1348 | return -1; | |
1349 | } | |
1350 | ||
1351 | return cal->IsGood(det); | |
1352 | ||
1353 | } | |
1354 | ||
1355 | //_____________________________________________________________________________ | |
1356 | Bool_t AliTRDcalibDB::IsChamberNoData(Int_t det) | |
7754cd1f | 1357 | { |
1358 | // | |
1359 | // Returns status, see name of functions for details ;-) | |
1360 | // | |
1361 | ||
95867fd1 | 1362 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1363 | (GetCachedCDBObject(kIDChamberStatus)); | |
6d50f529 | 1364 | if (!cal) { |
7754cd1f | 1365 | return -1; |
6d50f529 | 1366 | } |
7754cd1f | 1367 | |
eda91732 | 1368 | return cal->IsNoData(det); |
2745a409 | 1369 | |
7754cd1f | 1370 | } |
1371 | ||
1372 | //_____________________________________________________________________________ | |
eda91732 | 1373 | Bool_t AliTRDcalibDB::IsHalfChamberNoData(Int_t det, Int_t side) |
7754cd1f | 1374 | { |
1375 | // | |
1376 | // Returns status, see name of functions for details ;-) | |
1377 | // | |
1378 | ||
95867fd1 | 1379 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1380 | (GetCachedCDBObject(kIDChamberStatus)); | |
6d50f529 | 1381 | if (!cal) { |
7754cd1f | 1382 | return -1; |
6d50f529 | 1383 | } |
7754cd1f | 1384 | |
eda91732 | 1385 | return side > 0 ? cal->IsNoDataSideB(det) : cal->IsNoDataSideA(det); |
2745a409 | 1386 | |
7754cd1f | 1387 | } |
ea3eaa08 | 1388 | |
7a6352a6 | 1389 | //_____________________________________________________________________________ |
eda91732 | 1390 | Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det) |
ea3eaa08 | 1391 | { |
7a6352a6 | 1392 | // |
1393 | // Returns status, see name of functions for details ;-) | |
1394 | // | |
7754cd1f | 1395 | |
7a6352a6 | 1396 | const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *> |
1397 | (GetCachedCDBObject(kIDChamberStatus)); | |
1398 | if (!cal) { | |
1399 | return -1; | |
1400 | } | |
1401 | ||
eda91732 | 1402 | return cal->IsBadCalibrated(det); |
7a6352a6 | 1403 | |
1404 | } | |
ea3eaa08 | 1405 | |
cc7cef99 | 1406 | //_____________________________________________________________________________ |
0d83b3a5 | 1407 | const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method) |
cc7cef99 | 1408 | { |
1409 | // | |
1410 | // Returns the object storing the distributions for PID with likelihood | |
1411 | // | |
9a96f175 | 1412 | |
1413 | switch(method) { | |
0d83b3a5 | 1414 | case AliTRDpidUtil::kLQ: |
4ba1d6ae | 1415 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ)); |
0d83b3a5 | 1416 | case AliTRDpidUtil::kNN: |
4ba1d6ae | 1417 | return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN)); |
543691ea | 1418 | case AliTRDpidUtil::kESD: |
1419 | return 0x0; // To avoid compiler warnings | |
9a96f175 | 1420 | } |
1421 | ||
10f75631 | 1422 | return 0x0; |
2745a409 | 1423 | |
cc7cef99 | 1424 | } |
1425 | ||
9dcc64cc | 1426 | //_____________________________________________________________________________ |
ea3eaa08 | 1427 | AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method) |
1428 | { | |
1429 | // | |
1430 | // Returns the PID response object for 1D-LQ | |
1431 | // | |
1432 | ||
1433 | if (!fPIDResponse) { | |
1434 | ||
9dcc64cc | 1435 | fPIDResponse = new AliTRDPIDResponse; |
ea3eaa08 | 1436 | |
9dcc64cc | 1437 | // Load Reference Histos from OCDB |
1438 | fPIDResponse->SetPIDmethod(method); | |
51a0ce25 | 1439 | const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D)); |
ea3eaa08 | 1440 | |
51a0ce25 | 1441 | TIter refs(references); |
1442 | TObject *obj = NULL; | |
1443 | AliTRDPIDReference *ref = NULL; | |
1444 | Bool_t hasReference = kFALSE; | |
ea3eaa08 | 1445 | while ((obj = refs())){ |
1446 | if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){ | |
1447 | fPIDResponse->Load(ref); | |
1448 | hasReference = kTRUE; | |
1449 | break; | |
1450 | } | |
51a0ce25 | 1451 | } |
ea3eaa08 | 1452 | |
1453 | if (!hasReference) { | |
1454 | AliError("Reference histograms not found in the OCDB"); | |
1455 | } | |
1456 | ||
9dcc64cc | 1457 | } |
ea3eaa08 | 1458 | |
9dcc64cc | 1459 | return fPIDResponse; |
ea3eaa08 | 1460 | |
9dcc64cc | 1461 | } |
1462 | ||
1463 | //_____________________________________________________________________________ | |
1464 | const AliTRDCalTrkAttach* AliTRDcalibDB::GetAttachObject() | |
1465 | { | |
1466 | // | |
1467 | // Returns the object storing likelihood distributions for cluster to track attachment | |
1468 | // | |
ea3eaa08 | 1469 | |
9dcc64cc | 1470 | return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach)); |
9dcc64cc | 1471 | |
ea3eaa08 | 1472 | } |
9dcc64cc | 1473 | |
7754cd1f | 1474 | //_____________________________________________________________________________ |
d4c6453d | 1475 | const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject() |
7754cd1f | 1476 | { |
1477 | // | |
1478 | // Returns the object storing the monitoring data | |
1479 | // | |
1480 | ||
d4c6453d | 1481 | return dynamic_cast<const AliTRDCalMonitoring *> |
1482 | (GetCachedCDBObject(kIDMonitoringData)); | |
1b95a37b | 1483 | |
7754cd1f | 1484 | } |
1485 | ||
6a739e92 | 1486 | //_____________________________________________________________________________ |
1487 | void AliTRDcalibDB::SamplePRF() | |
1488 | { | |
1489 | // | |
2745a409 | 1490 | // Samples the pad response function (should maybe go somewhere else ...) |
6a739e92 | 1491 | // |
1492 | ||
1493 | const Int_t kPRFbin = 61; | |
1494 | ||
053767a4 | 1495 | Float_t prf[kNlayer][kPRFbin] = { |
6d50f529 | 1496 | {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02, |
6a739e92 | 1497 | 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02, |
1498 | 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01, | |
1499 | 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01, | |
1500 | 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01, | |
1501 | 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01, | |
1502 | 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01, | |
1503 | 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01, | |
1504 | 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01, | |
1505 | 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01, | |
1506 | 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01, | |
1507 | 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01, | |
1508 | 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01, | |
1509 | 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02, | |
1510 | 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02, | |
1511 | 2.9037e-02}, | |
1512 | {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02, | |
1513 | 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02, | |
1514 | 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01, | |
1515 | 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01, | |
1516 | 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01, | |
1517 | 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01, | |
1518 | 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01, | |
1519 | 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01, | |
1520 | 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01, | |
1521 | 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01, | |
1522 | 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01, | |
1523 | 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01, | |
1524 | 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01, | |
1525 | 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02, | |
1526 | 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02, | |
1527 | 2.5478e-02}, | |
1528 | {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02, | |
1529 | 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02, | |
1530 | 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01, | |
1531 | 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01, | |
1532 | 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01, | |
1533 | 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01, | |
1534 | 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01, | |
1535 | 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01, | |
1536 | 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01, | |
1537 | 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01, | |
1538 | 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01, | |
1539 | 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01, | |
1540 | 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02, | |
1541 | 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02, | |
1542 | 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02, | |
1543 | 2.2363e-02}, | |
1544 | {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02, | |
1545 | 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02, | |
1546 | 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01, | |
1547 | 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01, | |
1548 | 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01, | |
1549 | 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01, | |
1550 | 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01, | |
1551 | 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01, | |
1552 | 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01, | |
1553 | 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01, | |
1554 | 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01, | |
1555 | 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01, | |
1556 | 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02, | |
1557 | 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02, | |
1558 | 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02, | |
1559 | 1.9635e-02}, | |
1560 | {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02, | |
1561 | 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02, | |
1562 | 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01, | |
1563 | 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01, | |
1564 | 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01, | |
1565 | 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01, | |
1566 | 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01, | |
1567 | 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01, | |
1568 | 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01, | |
1569 | 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01, | |
1570 | 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01, | |
1571 | 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01, | |
1572 | 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02, | |
1573 | 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02, | |
1574 | 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02, | |
1575 | 1.7224e-02}, | |
1576 | {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02, | |
1577 | 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02, | |
1578 | 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01, | |
1579 | 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01, | |
1580 | 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01, | |
1581 | 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01, | |
1582 | 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01, | |
1583 | 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01, | |
1584 | 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01, | |
1585 | 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01, | |
1586 | 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01, | |
1587 | 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01, | |
1588 | 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02, | |
1589 | 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02, | |
1590 | 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02, | |
1591 | 1.5096e-02}}; | |
1592 | ||
1593 | // More sampling precision with linear interpolation | |
6d50f529 | 1594 | fPRFlo = -1.5; |
1595 | fPRFhi = 1.5; | |
6a739e92 | 1596 | Float_t pad[kPRFbin]; |
1597 | Int_t sPRFbin = kPRFbin; | |
6d50f529 | 1598 | Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin); |
6a739e92 | 1599 | for (Int_t iPad = 0; iPad < sPRFbin; iPad++) { |
6d50f529 | 1600 | pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo; |
6a739e92 | 1601 | } |
6d50f529 | 1602 | fPRFbin = 500; |
1603 | fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin); | |
1604 | fPRFpad = ((Int_t) (1.0 / fPRFwid)); | |
6a739e92 | 1605 | |
6d50f529 | 1606 | if (fPRFsmp) delete [] fPRFsmp; |
053767a4 | 1607 | fPRFsmp = new Float_t[kNlayer*fPRFbin]; |
6a739e92 | 1608 | |
1609 | Int_t ipos1; | |
1610 | Int_t ipos2; | |
1611 | Float_t diff; | |
1612 | ||
053767a4 | 1613 | for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) { |
6a739e92 | 1614 | |
6d50f529 | 1615 | for (Int_t iBin = 0; iBin < fPRFbin; iBin++) { |
6a739e92 | 1616 | |
6d50f529 | 1617 | Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo; |
6a739e92 | 1618 | ipos1 = ipos2 = 0; |
1619 | diff = 0; | |
1620 | do { | |
1621 | diff = bin - pad[ipos2++]; | |
1622 | } while ((diff > 0) && (ipos2 < kPRFbin)); | |
1623 | if (ipos2 == kPRFbin) { | |
053767a4 | 1624 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 | 1625 | } |
1626 | else if (ipos2 == 1) { | |
053767a4 | 1627 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1]; |
6a739e92 | 1628 | } |
1629 | else { | |
1630 | ipos2--; | |
1631 | if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1; | |
1632 | ipos1 = ipos2 - 1; | |
053767a4 | 1633 | fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2] |
1634 | + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1]) | |
1635 | / sPRFwid; | |
6a739e92 | 1636 | } |
1637 | ||
1638 | } | |
1639 | } | |
1640 | ||
1641 | } | |
1642 | ||
1643 | //_____________________________________________________________________________ | |
1644 | Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist | |
eb52b657 | 1645 | , Int_t layer, Double_t *pad) const |
6a739e92 | 1646 | { |
1647 | // | |
1648 | // Applies the pad response | |
56178ff4 | 1649 | // So far this is the fixed parametrization and should be replaced by |
1650 | // something dependent on calibration values | |
6a739e92 | 1651 | // |
1652 | ||
eb52b657 | 1653 | Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid)); |
053767a4 | 1654 | Int_t iOff = layer * fPRFbin; |
6a739e92 | 1655 | |
6d50f529 | 1656 | Int_t iBin0 = iBin - fPRFpad + iOff; |
6a739e92 | 1657 | Int_t iBin1 = iBin + iOff; |
6d50f529 | 1658 | Int_t iBin2 = iBin + fPRFpad + iOff; |
6a739e92 | 1659 | |
1660 | pad[0] = 0.0; | |
1661 | pad[1] = 0.0; | |
1662 | pad[2] = 0.0; | |
053767a4 | 1663 | if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) { |
6a739e92 | 1664 | |
1665 | if (iBin0 >= 0) { | |
6d50f529 | 1666 | pad[0] = signal * fPRFsmp[iBin0]; |
6a739e92 | 1667 | } |
6d50f529 | 1668 | pad[1] = signal * fPRFsmp[iBin1]; |
053767a4 | 1669 | if (iBin2 < (fPRFbin*kNlayer)) { |
6d50f529 | 1670 | pad[2] = signal * fPRFsmp[iBin2]; |
6a739e92 | 1671 | } |
1672 | ||
1673 | return 1; | |
1674 | ||
1675 | } | |
1676 | else { | |
1677 | ||
1678 | return 0; | |
1679 | ||
1680 | } | |
ab0a4106 | 1681 | |
3551db50 | 1682 | } |
7a6352a6 | 1683 | |
1684 |