1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Class providing the calibration parameters by accessing the CDB //
22 // Request an instance with AliTRDcalibDB::Instance() //
23 // If a new event is processed set the event number with SetRun //
24 // Then request the calibration data //
27 // Jan Fiete Grosse-Oetringhaus (Jan.Fiete.Grosse-Oetringhaus@cern.ch) //
29 ///////////////////////////////////////////////////////////////////////////////
33 #include "AliCDBManager.h"
34 #include "AliCDBStorage.h"
35 #include "AliCDBEntry.h"
38 #include "AliTRDcalibDB.h"
39 #include "AliTRDgeometry.h"
40 #include "AliTRDpadPlane.h"
41 #include "AliTRDCommonParam.h"
43 #include "Cal/AliTRDCalROC.h"
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"
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"
55 ClassImp(AliTRDcalibDB)
57 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
58 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
60 //_ singleton implementation __________________________________________________
61 AliTRDcalibDB* AliTRDcalibDB::Instance()
64 // Singleton implementation
65 // Returns an instance of this class, it is created if neccessary
68 if (fgTerminated != kFALSE) {
72 if (fgInstance == 0) {
73 fgInstance = new AliTRDcalibDB();
80 //_____________________________________________________________________________
81 void AliTRDcalibDB::Terminate()
84 // Singleton implementation
85 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
86 // This function can be called several times.
91 if (fgInstance != 0) {
98 //_____________________________________________________________________________
99 AliTRDcalibDB::AliTRDcalibDB()
110 // Default constructor
112 // TODO Default runnumber is set to 0, this should be changed later
113 // to an invalid value (e.g. -1) to prevent
114 // TODO invalid calibration data to be used.
117 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
122 // Create the sampled PRF
127 //_____________________________________________________________________________
128 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
139 // Copy constructor (not that it make any sense for a singleton...)
142 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
147 // Create the sampled PRF
152 //_____________________________________________________________________________
153 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
156 // Assignment operator (same as above ...)
160 AliFatal("No assignment operator defined");
167 //_____________________________________________________________________________
168 AliTRDcalibDB::~AliTRDcalibDB()
183 //_caching functions____________________________________________________________
184 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
187 // Retrieves a cdb object with the given id. The objects are cached as
188 // long as the run number is not changed.
190 // Put together the available objects here by using the lines
191 // a) For usual calibration objects:
193 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
195 // See function CacheCDBEntry for details.
197 // b) For calibration data which depends on two objects: One containing
198 // a value per detector and one the local fluctuations per pad:
200 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
202 // See function CacheMergeCDBEntry for details.
207 // Parameters defined per pad and chamber
209 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
211 case kIDVdriftChamber :
212 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
215 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
218 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
220 case kIDGainFactorPad :
221 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
223 case kIDGainFactorChamber :
224 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
227 // Parameters defined per pad
229 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
233 case kIDSuperModuleStatus :
234 return CacheCDBEntry(kIDSuperModuleStatus ,"TRD/Calib/SuperModuleStatus");
236 case kIDChamberStatus :
237 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
240 return CacheCDBEntry(kIDMCMStatus ,"TRD/Calib/MCMStatus");
243 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
247 case kIDMonitoringData :
248 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
251 return CacheCDBEntry(kIDGlobals ,"TRD/Calib/Globals");
254 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
263 //_____________________________________________________________________________
264 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
267 // Retrieves an entry with path <cdbPath> from the CDB.
270 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
272 AliError(Form("Failed to get entry: %s",cdbPath));
280 //_____________________________________________________________________________
281 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
284 // Caches the entry <id> with cdb path <cdbPath>
287 if (!fCDBCache[id]) {
288 fCDBEntries[id] = GetCDBEntry(cdbPath);
289 if (fCDBEntries[id]) {
290 fCDBCache[id] = fCDBEntries[id]->GetObject();
294 return fCDBCache[id];
298 //_____________________________________________________________________________
299 void AliTRDcalibDB::SetRun(Long64_t run)
302 // Sets current run number. Calibration data is read from the corresponding file.
303 // When the run number changes the caching is invalidated.
316 //_____________________________________________________________________________
317 void AliTRDcalibDB::Invalidate()
320 // Invalidates cache (when run number is changed).
323 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
324 if (fCDBEntries[i]) {
325 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
326 if ((fCDBEntries[i]->IsOwner() == kFALSE) && fCDBCache[i]) {
329 delete fCDBEntries[i];
338 //_____________________________________________________________________________
339 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
342 // Returns the drift velocity for the given pad.
345 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
346 (GetCachedCDBObject(kIDVdriftPad));
351 AliTRDCalROC *roc = calPad->GetCalROC(det);
356 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
357 (GetCachedCDBObject(kIDVdriftChamber));
362 return calChamber->GetValue(det) * roc->GetValue(col,row);
366 //_____________________________________________________________________________
367 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
370 // Returns the average drift velocity for the given detector
373 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
374 (GetCachedCDBObject(kIDVdriftChamber));
379 return calDet->GetValue(det);
383 //_____________________________________________________________________________
384 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
387 // Returns t0 for the given pad.
390 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
391 (GetCachedCDBObject(kIDT0Pad));
396 AliTRDCalROC *roc = calPad->GetCalROC(det);
401 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
402 (GetCachedCDBObject(kIDT0Chamber));
407 return calChamber->GetValue(det) * roc->GetValue(col,row);
411 //_____________________________________________________________________________
412 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
415 // Returns the average t0 for the given detector
418 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
419 (GetCachedCDBObject(kIDT0Chamber));
424 return calDet->GetValue(det);
428 //_____________________________________________________________________________
429 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
432 // Returns the gain factor for the given pad.
435 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
436 (GetCachedCDBObject(kIDGainFactorPad));
441 AliTRDCalROC *roc = calPad->GetCalROC(det);
445 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
446 (GetCachedCDBObject(kIDGainFactorChamber));
451 return calChamber->GetValue(det) * roc->GetValue(col,row);
455 //_____________________________________________________________________________
456 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
459 // Returns the average gain factor for the given detector
462 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
463 (GetCachedCDBObject(kIDGainFactorChamber));
468 return calDet->GetValue(det);
472 //_____________________________________________________________________________
473 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
476 // Returns the PRF width for the given pad.
479 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
480 (GetCachedCDBObject(kIDPRFWidth));
485 AliTRDCalROC *roc = calPad->GetCalROC(det);
490 return roc->GetValue(col,row);
494 //_____________________________________________________________________________
495 Float_t AliTRDcalibDB::GetSamplingFrequency()
498 // Returns the sampling frequency of the TRD read-out.
501 const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
502 (GetCachedCDBObject(kIDGlobals));
507 return calGlobal->GetSamplingFrequency();
511 //_____________________________________________________________________________
512 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
515 // Returns the number of time bins which are read-out.
518 const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
519 (GetCachedCDBObject(kIDGlobals));
524 return calGlobal->GetNumberOfTimeBins();
528 //_____________________________________________________________________________
529 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
532 // Returns the status of the given pad
535 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
536 (GetCachedCDBObject(kIDPadStatus));
541 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
546 return roc->GetStatus(col,row);
550 //_____________________________________________________________________________
551 Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row)
554 // Returns the status of the given MCM
557 // To translate pad column number into MCM number
558 Int_t mcm = ((Int_t) col / 18);
560 const AliTRDCalMCMStatus *cal = dynamic_cast<const AliTRDCalMCMStatus *>
561 (GetCachedCDBObject(kIDMCMStatus));
566 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
571 return roc->GetStatus(mcm,row);
575 //_____________________________________________________________________________
576 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
579 // Returns the status of the given chamber
582 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
583 (GetCachedCDBObject(kIDChamberStatus));
588 return cal->GetStatus(det);
592 //_____________________________________________________________________________
593 Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm)
596 // Returns the status of the given chamber
599 const AliTRDCalSuperModuleStatus *cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
600 (GetCachedCDBObject(kIDSuperModuleStatus));
605 return cal->GetStatus(sm);
609 //_____________________________________________________________________________
610 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
613 // Returns status, see name of functions for details ;-)
616 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
617 (GetCachedCDBObject(kIDPadStatus));
622 return cal->IsMasked(det,col,row);
626 //_____________________________________________________________________________
627 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
630 // Returns status, see name of functions for details ;-)
633 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
634 (GetCachedCDBObject(kIDPadStatus));
639 return cal->IsBridgedLeft(det,col,row);
643 //_____________________________________________________________________________
644 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
647 // Returns status, see name of functions for details ;-)
650 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
651 (GetCachedCDBObject(kIDPadStatus));
656 return cal->IsBridgedRight(det,col,row);
660 //_____________________________________________________________________________
661 Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row)
664 // Returns status, see name of functions for details ;-)
667 const AliTRDCalMCMStatus * cal = dynamic_cast<const AliTRDCalMCMStatus *>
668 (GetCachedCDBObject(kIDMCMStatus));
673 return cal->IsMasked(det,col,row);
677 //_____________________________________________________________________________
678 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
681 // Returns status, see name of functions for details ;-)
684 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
685 (GetCachedCDBObject(kIDChamberStatus));
690 return cal->IsInstalled(det);
694 //_____________________________________________________________________________
695 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
698 // Returns status, see name of functions for details ;-)
701 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
702 (GetCachedCDBObject(kIDChamberStatus));
707 return cal->IsMasked(det);
711 //_____________________________________________________________________________
712 Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det)
715 // Returns status, see name of functions for details ;-)
718 const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
719 (GetCachedCDBObject(kIDSuperModuleStatus));
724 return cal->IsInstalled(det);
728 //_____________________________________________________________________________
729 Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det)
732 // Returns status, see name of functions for details ;-)
735 const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
736 (GetCachedCDBObject(kIDSuperModuleStatus));
741 return cal->IsMasked(det);
745 //_____________________________________________________________________________
746 const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject()
749 // Returns the object storing the distributions for PID with likelihood
752 return dynamic_cast<const AliTRDCalPIDLQ *> (GetCachedCDBObject(kIDPIDLQ));
756 //_____________________________________________________________________________
757 const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject()
760 // Returns the object storing the monitoring data
763 return dynamic_cast<const AliTRDCalMonitoring *> (GetCachedCDBObject(kIDMonitoringData));
767 //_____________________________________________________________________________
768 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift, Float_t bz)
771 // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vdrift>
772 // and a B-field <bz> for Xe/CO2 (15%).
773 // The values are according to a GARFIELD simulation.
775 // This function basically does not belong to the calibration class.
776 // It should be moved somewhere else.
777 // However, currently it is in use by simulation and reconstruction.
780 Float_t fieldAbs = TMath::Abs(bz);
781 Float_t fieldSgn = (bz > 0.0) ? 1.0 : -1.0;
784 Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
785 Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
786 Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
787 Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
789 Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
790 ib = TMath::Max( 0,ib);
791 ib = TMath::Min(kNb,ib);
793 Float_t alphaL = p0[ib]
795 + p2[ib] * vdrift*vdrift
796 + p3[ib] * vdrift*vdrift*vdrift;
798 return TMath::Tan(fieldSgn * alphaL);
802 //_____________________________________________________________________________
803 void AliTRDcalibDB::SamplePRF()
806 // Samples the pad response function (should maybe go somewhere else ...)
809 const Int_t kPRFbin = 61;
811 Float_t prf[kNplan][kPRFbin] = {
812 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
813 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
814 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
815 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
816 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
817 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
818 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
819 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
820 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
821 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
822 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
823 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
824 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
825 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
826 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
828 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
829 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
830 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
831 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
832 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
833 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
834 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
835 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
836 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
837 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
838 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
839 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
840 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
841 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
842 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
844 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
845 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
846 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
847 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
848 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
849 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
850 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
851 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
852 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
853 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
854 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
855 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
856 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
857 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
858 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
860 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
861 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
862 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
863 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
864 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
865 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
866 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
867 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
868 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
869 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
870 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
871 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
872 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
873 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
874 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
876 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
877 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
878 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
879 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
880 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
881 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
882 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
883 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
884 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
885 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
886 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
887 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
888 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
889 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
890 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
892 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
893 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
894 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
895 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
896 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
897 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
898 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
899 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
900 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
901 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
902 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
903 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
904 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
905 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
906 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
909 // More sampling precision with linear interpolation
912 Float_t pad[kPRFbin];
913 Int_t sPRFbin = kPRFbin;
914 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
915 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
916 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
919 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
920 fPRFpad = ((Int_t) (1.0 / fPRFwid));
922 if (fPRFsmp) delete [] fPRFsmp;
923 fPRFsmp = new Float_t[kNplan*fPRFbin];
929 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
931 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
933 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
937 diff = bin - pad[ipos2++];
938 } while ((diff > 0) && (ipos2 < kPRFbin));
939 if (ipos2 == kPRFbin) {
940 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
942 else if (ipos2 == 1) {
943 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
947 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
949 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2]
950 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
959 //_____________________________________________________________________________
960 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
961 , Int_t plane, Double_t *pad) const
964 // Applies the pad response
967 Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid));
968 Int_t iOff = plane * fPRFbin;
970 Int_t iBin0 = iBin - fPRFpad + iOff;
971 Int_t iBin1 = iBin + iOff;
972 Int_t iBin2 = iBin + fPRFpad + iOff;
977 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNplan))) {
980 pad[0] = signal * fPRFsmp[iBin0];
982 pad[1] = signal * fPRFsmp[iBin1];
983 if (iBin2 < (fPRFbin*kNplan)) {
984 pad[2] = signal * fPRFsmp[iBin2];