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 ///////////////////////////////////////////////////////////////////////////////
34 #include "AliCDBManager.h"
35 #include "AliCDBStorage.h"
36 #include "AliCDBEntry.h"
39 #include "AliTRDcalibDB.h"
40 #include "AliTRDgeometry.h"
41 #include "AliTRDpadPlane.h"
42 #include "AliTRDCommonParam.h"
44 #include "Cal/AliTRDCalROC.h"
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"
50 #include "Cal/AliTRDCalChamberStatus.h"
51 #include "Cal/AliTRDCalPadStatus.h"
52 #include "Cal/AliTRDCalSingleChamberStatus.h"
54 ClassImp(AliTRDcalibDB)
56 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
57 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
59 //_ singleton implementation __________________________________________________
60 AliTRDcalibDB* AliTRDcalibDB::Instance()
63 // Singleton implementation
64 // Returns an instance of this class, it is created if neccessary
67 if (fgTerminated != kFALSE) {
71 if (fgInstance == 0) {
72 fgInstance = new AliTRDcalibDB();
79 //_____________________________________________________________________________
80 void AliTRDcalibDB::Terminate()
83 // Singleton implementation
84 // Deletes the instance of this class and sets the terminated flag,
85 // 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 kIDChamberStatus :
234 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
237 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
241 case kIDMonitoringData :
242 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
245 return CacheCDBEntry(kIDGlobals ,"TRD/Calib/Globals");
248 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
257 //_____________________________________________________________________________
258 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
261 // Retrieves an entry with path <cdbPath> from the CDB.
264 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
266 AliFatal(Form("Failed to get entry: %s",cdbPath));
274 //_____________________________________________________________________________
275 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
278 // Caches the entry <id> with cdb path <cdbPath>
281 if (!fCDBCache[id]) {
282 fCDBEntries[id] = GetCDBEntry(cdbPath);
283 if (fCDBEntries[id]) {
284 fCDBCache[id] = fCDBEntries[id]->GetObject();
288 return fCDBCache[id];
292 //_____________________________________________________________________________
293 void AliTRDcalibDB::SetRun(Long64_t run)
296 // Sets current run number. Calibration data is read from the corresponding file.
297 // When the run number changes the caching is invalidated.
310 //_____________________________________________________________________________
311 void AliTRDcalibDB::Invalidate()
314 // Invalidates cache (when run number is changed).
317 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
318 if (fCDBEntries[i]) {
319 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
320 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
324 delete fCDBEntries[i];
333 //_____________________________________________________________________________
334 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
337 // Returns the drift velocity for the given pad.
340 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
341 (GetCachedCDBObject(kIDVdriftPad));
346 AliTRDCalROC *roc = calPad->GetCalROC(det);
351 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
352 (GetCachedCDBObject(kIDVdriftChamber));
357 return calChamber->GetValue(det) * roc->GetValue(col,row);
361 //_____________________________________________________________________________
362 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
365 // Returns the Vdrift calibration object for a given ROC
366 // containing one number per pad
369 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
370 (GetCachedCDBObject(kIDVdriftPad));
375 AliTRDCalROC *roc = calPad->GetCalROC(det);
385 //_____________________________________________________________________________
386 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
389 // Returns the Vdrift calibration object
390 // containing one number per detector
393 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
394 (GetCachedCDBObject(kIDVdriftChamber));
404 //_____________________________________________________________________________
405 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
408 // Returns the average drift velocity for the given detector
411 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
412 (GetCachedCDBObject(kIDVdriftChamber));
417 return calDet->GetValue(det);
421 //_____________________________________________________________________________
422 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
425 // Returns t0 for the given pad.
428 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
429 (GetCachedCDBObject(kIDT0Pad));
434 AliTRDCalROC *roc = calPad->GetCalROC(det);
439 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
440 (GetCachedCDBObject(kIDT0Chamber));
445 return calChamber->GetValue(det) + roc->GetValue(col,row);
449 //_____________________________________________________________________________
450 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
453 // Returns the t0 calibration object for a given ROC
454 // containing one number per pad
457 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
458 (GetCachedCDBObject(kIDT0Pad));
463 AliTRDCalROC *roc = calPad->GetCalROC(det);
473 //_____________________________________________________________________________
474 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
477 // Returns the t0 calibration object
478 // containing one number per detector
481 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
482 (GetCachedCDBObject(kIDT0Chamber));
492 //_____________________________________________________________________________
493 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
496 // Returns the average t0 for the given detector
499 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
500 (GetCachedCDBObject(kIDT0Pad));
505 AliTRDCalROC *roc = calPad->GetCalROC(det);
510 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
511 (GetCachedCDBObject(kIDT0Chamber));
517 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
518 mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels();
525 //_____________________________________________________________________________
526 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
529 // Returns the gain factor for the given pad.
532 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
533 (GetCachedCDBObject(kIDGainFactorPad));
538 AliTRDCalROC *roc = calPad->GetCalROC(det);
543 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
544 (GetCachedCDBObject(kIDGainFactorChamber));
549 return calChamber->GetValue(det) * roc->GetValue(col,row);
553 //_____________________________________________________________________________
554 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
557 // Returns the gain factor calibration object for a given ROC
558 // containing one number per pad
561 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
562 (GetCachedCDBObject(kIDGainFactorPad));
567 AliTRDCalROC *roc = calPad->GetCalROC(det);
577 //_____________________________________________________________________________
578 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
581 // Returns the gain factor calibration object
582 // containing one number per detector
585 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
586 (GetCachedCDBObject(kIDGainFactorChamber));
596 //_____________________________________________________________________________
597 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
600 // Returns the average gain factor for the given detector
603 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
604 (GetCachedCDBObject(kIDGainFactorChamber));
609 return calDet->GetValue(det);
613 //_____________________________________________________________________________
614 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
617 // Returns the PRF width for the given pad.
620 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
621 (GetCachedCDBObject(kIDPRFWidth));
626 AliTRDCalROC *roc = calPad->GetCalROC(det);
631 return roc->GetValue(col,row);
635 //_____________________________________________________________________________
636 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
639 // Returns the number of time bins which are read-out.
642 const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
643 (GetCachedCDBObject(kIDGlobals));
648 return calGlobal->GetNumberOfTimeBins();
652 //_____________________________________________________________________________
653 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
656 // Returns the status of the given pad
659 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
660 (GetCachedCDBObject(kIDPadStatus));
665 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
670 return roc->GetStatus(col,row);
674 //_____________________________________________________________________________
675 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
678 // Returns the status of the given chamber
681 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
682 (GetCachedCDBObject(kIDChamberStatus));
687 return cal->GetStatus(det);
691 //_____________________________________________________________________________
692 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
695 // Returns status, see name of functions for details ;-)
698 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
699 (GetCachedCDBObject(kIDPadStatus));
704 return cal->IsMasked(det,col,row);
708 //_____________________________________________________________________________
709 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
712 // Returns status, see name of functions for details ;-)
715 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
716 (GetCachedCDBObject(kIDPadStatus));
721 return cal->IsBridgedLeft(det,col,row);
725 //_____________________________________________________________________________
726 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
729 // Returns status, see name of functions for details ;-)
732 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
733 (GetCachedCDBObject(kIDPadStatus));
738 return cal->IsBridgedRight(det,col,row);
742 //_____________________________________________________________________________
743 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
746 // Returns status, see name of functions for details ;-)
749 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
750 (GetCachedCDBObject(kIDChamberStatus));
755 return cal->IsInstalled(det);
759 //_____________________________________________________________________________
760 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
763 // Returns status, see name of functions for details ;-)
766 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
767 (GetCachedCDBObject(kIDChamberStatus));
772 return cal->IsMasked(det);
776 //_____________________________________________________________________________
777 const AliTRDCalPIDLQ *AliTRDcalibDB::GetPIDLQObject()
780 // Returns the object storing the distributions for PID with likelihood
783 return dynamic_cast<const AliTRDCalPIDLQ *>
784 (GetCachedCDBObject(kIDPIDLQ));
788 //_____________________________________________________________________________
789 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
792 // Returns the object storing the monitoring data
795 return dynamic_cast<const AliTRDCalMonitoring *>
796 (GetCachedCDBObject(kIDMonitoringData));
800 //_____________________________________________________________________________
801 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift, Float_t bz)
804 // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vdrift>
805 // and a B-field <bz> for Xe/CO2 (15%).
806 // The values are according to a GARFIELD simulation.
808 // This function basically does not belong to the calibration class.
809 // It should be moved somewhere else.
810 // However, currently it is in use by simulation and reconstruction.
813 Float_t fieldAbs = TMath::Abs(bz);
814 Float_t fieldSgn = (bz > 0.0) ? 1.0 : -1.0;
817 Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
818 Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
819 Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
820 Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
822 // No ExB if field is too small (or zero)
823 if (fieldAbs < 0.01) {
828 // Calculate ExB from parametrization
831 Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
832 ib = TMath::Max( 0,ib);
833 ib = TMath::Min(kNb,ib);
835 Float_t alphaL = p0[ib]
837 + p2[ib] * vdrift*vdrift
838 + p3[ib] * vdrift*vdrift*vdrift;
840 return TMath::Tan(fieldSgn * alphaL);
846 //_____________________________________________________________________________
847 void AliTRDcalibDB::SamplePRF()
850 // Samples the pad response function (should maybe go somewhere else ...)
853 const Int_t kPRFbin = 61;
855 Float_t prf[kNplan][kPRFbin] = {
856 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
857 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
858 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
859 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
860 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
861 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
862 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
863 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
864 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
865 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
866 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
867 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
868 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
869 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
870 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
872 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
873 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
874 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
875 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
876 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
877 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
878 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
879 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
880 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
881 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
882 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
883 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
884 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
885 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
886 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
888 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
889 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
890 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
891 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
892 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
893 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
894 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
895 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
896 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
897 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
898 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
899 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
900 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
901 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
902 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
904 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
905 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
906 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
907 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
908 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
909 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
910 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
911 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
912 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
913 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
914 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
915 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
916 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
917 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
918 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
920 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
921 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
922 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
923 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
924 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
925 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
926 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
927 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
928 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
929 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
930 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
931 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
932 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
933 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
934 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
936 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
937 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
938 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
939 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
940 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
941 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
942 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
943 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
944 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
945 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
946 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
947 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
948 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
949 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
950 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
953 // More sampling precision with linear interpolation
956 Float_t pad[kPRFbin];
957 Int_t sPRFbin = kPRFbin;
958 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
959 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
960 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
963 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
964 fPRFpad = ((Int_t) (1.0 / fPRFwid));
966 if (fPRFsmp) delete [] fPRFsmp;
967 fPRFsmp = new Float_t[kNplan*fPRFbin];
973 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
975 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
977 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
981 diff = bin - pad[ipos2++];
982 } while ((diff > 0) && (ipos2 < kPRFbin));
983 if (ipos2 == kPRFbin) {
984 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
986 else if (ipos2 == 1) {
987 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
991 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
993 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2]
994 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
1003 //_____________________________________________________________________________
1004 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1005 , Int_t plane, Double_t *pad) const
1008 // Applies the pad response
1009 // So far this is the fixed parametrization and should be replaced by
1010 // something dependent on calibration values
1013 Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid));
1014 Int_t iOff = plane * fPRFbin;
1016 Int_t iBin0 = iBin - fPRFpad + iOff;
1017 Int_t iBin1 = iBin + iOff;
1018 Int_t iBin2 = iBin + fPRFpad + iOff;
1023 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNplan))) {
1026 pad[0] = signal * fPRFsmp[iBin0];
1028 pad[1] = signal * fPRFsmp[iBin1];
1029 if (iBin2 < (fPRFbin*kNplan)) {
1030 pad[2] = signal * fPRFsmp[iBin2];