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 fgInstance = new AliTRDcalibDB();
77 //_____________________________________________________________________________
78 void AliTRDcalibDB::Terminate()
81 // Singleton implementation
82 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
83 // This function can be called several times.
96 //_____________________________________________________________________________
97 AliTRDcalibDB::AliTRDcalibDB()
102 // Default constructor
104 // TODO Default runnumber is set to 0, this should be changed later
105 // to an invalid value (e.g. -1) to prevent
106 // TODO invalid calibration data to be used.
109 fPadResponse.fPRFbin = 0;
110 fPadResponse.fPRFlo = 0.0;
111 fPadResponse.fPRFhi = 0.0;
112 fPadResponse.fPRFwid = 0.0;
113 fPadResponse.fPRFpad = 0;
114 fPadResponse.fPRFsmp = 0;
116 for (Int_t i=0; i<kCDBCacheSize; ++i)
122 // Create the sampled PRF
127 //_____________________________________________________________________________
128 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
133 // Copy constructor (not that it make any sense for a singleton...)
136 fPadResponse.fPRFbin = 0;
137 fPadResponse.fPRFlo = 0.0;
138 fPadResponse.fPRFhi = 0.0;
139 fPadResponse.fPRFwid = 0.0;
140 fPadResponse.fPRFpad = 0;
141 fPadResponse.fPRFsmp = 0;
143 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");
168 //_____________________________________________________________________________
169 AliTRDcalibDB::~AliTRDcalibDB()
175 if (fPadResponse.fPRFsmp) {
176 delete [] fPadResponse.fPRFsmp;
177 fPadResponse.fPRFsmp = 0;
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.
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");
229 // Parameters defined per pad
231 return CacheCDBEntry(kIDPRFWidth, "TRD/Calib/PRFWidth");
235 case kIDSuperModuleStatus :
236 return CacheCDBEntry(kIDSuperModuleStatus, "TRD/Calib/SuperModuleStatus");
238 case kIDChamberStatus :
239 return CacheCDBEntry(kIDChamberStatus, "TRD/Calib/ChamberStatus");
242 return CacheCDBEntry(kIDMCMStatus, "TRD/Calib/MCMStatus");
245 return CacheCDBEntry(kIDPadStatus, "TRD/Calib/PadStatus");
249 case kIDMonitoringData :
250 return CacheCDBEntry(kIDMonitoringData, "TRD/Calib/MonitoringData");
253 return CacheCDBEntry(kIDGlobals, "TRD/Calib/Globals");
256 return CacheCDBEntry(kIDPIDLQ, "TRD/Calib/PIDLQ");
265 //_____________________________________________________________________________
266 AliCDBEntry* AliTRDcalibDB::GetCDBEntry(const char* cdbPath)
269 // Retrieves an entry with path <cdbPath> from the CDB.
272 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
274 AliError(Form("Failed to get entry: %s",cdbPath));
278 AliInfo(Form("AliTRDcalibDB: Retrieved object: %s",cdbPath));
284 //_____________________________________________________________________________
285 const TObject* AliTRDcalibDB::CacheCDBEntry(Int_t id, const char* cdbPath)
288 // Caches the entry <id> with cdb path <cdbPath>
291 if (!fCDBCache[id]) {
292 fCDBEntries[id] = GetCDBEntry(cdbPath);
294 fCDBCache[id] = fCDBEntries[id]->GetObject();
296 return fCDBCache[id];
300 //_____________________________________________________________________________
301 void AliTRDcalibDB::SetRun(Long64_t run)
304 // Sets current run number. Calibration data is read from the corresponding file.
305 // When the run number changes the caching is invalidated.
316 //_____________________________________________________________________________
317 void AliTRDcalibDB::Invalidate()
320 // Invalidates cache (when run number is changed).
323 for (Int_t i=0; i<kCDBCacheSize; ++i) {
324 if (fCDBEntries[i]) {
325 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
326 if (fCDBEntries[i]->IsOwner() == kFALSE && fCDBCache[i]) {
329 delete fCDBEntries[i];
338 //_____________________________________________________________________________
339 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
342 // Returns the drift velocity for the given pad.
345 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDVdriftPad));
349 AliTRDCalROC* roc = calPad->GetCalROC(det);
353 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
357 return calChamber->GetValue(det) * roc->GetValue(col, row);
361 //_____________________________________________________________________________
362 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
365 // Returns the average drift velocity for the given detector
368 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
372 return calDet->GetValue(det);
376 //_____________________________________________________________________________
377 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
380 // Returns t0 for the given pad.
383 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDT0Pad));
387 AliTRDCalROC* roc = calPad->GetCalROC(det);
391 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
395 return calChamber->GetValue(det) * roc->GetValue(col, row);
399 //_____________________________________________________________________________
400 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
403 // Returns the average t0 for the given detector
406 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
410 return calDet->GetValue(det);
414 //_____________________________________________________________________________
415 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
418 // Returns the gain factor for the given pad.
421 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDGainFactorPad));
425 AliTRDCalROC* roc = calPad->GetCalROC(det);
429 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
433 return calChamber->GetValue(det) * roc->GetValue(col, row);
437 //_____________________________________________________________________________
438 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
441 // Returns the average gain factor for the given detector
444 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
448 return calDet->GetValue(det);
452 //_____________________________________________________________________________
453 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
456 // Returns the PRF width for the given pad.
459 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDPRFWidth));
463 AliTRDCalROC* roc = calPad->GetCalROC(det);
467 return roc->GetValue(col, row);
471 //_____________________________________________________________________________
472 Float_t AliTRDcalibDB::GetSamplingFrequency()
475 // Returns the sampling frequency of the TRD read-out.
478 const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals));
482 return calGlobal->GetSamplingFrequency();
486 //_____________________________________________________________________________
487 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
490 // Returns the number of time bins which are read-out.
493 const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals));
497 return calGlobal->GetNumberOfTimeBins();
501 //_____________________________________________________________________________
502 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
505 // Returns the status of the given pad
508 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
512 const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
516 return roc->GetStatus(col, row);
520 //_____________________________________________________________________________
521 Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row)
524 // Returns the status of the given MCM
527 Int_t mcm = ((Int_t) col / 18);
529 const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
533 const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
537 return roc->GetStatus(mcm, row);
541 //_____________________________________________________________________________
542 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
545 // Returns the status of the given chamber
548 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
552 return cal->GetStatus(det);
556 //_____________________________________________________________________________
557 Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm)
560 // Returns the status of the given chamber
563 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
567 return cal->GetStatus(sm);
571 //_____________________________________________________________________________
572 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
575 // Returns status, see name of functions for details ;-)
578 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
582 return cal->IsMasked(det, col, row);
586 //_____________________________________________________________________________
587 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
590 // Returns status, see name of functions for details ;-)
593 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
597 return cal->IsBridgedLeft(det, col, row);
601 //_____________________________________________________________________________
602 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
605 // Returns status, see name of functions for details ;-)
608 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
612 return cal->IsBridgedRight(det, col, row);
616 //_____________________________________________________________________________
617 Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row)
620 // Returns status, see name of functions for details ;-)
623 const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
627 return cal->IsMasked(det, col, row);
631 //_____________________________________________________________________________
632 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
635 // Returns status, see name of functions for details ;-)
638 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
642 return cal->IsInstalled(det);
646 //_____________________________________________________________________________
647 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
650 // Returns status, see name of functions for details ;-)
653 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
657 return cal->IsMasked(det);
661 //_____________________________________________________________________________
662 Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det)
665 // Returns status, see name of functions for details ;-)
668 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
672 return cal->IsInstalled(det);
676 //_____________________________________________________________________________
677 Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det)
680 // Returns status, see name of functions for details ;-)
683 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
687 return cal->IsMasked(det);
691 //_____________________________________________________________________________
692 const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject()
695 // Returns the object storing the distributions for PID with likelihood
698 return dynamic_cast<const AliTRDCalPIDLQ*> (GetCachedCDBObject(kIDPIDLQ));
702 //_____________________________________________________________________________
703 const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject()
706 // Returns the object storing the monitoring data
709 return dynamic_cast<const AliTRDCalMonitoring*> (GetCachedCDBObject(kIDMonitoringData));
713 //_____________________________________________________________________________
714 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift)
717 // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vd>
718 // and a B-field <b> for Xe/CO2 (15%).
719 // The values are according to a GARFIELD simulation.
721 // This function basically does not belong to the calibration class. It should be moved somewhere else.
722 // However, currently it is in use by simulation and reconstruction.
725 AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();
728 Float_t fieldAbs = TMath::Abs(commonParam->GetField());
729 Float_t fieldSgn = 1.0;
730 if (fieldAbs > 0.0) {
731 fieldSgn = commonParam->GetField() / fieldAbs;
735 Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
736 Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
737 Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
738 Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
740 Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
741 ib = TMath::Max( 0,ib);
742 ib = TMath::Min(kNb,ib);
744 Float_t alphaL = p0[ib]
746 + p2[ib] * vdrift*vdrift
747 + p3[ib] * vdrift*vdrift*vdrift;
749 return TMath::Tan(fieldSgn * alphaL);
753 //_____________________________________________________________________________
754 void AliTRDcalibDB::SamplePRF()
757 // Samples the pad response function (should maybe go somewhere else ...)
760 const Int_t kPRFbin = 61;
762 Float_t prf[kNplan][kPRFbin] = { {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
763 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
764 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
765 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
766 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
767 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
768 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
769 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
770 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
771 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
772 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
773 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
774 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
775 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
776 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
778 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
779 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
780 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
781 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
782 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
783 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
784 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
785 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
786 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
787 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
788 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
789 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
790 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
791 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
792 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
794 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
795 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
796 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
797 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
798 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
799 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
800 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
801 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
802 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
803 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
804 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
805 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
806 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
807 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
808 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
810 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
811 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
812 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
813 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
814 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
815 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
816 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
817 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
818 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
819 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
820 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
821 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
822 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
823 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
824 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
826 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
827 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
828 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
829 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
830 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
831 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
832 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
833 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
834 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
835 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
836 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
837 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
838 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
839 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
840 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
842 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
843 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
844 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
845 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
846 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
847 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
848 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
849 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
850 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
851 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
852 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
853 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
854 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
855 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
856 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
859 // More sampling precision with linear interpolation
860 fPadResponse.fPRFlo = -1.5;
861 fPadResponse.fPRFhi = 1.5;
862 Float_t pad[kPRFbin];
863 Int_t sPRFbin = kPRFbin;
864 Float_t sPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) sPRFbin);
865 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
866 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPadResponse.fPRFlo;
868 fPadResponse.fPRFbin = 500;
869 fPadResponse.fPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) fPadResponse.fPRFbin);
870 fPadResponse.fPRFpad = ((Int_t) (1.0 / fPadResponse.fPRFwid));
872 if (fPadResponse.fPRFsmp) delete [] fPadResponse.fPRFsmp;
873 fPadResponse.fPRFsmp = new Float_t[kNplan*fPadResponse.fPRFbin];
879 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
881 for (Int_t iBin = 0; iBin < fPadResponse.fPRFbin; iBin++) {
883 Float_t bin = (((Float_t) iBin) + 0.5) * fPadResponse.fPRFwid + fPadResponse.fPRFlo;
887 diff = bin - pad[ipos2++];
888 } while ((diff > 0) && (ipos2 < kPRFbin));
889 if (ipos2 == kPRFbin) {
890 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1];
892 else if (ipos2 == 1) {
893 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1];
897 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
899 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2]
900 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
909 //_____________________________________________________________________________
910 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
911 , Int_t plane, Double_t *pad) const
914 // Applies the pad response
917 Int_t iBin = ((Int_t) (( - dist - fPadResponse.fPRFlo) / fPadResponse.fPRFwid));
918 Int_t iOff = plane * fPadResponse.fPRFbin;
920 Int_t iBin0 = iBin - fPadResponse.fPRFpad + iOff;
921 Int_t iBin1 = iBin + iOff;
922 Int_t iBin2 = iBin + fPadResponse.fPRFpad + iOff;
927 if ((iBin1 >= 0) && (iBin1 < (fPadResponse.fPRFbin*kNplan))) {
930 pad[0] = signal * fPadResponse.fPRFsmp[iBin0];
932 pad[1] = signal * fPadResponse.fPRFsmp[iBin1];
933 if (iBin2 < (fPadResponse.fPRFbin*kNplan)) {
934 pad[2] = signal * fPadResponse.fPRFsmp[iBin2];