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/AliTRDCalFEE.h"
45 #include "Cal/AliTRDCalPID.h"
46 #include "Cal/AliTRDCalMonitoring.h"
47 #include "Cal/AliTRDCalChamberStatus.h"
48 #include "Cal/AliTRDCalPadStatus.h"
49 #include "Cal/AliTRDCalSingleChamberStatus.h"
51 ClassImp(AliTRDcalibDB)
53 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
54 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
56 //_ singleton implementation __________________________________________________
57 AliTRDcalibDB* AliTRDcalibDB::Instance()
60 // Singleton implementation
61 // Returns an instance of this class, it is created if neccessary
64 if (fgTerminated != kFALSE) {
68 if (fgInstance == 0) {
69 fgInstance = new AliTRDcalibDB();
76 //_____________________________________________________________________________
77 void AliTRDcalibDB::Terminate()
80 // Singleton implementation
81 // Deletes the instance of this class and sets the terminated flag,
82 // instances cannot be requested anymore
83 // This function can be called several times.
88 if (fgInstance != 0) {
95 //_____________________________________________________________________________
96 AliTRDcalibDB::AliTRDcalibDB()
107 // Default constructor
109 // TODO Default runnumber is set to 0, this should be changed later
110 // to an invalid value (e.g. -1) to prevent
111 // TODO invalid calibration data to be used.
114 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
119 // Create the sampled PRF
124 //_____________________________________________________________________________
125 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
136 // Copy constructor (not that it make any sense for a singleton...)
139 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
144 // Create the sampled PRF
149 //_____________________________________________________________________________
150 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
153 // Assignment operator (same as above ...)
157 AliFatal("No assignment operator defined");
164 //_____________________________________________________________________________
165 AliTRDcalibDB::~AliTRDcalibDB()
180 //_caching functions____________________________________________________________
181 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
184 // Retrieves a cdb object with the given id. The objects are cached as
185 // long as the run number is not changed.
187 // Put together the available objects here by using the lines
188 // a) For usual calibration objects:
190 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
192 // See function CacheCDBEntry for details.
194 // b) For calibration data which depends on two objects: One containing
195 // a value per detector and one the local fluctuations per pad:
197 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
199 // See function CacheMergeCDBEntry for details.
204 // Parameters defined per pad and chamber
206 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
208 case kIDVdriftChamber :
209 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
212 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
215 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
217 case kIDGainFactorPad :
218 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
220 case kIDGainFactorChamber :
221 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
223 case kIDNoiseChamber :
224 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
227 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
231 // Parameters defined per pad
233 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
237 case kIDChamberStatus :
238 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
241 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
245 case kIDMonitoringData :
246 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
249 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
252 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
255 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
257 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
260 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
269 //_____________________________________________________________________________
270 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
273 // Retrieves an entry with path <cdbPath> from the CDB.
276 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
278 AliError(Form("Failed to get entry: %s",cdbPath));
286 //_____________________________________________________________________________
287 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
290 // Caches the entry <id> with cdb path <cdbPath>
293 if (!fCDBCache[id]) {
294 fCDBEntries[id] = GetCDBEntry(cdbPath);
295 if (fCDBEntries[id]) {
296 fCDBCache[id] = fCDBEntries[id]->GetObject();
300 return fCDBCache[id];
304 //_____________________________________________________________________________
305 void AliTRDcalibDB::SetRun(Long64_t run)
308 // Sets current run number. Calibration data is read from the corresponding file.
309 // When the run number changes the caching is invalidated.
322 //_____________________________________________________________________________
323 void AliTRDcalibDB::Invalidate()
326 // Invalidates cache (when run number is changed).
329 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
330 if (fCDBEntries[i]) {
331 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
332 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
336 delete fCDBEntries[i];
344 //_____________________________________________________________________________
345 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
348 // Returns the noise level in ADC counts for the given pad.
351 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
352 (GetCachedCDBObject(kIDNoisePad));
357 AliTRDCalROC *roc = calPad->GetCalROC(det);
362 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
363 (GetCachedCDBObject(kIDNoiseChamber));
368 return calChamber->GetValue(det) * roc->GetValue(col,row);
372 //_____________________________________________________________________________
373 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
376 // Returns the Vdrift calibration object for a given ROC
377 // containing one number per pad
380 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
381 (GetCachedCDBObject(kIDNoisePad));
386 AliTRDCalROC *roc = calPad->GetCalROC(det);
396 //_____________________________________________________________________________
397 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
400 // Returns the Vdrift calibration object
401 // containing one number per detector
404 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
405 (GetCachedCDBObject(kIDNoiseChamber));
415 //_____________________________________________________________________________
416 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
419 // Returns the drift velocity for the given pad.
422 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
423 (GetCachedCDBObject(kIDVdriftPad));
428 AliTRDCalROC *roc = calPad->GetCalROC(det);
433 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
434 (GetCachedCDBObject(kIDVdriftChamber));
439 return calChamber->GetValue(det) * roc->GetValue(col,row);
443 //_____________________________________________________________________________
444 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
447 // Returns the Vdrift calibration object for a given ROC
448 // containing one number per pad
451 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
452 (GetCachedCDBObject(kIDVdriftPad));
457 AliTRDCalROC *roc = calPad->GetCalROC(det);
467 //_____________________________________________________________________________
468 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
471 // Returns the Vdrift calibration object
472 // containing one number per detector
475 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
476 (GetCachedCDBObject(kIDVdriftChamber));
486 //_____________________________________________________________________________
487 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
490 // Returns the average drift velocity for the given detector
493 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
494 (GetCachedCDBObject(kIDVdriftChamber));
499 return calDet->GetValue(det);
503 //_____________________________________________________________________________
504 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
507 // Returns t0 for the given pad.
510 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
511 (GetCachedCDBObject(kIDT0Pad));
516 AliTRDCalROC *roc = calPad->GetCalROC(det);
521 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
522 (GetCachedCDBObject(kIDT0Chamber));
527 return calChamber->GetValue(det) + roc->GetValue(col,row);
531 //_____________________________________________________________________________
532 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
535 // Returns the t0 calibration object for a given ROC
536 // containing one number per pad
539 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
540 (GetCachedCDBObject(kIDT0Pad));
545 AliTRDCalROC *roc = calPad->GetCalROC(det);
555 //_____________________________________________________________________________
556 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
559 // Returns the t0 calibration object
560 // containing one number per detector
563 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
564 (GetCachedCDBObject(kIDT0Chamber));
574 //_____________________________________________________________________________
575 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
578 // Returns the average t0 for the given detector
581 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
582 (GetCachedCDBObject(kIDT0Pad));
587 AliTRDCalROC *roc = calPad->GetCalROC(det);
592 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
593 (GetCachedCDBObject(kIDT0Chamber));
599 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
600 mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels();
607 //_____________________________________________________________________________
608 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
611 // Returns the gain factor for the given pad.
614 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
615 (GetCachedCDBObject(kIDGainFactorPad));
620 AliTRDCalROC *roc = calPad->GetCalROC(det);
625 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
626 (GetCachedCDBObject(kIDGainFactorChamber));
631 return calChamber->GetValue(det) * roc->GetValue(col,row);
635 //_____________________________________________________________________________
636 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
639 // Returns the gain factor calibration object for a given ROC
642 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
643 (GetCachedCDBObject(kIDGainFactorPad));
648 AliTRDCalROC *roc = calPad->GetCalROC(det);
658 //_____________________________________________________________________________
659 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
662 // Returns the gain factor calibration object
663 // containing one number per detector
666 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
667 (GetCachedCDBObject(kIDGainFactorChamber));
677 //_____________________________________________________________________________
678 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
681 // Returns the average gain factor for the given detector
684 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
685 (GetCachedCDBObject(kIDGainFactorChamber));
690 return calDet->GetValue(det);
694 //_____________________________________________________________________________
695 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
698 // Returns the PRF calibration object for a given ROC
699 // containing one number per pad
702 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
703 (GetCachedCDBObject(kIDPRFWidth));
708 AliTRDCalROC *roc = calPad->GetCalROC(det);
718 //_____________________________________________________________________________
719 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
722 // Returns the PRF width for the given pad.
725 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
726 (GetCachedCDBObject(kIDPRFWidth));
731 AliTRDCalROC *roc = calPad->GetCalROC(det);
736 return roc->GetValue(col,row);
740 //_____________________________________________________________________________
741 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
744 // Returns the number of time bins which are read-out.
747 const AliTRDCalFEE *calFEE = dynamic_cast<const AliTRDCalFEE *>
748 (GetCachedCDBObject(kIDFEE));
753 return calFEE->GetNumberOfTimeBins();
757 //_____________________________________________________________________________
758 Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS(){
760 // Returns Number of time bins from the DCS
762 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
766 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
771 return calDCS->GetGlobalNumberOfTimeBins();
774 //_____________________________________________________________________________
775 void AliTRDcalibDB::GetFilterType(TString &filterType){
776 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
781 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(1)); // Take EOR
787 filterType = calDCS->GetGlobalFilterType();
790 //_____________________________________________________________________________
791 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
794 // Returns the status of the given pad
797 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
798 (GetCachedCDBObject(kIDPadStatus));
803 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
808 return roc->GetStatus(col,row);
812 //_____________________________________________________________________________
813 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
816 // Returns the pad status calibration object for a given ROC
819 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
820 (GetCachedCDBObject(kIDPadStatus));
825 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
835 //_____________________________________________________________________________
836 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
839 // Returns the status of the given chamber
842 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
843 (GetCachedCDBObject(kIDChamberStatus));
848 return cal->GetStatus(det);
852 //_____________________________________________________________________________
853 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
856 // Returns the TRD reconstruction parameters from the OCDB
859 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
860 if (!recos) return 0x0;
862 // calculate entry based on event type info
863 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
865 return (AliTRDrecoParam*)recos->UncheckedAt(n);
869 //_____________________________________________________________________________
870 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
873 // Returns status, see name of functions for details ;-)
876 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
877 (GetCachedCDBObject(kIDPadStatus));
882 return cal->IsMasked(det,col,row);
886 //_____________________________________________________________________________
887 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
890 // Returns status, see name of functions for details ;-)
893 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
894 (GetCachedCDBObject(kIDPadStatus));
899 return cal->IsBridgedLeft(det,col,row);
903 //_____________________________________________________________________________
904 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
907 // Returns status, see name of functions for details ;-)
910 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
911 (GetCachedCDBObject(kIDPadStatus));
916 return cal->IsBridgedRight(det,col,row);
920 //_____________________________________________________________________________
921 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
924 // Returns status, see name of functions for details ;-)
926 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
927 (GetCachedCDBObject(kIDPadStatus));
932 return cal->IsNotConnected(det,col,row);
936 //_____________________________________________________________________________
937 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
940 // Returns status, see name of functions for details ;-)
943 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
944 (GetCachedCDBObject(kIDChamberStatus));
949 return cal->IsInstalled(det);
953 //_____________________________________________________________________________
954 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
957 // Returns status, see name of functions for details ;-)
960 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
961 (GetCachedCDBObject(kIDChamberStatus));
966 return cal->IsMasked(det);
970 //_____________________________________________________________________________
971 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
974 // Returns the object storing the distributions for PID with likelihood
978 case AliTRDpidUtil::kLQ:
979 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
980 case AliTRDpidUtil::kNN:
981 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
982 case AliTRDpidUtil::kESD:
983 return 0x0; // To avoid compiler warnings
990 //_____________________________________________________________________________
991 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
994 // Returns the object storing the monitoring data
997 return dynamic_cast<const AliTRDCalMonitoring *>
998 (GetCachedCDBObject(kIDMonitoringData));
1002 //_____________________________________________________________________________
1003 void AliTRDcalibDB::SamplePRF()
1006 // Samples the pad response function (should maybe go somewhere else ...)
1009 const Int_t kPRFbin = 61;
1011 Float_t prf[kNlayer][kPRFbin] = {
1012 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
1013 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1014 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1015 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1016 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1017 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1018 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1019 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1020 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1021 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1022 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1023 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1024 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1025 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1026 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1028 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1029 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1030 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1031 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1032 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1033 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1034 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1035 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1036 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1037 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1038 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1039 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1040 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1041 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1042 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1044 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1045 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1046 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1047 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1048 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1049 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1050 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1051 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1052 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1053 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1054 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1055 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1056 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1057 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1058 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1060 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1061 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1062 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1063 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1064 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1065 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1066 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1067 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1068 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1069 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1070 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1071 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1072 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1073 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1074 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1076 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1077 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1078 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1079 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1080 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1081 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1082 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1083 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1084 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1085 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1086 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1087 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1088 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1089 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1090 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1092 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1093 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1094 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1095 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1096 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1097 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1098 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1099 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1100 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1101 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1102 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1103 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1104 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1105 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1106 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1109 // More sampling precision with linear interpolation
1112 Float_t pad[kPRFbin];
1113 Int_t sPRFbin = kPRFbin;
1114 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1115 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1116 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1119 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1120 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1122 if (fPRFsmp) delete [] fPRFsmp;
1123 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1129 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1131 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1133 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1137 diff = bin - pad[ipos2++];
1138 } while ((diff > 0) && (ipos2 < kPRFbin));
1139 if (ipos2 == kPRFbin) {
1140 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1142 else if (ipos2 == 1) {
1143 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1147 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1149 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1150 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1159 //_____________________________________________________________________________
1160 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1161 , Int_t layer, Double_t *pad) const
1164 // Applies the pad response
1165 // So far this is the fixed parametrization and should be replaced by
1166 // something dependent on calibration values
1169 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1170 Int_t iOff = layer * fPRFbin;
1172 Int_t iBin0 = iBin - fPRFpad + iOff;
1173 Int_t iBin1 = iBin + iOff;
1174 Int_t iBin2 = iBin + fPRFpad + iOff;
1179 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1182 pad[0] = signal * fPRFsmp[iBin0];
1184 pad[1] = signal * fPRFsmp[iBin1];
1185 if (iBin2 < (fPRFbin*kNlayer)) {
1186 pad[2] = signal * fPRFsmp[iBin2];