]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDcalibDB.cxx
bugfix
[u/mrichter/AliRoot.git] / TRD / AliTRDcalibDB.cxx
CommitLineData
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
38#include "AliTRDcalibDB.h"
3551db50 39
7754cd1f 40#include "Cal/AliTRDCalROC.h"
7754cd1f 41#include "Cal/AliTRDCalPad.h"
42#include "Cal/AliTRDCalDet.h"
e232d349 43#include "Cal/AliTRDCalDCS.h"
720a0a16 44#include "Cal/AliTRDCalPID.h"
7754cd1f 45#include "Cal/AliTRDCalMonitoring.h"
7754cd1f 46#include "Cal/AliTRDCalChamberStatus.h"
7754cd1f 47#include "Cal/AliTRDCalPadStatus.h"
48#include "Cal/AliTRDCalSingleChamberStatus.h"
3551db50 49
50ClassImp(AliTRDcalibDB)
51
2745a409 52AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
53Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
3551db50 54
55//_ singleton implementation __________________________________________________
56AliTRDcalibDB* AliTRDcalibDB::Instance()
57{
58 //
59 // Singleton implementation
60 // Returns an instance of this class, it is created if neccessary
63a700c6 61 //
3551db50 62
6d50f529 63 if (fgTerminated != kFALSE) {
3551db50 64 return 0;
6d50f529 65 }
3551db50 66
6d50f529 67 if (fgInstance == 0) {
3551db50 68 fgInstance = new AliTRDcalibDB();
6d50f529 69 }
e254cad1 70
3551db50 71 return fgInstance;
4e009ce4 72
3551db50 73}
74
2745a409 75//_____________________________________________________________________________
3551db50 76void AliTRDcalibDB::Terminate()
77{
78 //
79 // Singleton implementation
6bf5f0ce 80 // Deletes the instance of this class and sets the terminated flag,
81 // instances cannot be requested anymore
3551db50 82 // This function can be called several times.
83 //
84
85 fgTerminated = kTRUE;
86
6d50f529 87 if (fgInstance != 0) {
3551db50 88 delete fgInstance;
89 fgInstance = 0;
90 }
2745a409 91
3551db50 92}
93
94//_____________________________________________________________________________
95AliTRDcalibDB::AliTRDcalibDB()
2745a409 96 :TObject()
97 ,fRun(-1)
6d50f529 98 ,fPRFsmp(0)
99 ,fPRFbin(0)
100 ,fPRFlo(0)
101 ,fPRFhi(0)
102 ,fPRFwid(0)
103 ,fPRFpad(0)
3551db50 104{
105 //
2745a409 106 // Default constructor
3551db50 107 //
2745a409 108 // TODO Default runnumber is set to 0, this should be changed later
109 // to an invalid value (e.g. -1) to prevent
3551db50 110 // TODO invalid calibration data to be used.
2745a409 111 //
112
95867fd1 113 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
2745a409 114 fCDBCache[i] = 0;
115 fCDBEntries[i] = 0;
116 }
3551db50 117
2745a409 118 // Create the sampled PRF
119 SamplePRF();
d4c6453d 120
2745a409 121}
122
123//_____________________________________________________________________________
124AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
125 :TObject(c)
6d50f529 126 ,fRun(-1)
127 ,fPRFsmp(0)
128 ,fPRFbin(0)
129 ,fPRFlo(0)
130 ,fPRFhi(0)
131 ,fPRFwid(0)
132 ,fPRFpad(0)
2745a409 133{
134 //
135 // Copy constructor (not that it make any sense for a singleton...)
136 //
137
95867fd1 138 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
2745a409 139 fCDBCache[i] = 0;
3551db50 140 fCDBEntries[i] = 0;
141 }
6a739e92 142
143 // Create the sampled PRF
144 SamplePRF();
2745a409 145
146}
147
148//_____________________________________________________________________________
149AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
150{
151 //
152 // Assignment operator (same as above ...)
153 //
154
155 if (this != &c) {
156 AliFatal("No assignment operator defined");
157 }
4e009ce4 158
2745a409 159 return *this;
160
acba9bad 161}
3551db50 162
163//_____________________________________________________________________________
164AliTRDcalibDB::~AliTRDcalibDB()
165{
166 //
167 // destructor
168 //
169
6d50f529 170 if (fPRFsmp) {
171 delete [] fPRFsmp;
172 fPRFsmp = 0;
6a739e92 173 }
174
3551db50 175 Invalidate();
2745a409 176
acba9bad 177}
3551db50 178
63a700c6 179//_caching functions____________________________________________________________
95867fd1 180const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
63a700c6 181{
2745a409 182 //
183 // Retrieves a cdb object with the given id. The objects are cached as
184 // long as the run number is not changed.
185 //
186 // Put together the available objects here by using the lines
187 // a) For usual calibration objects:
188 // case kID<Name> :
189 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
190 // break;
191 // See function CacheCDBEntry for details.
192 // and
193 // b) For calibration data which depends on two objects: One containing
194 // a value per detector and one the local fluctuations per pad:
195 // case kID<Name> :
196 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
197 // break;
198 // See function CacheMergeCDBEntry for details.
199 //
63a700c6 200
6d50f529 201 switch (id) {
2745a409 202
203 // Parameters defined per pad and chamber
204 case kIDVdriftPad :
6d50f529 205 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
2745a409 206 break;
207 case kIDVdriftChamber :
6d50f529 208 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
2745a409 209 break;
210 case kIDT0Pad :
6d50f529 211 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
2745a409 212 break;
213 case kIDT0Chamber :
6d50f529 214 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
2745a409 215 break;
216 case kIDGainFactorPad :
6d50f529 217 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
2745a409 218 break;
219 case kIDGainFactorChamber :
6d50f529 220 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
2745a409 221 break;
df83a620 222 case kIDNoiseChamber :
223 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
224 break;
225 case kIDNoisePad :
226 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
227 break;
228
2745a409 229
230 // Parameters defined per pad
231 case kIDPRFWidth :
6d50f529 232 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
2745a409 233 break;
234
235 // Status values
2745a409 236 case kIDChamberStatus :
6d50f529 237 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
2745a409 238 break;
2745a409 239 case kIDPadStatus :
6d50f529 240 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
2745a409 241 break;
242
243 // Global parameters
244 case kIDMonitoringData :
6d50f529 245 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
2745a409 246 break;
aa617684 247 case kIDFEE :
248 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
2745a409 249 break;
e232d349 250 case kIDDCS :
251 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
252 break;
44dbae42 253 case kIDPIDNN :
254 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
2745a409 255 case kIDPIDLQ :
6d50f529 256 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
2745a409 257 break;
a7ac01d2 258 case kIDRecoParam :
259 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
260 break;
2745a409 261
262 }
263
264 return 0;
265
63a700c6 266}
267
268//_____________________________________________________________________________
95867fd1 269AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
63a700c6 270{
271 //
272 // Retrieves an entry with path <cdbPath> from the CDB.
273 //
274
95867fd1 275 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
2745a409 276 if (!entry) {
a7ac01d2 277 AliError(Form("Failed to get entry: %s",cdbPath));
63a700c6 278 return 0;
279 }
280
63a700c6 281 return entry;
2745a409 282
63a700c6 283}
284
285//_____________________________________________________________________________
95867fd1 286const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
63a700c6 287{
288 //
289 // Caches the entry <id> with cdb path <cdbPath>
290 //
291
2745a409 292 if (!fCDBCache[id]) {
63a700c6 293 fCDBEntries[id] = GetCDBEntry(cdbPath);
95867fd1 294 if (fCDBEntries[id]) {
63a700c6 295 fCDBCache[id] = fCDBEntries[id]->GetObject();
95867fd1 296 }
63a700c6 297 }
95867fd1 298
63a700c6 299 return fCDBCache[id];
2745a409 300
63a700c6 301}
302
3551db50 303//_____________________________________________________________________________
304void AliTRDcalibDB::SetRun(Long64_t run)
305{
306 //
7754cd1f 307 // Sets current run number. Calibration data is read from the corresponding file.
3551db50 308 // When the run number changes the caching is invalidated.
309 //
7754cd1f 310
6d50f529 311 if (fRun == run) {
3551db50 312 return;
6d50f529 313 }
7754cd1f 314
3551db50 315 fRun = run;
95867fd1 316
3551db50 317 Invalidate();
2745a409 318
3551db50 319}
7754cd1f 320
3551db50 321//_____________________________________________________________________________
322void AliTRDcalibDB::Invalidate()
323{
324 //
325 // Invalidates cache (when run number is changed).
326 //
327
95867fd1 328 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
2745a409 329 if (fCDBEntries[i]) {
330 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
11f5dd43 331 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
332 (fCDBCache[i])) {
e254cad1 333 delete fCDBCache[i];
2745a409 334 }
e254cad1 335 delete fCDBEntries[i];
336 }
3551db50 337 fCDBEntries[i] = 0;
2745a409 338 fCDBCache[i] = 0;
3551db50 339 }
340 }
2745a409 341
df83a620 342}
343//_____________________________________________________________________________
344Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
345{
346 //
347 // Returns the noise level in ADC counts for the given pad.
348 //
349
350 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
351 (GetCachedCDBObject(kIDNoisePad));
352 if (!calPad) {
353 return -1;
354 }
355
356 AliTRDCalROC *roc = calPad->GetCalROC(det);
357 if (!roc) {
358 return -1;
359 }
360
361 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
362 (GetCachedCDBObject(kIDNoiseChamber));
363 if (!calChamber) {
364 return -1;
365 }
366
367 return calChamber->GetValue(det) * roc->GetValue(col,row);
368
369}
370
371//_____________________________________________________________________________
372AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
373{
374 //
375 // Returns the Vdrift calibration object for a given ROC
376 // containing one number per pad
377 //
378
379 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
380 (GetCachedCDBObject(kIDNoisePad));
381 if (!calPad) {
382 return 0;
383 }
384
385 AliTRDCalROC *roc = calPad->GetCalROC(det);
386 if (!roc) {
387 return 0;
388 }
389 else {
390 return roc;
391 }
392
393}
394
395//_____________________________________________________________________________
396const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
397{
398 //
399 // Returns the Vdrift calibration object
400 // containing one number per detector
401 //
402
403 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
404 (GetCachedCDBObject(kIDNoiseChamber));
405 if (!calChamber) {
406 return 0;
407 }
408 else {
409 return calChamber;
410 }
411
3551db50 412}
413
3551db50 414//_____________________________________________________________________________
415Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
416{
417 //
418 // Returns the drift velocity for the given pad.
419 //
7754cd1f 420
95867fd1 421 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
6d50f529 422 (GetCachedCDBObject(kIDVdriftPad));
423 if (!calPad) {
3551db50 424 return -1;
6d50f529 425 }
3551db50 426
95867fd1 427 AliTRDCalROC *roc = calPad->GetCalROC(det);
6d50f529 428 if (!roc) {
3551db50 429 return -1;
6d50f529 430 }
3551db50 431
95867fd1 432 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
6d50f529 433 (GetCachedCDBObject(kIDVdriftChamber));
434 if (!calChamber) {
7754cd1f 435 return -1;
6d50f529 436 }
7754cd1f 437
95867fd1 438 return calChamber->GetValue(det) * roc->GetValue(col,row);
2745a409 439
7754cd1f 440}
afb9f880 441
442//_____________________________________________________________________________
443AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
444{
445 //
446 // Returns the Vdrift calibration object for a given ROC
447 // containing one number per pad
448 //
449
450 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
451 (GetCachedCDBObject(kIDVdriftPad));
452 if (!calPad) {
453 return 0;
454 }
455
456 AliTRDCalROC *roc = calPad->GetCalROC(det);
457 if (!roc) {
458 return 0;
459 }
460 else {
461 return roc;
462 }
463
464}
465
466//_____________________________________________________________________________
467const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
468{
469 //
470 // Returns the Vdrift calibration object
471 // containing one number per detector
472 //
473
474 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
475 (GetCachedCDBObject(kIDVdriftChamber));
476 if (!calChamber) {
477 return 0;
478 }
479 else {
480 return calChamber;
481 }
482
483}
7754cd1f 484
485//_____________________________________________________________________________
486Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
487{
488 //
489 // Returns the average drift velocity for the given detector
490 //
491
95867fd1 492 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
6d50f529 493 (GetCachedCDBObject(kIDVdriftChamber));
494 if (!calDet) {
7754cd1f 495 return -1;
6d50f529 496 }
7754cd1f 497
498 return calDet->GetValue(det);
2745a409 499
acba9bad 500}
3551db50 501
502//_____________________________________________________________________________
503Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
504{
505 //
506 // Returns t0 for the given pad.
507 //
508
d4c6453d 509 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
510 (GetCachedCDBObject(kIDT0Pad));
6d50f529 511 if (!calPad) {
3551db50 512 return -1;
6d50f529 513 }
3551db50 514
d4c6453d 515 AliTRDCalROC *roc = calPad->GetCalROC(det);
6d50f529 516 if (!roc) {
3551db50 517 return -1;
6d50f529 518 }
3551db50 519
d4c6453d 520 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
521 (GetCachedCDBObject(kIDT0Chamber));
6d50f529 522 if (!calChamber) {
7754cd1f 523 return -1;
6d50f529 524 }
7754cd1f 525
8d786fb8 526 return calChamber->GetValue(det) + roc->GetValue(col,row);
2745a409 527
7754cd1f 528}
afb9f880 529
56178ff4 530//_____________________________________________________________________________
531AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
532{
533 //
534 // Returns the t0 calibration object for a given ROC
535 // containing one number per pad
536 //
537
538 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
539 (GetCachedCDBObject(kIDT0Pad));
540 if (!calPad) {
541 return 0;
542 }
543
544 AliTRDCalROC *roc = calPad->GetCalROC(det);
545 if (!roc) {
546 return 0;
547 }
548 else {
549 return roc;
550 }
551
552}
553
554//_____________________________________________________________________________
555const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
556{
557 //
558 // Returns the t0 calibration object
559 // containing one number per detector
560 //
561
562 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
563 (GetCachedCDBObject(kIDT0Chamber));
564 if (!calChamber) {
565 return 0;
566 }
567 else {
568 return calChamber;
569 }
570
571}
572
7754cd1f 573//_____________________________________________________________________________
574Float_t AliTRDcalibDB::GetT0Average(Int_t det)
575{
576 //
577 // Returns the average t0 for the given detector
578 //
579
5aba4f09 580 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
581 (GetCachedCDBObject(kIDT0Pad));
582 if (!calPad) {
583 return -1;
584 }
585
586 AliTRDCalROC *roc = calPad->GetCalROC(det);
587 if (!roc) {
588 return -1;
589 }
590
95867fd1 591 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
6d50f529 592 (GetCachedCDBObject(kIDT0Chamber));
593 if (!calDet) {
7754cd1f 594 return -1;
6d50f529 595 }
7754cd1f 596
5aba4f09 597 Double_t mean = 0.0;
598 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
599 mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels();
600 }
601
602 return mean;
2745a409 603
acba9bad 604}
3551db50 605
606//_____________________________________________________________________________
607Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
608{
609 //
610 // Returns the gain factor for the given pad.
611 //
612
95867fd1 613 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
6d50f529 614 (GetCachedCDBObject(kIDGainFactorPad));
615 if (!calPad) {
3551db50 616 return -1;
6d50f529 617 }
3551db50 618
95867fd1 619 AliTRDCalROC *roc = calPad->GetCalROC(det);
56178ff4 620 if (!roc) {
3551db50 621 return -1;
56178ff4 622 }
3551db50 623
95867fd1 624 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
6d50f529 625 (GetCachedCDBObject(kIDGainFactorChamber));
626 if (!calChamber) {
7754cd1f 627 return -1;
6d50f529 628 }
7754cd1f 629
95867fd1 630 return calChamber->GetValue(det) * roc->GetValue(col,row);
2745a409 631
7754cd1f 632}
633
56178ff4 634//_____________________________________________________________________________
635AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
636{
637 //
638 // Returns the gain factor calibration object for a given ROC
56178ff4 639 //
640
641 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
642 (GetCachedCDBObject(kIDGainFactorPad));
643 if (!calPad) {
644 return 0;
645 }
646
647 AliTRDCalROC *roc = calPad->GetCalROC(det);
648 if (!roc) {
649 return 0;
650 }
651 else {
652 return roc;
653 }
654
655}
656
657//_____________________________________________________________________________
658const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
659{
660 //
661 // Returns the gain factor calibration object
662 // containing one number per detector
663 //
664
665 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
666 (GetCachedCDBObject(kIDGainFactorChamber));
667 if (!calChamber) {
668 return 0;
669 }
670 else {
671 return calChamber;
672 }
673
674}
675
7754cd1f 676//_____________________________________________________________________________
677Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
678{
679 //
680 // Returns the average gain factor for the given detector
681 //
682
95867fd1 683 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
6d50f529 684 (GetCachedCDBObject(kIDGainFactorChamber));
685 if (!calDet) {
7754cd1f 686 return -1;
6d50f529 687 }
7754cd1f 688
689 return calDet->GetValue(det);
2745a409 690
acba9bad 691}
6a739e92 692
524fc8fa 693//_____________________________________________________________________________
694AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
695{
696 //
697 // Returns the PRF calibration object for a given ROC
698 // containing one number per pad
699 //
700
701 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
702 (GetCachedCDBObject(kIDPRFWidth));
703 if (!calPad) {
704 return 0;
705 }
706
707 AliTRDCalROC *roc = calPad->GetCalROC(det);
708 if (!roc) {
709 return 0;
710 }
711 else {
712 return roc;
713 }
714
715}
716
6a739e92 717//_____________________________________________________________________________
718Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
719{
720 //
721 // Returns the PRF width for the given pad.
722 //
723
95867fd1 724 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
6d50f529 725 (GetCachedCDBObject(kIDPRFWidth));
726 if (!calPad) {
6a739e92 727 return -1;
6d50f529 728 }
6a739e92 729
95867fd1 730 AliTRDCalROC *roc = calPad->GetCalROC(det);
6d50f529 731 if (!roc) {
6a739e92 732 return -1;
6d50f529 733 }
6a739e92 734
95867fd1 735 return roc->GetValue(col,row);
2745a409 736
acba9bad 737}
3551db50 738
739//_____________________________________________________________________________
f1dcad37 740Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
3551db50 741{
e232d349 742 //
743 // Returns Number of time bins from the DCS
744 //
f1dcad37 745
c6f7c6cb 746 Int_t nMixed = -2; // not the same number for all chambers
747 Int_t nUndef = -1; // default value - has not been set!
748 Int_t nTbSor = nUndef;
749 Int_t nTbEor = nUndef;
750
e232d349 751 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
f1dcad37 752
c6f7c6cb 753 if (!dcsArr) {
754 AliError("No DCS object found!");
755 return nUndef;
e232d349 756 }
c6f7c6cb 757
758 const AliTRDCalDCS *calDCSsor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(0));
986e1ade 759 const AliTRDCalDCS *calDCSeor = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1));
0eaf9c74 760
c6f7c6cb 761 if (!calDCSsor) {
762 // the SOR file is mandatory
763 AliError("NO SOR AliTRDCalDCS object found in CDB file!");
764 return nUndef;
7a6352a6 765 }
c6f7c6cb 766
767 if (!calDCSeor) {
768 // this can happen if the run is shorter than a couple of seconds.
769 AliWarning("NO EOR AliTRDCalDCS object found in CDB file.");
7a6352a6 770 }
c6f7c6cb 771
772 // get the numbers
773 nTbSor = calDCSsor->GetGlobalNumberOfTimeBins();
774 if (calDCSeor) nTbEor = calDCSeor->GetGlobalNumberOfTimeBins();
775
776 // if they're the same return the value
777 // -2 means mixed, -1: no data, >= 0: good number of time bins
778 if (nTbSor == nTbEor) return nTbSor;
779
780 // if they're differing:
781 if (nTbSor == nMixed || nTbEor == nMixed) {
782 AliWarning("Inconsistent number of time bins found!");
783 return nMixed;
e232d349 784 }
c6f7c6cb 785
786 // one is undefined, the other ok -> return that one
787 if (nTbSor == nUndef) return nTbEor;
788 if (nTbEor == nUndef) return nTbSor;
789
790 // only remains: two different numbers >= 0
791 return nMixed;
e232d349 792}
793
794//_____________________________________________________________________________
f1dcad37 795void AliTRDcalibDB::GetFilterType(TString &filterType)
796{
797 //
798 // Returns the filter type
799 //
800
e232d349 801 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
802 if(!dcsArr){
803 filterType = "";
804 return;
805 }
806 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
807
808 if(!calDCS){
809 filterType = "";
810 return;
811 }
812 filterType = calDCS->GetGlobalFilterType();
f1dcad37 813
e232d349 814}
815
7754cd1f 816//_____________________________________________________________________________
817Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
818{
819 //
820 // Returns the status of the given pad
821 //
822
aa617684 823 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
824 (GetCachedCDBObject(kIDPadStatus));
6d50f529 825 if (!cal) {
7754cd1f 826 return -1;
6d50f529 827 }
7754cd1f 828
95867fd1 829 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
6d50f529 830 if (!roc) {
7754cd1f 831 return -1;
6d50f529 832 }
7754cd1f 833
95867fd1 834 return roc->GetStatus(col,row);
2745a409 835
7754cd1f 836}
837
0e09df31 838//_____________________________________________________________________________
839AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
840{
841 //
842 // Returns the pad status calibration object for a given ROC
843 //
844
845 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
846 (GetCachedCDBObject(kIDPadStatus));
847 if (!cal) {
848 return 0;
849 }
850
851 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
852 if (!roc) {
853 return 0;
854 }
855 else {
856 return roc;
857 }
858
859}
860
7754cd1f 861//_____________________________________________________________________________
862Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
863{
864 //
865 // Returns the status of the given chamber
866 //
867
95867fd1 868 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
6d50f529 869 (GetCachedCDBObject(kIDChamberStatus));
870 if (!cal) {
7754cd1f 871 return -1;
6d50f529 872 }
7754cd1f 873
874 return cal->GetStatus(det);
2745a409 875
7754cd1f 876}
877
a7ac01d2 878//_____________________________________________________________________________
879AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
880{
be28462a 881 //
882 // Returns the TRD reconstruction parameters from the OCDB
883 //
884
a7ac01d2 885 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
be28462a 886 if (!recos) return 0x0;
a7ac01d2 887
888 // calculate entry based on event type info
889 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
be28462a 890
a7ac01d2 891 return (AliTRDrecoParam*)recos->UncheckedAt(n);
a7ac01d2 892
be28462a 893}
a7ac01d2 894
7754cd1f 895//_____________________________________________________________________________
896Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
897{
898 //
899 // Returns status, see name of functions for details ;-)
900 //
901
95867fd1 902 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
903 (GetCachedCDBObject(kIDPadStatus));
6d50f529 904 if (!cal) {
7754cd1f 905 return -1;
6d50f529 906 }
7754cd1f 907
95867fd1 908 return cal->IsMasked(det,col,row);
2745a409 909
7754cd1f 910}
911
912//_____________________________________________________________________________
913Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
914{
915 //
916 // Returns status, see name of functions for details ;-)
917 //
918
95867fd1 919 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
920 (GetCachedCDBObject(kIDPadStatus));
6d50f529 921 if (!cal) {
7754cd1f 922 return -1;
6d50f529 923 }
7754cd1f 924
95867fd1 925 return cal->IsBridgedLeft(det,col,row);
2745a409 926
7754cd1f 927}
928
929//_____________________________________________________________________________
930Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
931{
932 //
933 // Returns status, see name of functions for details ;-)
934 //
935
95867fd1 936 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
937 (GetCachedCDBObject(kIDPadStatus));
6d50f529 938 if (!cal) {
7754cd1f 939 return -1;
6d50f529 940 }
7754cd1f 941
95867fd1 942 return cal->IsBridgedRight(det,col,row);
2745a409 943
7754cd1f 944}
945
fa7427d0 946//_____________________________________________________________________________
947Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
948{
949 //
950 // Returns status, see name of functions for details ;-)
951 //
f1dcad37 952
fa7427d0 953 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
954 (GetCachedCDBObject(kIDPadStatus));
955 if (!cal) {
956 return -1;
957 }
958
959 return cal->IsNotConnected(det,col,row);
960
961}
962
7754cd1f 963//_____________________________________________________________________________
964Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
965{
966 //
967 // Returns status, see name of functions for details ;-)
968 //
969
95867fd1 970 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
971 (GetCachedCDBObject(kIDChamberStatus));
6d50f529 972 if (!cal) {
7754cd1f 973 return -1;
6d50f529 974 }
7754cd1f 975
976 return cal->IsInstalled(det);
2745a409 977
7754cd1f 978}
979
980//_____________________________________________________________________________
981Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
982{
983 //
984 // Returns status, see name of functions for details ;-)
985 //
986
95867fd1 987 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
988 (GetCachedCDBObject(kIDChamberStatus));
6d50f529 989 if (!cal) {
7754cd1f 990 return -1;
6d50f529 991 }
7754cd1f 992
993 return cal->IsMasked(det);
2745a409 994
7754cd1f 995}
7a6352a6 996//_____________________________________________________________________________
997Bool_t AliTRDcalibDB::IsHalfChamberMasked(Int_t det, Int_t side){
998 //
999 // Returns status, see name of functions for details ;-)
1000 //
7754cd1f 1001
7a6352a6 1002 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1003 (GetCachedCDBObject(kIDChamberStatus));
1004 if (!cal) {
1005 return -1;
1006 }
1007
1008 return side > 0 ? cal->IsHalfChamberSideBMasked(det) : cal->IsHalfChamberSideAMasked(det);
1009
1010}
cc7cef99 1011//_____________________________________________________________________________
0d83b3a5 1012const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
cc7cef99 1013{
1014 //
1015 // Returns the object storing the distributions for PID with likelihood
1016 //
9a96f175 1017
1018 switch(method) {
0d83b3a5 1019 case AliTRDpidUtil::kLQ:
4ba1d6ae 1020 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
0d83b3a5 1021 case AliTRDpidUtil::kNN:
4ba1d6ae 1022 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
543691ea 1023 case AliTRDpidUtil::kESD:
1024 return 0x0; // To avoid compiler warnings
9a96f175 1025 }
1026
10f75631 1027 return 0x0;
2745a409 1028
cc7cef99 1029}
1030
7754cd1f 1031//_____________________________________________________________________________
d4c6453d 1032const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
7754cd1f 1033{
1034 //
1035 // Returns the object storing the monitoring data
1036 //
1037
d4c6453d 1038 return dynamic_cast<const AliTRDCalMonitoring *>
1039 (GetCachedCDBObject(kIDMonitoringData));
1b95a37b 1040
7754cd1f 1041}
1042
6a739e92 1043//_____________________________________________________________________________
1044void AliTRDcalibDB::SamplePRF()
1045{
1046 //
2745a409 1047 // Samples the pad response function (should maybe go somewhere else ...)
6a739e92 1048 //
1049
1050 const Int_t kPRFbin = 61;
1051
053767a4 1052 Float_t prf[kNlayer][kPRFbin] = {
6d50f529 1053 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
6a739e92 1054 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1055 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1056 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1057 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1058 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1059 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1060 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1061 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1062 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1063 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1064 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1065 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1066 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1067 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1068 2.9037e-02},
1069 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1070 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1071 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1072 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1073 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1074 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1075 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1076 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1077 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1078 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1079 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1080 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1081 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1082 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1083 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1084 2.5478e-02},
1085 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1086 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1087 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1088 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1089 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1090 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1091 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1092 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1093 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1094 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1095 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1096 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1097 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1098 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1099 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1100 2.2363e-02},
1101 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1102 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1103 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1104 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1105 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1106 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1107 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1108 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1109 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1110 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1111 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1112 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1113 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1114 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1115 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1116 1.9635e-02},
1117 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1118 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1119 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1120 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1121 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1122 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1123 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1124 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1125 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1126 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1127 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1128 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1129 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1130 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1131 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1132 1.7224e-02},
1133 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1134 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1135 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1136 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1137 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1138 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1139 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1140 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1141 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1142 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1143 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1144 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1145 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1146 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1147 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1148 1.5096e-02}};
1149
1150 // More sampling precision with linear interpolation
6d50f529 1151 fPRFlo = -1.5;
1152 fPRFhi = 1.5;
6a739e92 1153 Float_t pad[kPRFbin];
1154 Int_t sPRFbin = kPRFbin;
6d50f529 1155 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
6a739e92 1156 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
6d50f529 1157 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
6a739e92 1158 }
6d50f529 1159 fPRFbin = 500;
1160 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1161 fPRFpad = ((Int_t) (1.0 / fPRFwid));
6a739e92 1162
6d50f529 1163 if (fPRFsmp) delete [] fPRFsmp;
053767a4 1164 fPRFsmp = new Float_t[kNlayer*fPRFbin];
6a739e92 1165
1166 Int_t ipos1;
1167 Int_t ipos2;
1168 Float_t diff;
1169
053767a4 1170 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
6a739e92 1171
6d50f529 1172 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
6a739e92 1173
6d50f529 1174 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
6a739e92 1175 ipos1 = ipos2 = 0;
1176 diff = 0;
1177 do {
1178 diff = bin - pad[ipos2++];
1179 } while ((diff > 0) && (ipos2 < kPRFbin));
1180 if (ipos2 == kPRFbin) {
053767a4 1181 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
6a739e92 1182 }
1183 else if (ipos2 == 1) {
053767a4 1184 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
6a739e92 1185 }
1186 else {
1187 ipos2--;
1188 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1189 ipos1 = ipos2 - 1;
053767a4 1190 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1191 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1192 / sPRFwid;
6a739e92 1193 }
1194
1195 }
1196 }
1197
1198}
1199
1200//_____________________________________________________________________________
1201Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
eb52b657 1202 , Int_t layer, Double_t *pad) const
6a739e92 1203{
1204 //
1205 // Applies the pad response
56178ff4 1206 // So far this is the fixed parametrization and should be replaced by
1207 // something dependent on calibration values
6a739e92 1208 //
1209
eb52b657 1210 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
053767a4 1211 Int_t iOff = layer * fPRFbin;
6a739e92 1212
6d50f529 1213 Int_t iBin0 = iBin - fPRFpad + iOff;
6a739e92 1214 Int_t iBin1 = iBin + iOff;
6d50f529 1215 Int_t iBin2 = iBin + fPRFpad + iOff;
6a739e92 1216
1217 pad[0] = 0.0;
1218 pad[1] = 0.0;
1219 pad[2] = 0.0;
053767a4 1220 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
6a739e92 1221
1222 if (iBin0 >= 0) {
6d50f529 1223 pad[0] = signal * fPRFsmp[iBin0];
6a739e92 1224 }
6d50f529 1225 pad[1] = signal * fPRFsmp[iBin1];
053767a4 1226 if (iBin2 < (fPRFbin*kNlayer)) {
6d50f529 1227 pad[2] = signal * fPRFsmp[iBin2];
6a739e92 1228 }
1229
1230 return 1;
1231
1232 }
1233 else {
1234
1235 return 0;
1236
1237 }
ab0a4106 1238
3551db50 1239}
7a6352a6 1240
1241