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