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