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 ///////////////////////////////////////////////////////////////////////////////
31 #include <TClonesArray.h>
32 #include <TObjArray.h>
34 #include "AliCDBManager.h"
35 #include "AliCDBEntry.h"
38 #include "AliTRDcalibDB.h"
40 #include "Cal/AliTRDCalROC.h"
41 #include "Cal/AliTRDCalPad.h"
42 #include "Cal/AliTRDCalDet.h"
43 #include "Cal/AliTRDCalDCS.h"
44 #include "Cal/AliTRDCalPID.h"
45 #include "Cal/AliTRDCalMonitoring.h"
46 #include "Cal/AliTRDCalChamberStatus.h"
47 #include "Cal/AliTRDCalPadStatus.h"
48 #include "Cal/AliTRDCalSingleChamberStatus.h"
50 ClassImp(AliTRDcalibDB)
52 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
53 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
55 //_ singleton implementation __________________________________________________
56 AliTRDcalibDB* AliTRDcalibDB::Instance()
59 // Singleton implementation
60 // Returns an instance of this class, it is created if neccessary
63 if (fgTerminated != kFALSE) {
67 if (fgInstance == 0) {
68 fgInstance = new AliTRDcalibDB();
75 //_____________________________________________________________________________
76 void AliTRDcalibDB::Terminate()
79 // Singleton implementation
80 // Deletes the instance of this class and sets the terminated flag,
81 // instances cannot be requested anymore
82 // This function can be called several times.
87 if (fgInstance != 0) {
94 //_____________________________________________________________________________
95 AliTRDcalibDB::AliTRDcalibDB()
106 // Default constructor
108 // TODO Default runnumber is set to 0, this should be changed later
109 // to an invalid value (e.g. -1) to prevent
110 // TODO invalid calibration data to be used.
113 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
118 // Create the sampled PRF
123 //_____________________________________________________________________________
124 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
135 // Copy constructor (not that it make any sense for a singleton...)
138 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
143 // Create the sampled PRF
148 //_____________________________________________________________________________
149 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
152 // Assignment operator (same as above ...)
156 AliFatal("No assignment operator defined");
163 //_____________________________________________________________________________
164 AliTRDcalibDB::~AliTRDcalibDB()
179 //_caching functions____________________________________________________________
180 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
183 // Retrieves a cdb object with the given id. The objects are cached as
184 // long as the run number is not changed.
186 // Put together the available objects here by using the lines
187 // a) For usual calibration objects:
189 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
191 // See function CacheCDBEntry for details.
193 // b) For calibration data which depends on two objects: One containing
194 // a value per detector and one the local fluctuations per pad:
196 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
198 // See function CacheMergeCDBEntry for details.
203 // Parameters defined per pad and chamber
205 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
207 case kIDVdriftChamber :
208 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
211 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
214 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
216 case kIDGainFactorPad :
217 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
219 case kIDGainFactorChamber :
220 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
222 case kIDNoiseChamber :
223 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
226 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
230 // Parameters defined per pad
232 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
236 case kIDChamberStatus :
237 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
240 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
244 case kIDMonitoringData :
245 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
248 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
251 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
254 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
256 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
259 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
268 //_____________________________________________________________________________
269 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
272 // Retrieves an entry with path <cdbPath> from the CDB.
275 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
277 AliError(Form("Failed to get entry: %s",cdbPath));
285 //_____________________________________________________________________________
286 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
289 // Caches the entry <id> with cdb path <cdbPath>
292 if (!fCDBCache[id]) {
293 fCDBEntries[id] = GetCDBEntry(cdbPath);
294 if (fCDBEntries[id]) {
295 fCDBCache[id] = fCDBEntries[id]->GetObject();
299 return fCDBCache[id];
303 //_____________________________________________________________________________
304 void AliTRDcalibDB::SetRun(Long64_t run)
307 // Sets current run number. Calibration data is read from the corresponding file.
308 // When the run number changes the caching is invalidated.
321 //_____________________________________________________________________________
322 void AliTRDcalibDB::Invalidate()
325 // Invalidates cache (when run number is changed).
328 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
329 if (fCDBEntries[i]) {
330 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
331 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
335 delete fCDBEntries[i];
343 //_____________________________________________________________________________
344 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
347 // Returns the noise level in ADC counts for the given pad.
350 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
351 (GetCachedCDBObject(kIDNoisePad));
356 AliTRDCalROC *roc = calPad->GetCalROC(det);
361 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
362 (GetCachedCDBObject(kIDNoiseChamber));
367 return calChamber->GetValue(det) * roc->GetValue(col,row);
371 //_____________________________________________________________________________
372 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
375 // Returns the Vdrift calibration object for a given ROC
376 // containing one number per pad
379 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
380 (GetCachedCDBObject(kIDNoisePad));
385 AliTRDCalROC *roc = calPad->GetCalROC(det);
395 //_____________________________________________________________________________
396 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
399 // Returns the Vdrift calibration object
400 // containing one number per detector
403 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
404 (GetCachedCDBObject(kIDNoiseChamber));
414 //_____________________________________________________________________________
415 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
418 // Returns the drift velocity for the given pad.
421 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
422 (GetCachedCDBObject(kIDVdriftPad));
427 AliTRDCalROC *roc = calPad->GetCalROC(det);
432 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
433 (GetCachedCDBObject(kIDVdriftChamber));
438 return calChamber->GetValue(det) * roc->GetValue(col,row);
442 //_____________________________________________________________________________
443 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
446 // Returns the Vdrift calibration object for a given ROC
447 // containing one number per pad
450 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
451 (GetCachedCDBObject(kIDVdriftPad));
456 AliTRDCalROC *roc = calPad->GetCalROC(det);
466 //_____________________________________________________________________________
467 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
470 // Returns the Vdrift calibration object
471 // containing one number per detector
474 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
475 (GetCachedCDBObject(kIDVdriftChamber));
485 //_____________________________________________________________________________
486 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
489 // Returns the average drift velocity for the given detector
492 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
493 (GetCachedCDBObject(kIDVdriftChamber));
498 return calDet->GetValue(det);
502 //_____________________________________________________________________________
503 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
506 // Returns t0 for the given pad.
509 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
510 (GetCachedCDBObject(kIDT0Pad));
515 AliTRDCalROC *roc = calPad->GetCalROC(det);
520 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
521 (GetCachedCDBObject(kIDT0Chamber));
526 return calChamber->GetValue(det) + roc->GetValue(col,row);
530 //_____________________________________________________________________________
531 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
534 // Returns the t0 calibration object for a given ROC
535 // containing one number per pad
538 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
539 (GetCachedCDBObject(kIDT0Pad));
544 AliTRDCalROC *roc = calPad->GetCalROC(det);
554 //_____________________________________________________________________________
555 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
558 // Returns the t0 calibration object
559 // containing one number per detector
562 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
563 (GetCachedCDBObject(kIDT0Chamber));
573 //_____________________________________________________________________________
574 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
577 // Returns the average t0 for the given detector
580 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
581 (GetCachedCDBObject(kIDT0Pad));
586 AliTRDCalROC *roc = calPad->GetCalROC(det);
591 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
592 (GetCachedCDBObject(kIDT0Chamber));
598 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
599 mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels();
606 //_____________________________________________________________________________
607 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
610 // Returns the gain factor for the given pad.
613 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
614 (GetCachedCDBObject(kIDGainFactorPad));
619 AliTRDCalROC *roc = calPad->GetCalROC(det);
624 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
625 (GetCachedCDBObject(kIDGainFactorChamber));
630 return calChamber->GetValue(det) * roc->GetValue(col,row);
634 //_____________________________________________________________________________
635 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
638 // Returns the gain factor calibration object for a given ROC
641 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
642 (GetCachedCDBObject(kIDGainFactorPad));
647 AliTRDCalROC *roc = calPad->GetCalROC(det);
657 //_____________________________________________________________________________
658 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
661 // Returns the gain factor calibration object
662 // containing one number per detector
665 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
666 (GetCachedCDBObject(kIDGainFactorChamber));
676 //_____________________________________________________________________________
677 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
680 // Returns the average gain factor for the given detector
683 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
684 (GetCachedCDBObject(kIDGainFactorChamber));
689 return calDet->GetValue(det);
693 //_____________________________________________________________________________
694 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
697 // Returns the PRF calibration object for a given ROC
698 // containing one number per pad
701 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
702 (GetCachedCDBObject(kIDPRFWidth));
707 AliTRDCalROC *roc = calPad->GetCalROC(det);
717 //_____________________________________________________________________________
718 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
721 // Returns the PRF width for the given pad.
724 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
725 (GetCachedCDBObject(kIDPRFWidth));
730 AliTRDCalROC *roc = calPad->GetCalROC(det);
735 return roc->GetValue(col,row);
739 //_____________________________________________________________________________
740 Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
743 // Returns Number of time bins from the DCS
746 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
751 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
756 return calDCS->GetGlobalNumberOfTimeBins();
760 //_____________________________________________________________________________
761 void AliTRDcalibDB::GetFilterType(TString &filterType)
764 // Returns the filter type
767 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
772 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
778 filterType = calDCS->GetGlobalFilterType();
782 //_____________________________________________________________________________
783 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
786 // Returns the status of the given pad
789 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
790 (GetCachedCDBObject(kIDPadStatus));
795 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
800 return roc->GetStatus(col,row);
804 //_____________________________________________________________________________
805 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
808 // Returns the pad status calibration object for a given ROC
811 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
812 (GetCachedCDBObject(kIDPadStatus));
817 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
827 //_____________________________________________________________________________
828 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
831 // Returns the status of the given chamber
834 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
835 (GetCachedCDBObject(kIDChamberStatus));
840 return cal->GetStatus(det);
844 //_____________________________________________________________________________
845 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
848 // Returns the TRD reconstruction parameters from the OCDB
851 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
852 if (!recos) return 0x0;
854 // calculate entry based on event type info
855 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
857 return (AliTRDrecoParam*)recos->UncheckedAt(n);
861 //_____________________________________________________________________________
862 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
865 // Returns status, see name of functions for details ;-)
868 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
869 (GetCachedCDBObject(kIDPadStatus));
874 return cal->IsMasked(det,col,row);
878 //_____________________________________________________________________________
879 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
882 // Returns status, see name of functions for details ;-)
885 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
886 (GetCachedCDBObject(kIDPadStatus));
891 return cal->IsBridgedLeft(det,col,row);
895 //_____________________________________________________________________________
896 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
899 // Returns status, see name of functions for details ;-)
902 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
903 (GetCachedCDBObject(kIDPadStatus));
908 return cal->IsBridgedRight(det,col,row);
912 //_____________________________________________________________________________
913 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
916 // Returns status, see name of functions for details ;-)
919 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
920 (GetCachedCDBObject(kIDPadStatus));
925 return cal->IsNotConnected(det,col,row);
929 //_____________________________________________________________________________
930 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
933 // Returns status, see name of functions for details ;-)
936 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
937 (GetCachedCDBObject(kIDChamberStatus));
942 return cal->IsInstalled(det);
946 //_____________________________________________________________________________
947 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
950 // Returns status, see name of functions for details ;-)
953 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
954 (GetCachedCDBObject(kIDChamberStatus));
959 return cal->IsMasked(det);
963 //_____________________________________________________________________________
964 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
967 // Returns the object storing the distributions for PID with likelihood
971 case AliTRDpidUtil::kLQ:
972 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
973 case AliTRDpidUtil::kNN:
974 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
975 case AliTRDpidUtil::kESD:
976 return 0x0; // To avoid compiler warnings
983 //_____________________________________________________________________________
984 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
987 // Returns the object storing the monitoring data
990 return dynamic_cast<const AliTRDCalMonitoring *>
991 (GetCachedCDBObject(kIDMonitoringData));
995 //_____________________________________________________________________________
996 void AliTRDcalibDB::SamplePRF()
999 // Samples the pad response function (should maybe go somewhere else ...)
1002 const Int_t kPRFbin = 61;
1004 Float_t prf[kNlayer][kPRFbin] = {
1005 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
1006 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1007 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1008 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1009 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1010 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1011 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1012 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1013 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1014 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1015 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1016 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1017 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1018 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1019 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1021 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1022 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1023 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1024 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1025 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1026 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1027 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1028 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1029 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1030 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1031 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1032 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1033 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1034 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1035 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1037 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1038 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1039 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1040 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1041 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1042 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1043 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1044 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1045 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1046 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1047 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1048 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1049 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1050 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1051 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1053 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1054 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1055 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1056 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1057 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1058 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1059 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1060 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1061 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1062 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1063 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1064 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1065 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1066 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1067 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1069 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1070 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1071 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1072 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1073 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1074 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1075 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1076 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1077 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1078 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1079 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1080 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1081 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1082 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1083 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1085 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1086 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1087 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1088 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1089 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1090 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1091 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1092 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1093 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1094 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1095 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1096 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1097 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1098 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1099 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1102 // More sampling precision with linear interpolation
1105 Float_t pad[kPRFbin];
1106 Int_t sPRFbin = kPRFbin;
1107 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1108 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1109 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1112 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1113 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1115 if (fPRFsmp) delete [] fPRFsmp;
1116 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1122 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1124 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1126 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1130 diff = bin - pad[ipos2++];
1131 } while ((diff > 0) && (ipos2 < kPRFbin));
1132 if (ipos2 == kPRFbin) {
1133 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1135 else if (ipos2 == 1) {
1136 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1140 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1142 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1143 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1152 //_____________________________________________________________________________
1153 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1154 , Int_t layer, Double_t *pad) const
1157 // Applies the pad response
1158 // So far this is the fixed parametrization and should be replaced by
1159 // something dependent on calibration values
1162 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1163 Int_t iOff = layer * fPRFbin;
1165 Int_t iBin0 = iBin - fPRFpad + iOff;
1166 Int_t iBin1 = iBin + iOff;
1167 Int_t iBin2 = iBin + fPRFpad + iOff;
1172 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1175 pad[0] = signal * fPRFsmp[iBin0];
1177 pad[1] = signal * fPRFsmp[iBin1];
1178 if (iBin2 < (fPRFbin*kNlayer)) {
1179 pad[2] = signal * fPRFsmp[iBin2];