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 //
26 ///////////////////////////////////////////////////////////////////////////////
30 #include <AliCDBManager.h>
32 #include "AliTRDcalibDB.h"
33 #include "AliTRDgeometry.h"
34 #include "AliTRDpadPlane.h"
35 #include "AliTRDCommonParam.h"
37 #include "Cal/AliTRDCalROC.h"
39 #include "Cal/AliTRDCalChamberPos.h"
40 #include "Cal/AliTRDCalStackPos.h"
41 #include "Cal/AliTRDCalSuperModulePos.h"
43 #include "Cal/AliTRDCalPad.h"
44 #include "Cal/AliTRDCalDet.h"
45 #include "Cal/AliTRDCalGlobals.h"
46 #include "Cal/AliTRDCalPIDLQ.h"
47 #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 void AliTRDcalibDB::Terminate()
80 // Singleton implementation
81 // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
82 // This function can be called several times.
94 //_____________________________________________________________________________
95 AliTRDcalibDB::AliTRDcalibDB()
101 // TODO Default runnumber is set to 0, this should be changed later to an invalid value (e.g. -1) to prevent
102 // TODO invalid calibration data to be used.
105 fPadResponse.fPRFbin = 0;
106 fPadResponse.fPRFlo = 0.0;
107 fPadResponse.fPRFhi = 0.0;
108 fPadResponse.fPRFwid = 0.0;
109 fPadResponse.fPRFpad = 0;
110 fPadResponse.fPRFsmp = 0;
112 for (Int_t i=0; i<kCDBCacheSize; ++i)
118 // Create the sampled PRF
122 //_____________________________________________________________________________
123 AliTRDcalibDB::~AliTRDcalibDB()
129 if (fPadResponse.fPRFsmp) {
130 delete [] fPadResponse.fPRFsmp;
131 fPadResponse.fPRFsmp = 0;
137 //_caching functions____________________________________________________________
138 const TObject* AliTRDcalibDB::GetCachedCDBObject(Int_t id)
141 // Retrieves a cdb object with the given id. The objects are cached as long as the run number is not changed.
143 // Put together the available objects here by using the lines
144 // a) For usual calibration objects:
145 // ase kID<Name> : return CacheCDBEntry(kID<Name>, "TRD/Calib/<Path>"); break;
146 // See function CacheCDBEntry for details.
148 // b) For calibration data which depends on two objects: One containing a value per detector and one the local fluctuations per pad:
149 // case kID<Name> : return CacheMergeCDBEntry(kID<Name>, "TRD/Calib/<padPath>", "TRD/Calib/<chamberPath>"); break;
150 // See function CacheMergeCDBEntry for details.
155 // parameters defined per pad and chamber
156 case kIDVdriftPad : return CacheCDBEntry(kIDVdriftPad, "TRD/Calib/LocalVdrift"); break;
157 case kIDVdriftChamber : return CacheCDBEntry(kIDVdriftChamber, "TRD/Calib/ChamberVdrift"); break;
159 case kIDT0Pad : return CacheCDBEntry(kIDT0Pad, "TRD/Calib/LocalT0"); break;
160 case kIDT0Chamber : return CacheCDBEntry(kIDT0Chamber, "TRD/Calib/ChamberT0"); break;
162 case kIDGainFactorPad : return CacheCDBEntry(kIDGainFactorPad, "TRD/Calib/LocalGainFactor"); break;
163 case kIDGainFactorChamber : return CacheCDBEntry(kIDGainFactorChamber, "TRD/Calib/ChamberGainFactor"); break;
165 // parameters defined per pad
166 case kIDPRFWidth : return CacheCDBEntry(kIDPRFWidth, "TRD/Calib/PRFWidth"); break;
169 case kIDSuperModuleStatus : return CacheCDBEntry(kIDSuperModuleStatus, "TRD/Calib/SuperModuleStatus"); break;
170 case kIDChamberStatus : return CacheCDBEntry(kIDChamberStatus, "TRD/Calib/ChamberStatus"); break;
171 case kIDMCMStatus : return CacheCDBEntry(kIDMCMStatus, "TRD/Calib/MCMStatus"); break;
172 case kIDPadStatus : return CacheCDBEntry(kIDPadStatus, "TRD/Calib/PadStatus"); break;
175 case kIDMonitoringData : return CacheCDBEntry(kIDMonitoringData, "TRD/Calib/MonitoringData"); break;
176 case kIDGlobals : return CacheCDBEntry(kIDGlobals, "TRD/Calib/Globals"); break;
177 case kIDSuperModulePos : return CacheCDBEntry(kIDSuperModulePos, "TRD/Calib/SuperModulePos"); break;
178 case kIDChamberPos : return CacheCDBEntry(kIDChamberPos, "TRD/Calib/ChamberPos"); break;
179 case kIDStackPos : return CacheCDBEntry(kIDStackPos, "TRD/Calib/StackPos"); break;
180 case kIDPIDLQ : return CacheCDBEntry(kIDPIDLQ, "TRD/Calib/PIDLQ"); break;
185 //_____________________________________________________________________________
186 AliCDBEntry* AliTRDcalibDB::GetCDBEntry(const char* cdbPath)
189 // Retrieves an entry with path <cdbPath> from the CDB.
192 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath, fRun);
195 std::cerr << "AliTRDcalibDB: Failed to get entry: " << cdbPath << std::endl;
199 std::cout << "AliTRDcalibDB: Retrieved object: " << cdbPath << std::endl;
203 //_____________________________________________________________________________
204 const TObject* AliTRDcalibDB::CacheCDBEntry(Int_t id, const char* cdbPath)
207 // Caches the entry <id> with cdb path <cdbPath>
212 fCDBEntries[id] = GetCDBEntry(cdbPath);
214 fCDBCache[id] = fCDBEntries[id]->GetObject();
216 return fCDBCache[id];
219 //_____________________________________________________________________________
220 void AliTRDcalibDB::SetRun(Long64_t run)
223 // Sets current run number. Calibration data is read from the corresponding file.
224 // When the run number changes the caching is invalidated.
234 //_____________________________________________________________________________
235 void AliTRDcalibDB::Invalidate()
238 // Invalidates cache (when run number is changed).
241 for (Int_t i=0; i<kCDBCacheSize; ++i)
245 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE)
247 if (fCDBEntries[i]->IsOwner() == kFALSE && fCDBCache[i])
250 delete fCDBEntries[i];
258 //_____________________________________________________________________________
259 Bool_t AliTRDcalibDB::GetChamberPos(Int_t det, Float_t* xyz)
262 // Returns the deviation of the chamber position from the nominal position.
265 const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamberPos));
269 const Float_t* kvalues = chamber->GetPos(det);
280 //_____________________________________________________________________________
281 Bool_t AliTRDcalibDB::GetChamberRot(Int_t det, Float_t* xyz)
284 // Returns the rotation of the chamber from the nominal position.
287 const AliTRDCalChamberPos* chamber = dynamic_cast<const AliTRDCalChamberPos*>(GetCachedCDBObject(kIDChamberPos));
291 const Float_t* kvalues = chamber->GetRot(det);
302 //_____________________________________________________________________________
303 Bool_t AliTRDcalibDB::GetStackPos(Int_t chamber, Int_t sector, Float_t* xyz)
306 // Returns the deviation of the stack position from the nominal position.
309 const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStackPos));
313 const Float_t* kvalues = stack->GetPos(chamber, sector);
324 //_____________________________________________________________________________
325 Bool_t AliTRDcalibDB::GetStackRot(Int_t chamber, Int_t sector, Float_t* xyz)
328 // Returns the rotation of the stack from the nominal position.
331 const AliTRDCalStackPos* stack = dynamic_cast<const AliTRDCalStackPos*>(GetCachedCDBObject(kIDStackPos));
335 const Float_t* kvalues = stack->GetRot(chamber, sector);
346 //_____________________________________________________________________________
347 Bool_t AliTRDcalibDB::GetSuperModulePos(Int_t sm, Float_t* xyz)
350 // Returns the deviation of the supermodule position from the nominal position.
353 const AliTRDCalSuperModulePos* smPos = dynamic_cast<const AliTRDCalSuperModulePos*>(GetCachedCDBObject(kIDSuperModulePos));
357 const Float_t* kvalues = smPos->GetPos(sm);
368 //_____________________________________________________________________________
369 Bool_t AliTRDcalibDB::GetSuperModuleRot(Int_t sm, Float_t* xyz)
372 // Returns the rotation of the supermodule from the nominal position.
375 const AliTRDCalSuperModulePos* smPos = dynamic_cast<const AliTRDCalSuperModulePos*>(GetCachedCDBObject(kIDSuperModulePos));
379 const Float_t* kvalues = smPos->GetRot(sm);
390 //_____________________________________________________________________________
391 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
394 // Returns the drift velocity for the given pad.
397 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDVdriftPad));
401 AliTRDCalROC* roc = calPad->GetCalROC(det);
405 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
409 return calChamber->GetValue(det) * roc->GetValue(col, row);
412 //_____________________________________________________________________________
413 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
416 // Returns the average drift velocity for the given detector
419 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDVdriftChamber));
423 return calDet->GetValue(det);
426 //_____________________________________________________________________________
427 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
430 // Returns t0 for the given pad.
433 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDT0Pad));
437 AliTRDCalROC* roc = calPad->GetCalROC(det);
441 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
445 return calChamber->GetValue(det) * roc->GetValue(col, row);
448 //_____________________________________________________________________________
449 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
452 // Returns the average t0 for the given detector
455 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDT0Chamber));
459 return calDet->GetValue(det);
462 //_____________________________________________________________________________
463 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
466 // Returns the gain factor for the given pad.
469 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDGainFactorPad));
473 AliTRDCalROC* roc = calPad->GetCalROC(det);
477 const AliTRDCalDet* calChamber = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
481 return calChamber->GetValue(det) * roc->GetValue(col, row);
484 //_____________________________________________________________________________
485 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
488 // Returns the average gain factor for the given detector
491 const AliTRDCalDet* calDet = dynamic_cast<const AliTRDCalDet*> (GetCachedCDBObject(kIDGainFactorChamber));
495 return calDet->GetValue(det);
498 //_____________________________________________________________________________
499 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
502 // Returns the PRF width for the given pad.
505 const AliTRDCalPad* calPad = dynamic_cast<const AliTRDCalPad*> (GetCachedCDBObject(kIDPRFWidth));
509 AliTRDCalROC* roc = calPad->GetCalROC(det);
513 return roc->GetValue(col, row);
516 //_____________________________________________________________________________
517 Float_t AliTRDcalibDB::GetSamplingFrequency()
520 // Returns the sampling frequency of the TRD read-out.
523 const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals));
527 return calGlobal->GetSamplingFrequency();
530 //_____________________________________________________________________________
531 Int_t AliTRDcalibDB::GetNumberOfTimeBins()
534 // Returns the number of time bins which are read-out.
537 const AliTRDCalGlobals* calGlobal = dynamic_cast<const AliTRDCalGlobals*> (GetCachedCDBObject(kIDGlobals));
541 return calGlobal->GetNumberOfTimeBins();
544 //_____________________________________________________________________________
545 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
548 // Returns the status of the given pad
551 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
555 const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
559 return roc->GetStatus(col, row);
562 //_____________________________________________________________________________
563 Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row)
566 // Returns the status of the given MCM
569 const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
573 const AliTRDCalSingleChamberStatus* roc = cal->GetCalROC(det);
577 return roc->GetStatus(col, row);
580 //_____________________________________________________________________________
581 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
584 // Returns the status of the given chamber
587 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
591 return cal->GetStatus(det);
594 //_____________________________________________________________________________
595 Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm)
598 // Returns the status of the given chamber
601 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
605 return cal->GetStatus(sm);
608 //_____________________________________________________________________________
609 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
612 // Returns status, see name of functions for details ;-)
615 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
619 return cal->IsMasked(det, col, row);
622 //_____________________________________________________________________________
623 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
626 // Returns status, see name of functions for details ;-)
629 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
633 return cal->IsBridgedLeft(det, col, row);
636 //_____________________________________________________________________________
637 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
640 // Returns status, see name of functions for details ;-)
643 const AliTRDCalPadStatus* cal = dynamic_cast<const AliTRDCalPadStatus*> (GetCachedCDBObject(kIDPadStatus));
647 return cal->IsBridgedRight(det, col, row);
650 //_____________________________________________________________________________
651 Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row)
654 // Returns status, see name of functions for details ;-)
657 const AliTRDCalMCMStatus* cal = dynamic_cast<const AliTRDCalMCMStatus*> (GetCachedCDBObject(kIDMCMStatus));
661 return cal->IsMasked(det, col, row);
664 //_____________________________________________________________________________
665 Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det)
668 // Returns status, see name of functions for details ;-)
671 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
675 return cal->IsInstalled(det);
678 //_____________________________________________________________________________
679 Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det)
682 // Returns status, see name of functions for details ;-)
685 const AliTRDCalChamberStatus* cal = dynamic_cast<const AliTRDCalChamberStatus*> (GetCachedCDBObject(kIDChamberStatus));
689 return cal->IsMasked(det);
692 //_____________________________________________________________________________
693 Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det)
696 // Returns status, see name of functions for details ;-)
699 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
703 return cal->IsInstalled(det);
706 //_____________________________________________________________________________
707 Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det)
710 // Returns status, see name of functions for details ;-)
713 const AliTRDCalSuperModuleStatus* cal = dynamic_cast<const AliTRDCalSuperModuleStatus*> (GetCachedCDBObject(kIDSuperModuleStatus));
717 return cal->IsMasked(det);
720 //_____________________________________________________________________________
721 const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject()
724 // Returns the object storing the distributions for PID with likelihood
727 return dynamic_cast<const AliTRDCalPIDLQ*> (GetCachedCDBObject(kIDPIDLQ));
730 //_____________________________________________________________________________
731 const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject()
734 // Returns the object storing the monitoring data
737 return dynamic_cast<const AliTRDCalMonitoring*> (GetCachedCDBObject(kIDMonitoringData));
740 //_____________________________________________________________________________
741 Float_t AliTRDcalibDB::GetOmegaTau(Float_t vdrift)
744 // Returns omega*tau (tan(Lorentz-angle)) for a given drift velocity <vd>
745 // and a B-field <b> for Xe/CO2 (15%).
746 // The values are according to a GARFIELD simulation.
748 // This function basically does not belong to the calibration class. It should be moved somewhere else.
749 // However, currently it is in use by simulation and reconstruction.
752 AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();
755 Float_t fieldAbs = TMath::Abs(commonParam->GetField());
756 Float_t fieldSgn = 1.0;
757 if (fieldAbs > 0.0) {
758 fieldSgn = commonParam->GetField() / fieldAbs;
762 Float_t p0[kNb] = { 0.004810, 0.007412, 0.010252, 0.013409, 0.016888 };
763 Float_t p1[kNb] = { 0.054875, 0.081534, 0.107333, 0.131983, 0.155455 };
764 Float_t p2[kNb] = { -0.008682, -0.012896, -0.016987, -0.020880, -0.024623 };
765 Float_t p3[kNb] = { 0.000155, 0.000238, 0.000330, 0.000428, 0.000541 };
767 Int_t ib = ((Int_t) (10 * (fieldAbs - 0.15)));
768 ib = TMath::Max( 0,ib);
769 ib = TMath::Min(kNb,ib);
771 Float_t alphaL = p0[ib]
773 + p2[ib] * vdrift*vdrift
774 + p3[ib] * vdrift*vdrift*vdrift;
776 return TMath::Tan(fieldSgn * alphaL);
780 //_____________________________________________________________________________
781 void AliTRDcalibDB::SamplePRF()
784 // Samples the pad response function
787 const Int_t kPRFbin = 61;
789 Float_t prf[kNplan][kPRFbin] = { {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
790 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
791 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
792 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
793 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
794 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
795 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
796 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
797 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
798 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
799 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
800 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
801 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
802 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
803 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
805 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
806 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
807 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
808 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
809 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
810 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
811 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
812 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
813 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
814 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
815 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
816 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
817 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
818 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
819 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
821 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
822 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
823 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
824 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
825 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
826 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
827 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
828 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
829 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
830 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
831 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
832 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
833 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
834 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
835 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
837 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
838 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
839 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
840 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
841 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
842 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
843 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
844 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
845 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
846 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
847 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
848 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
849 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
850 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
851 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
853 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
854 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
855 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
856 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
857 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
858 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
859 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
860 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
861 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
862 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
863 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
864 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
865 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
866 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
867 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
869 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
870 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
871 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
872 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
873 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
874 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
875 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
876 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
877 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
878 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
879 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
880 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
881 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
882 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
883 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
886 // More sampling precision with linear interpolation
887 fPadResponse.fPRFlo = -1.5;
888 fPadResponse.fPRFhi = 1.5;
889 Float_t pad[kPRFbin];
890 Int_t sPRFbin = kPRFbin;
891 Float_t sPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) sPRFbin);
892 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
893 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPadResponse.fPRFlo;
895 fPadResponse.fPRFbin = 500;
896 fPadResponse.fPRFwid = (fPadResponse.fPRFhi - fPadResponse.fPRFlo) / ((Float_t) fPadResponse.fPRFbin);
897 fPadResponse.fPRFpad = ((Int_t) (1.0 / fPadResponse.fPRFwid));
899 if (fPadResponse.fPRFsmp) delete [] fPadResponse.fPRFsmp;
900 fPadResponse.fPRFsmp = new Float_t[kNplan*fPadResponse.fPRFbin];
906 for (Int_t iPla = 0; iPla < kNplan; iPla++) {
908 for (Int_t iBin = 0; iBin < fPadResponse.fPRFbin; iBin++) {
910 Float_t bin = (((Float_t) iBin) + 0.5) * fPadResponse.fPRFwid + fPadResponse.fPRFlo;
914 diff = bin - pad[ipos2++];
915 } while ((diff > 0) && (ipos2 < kPRFbin));
916 if (ipos2 == kPRFbin) {
917 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1];
919 else if (ipos2 == 1) {
920 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2-1];
924 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
926 fPadResponse.fPRFsmp[iPla*fPadResponse.fPRFbin+iBin] = prf[iPla][ipos2]
927 + diff * (prf[iPla][ipos2] - prf[iPla][ipos1])
936 //_____________________________________________________________________________
937 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
938 , Int_t plane, Double_t *pad) const
941 // Applies the pad response
944 Int_t iBin = ((Int_t) (( - dist - fPadResponse.fPRFlo) / fPadResponse.fPRFwid));
945 Int_t iOff = plane * fPadResponse.fPRFbin;
947 Int_t iBin0 = iBin - fPadResponse.fPRFpad + iOff;
948 Int_t iBin1 = iBin + iOff;
949 Int_t iBin2 = iBin + fPadResponse.fPRFpad + iOff;
954 if ((iBin1 >= 0) && (iBin1 < (fPadResponse.fPRFbin*kNplan))) {
957 pad[0] = signal * fPadResponse.fPRFsmp[iBin0];
959 pad[1] = signal * fPadResponse.fPRFsmp[iBin1];
960 if (iBin2 < (fPadResponse.fPRFbin*kNplan)) {
961 pad[2] = signal * fPadResponse.fPRFsmp[iBin2];