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 <TClonesArray.h>
35 #include "AliCDBManager.h"
36 #include "AliCDBStorage.h"
37 #include "AliCDBEntry.h"
40 #include "AliTRDcalibDB.h"
41 #include "AliTRDrecoParam.h"
42 #include "AliTRDgeometry.h"
43 #include "AliTRDpadPlane.h"
44 #include "AliTRDCommonParam.h"
46 #include "Cal/AliTRDCalROC.h"
47 #include "Cal/AliTRDCalPad.h"
48 #include "Cal/AliTRDCalDet.h"
49 #include "Cal/AliTRDCalFEE.h"
50 #include "Cal/AliTRDCalPID.h"
51 #include "Cal/AliTRDCalMonitoring.h"
52 #include "Cal/AliTRDCalChamberStatus.h"
53 #include "Cal/AliTRDCalPadStatus.h"
54 #include "Cal/AliTRDCalSingleChamberStatus.h"
56 ClassImp(AliTRDcalibDB)
58 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
59 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
61 //_ singleton implementation __________________________________________________
62 AliTRDcalibDB* AliTRDcalibDB::Instance()
65 // Singleton implementation
66 // Returns an instance of this class, it is created if neccessary
69 if (fgTerminated != kFALSE) {
73 if (fgInstance == 0) {
74 fgInstance = new AliTRDcalibDB();
81 //_____________________________________________________________________________
82 void AliTRDcalibDB::Terminate()
85 // Singleton implementation
86 // Deletes the instance of this class and sets the terminated flag,
87 // instances cannot be requested anymore
88 // This function can be called several times.
93 if (fgInstance != 0) {
100 //_____________________________________________________________________________
101 AliTRDcalibDB::AliTRDcalibDB()
112 // Default constructor
114 // TODO Default runnumber is set to 0, this should be changed later
115 // to an invalid value (e.g. -1) to prevent
116 // TODO invalid calibration data to be used.
119 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
124 // Create the sampled PRF
129 //_____________________________________________________________________________
130 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
141 // Copy constructor (not that it make any sense for a singleton...)
144 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
149 // Create the sampled PRF
154 //_____________________________________________________________________________
155 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
158 // Assignment operator (same as above ...)
162 AliFatal("No assignment operator defined");
169 //_____________________________________________________________________________
170 AliTRDcalibDB::~AliTRDcalibDB()
185 //_caching functions____________________________________________________________
186 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
189 // Retrieves a cdb object with the given id. The objects are cached as
190 // long as the run number is not changed.
192 // Put together the available objects here by using the lines
193 // a) For usual calibration objects:
195 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
197 // See function CacheCDBEntry for details.
199 // b) For calibration data which depends on two objects: One containing
200 // a value per detector and one the local fluctuations per pad:
202 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
204 // See function CacheMergeCDBEntry for details.
209 // Parameters defined per pad and chamber
211 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
213 case kIDVdriftChamber :
214 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
217 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
220 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
222 case kIDGainFactorPad :
223 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
225 case kIDGainFactorChamber :
226 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
228 case kIDNoiseChamber :
229 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
232 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
236 // Parameters defined per pad
238 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
242 case kIDChamberStatus :
243 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
246 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
250 case kIDMonitoringData :
251 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
254 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
257 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
259 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
262 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
271 //_____________________________________________________________________________
272 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
275 // Retrieves an entry with path <cdbPath> from the CDB.
278 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
280 AliError(Form("Failed to get entry: %s",cdbPath));
288 //_____________________________________________________________________________
289 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
292 // Caches the entry <id> with cdb path <cdbPath>
295 if (!fCDBCache[id]) {
296 fCDBEntries[id] = GetCDBEntry(cdbPath);
297 if (fCDBEntries[id]) {
298 fCDBCache[id] = fCDBEntries[id]->GetObject();
302 return fCDBCache[id];
306 //_____________________________________________________________________________
307 void AliTRDcalibDB::SetRun(Long64_t run)
310 // Sets current run number. Calibration data is read from the corresponding file.
311 // When the run number changes the caching is invalidated.
324 //_____________________________________________________________________________
325 void AliTRDcalibDB::Invalidate()
328 // Invalidates cache (when run number is changed).
331 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
332 if (fCDBEntries[i]) {
333 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
334 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
338 delete fCDBEntries[i];
346 //_____________________________________________________________________________
347 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
350 // Returns the noise level in ADC counts for the given pad.
353 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
354 (GetCachedCDBObject(kIDNoisePad));
359 AliTRDCalROC *roc = calPad->GetCalROC(det);
364 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
365 (GetCachedCDBObject(kIDNoiseChamber));
370 return calChamber->GetValue(det) * roc->GetValue(col,row);
374 //_____________________________________________________________________________
375 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
378 // Returns the Vdrift calibration object for a given ROC
379 // containing one number per pad
382 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
383 (GetCachedCDBObject(kIDNoisePad));
388 AliTRDCalROC *roc = calPad->GetCalROC(det);
398 //_____________________________________________________________________________
399 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
402 // Returns the Vdrift calibration object
403 // containing one number per detector
406 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
407 (GetCachedCDBObject(kIDNoiseChamber));
417 //_____________________________________________________________________________
418 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
421 // Returns the drift velocity for the given pad.
424 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
425 (GetCachedCDBObject(kIDVdriftPad));
430 AliTRDCalROC *roc = calPad->GetCalROC(det);
435 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
436 (GetCachedCDBObject(kIDVdriftChamber));
441 return calChamber->GetValue(det) * roc->GetValue(col,row);
445 //_____________________________________________________________________________
446 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
449 // Returns the Vdrift calibration object for a given ROC
450 // containing one number per pad
453 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
454 (GetCachedCDBObject(kIDVdriftPad));
459 AliTRDCalROC *roc = calPad->GetCalROC(det);
469 //_____________________________________________________________________________
470 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
473 // Returns the Vdrift calibration object
474 // containing one number per detector
477 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
478 (GetCachedCDBObject(kIDVdriftChamber));
488 //_____________________________________________________________________________
489 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
492 // Returns the average drift velocity for the given detector
495 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
496 (GetCachedCDBObject(kIDVdriftChamber));
501 return calDet->GetValue(det);
505 //_____________________________________________________________________________
506 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
509 // Returns t0 for the given pad.
512 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
513 (GetCachedCDBObject(kIDT0Pad));
518 AliTRDCalROC *roc = calPad->GetCalROC(det);
523 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
524 (GetCachedCDBObject(kIDT0Chamber));
529 return calChamber->GetValue(det) + roc->GetValue(col,row);
533 //_____________________________________________________________________________
534 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
537 // Returns the t0 calibration object for a given ROC
538 // containing one number per pad
541 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
542 (GetCachedCDBObject(kIDT0Pad));
547 AliTRDCalROC *roc = calPad->GetCalROC(det);
557 //_____________________________________________________________________________
558 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
561 // Returns the t0 calibration object
562 // containing one number per detector
565 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
566 (GetCachedCDBObject(kIDT0Chamber));
576 //_____________________________________________________________________________
577 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
580 // Returns the average t0 for the given detector
583 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
584 (GetCachedCDBObject(kIDT0Pad));
589 AliTRDCalROC *roc = calPad->GetCalROC(det);
594 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
595 (GetCachedCDBObject(kIDT0Chamber));
601 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
602 mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels();
609 //_____________________________________________________________________________
610 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
613 // Returns the gain factor for the given pad.
616 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
617 (GetCachedCDBObject(kIDGainFactorPad));
622 AliTRDCalROC *roc = calPad->GetCalROC(det);
627 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
628 (GetCachedCDBObject(kIDGainFactorChamber));
633 return calChamber->GetValue(det) * roc->GetValue(col,row);
637 //_____________________________________________________________________________
638 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
641 // Returns the gain factor calibration object for a given ROC
644 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
645 (GetCachedCDBObject(kIDGainFactorPad));
650 AliTRDCalROC *roc = calPad->GetCalROC(det);
660 //_____________________________________________________________________________
661 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
664 // Returns the gain factor calibration object
665 // containing one number per detector
668 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
669 (GetCachedCDBObject(kIDGainFactorChamber));
679 //_____________________________________________________________________________
680 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
683 // Returns the average gain factor for the given detector
686 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
687 (GetCachedCDBObject(kIDGainFactorChamber));
692 return calDet->GetValue(det);
696 //_____________________________________________________________________________
697 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
700 // Returns the PRF calibration object for a given ROC
701 // containing one number per pad
704 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
705 (GetCachedCDBObject(kIDPRFWidth));
710 AliTRDCalROC *roc = calPad->GetCalROC(det);
720 //_____________________________________________________________________________
721 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
724 // Returns the PRF width for the given pad.
727 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
728 (GetCachedCDBObject(kIDPRFWidth));
733 AliTRDCalROC *roc = calPad->GetCalROC(det);
738 return roc->GetValue(col,row);
742 //_____________________________________________________________________________
743 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
746 // Returns the number of time bins which are read-out.
749 const AliTRDCalFEE *calFEE = dynamic_cast<const AliTRDCalFEE *>
750 (GetCachedCDBObject(kIDFEE));
755 return calFEE->GetNumberOfTimeBins();
759 //_____________________________________________________________________________
760 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
763 // Returns the status of the given pad
766 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
767 (GetCachedCDBObject(kIDPadStatus));
772 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
777 return roc->GetStatus(col,row);
781 //_____________________________________________________________________________
782 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
785 // Returns the pad status calibration object for a given ROC
788 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
789 (GetCachedCDBObject(kIDPadStatus));
794 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
804 //_____________________________________________________________________________
805 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
808 // Returns the status of the given chamber
811 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
812 (GetCachedCDBObject(kIDChamberStatus));
817 return cal->GetStatus(det);
821 //_____________________________________________________________________________
822 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
824 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
825 if(!recos) return 0x0;
827 // calculate entry based on event type info
828 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
829 return (AliTRDrecoParam*)recos->UncheckedAt(n);
833 //_____________________________________________________________________________
834 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
837 // Returns status, see name of functions for details ;-)
840 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
841 (GetCachedCDBObject(kIDPadStatus));
846 return cal->IsMasked(det,col,row);
850 //_____________________________________________________________________________
851 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
854 // Returns status, see name of functions for details ;-)
857 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
858 (GetCachedCDBObject(kIDPadStatus));
863 return cal->IsBridgedLeft(det,col,row);
867 //_____________________________________________________________________________
868 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
871 // Returns status, see name of functions for details ;-)
874 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
875 (GetCachedCDBObject(kIDPadStatus));
880 return cal->IsBridgedRight(det,col,row);
884 //_____________________________________________________________________________
885 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
888 // Returns status, see name of functions for details ;-)
890 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
891 (GetCachedCDBObject(kIDPadStatus));
896 return cal->IsNotConnected(det,col,row);
900 //_____________________________________________________________________________
901 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
904 // Returns status, see name of functions for details ;-)
907 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
908 (GetCachedCDBObject(kIDChamberStatus));
913 return cal->IsInstalled(det);
917 //_____________________________________________________________________________
918 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
921 // Returns status, see name of functions for details ;-)
924 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
925 (GetCachedCDBObject(kIDChamberStatus));
930 return cal->IsMasked(det);
934 //_____________________________________________________________________________
935 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
938 // Returns the object storing the distributions for PID with likelihood
942 case AliTRDpidUtil::kLQ:
943 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
944 case AliTRDpidUtil::kNN:
945 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
946 case AliTRDpidUtil::kESD:
947 return 0x0; // To avoid compiler warnings
954 //_____________________________________________________________________________
955 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
958 // Returns the object storing the monitoring data
961 return dynamic_cast<const AliTRDCalMonitoring *>
962 (GetCachedCDBObject(kIDMonitoringData));
966 //_____________________________________________________________________________
967 void AliTRDcalibDB::SamplePRF()
970 // Samples the pad response function (should maybe go somewhere else ...)
973 const Int_t kPRFbin = 61;
975 Float_t prf[kNlayer][kPRFbin] = {
976 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
977 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
978 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
979 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
980 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
981 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
982 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
983 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
984 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
985 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
986 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
987 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
988 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
989 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
990 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
992 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
993 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
994 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
995 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
996 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
997 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
998 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
999 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1000 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1001 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1002 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1003 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1004 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1005 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1006 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1008 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1009 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1010 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1011 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1012 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1013 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1014 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1015 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1016 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1017 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1018 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1019 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1020 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1021 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1022 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1024 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1025 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1026 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1027 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1028 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1029 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1030 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1031 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1032 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1033 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1034 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1035 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1036 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1037 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1038 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1040 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1041 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1042 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1043 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1044 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1045 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1046 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1047 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1048 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1049 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1050 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1051 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1052 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1053 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1054 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1056 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1057 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1058 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1059 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1060 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1061 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1062 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1063 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1064 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1065 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1066 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1067 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1068 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1069 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1070 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1073 // More sampling precision with linear interpolation
1076 Float_t pad[kPRFbin];
1077 Int_t sPRFbin = kPRFbin;
1078 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1079 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1080 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1083 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1084 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1086 if (fPRFsmp) delete [] fPRFsmp;
1087 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1093 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1095 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1097 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1101 diff = bin - pad[ipos2++];
1102 } while ((diff > 0) && (ipos2 < kPRFbin));
1103 if (ipos2 == kPRFbin) {
1104 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1106 else if (ipos2 == 1) {
1107 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1111 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1113 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1114 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1123 //_____________________________________________________________________________
1124 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1125 , Int_t layer, Double_t *pad) const
1128 // Applies the pad response
1129 // So far this is the fixed parametrization and should be replaced by
1130 // something dependent on calibration values
1133 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1134 Int_t iOff = layer * fPRFbin;
1136 Int_t iBin0 = iBin - fPRFpad + iOff;
1137 Int_t iBin1 = iBin + iOff;
1138 Int_t iBin2 = iBin + fPRFpad + iOff;
1143 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1146 pad[0] = signal * fPRFsmp[iBin0];
1148 pad[1] = signal * fPRFsmp[iBin1];
1149 if (iBin2 < (fPRFbin*kNlayer)) {
1150 pad[2] = signal * fPRFsmp[iBin2];