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,
86 // instances cannot be requested anymore
87 // This function can be called several times.
92 if (fgInstance != 0) {
99 //_____________________________________________________________________________
100 AliTRDcalibDB::AliTRDcalibDB()
111 // Default constructor
113 // TODO Default runnumber is set to 0, this should be changed later
114 // to an invalid value (e.g. -1) to prevent
115 // TODO invalid calibration data to be used.
118 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
123 // Create the sampled PRF
128 //_____________________________________________________________________________
129 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
140 // Copy constructor (not that it make any sense for a singleton...)
143 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
148 // Create the sampled PRF
153 //_____________________________________________________________________________
154 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
157 // Assignment operator (same as above ...)
161 AliFatal("No assignment operator defined");
168 //_____________________________________________________________________________
169 AliTRDcalibDB::~AliTRDcalibDB()
184 //_caching functions____________________________________________________________
185 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
188 // Retrieves a cdb object with the given id. The objects are cached as
189 // long as the run number is not changed.
191 // Put together the available objects here by using the lines
192 // a) For usual calibration objects:
194 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
196 // See function CacheCDBEntry for details.
198 // b) For calibration data which depends on two objects: One containing
199 // a value per detector and one the local fluctuations per pad:
201 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
203 // See function CacheMergeCDBEntry for details.
208 // Parameters defined per pad and chamber
210 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
212 case kIDVdriftChamber :
213 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
216 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
219 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
221 case kIDGainFactorPad :
222 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
224 case kIDGainFactorChamber :
225 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
228 // Parameters defined per pad
230 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
234 case kIDSuperModuleStatus :
235 return CacheCDBEntry(kIDSuperModuleStatus ,"TRD/Calib/SuperModuleStatus");
237 case kIDChamberStatus :
238 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
241 return CacheCDBEntry(kIDMCMStatus ,"TRD/Calib/MCMStatus");
244 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
248 case kIDMonitoringData :
249 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
252 return CacheCDBEntry(kIDGlobals ,"TRD/Calib/Globals");
255 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
264 //_____________________________________________________________________________
265 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
268 // Retrieves an entry with path <cdbPath> from the CDB.
271 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
273 AliError(Form("Failed to get entry: %s",cdbPath));
281 //_____________________________________________________________________________
282 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
285 // Caches the entry <id> with cdb path <cdbPath>
288 if (!fCDBCache[id]) {
289 fCDBEntries[id] = GetCDBEntry(cdbPath);
290 if (fCDBEntries[id]) {
291 fCDBCache[id] = fCDBEntries[id]->GetObject();
295 return fCDBCache[id];
299 //_____________________________________________________________________________
300 void AliTRDcalibDB::SetRun(Long64_t run)
303 // Sets current run number. Calibration data is read from the corresponding file.
304 // When the run number changes the caching is invalidated.
317 //_____________________________________________________________________________
318 void AliTRDcalibDB::Invalidate()
321 // Invalidates cache (when run number is changed).
324 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
325 if (fCDBEntries[i]) {
326 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
327 if ((fCDBEntries[i]->IsOwner() == kFALSE) && fCDBCache[i]) {
330 delete fCDBEntries[i];
339 //_____________________________________________________________________________
340 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
343 // Returns the drift velocity for the given pad.
346 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
347 (GetCachedCDBObject(kIDVdriftPad));
352 AliTRDCalROC *roc = calPad->GetCalROC(det);
357 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
358 (GetCachedCDBObject(kIDVdriftChamber));
363 return calChamber->GetValue(det) * roc->GetValue(col,row);
367 //_____________________________________________________________________________
368 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
371 // Returns the average drift velocity for the given detector
374 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
375 (GetCachedCDBObject(kIDVdriftChamber));
380 return calDet->GetValue(det);
384 //_____________________________________________________________________________
385 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
388 // Returns t0 for the given pad.
391 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
392 (GetCachedCDBObject(kIDT0Pad));
397 AliTRDCalROC *roc = calPad->GetCalROC(det);
402 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
403 (GetCachedCDBObject(kIDT0Chamber));
408 return calChamber->GetValue(det) * roc->GetValue(col,row);
412 //_____________________________________________________________________________
413 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
416 // Returns the average t0 for the given detector
419 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
420 (GetCachedCDBObject(kIDT0Chamber));
425 return calDet->GetValue(det);
429 //_____________________________________________________________________________
430 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
433 // Returns the gain factor for the given pad.
436 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
437 (GetCachedCDBObject(kIDGainFactorPad));
442 AliTRDCalROC *roc = calPad->GetCalROC(det);
446 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
447 (GetCachedCDBObject(kIDGainFactorChamber));
452 return calChamber->GetValue(det) * roc->GetValue(col,row);
456 //_____________________________________________________________________________
457 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
460 // Returns the average gain factor for the given detector
463 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
464 (GetCachedCDBObject(kIDGainFactorChamber));
469 return calDet->GetValue(det);
473 //_____________________________________________________________________________
474 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
477 // Returns the PRF width for the given pad.
480 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
481 (GetCachedCDBObject(kIDPRFWidth));
486 AliTRDCalROC *roc = calPad->GetCalROC(det);
491 return roc->GetValue(col,row);
495 //_____________________________________________________________________________
496 Float_t AliTRDcalibDB::GetSamplingFrequency()
499 // Returns the sampling frequency of the TRD read-out.
502 const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
503 (GetCachedCDBObject(kIDGlobals));
508 return calGlobal->GetSamplingFrequency();
512 //_____________________________________________________________________________
513 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
516 // Returns the number of time bins which are read-out.
519 const AliTRDCalGlobals *calGlobal = dynamic_cast<const AliTRDCalGlobals *>
520 (GetCachedCDBObject(kIDGlobals));
525 return calGlobal->GetNumberOfTimeBins();
529 //_____________________________________________________________________________
530 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
533 // Returns the status of the given pad
536 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
537 (GetCachedCDBObject(kIDPadStatus));
542 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
547 return roc->GetStatus(col,row);
551 //_____________________________________________________________________________
552 Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row)
555 // Returns the status of the given MCM
558 const AliTRDCalMCMStatus *cal = dynamic_cast<const AliTRDCalMCMStatus *>
559 (GetCachedCDBObject(kIDMCMStatus));
564 return cal->GetStatus(det,col,row);
568 //_____________________________________________________________________________
569 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
572 // Returns the status of the given chamber
575 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
576 (GetCachedCDBObject(kIDChamberStatus));
581 return cal->GetStatus(det);
585 //_____________________________________________________________________________
586 Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm)
589 // Returns the status of the given chamber
592 const AliTRDCalSuperModuleStatus *cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
593 (GetCachedCDBObject(kIDSuperModuleStatus));
598 return cal->GetStatus(sm);
602 //_____________________________________________________________________________
603 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
606 // Returns status, see name of functions for details ;-)
609 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
610 (GetCachedCDBObject(kIDPadStatus));
615 return cal->IsMasked(det,col,row);
619 //_____________________________________________________________________________
620 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
623 // Returns status, see name of functions for details ;-)
626 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
627 (GetCachedCDBObject(kIDPadStatus));
632 return cal->IsBridgedLeft(det,col,row);
636 //_____________________________________________________________________________
637 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
640 // Returns status, see name of functions for details ;-)
643 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
644 (GetCachedCDBObject(kIDPadStatus));
649 return cal->IsBridgedRight(det,col,row);
653 //_____________________________________________________________________________
654 Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row)
657 // Returns status, see name of functions for details ;-)
660 const AliTRDCalMCMStatus * cal = dynamic_cast<const AliTRDCalMCMStatus *>
661 (GetCachedCDBObject(kIDMCMStatus));
666 return cal->IsMasked(det,col,row);
670 //_____________________________________________________________________________
671 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
674 // Returns status, see name of functions for details ;-)
677 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
678 (GetCachedCDBObject(kIDChamberStatus));
683 return cal->IsInstalled(det);
687 //_____________________________________________________________________________
688 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
691 // Returns status, see name of functions for details ;-)
694 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
695 (GetCachedCDBObject(kIDChamberStatus));
700 return cal->IsMasked(det);
704 //_____________________________________________________________________________
705 Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det)
708 // Returns status, see name of functions for details ;-)
711 const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
712 (GetCachedCDBObject(kIDSuperModuleStatus));
717 return cal->IsInstalled(det);
721 //_____________________________________________________________________________
722 Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det)
725 // Returns status, see name of functions for details ;-)
728 const AliTRDCalSuperModuleStatus * cal = dynamic_cast<const AliTRDCalSuperModuleStatus *>
729 (GetCachedCDBObject(kIDSuperModuleStatus));
734 return cal->IsMasked(det);
738 //_____________________________________________________________________________
739 const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject()
742 // Returns the object storing the distributions for PID with likelihood
745 return dynamic_cast<const AliTRDCalPIDLQ *> (GetCachedCDBObject(kIDPIDLQ));
749 //_____________________________________________________________________________
750 const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject()
753 // Returns the object storing the monitoring data
756 return dynamic_cast<const AliTRDCalMonitoring *> (GetCachedCDBObject(kIDMonitoringData));
760 //_____________________________________________________________________________
761 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift, Float_t bz)
764 // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vdrift>
765 // and a B-field <bz> for Xe/CO2 (15%).
766 // The values are according to a GARFIELD simulation.
768 // This function basically does not belong to the calibration class.
769 // It should be moved somewhere else.
770 // However, currently it is in use by simulation and reconstruction.
773 Float_t fieldAbs = TMath::Abs(bz);
774 Float_t fieldSgn = (bz > 0.0) ? 1.0 : -1.0;
777 Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
778 Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
779 Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
780 Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
782 Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
783 ib = TMath::Max( 0,ib);
784 ib = TMath::Min(kNb,ib);
786 Float_t alphaL = p0[ib]
788 + p2[ib] * vdrift*vdrift
789 + p3[ib] * vdrift*vdrift*vdrift;
791 return TMath::Tan(fieldSgn * alphaL);
795 //_____________________________________________________________________________
796 void AliTRDcalibDB::SamplePRF()
799 // Samples the pad response function (should maybe go somewhere else ...)
802 const Int_t kPRFbin = 61;
804 Float_t prf[kNplan][kPRFbin] = {
805 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
806 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
807 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
808 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
809 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
810 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
811 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
812 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
813 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
814 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
815 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
816 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
817 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
818 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
819 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
821 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
822 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
823 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
824 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
825 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
826 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
827 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
828 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
829 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
830 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
831 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
832 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
833 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
834 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
835 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
837 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
838 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
839 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
840 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
841 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
842 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
843 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
844 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
845 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
846 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
847 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
848 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
849 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
850 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
851 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
853 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
854 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
855 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
856 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
857 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
858 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
859 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
860 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
861 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
862 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
863 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
864 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
865 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
866 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
867 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
869 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
870 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
871 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
872 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
873 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
874 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
875 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
876 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
877 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
878 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
879 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
880 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
881 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
882 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
883 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
885 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
886 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
887 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
888 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
889 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
890 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
891 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
892 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
893 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
894 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
895 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
896 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
897 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
898 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
899 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
902 // More sampling precision with linear interpolation
905 Float_t pad[kPRFbin];
906 Int_t sPRFbin = kPRFbin;
907 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
908 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
909 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
912 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
913 fPRFpad = ((Int_t) (1.0 / fPRFwid));
915 if (fPRFsmp) delete [] fPRFsmp;
916 fPRFsmp = new Float_t[kNplan*fPRFbin];
922 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
924 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
926 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
930 diff = bin - pad[ipos2++];
931 } while ((diff > 0) && (ipos2 < kPRFbin));
932 if (ipos2 == kPRFbin) {
933 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
935 else if (ipos2 == 1) {
936 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2-1];
940 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
942 fPRFsmp[iPla*fPRFbin+iBin] = prf[iPla][ipos2]
943 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
952 //_____________________________________________________________________________
953 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
954 , Int_t plane, Double_t *pad) const
957 // Applies the pad response
960 Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid));
961 Int_t iOff = plane * fPRFbin;
963 Int_t iBin0 = iBin - fPRFpad + iOff;
964 Int_t iBin1 = iBin + iOff;
965 Int_t iBin2 = iBin + fPRFpad + iOff;
970 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNplan))) {
973 pad[0] = signal * fPRFsmp[iBin0];
975 pad[1] = signal * fPRFsmp[iBin1];
976 if (iBin2 < (fPRFbin*kNplan)) {
977 pad[2] = signal * fPRFsmp[iBin2];