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