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 "AliTRDPIDReference.h"
39 #include "AliTRDPIDResponseObject.h"
40 #include "AliTRDcalibDB.h"
41 #include "AliTRDtrapConfig.h"
42 #include "AliTRDtrapConfigHandler.h"
43 #include "AliTRDCommonParam.h"
45 #include "Cal/AliTRDCalROC.h"
46 #include "Cal/AliTRDCalPad.h"
47 #include "Cal/AliTRDCalDet.h"
48 #include "Cal/AliTRDCalDCS.h"
49 #include "Cal/AliTRDCalDCSv2.h"
50 #include "Cal/AliTRDCalDCSFEEv2.h"
51 #include "Cal/AliTRDCalPID.h"
52 #include "Cal/AliTRDCalMonitoring.h"
53 #include "Cal/AliTRDCalChamberStatus.h"
54 #include "Cal/AliTRDCalPadStatus.h"
55 #include "Cal/AliTRDCalSingleChamberStatus.h"
56 #include "Cal/AliTRDCalTrkAttach.h"
57 #include "Cal/AliTRDCalOnlineGainTable.h"
59 ClassImp(AliTRDcalibDB)
61 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
62 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
64 //_ singleton implementation __________________________________________________
65 AliTRDcalibDB* AliTRDcalibDB::Instance()
68 // Singleton implementation
69 // Returns an instance of this class, it is created if neccessary
72 if (fgTerminated != kFALSE) {
76 if (fgInstance == 0) {
77 fgInstance = new AliTRDcalibDB();
84 //_____________________________________________________________________________
85 void AliTRDcalibDB::Terminate()
88 // Singleton implementation
89 // Deletes the instance of this class and sets the terminated flag,
90 // instances cannot be requested anymore
91 // This function can be called several times.
96 if (fgInstance != 0) {
103 //_____________________________________________________________________________
104 AliTRDcalibDB::AliTRDcalibDB()
114 ,fOnlineGainTableID(0)
117 ,fTrapConfigVersion("")
120 // Default constructor
122 // TODO Default runnumber is set to 0, this should be changed later
123 // to an invalid value (e.g. -1) to prevent
124 // TODO invalid calibration data to be used.
127 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
132 // Create the sampled PRF
137 //_____________________________________________________________________________
138 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
148 ,fOnlineGainTableID(0)
151 ,fTrapConfigVersion("")
154 // Copy constructor (not that it make any sense for a singleton...)
157 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
162 // Create the sampled PRF
167 //_____________________________________________________________________________
168 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
171 // Assignment operator (same as above ...)
175 AliFatal("No assignment operator defined");
182 //_____________________________________________________________________________
183 AliTRDcalibDB::~AliTRDcalibDB()
203 //_caching functions____________________________________________________________
204 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
207 // Retrieves a cdb object with the given id. The objects are cached as
208 // long as the run number is not changed.
210 // Put together the available objects here by using the lines
211 // a) For usual calibration objects:
213 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
215 // See function CacheCDBEntry for details.
217 // b) For calibration data which depends on two objects: One containing
218 // a value per detector and one the local fluctuations per pad:
220 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
222 // See function CacheMergeCDBEntry for details.
227 // Parameters defined per pad and chamber
229 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
231 case kIDVdriftChamber :
232 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
235 return CacheCDBEntry(kIDExBChamber ,"TRD/Calib/ChamberExB");
238 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
241 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
243 case kIDGainFactorPad :
244 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
246 case kIDGainFactorChamber :
247 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
250 case kIDOnlineGainFactor :
251 switch(GetOnlineGainTableID()) {
253 // For testing purposes only !!!
254 AliInfo("No gain table name from OCDB. Use default table!");
255 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
258 // Online gain table ID 1
259 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
262 // Online gain table ID 2
263 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2011-01");
266 // Online gain table ID 3
267 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2011-01");
270 // Online gain table ID 4
271 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-02");
274 // Online gain table ID 5
275 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-03");
278 // Online gain table ID 6
279 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2012-01");
282 // Online gain table ID 7
283 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2012-01");
286 // Online gain table ID 8
287 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2012-01");
292 case kIDNoiseChamber :
293 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
296 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
299 // Parameters defined per pad
301 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
305 case kIDChamberStatus :
306 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
309 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
313 case kIDMonitoringData :
314 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
317 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
320 return CacheCDBEntry(kIDFEE ,"TRD/Calib/TrapConfig");
323 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
326 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
329 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
332 return CacheCDBEntry(kIDPIDLQ1D ,"TRD/Calib/PIDLQ1D");
335 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
338 return CacheCDBEntry(kIDAttach ,"TRD/Calib/TrkAttach");
341 return CacheCDBEntry(kIDPHQ ,"TRD/Calib/PHQ");
349 //_____________________________________________________________________________
350 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
353 // Retrieves an entry with path <cdbPath> from the CDB.
356 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
358 AliError(Form("Failed to get entry: %s",cdbPath));
366 //_____________________________________________________________________________
367 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
370 // Caches the entry <id> with cdb path <cdbPath>
373 if (!fCDBCache[id]) {
374 fCDBEntries[id] = GetCDBEntry(cdbPath);
375 if (fCDBEntries[id]) {
376 fCDBCache[id] = fCDBEntries[id]->GetObject();
380 return fCDBCache[id];
384 //_____________________________________________________________________________
385 void AliTRDcalibDB::SetRun(Long64_t run)
388 // Sets current run number. Calibration data is read from the corresponding file.
389 // When the run number changes the caching is invalidated.
402 //_____________________________________________________________________________
403 void AliTRDcalibDB::Invalidate()
406 // Invalidates cache (when run number is changed).
409 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
410 if (fCDBEntries[i]) {
411 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
412 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
416 delete fCDBEntries[i];
423 fOnlineGainTableID = 0;
427 //_____________________________________________________________________________
428 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
431 // Returns the noise level in ADC counts for the given pad.
434 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
435 (GetCachedCDBObject(kIDNoisePad));
440 AliTRDCalROC *roc = calPad->GetCalROC(det);
445 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
446 (GetCachedCDBObject(kIDNoiseChamber));
451 return calChamber->GetValue(det) * roc->GetValue(col,row);
455 //_____________________________________________________________________________
456 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
459 // Returns the Vdrift calibration object for a given ROC
460 // containing one number per pad
463 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
464 (GetCachedCDBObject(kIDNoisePad));
469 AliTRDCalROC *roc = calPad->GetCalROC(det);
479 //_____________________________________________________________________________
480 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
483 // Returns the Vdrift calibration object
484 // containing one number per detector
487 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
488 (GetCachedCDBObject(kIDNoiseChamber));
498 //_____________________________________________________________________________
499 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
502 // Returns the drift velocity for the given pad.
505 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
506 (GetCachedCDBObject(kIDVdriftPad));
511 AliTRDCalROC *roc = calPad->GetCalROC(det);
516 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
517 (GetCachedCDBObject(kIDVdriftChamber));
522 return calChamber->GetValue(det) * roc->GetValue(col,row);
526 //_____________________________________________________________________________
527 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
530 // Returns the Vdrift calibration object for a given ROC
531 // containing one number per pad
534 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
535 (GetCachedCDBObject(kIDVdriftPad));
540 AliTRDCalROC *roc = calPad->GetCalROC(det);
550 //_____________________________________________________________________________
551 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
554 // Returns the Vdrift calibration object
555 // containing one number per detector
558 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
559 (GetCachedCDBObject(kIDVdriftChamber));
569 //_____________________________________________________________________________
570 TObjArray * AliTRDcalibDB::GetPHQ()
573 //return PHQ calibration object
575 TObjArray *arr = (TObjArray *) (GetCachedCDBObject(kIDPHQ));
579 //_____________________________________________________________________________
580 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
583 // Returns the average drift velocity for the given detector
586 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
587 (GetCachedCDBObject(kIDVdriftChamber));
592 return calDet->GetValue(det);
595 //_____________________________________________________________________________
596 const AliTRDCalDet *AliTRDcalibDB::GetExBDet()
599 // Returns the exB calibration object
600 // containing one number per detector
603 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> (GetCachedCDBObject(kIDExBChamber));
605 Double_t meanexb = 100.0;
606 if (calChamber) meanexb = calChamber->GetMean();
607 //printf("mean %f\n",meanexb);
609 if ((!calChamber) || (meanexb > 70.0)) {
611 const AliTRDCalDet *calChambervdrift = dynamic_cast<const AliTRDCalDet *>
612 (GetCachedCDBObject(kIDVdriftChamber));
613 if (!calChambervdrift) {
617 AliTRDCalDet *calDetExB = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
618 for(Int_t k = 0; k < 540; k++){
619 calDetExB->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(calChambervdrift->GetValue(k)));
624 else return calChamber;
627 //_____________________________________________________________________________
628 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
631 // Returns t0 for the given pad.
634 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
635 (GetCachedCDBObject(kIDT0Pad));
640 AliTRDCalROC *roc = calPad->GetCalROC(det);
645 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
646 (GetCachedCDBObject(kIDT0Chamber));
651 return calChamber->GetValue(det) + roc->GetValue(col,row);
655 //_____________________________________________________________________________
656 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
659 // Returns the t0 calibration object for a given ROC
660 // containing one number per pad
663 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
664 (GetCachedCDBObject(kIDT0Pad));
669 AliTRDCalROC *roc = calPad->GetCalROC(det);
679 //_____________________________________________________________________________
680 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
683 // Returns the t0 calibration object
684 // containing one number per detector
687 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
688 (GetCachedCDBObject(kIDT0Chamber));
698 //_____________________________________________________________________________
699 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
702 // Returns the average t0 for the given detector
705 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
706 (GetCachedCDBObject(kIDT0Pad));
711 AliTRDCalROC *roc = calPad->GetCalROC(det);
716 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
717 (GetCachedCDBObject(kIDT0Chamber));
723 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
724 sum += roc->GetValue(channel);
726 sum /= roc->GetNchannels();
727 sum += calDet->GetValue(det);
732 //_____________________________________________________________________________
733 AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det)
736 // Returns the online gain factor table for a given ROC.
739 if (!HasOnlineFilterGain()) {
743 const AliTRDCalOnlineGainTable *calOnline
744 = dynamic_cast<const AliTRDCalOnlineGainTable *>
745 (GetCachedCDBObject(kIDOnlineGainFactor));
750 return calOnline->GetGainTableROC(det);
754 //_____________________________________________________________________________
755 Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row)
758 // Returns the online gain factor for the given pad.
761 if (!HasOnlineFilterGain()) {
765 const AliTRDCalOnlineGainTable *calOnline
766 = dynamic_cast<const AliTRDCalOnlineGainTable *>
767 (GetCachedCDBObject(kIDOnlineGainFactor));
772 return calOnline->GetGainCorrectionFactor(det,row,col);
776 //_____________________________________________________________________________
777 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
780 // Returns the gain factor calibration object for a given ROC
783 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
784 (GetCachedCDBObject(kIDGainFactorPad));
789 AliTRDCalROC *roc = calPad->GetCalROC(det);
799 //_____________________________________________________________________________
800 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
803 // Returns the gain factor for the given pad.
806 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
807 (GetCachedCDBObject(kIDGainFactorPad));
812 AliTRDCalROC *roc = calPad->GetCalROC(det);
817 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
818 (GetCachedCDBObject(kIDGainFactorChamber));
823 return calChamber->GetValue(det) * roc->GetValue(col,row);
827 //_____________________________________________________________________________
828 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
831 // Returns the gain factor calibration object
832 // containing one number per detector
835 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
836 (GetCachedCDBObject(kIDGainFactorChamber));
846 //_____________________________________________________________________________
847 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
850 // Returns the average gain factor for the given detector
853 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
854 (GetCachedCDBObject(kIDGainFactorChamber));
859 return calDet->GetValue(det);
863 //_____________________________________________________________________________
864 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
867 // Returns the PRF calibration object for a given ROC
868 // containing one number per pad
871 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
872 (GetCachedCDBObject(kIDPRFWidth));
877 AliTRDCalROC *roc = calPad->GetCalROC(det);
887 //_____________________________________________________________________________
888 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
891 // Returns the PRF width for the given pad.
894 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
895 (GetCachedCDBObject(kIDPRFWidth));
900 AliTRDCalROC *roc = calPad->GetCalROC(det);
905 return roc->GetValue(col,row);
909 //_____________________________________________________________________________
910 Int_t AliTRDcalibDB::ExtractTimeBinsFromString(TString tbstr)
912 // default value - has not been set
915 // Check if there is any content in the string first
916 if (tbstr.Length() == 0) {
917 AliError("Parameter for number of timebins is empty!");
921 // Check if we have the correct config parameter
922 TString tbident = "tb";
923 TString tbsubstr = tbstr(0,2);
924 if (!tbsubstr.EqualTo(tbident)) {
925 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
930 // check if there is more than a number
931 if (!tbstr.IsDigit()) {
932 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
940 //_____________________________________________________________________________
941 Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
944 // Returns number of time bins from the DCS
947 // Get the corresponding parameter
948 TString cfgstr = "", cfgname = "";
949 GetGlobalConfiguration(cfgname);
950 GetDCSConfigParOption(cfgname, kTimebin, 0, cfgstr);
952 return ExtractTimeBinsFromString(cfgstr);
956 //_____________________________________________________________________________
957 void AliTRDcalibDB::GetFilterType(TString &filterType)
960 // Returns the filter type
963 TString cfgname = "";
964 GetGlobalConfiguration(cfgname);
965 GetDCSConfigParOption(cfgname, kFltrSet, 0, filterType);
969 //_____________________________________________________________________________
970 Int_t AliTRDcalibDB::GetOnlineGainTableID()
973 // Get the gain table ID from the DCS
976 if (fOnlineGainTableID > 0) {
977 return fOnlineGainTableID;
980 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
985 Int_t esor = 0; // Take SOR
986 Int_t calver = 0; // Check CalDCS version
987 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
988 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
992 // No data for old DCS object available, anyway
996 else if (calver == 2) {
999 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
1004 TString tableName = "";
1005 for (Int_t i = 0; i < 540; i++) {
1006 const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0);
1007 tableName = calDCSFEEv2->GetGainTableName();
1008 if (tableName.Length() > 0) {
1012 if (tableName.CompareTo("Krypton_2011-01") == 0) {
1013 fOnlineGainTableID = 1;
1014 return fOnlineGainTableID;
1016 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0) {
1017 fOnlineGainTableID = 2;
1018 return fOnlineGainTableID;
1020 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2011-01") == 0) {
1021 fOnlineGainTableID = 3;
1022 return fOnlineGainTableID;
1024 if (tableName.CompareTo("Krypton_2011-02") == 0) {
1025 fOnlineGainTableID = 4;
1026 return fOnlineGainTableID;
1028 if (tableName.CompareTo("Krypton_2011-03") == 0) {
1029 fOnlineGainTableID = 5;
1030 return fOnlineGainTableID;
1032 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2012-01") == 0) {
1033 fOnlineGainTableID = 6;
1034 return fOnlineGainTableID;
1036 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2012-01") == 0) {
1037 fOnlineGainTableID = 7;
1038 return fOnlineGainTableID;
1040 if (tableName.CompareTo("Krypton_2011-03") == 0) {
1041 fOnlineGainTableID = 8;
1042 return fOnlineGainTableID;
1048 AliError("NO DCS/DCSv2 OCDB entry found!");
1057 //_____________________________________________________________________________
1058 void AliTRDcalibDB::GetGlobalConfiguration(TString &config)
1061 // Get Configuration from the DCS
1064 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1066 AliError("No DCS CDB Object available!");
1071 Int_t idSOR = 0, idEOR=1; // The index of SOR and EOR
1072 Bool_t hasSOR = (dcsArr->At(idSOR));
1073 Bool_t hasEOR = (dcsArr->At(idEOR));
1074 TString cfgSOR = "", cfgEOR = ""; // The configuration at SOR/EOR
1076 // The SOR object is mandatory
1078 AliError("NO SOR object found in CDB file!");
1082 if (!hasEOR) AliWarning("NO EOR object found in CDB file!");
1084 // Check CalDCS version
1086 if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCS")) calver = 1;
1087 else if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1089 // Get the configuration strings
1092 const AliTRDCalDCS *calSOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idSOR));
1093 cfgSOR = calSOR->GetGlobalConfigName();
1095 const AliTRDCalDCS *calEOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idEOR));
1096 cfgEOR = calEOR->GetGlobalConfigName();
1099 else if (calver == 2) {
1101 const AliTRDCalDCSv2 *calv2SOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idSOR));
1102 cfgSOR = calv2SOR->GetGlobalConfigName();
1104 const AliTRDCalDCSv2 *calv2EOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idEOR));
1105 cfgEOR = calv2EOR->GetGlobalConfigName();
1109 AliError("NO DCS/DCSv2 OCDB entry found!");
1114 // If there is no EOR entry, return the SOR value
1115 if (!hasEOR || cfgEOR.Length()==0) {
1120 // Check if the configuration is the same for both
1121 if (cfgSOR.EqualTo(cfgEOR)) {
1126 // When both SOR and EOR have an entry but are different, the config is not defined
1127 AliError("Inconsistent configuration at start and end of run found!");
1133 //_____________________________________________________________________________
1134 void AliTRDcalibDB::GetGlobalConfigurationVersion(TString &version)
1137 // Get Version of Configuration from the DCS
1140 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1146 Int_t esor = 0; // Take SOR
1147 Int_t calver = 0; // Check CalDCS version
1148 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
1149 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1154 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
1159 version = calDCS->GetGlobalConfigVersion();
1162 else if (calver == 2) {
1165 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
1170 version = calDCSv2->GetGlobalConfigVersion();
1175 AliError("NO DCS/DCSv2 OCDB entry found!");
1181 //_____________________________________________________________________________
1182 Int_t AliTRDcalibDB::GetNumberOfParsDCS(TString cname)
1184 // Get the number of configuration parameters from the DCS config
1186 TString cdelim = "_";
1187 TObjArray *carr = cname.Tokenize(cdelim);
1188 return carr->GetEntries() - 1; // -1 for the "cf"
1192 //_____________________________________________________________________________
1193 Int_t AliTRDcalibDB::GetNumberOfOptsDCS(TString cname, Int_t cfgType)
1195 // Get the number of options of a given configuration parameter from DCS
1197 TString cdelim = "_";
1198 TString odelim = "-";
1200 TObjArray *carr = cname.Tokenize(cdelim);
1201 Int_t nconfig = carr->GetEntries();
1204 if ((nconfig == 0) || ((nconfig-1) < cfgType)) {
1205 AliError("Not enough parameters in DCS configuration name!");
1209 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1210 TObjArray *oarr = fullcfg.Tokenize(odelim);
1211 return oarr->GetEntries() -1; // -1 for the parameter name
1215 //_____________________________________________________________________________
1216 void AliTRDcalibDB::GetDCSConfigParOption(TString cname, Int_t cfgType, Int_t option, TString &cfgo)
1219 // Get a configuration (see enum in header file) or the options of a configuration
1220 // option == 0 returns the configuration itself
1221 // option > 0 returns the optional parameter Nr. (option) of the configuration (cfgType)
1224 // define the delimiters
1225 TString cdelim = "_";
1226 TString odelim = "-";
1228 TObjArray *carr = cname.Tokenize(cdelim);
1229 Int_t nconfig = carr->GetEntries();
1233 AliError("DCS configuration name empty!");
1236 } else if ((nconfig-1) < cfgType) {
1237 AliError("Not enough parameters in DCS configuration name!");
1242 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1243 TObjArray *oarr = fullcfg.Tokenize(odelim);
1244 Int_t noptions = oarr->GetEntries();
1247 if ((noptions-1) < option) {
1248 AliError("Not enough options in DCS configuration name!");
1253 cfgo = ((TObjString*)oarr->At(option))->GetString();
1258 //_____________________________________________________________________________
1259 Bool_t AliTRDcalibDB::HasOnlineFilterPedestal()
1262 // Checks whether pedestal filter was applied online
1265 TString filterconfig;
1266 GetFilterType(filterconfig);
1268 return filterconfig.Contains("p");
1272 //_____________________________________________________________________________
1273 Bool_t AliTRDcalibDB::HasOnlineFilterGain()
1276 // Checks whether online gain filter was applied
1279 TString filterconfig;
1280 GetFilterType(filterconfig);
1282 return filterconfig.Contains("g");
1286 //_____________________________________________________________________________
1287 Bool_t AliTRDcalibDB::HasOnlineTailCancellation()
1290 // Checks whether online tail cancellation was applied
1293 TString filterconfig;
1294 GetFilterType(filterconfig);
1296 return filterconfig.Contains("t");
1300 //_____________________________________________________________________________
1301 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
1304 // Returns the status of the given pad
1307 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1308 (GetCachedCDBObject(kIDPadStatus));
1313 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1318 return roc->GetStatus(col,row);
1322 //_____________________________________________________________________________
1323 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
1326 // Returns the pad status calibration object for a given ROC
1329 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1330 (GetCachedCDBObject(kIDPadStatus));
1335 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1345 //_____________________________________________________________________________
1346 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
1349 // Returns the status of the given chamber
1352 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
1353 (GetCachedCDBObject(kIDChamberStatus));
1358 return cal->GetStatus(det);
1362 //_____________________________________________________________________________
1363 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
1366 // Returns the TRD reconstruction parameters from the OCDB
1369 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
1370 if (!recos) return 0x0;
1372 // calculate entry based on event type info
1373 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
1375 return (AliTRDrecoParam *) recos->UncheckedAt(n);
1379 //_____________________________________________________________________________
1380 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
1383 // Returns status, see name of functions for details ;-)
1386 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1387 (GetCachedCDBObject(kIDPadStatus));
1392 return cal->IsMasked(det,col,row);
1396 //_____________________________________________________________________________
1397 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
1400 // Returns status, see name of functions for details ;-)
1403 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1404 (GetCachedCDBObject(kIDPadStatus));
1409 return cal->IsBridgedLeft(det,col,row);
1413 //_____________________________________________________________________________
1414 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
1417 // Returns status, see name of functions for details ;-)
1420 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1421 (GetCachedCDBObject(kIDPadStatus));
1426 return cal->IsBridgedRight(det,col,row);
1430 //_____________________________________________________________________________
1431 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
1434 // Returns status, see name of functions for details ;-)
1437 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1438 (GetCachedCDBObject(kIDPadStatus));
1443 return cal->IsNotConnected(det,col,row);
1447 //_____________________________________________________________________________
1448 Bool_t AliTRDcalibDB::IsChamberGood(Int_t det)
1451 // Returns status, see name of functions for details ;-)
1454 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1455 (GetCachedCDBObject(kIDChamberStatus));
1460 return cal->IsGood(det);
1464 //_____________________________________________________________________________
1465 Bool_t AliTRDcalibDB::IsChamberNoData(Int_t det)
1468 // Returns status, see name of functions for details ;-)
1471 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1472 (GetCachedCDBObject(kIDChamberStatus));
1477 return cal->IsNoData(det);
1481 //_____________________________________________________________________________
1482 Bool_t AliTRDcalibDB::IsHalfChamberNoData(Int_t det, Int_t side)
1485 // Returns status, see name of functions for details ;-)
1488 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1489 (GetCachedCDBObject(kIDChamberStatus));
1494 return side > 0 ? cal->IsNoDataSideB(det) : cal->IsNoDataSideA(det);
1498 //_____________________________________________________________________________
1499 Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det)
1502 // Returns status, see name of functions for details ;-)
1505 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1506 (GetCachedCDBObject(kIDChamberStatus));
1511 return cal->IsBadCalibrated(det);
1515 //_____________________________________________________________________________
1516 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
1519 // Returns the object storing the distributions for PID with likelihood
1523 case AliTRDpidUtil::kLQ:
1524 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
1525 case AliTRDpidUtil::kNN:
1526 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
1527 case AliTRDpidUtil::kESD:
1528 return 0x0; // To avoid compiler warnings
1535 //_____________________________________________________________________________
1536 AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method)
1539 // Returns the PID response object for 1D-LQ
1542 if (!fPIDResponse) {
1544 fPIDResponse = new AliTRDPIDResponse;
1546 // Load Reference Histos from OCDB
1547 if(method == AliTRDPIDResponse::kLQ1D){
1548 fPIDResponse->SetPIDmethod(method);
1549 const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
1551 TIter refs(references);
1552 TObject *obj = NULL;
1553 AliTRDPIDReference *ref = NULL;
1554 Bool_t hasReference = kFALSE;
1555 while ((obj = refs())){
1556 if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
1557 AliTRDPIDResponseObject *ro = new AliTRDPIDResponseObject;
1558 ro->SetPIDReference(ref);
1559 fPIDResponse->SetPIDResponseObject(ro);
1560 hasReference = kTRUE;
1565 if (!hasReference) {
1566 AliError("Reference histograms not found in the OCDB");
1572 return fPIDResponse;
1576 //_____________________________________________________________________________
1577 const AliTRDCalTrkAttach* AliTRDcalibDB::GetAttachObject()
1580 // Returns the object storing likelihood distributions for cluster to track attachment
1583 return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach));
1587 //_____________________________________________________________________________
1588 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
1591 // Returns the object storing the monitoring data
1594 return dynamic_cast<const AliTRDCalMonitoring *>
1595 (GetCachedCDBObject(kIDMonitoringData));
1599 //_____________________________________________________________________________
1600 void AliTRDcalibDB::SamplePRF()
1603 // Samples the pad response function (should maybe go somewhere else ...)
1606 const Int_t kPRFbin = 61;
1608 Float_t prf[kNlayer][kPRFbin] = {
1609 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
1610 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1611 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1612 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1613 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1614 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1615 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1616 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1617 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1618 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1619 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1620 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1621 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1622 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1623 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1625 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1626 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1627 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1628 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1629 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1630 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1631 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1632 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1633 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1634 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1635 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1636 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1637 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1638 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1639 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1641 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1642 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1643 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1644 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1645 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1646 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1647 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1648 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1649 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1650 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1651 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1652 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1653 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1654 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1655 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1657 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1658 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1659 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1660 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1661 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1662 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1663 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1664 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1665 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1666 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1667 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1668 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1669 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1670 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1671 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1673 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1674 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1675 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1676 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1677 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1678 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1679 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1680 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1681 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1682 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1683 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1684 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1685 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1686 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1687 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1689 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1690 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1691 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1692 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1693 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1694 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1695 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1696 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1697 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1698 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1699 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1700 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1701 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1702 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1703 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1706 // More sampling precision with linear interpolation
1709 Float_t pad[kPRFbin];
1710 Int_t sPRFbin = kPRFbin;
1711 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1712 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1713 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1716 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1717 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1719 if (fPRFsmp) delete [] fPRFsmp;
1720 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1726 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1728 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1730 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1734 diff = bin - pad[ipos2++];
1735 } while ((diff > 0) && (ipos2 < kPRFbin));
1736 if (ipos2 == kPRFbin) {
1737 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1739 else if (ipos2 == 1) {
1740 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1744 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1746 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1747 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1756 //_____________________________________________________________________________
1757 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1758 , Int_t layer, Double_t *pad) const
1761 // Applies the pad response
1762 // So far this is the fixed parametrization and should be replaced by
1763 // something dependent on calibration values
1766 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1767 Int_t iOff = layer * fPRFbin;
1769 Int_t iBin0 = iBin - fPRFpad + iOff;
1770 Int_t iBin1 = iBin + iOff;
1771 Int_t iBin2 = iBin + fPRFpad + iOff;
1776 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1779 pad[0] = signal * fPRFsmp[iBin0];
1781 pad[1] = signal * fPRFsmp[iBin1];
1782 if (iBin2 < (fPRFbin*kNlayer)) {
1783 pad[2] = signal * fPRFsmp[iBin2];
1798 AliTRDtrapConfig* AliTRDcalibDB::GetTrapConfig()
1800 // return an existing TRAPconfig or load it from the OCDB
1801 // in case of failure, a default TRAPconfig is created
1806 if ((fTrapConfigName.Length() <= 0) || (fTrapConfigVersion.Length() <= 0)) {
1807 // query the configuration to be used
1809 this->GetGlobalConfiguration(configName);
1810 TString configVersion;
1811 this->GetGlobalConfigurationVersion(configVersion);
1814 // try to load the requested configuration
1815 this->LoadTrapConfig(fTrapConfigName, fTrapConfigVersion);
1817 // if we still don't have a valid TRAPconfig, create a default one
1819 AliWarning("Falling back to default configuration");
1820 fTrapConfig = new AliTRDtrapConfig("default", "default TRAP configuration");
1821 AliTRDtrapConfigHandler cfgHandler(fTrapConfig);
1823 cfgHandler.LoadConfig();
1826 AliInfo(Form("using TRAPconfig \"%s\"", fTrapConfig->GetTitle()));
1833 AliTRDtrapConfig* AliTRDcalibDB::LoadTrapConfig(const TString &name, const TString &version)
1835 // try to load the specified configuration from the OCDB
1836 // if it fails, or it does not exist, return null
1838 AliInfo(Form("looking for TRAPconfig \"%s.%s\"", name.Data(), version.Data()));
1840 const AliTRDCalTrapConfig *caltrap = dynamic_cast<const AliTRDCalTrapConfig*> (GetCachedCDBObject(kIDTrapConfig));
1843 TString configName(name);
1844 configName.Append(".");
1845 configName.Append(version);
1846 fTrapConfig = caltrap->Get(configName);
1850 AliError("No TRAPconfig entry found!");