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