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 "AliTRDcalibDB.h"
40 #include "AliTRDtrapConfig.h"
41 #include "AliTRDtrapConfigHandler.h"
42 #include "AliTRDCommonParam.h"
44 #include "Cal/AliTRDCalROC.h"
45 #include "Cal/AliTRDCalPad.h"
46 #include "Cal/AliTRDCalDet.h"
47 #include "Cal/AliTRDCalDCS.h"
48 #include "Cal/AliTRDCalDCSv2.h"
49 #include "Cal/AliTRDCalDCSFEEv2.h"
50 #include "Cal/AliTRDCalPID.h"
51 #include "Cal/AliTRDCalMonitoring.h"
52 #include "Cal/AliTRDCalChamberStatus.h"
53 #include "Cal/AliTRDCalPadStatus.h"
54 #include "Cal/AliTRDCalSingleChamberStatus.h"
55 #include "Cal/AliTRDCalTrkAttach.h"
56 #include "Cal/AliTRDCalOnlineGainTable.h"
58 ClassImp(AliTRDcalibDB)
60 AliTRDcalibDB *AliTRDcalibDB::fgInstance = 0;
61 Bool_t AliTRDcalibDB::fgTerminated = kFALSE;
63 //_ singleton implementation __________________________________________________
64 AliTRDcalibDB* AliTRDcalibDB::Instance()
67 // Singleton implementation
68 // Returns an instance of this class, it is created if neccessary
71 if (fgTerminated != kFALSE) {
75 if (fgInstance == 0) {
76 fgInstance = new AliTRDcalibDB();
83 //_____________________________________________________________________________
84 void AliTRDcalibDB::Terminate()
87 // Singleton implementation
88 // Deletes the instance of this class and sets the terminated flag,
89 // instances cannot be requested anymore
90 // This function can be called several times.
95 if (fgInstance != 0) {
102 //_____________________________________________________________________________
103 AliTRDcalibDB::AliTRDcalibDB()
113 ,fOnlineGainTableID(0)
116 ,fTrapConfigVersion("")
119 // Default constructor
121 // TODO Default runnumber is set to 0, this should be changed later
122 // to an invalid value (e.g. -1) to prevent
123 // TODO invalid calibration data to be used.
126 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
131 // Create the sampled PRF
136 //_____________________________________________________________________________
137 AliTRDcalibDB::AliTRDcalibDB(const AliTRDcalibDB &c)
147 ,fOnlineGainTableID(0)
150 ,fTrapConfigVersion("")
153 // Copy constructor (not that it make any sense for a singleton...)
156 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
161 // Create the sampled PRF
166 //_____________________________________________________________________________
167 AliTRDcalibDB &AliTRDcalibDB::operator=(const AliTRDcalibDB &c)
170 // Assignment operator (same as above ...)
174 AliFatal("No assignment operator defined");
181 //_____________________________________________________________________________
182 AliTRDcalibDB::~AliTRDcalibDB()
202 //_caching functions____________________________________________________________
203 const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id)
206 // Retrieves a cdb object with the given id. The objects are cached as
207 // long as the run number is not changed.
209 // Put together the available objects here by using the lines
210 // a) For usual calibration objects:
212 // return CacheCDBEntry(kID<Name>,"TRD/Calib/<Path>");
214 // See function CacheCDBEntry for details.
216 // b) For calibration data which depends on two objects: One containing
217 // a value per detector and one the local fluctuations per pad:
219 // return CacheMergeCDBEntry(kID<Name>,"TRD/Calib/<padPath>","TRD/Calib/<chamberPath>");
221 // See function CacheMergeCDBEntry for details.
226 // Parameters defined per pad and chamber
228 return CacheCDBEntry(kIDVdriftPad ,"TRD/Calib/LocalVdrift");
230 case kIDVdriftChamber :
231 return CacheCDBEntry(kIDVdriftChamber ,"TRD/Calib/ChamberVdrift");
234 return CacheCDBEntry(kIDExBChamber ,"TRD/Calib/ChamberExB");
237 return CacheCDBEntry(kIDT0Pad ,"TRD/Calib/LocalT0");
240 return CacheCDBEntry(kIDT0Chamber ,"TRD/Calib/ChamberT0");
242 case kIDGainFactorPad :
243 return CacheCDBEntry(kIDGainFactorPad ,"TRD/Calib/LocalGainFactor");
245 case kIDGainFactorChamber :
246 return CacheCDBEntry(kIDGainFactorChamber ,"TRD/Calib/ChamberGainFactor");
249 case kIDOnlineGainFactor :
250 switch(GetOnlineGainTableID()) {
252 // For testing purposes only !!!
253 AliInfo("No gain table name from OCDB. Use default table!");
254 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
257 // Online gain table ID 1
258 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-01");
261 // Online gain table ID 2
262 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2011-01");
265 // Online gain table ID 3
266 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2011-01");
269 // Online gain table ID 4
270 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-02");
273 // Online gain table ID 5
274 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2011-03");
277 // Online gain table ID 6
278 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN0_2012-01");
281 // Online gain table ID 7
282 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Gaintbl_Uniform_FGAN8_2012-01");
285 // Online gain table ID 8
286 return CacheCDBEntry(kIDOnlineGainFactor ,"TRD/Calib/Krypton_2012-01");
291 case kIDNoiseChamber :
292 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
295 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
298 // Parameters defined per pad
300 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
304 case kIDChamberStatus :
305 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
308 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
312 case kIDMonitoringData :
313 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
316 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
319 return CacheCDBEntry(kIDFEE ,"TRD/Calib/TrapConfig");
322 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
325 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
328 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
331 return CacheCDBEntry(kIDPIDLQ1D ,"TRD/Calib/PIDLQ1D");
334 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
337 return CacheCDBEntry(kIDAttach ,"TRD/Calib/TrkAttach");
340 return CacheCDBEntry(kIDPHQ ,"TRD/Calib/PHQ");
348 //_____________________________________________________________________________
349 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
352 // Retrieves an entry with path <cdbPath> from the CDB.
355 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
357 AliError(Form("Failed to get entry: %s",cdbPath));
365 //_____________________________________________________________________________
366 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
369 // Caches the entry <id> with cdb path <cdbPath>
372 if (!fCDBCache[id]) {
373 fCDBEntries[id] = GetCDBEntry(cdbPath);
374 if (fCDBEntries[id]) {
375 fCDBCache[id] = fCDBEntries[id]->GetObject();
379 return fCDBCache[id];
383 //_____________________________________________________________________________
384 void AliTRDcalibDB::SetRun(Long64_t run)
387 // Sets current run number. Calibration data is read from the corresponding file.
388 // When the run number changes the caching is invalidated.
401 //_____________________________________________________________________________
402 void AliTRDcalibDB::Invalidate()
405 // Invalidates cache (when run number is changed).
408 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
409 if (fCDBEntries[i]) {
410 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
411 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
415 delete fCDBEntries[i];
422 fOnlineGainTableID = 0;
426 //_____________________________________________________________________________
427 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
430 // Returns the noise level in ADC counts for the given pad.
433 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
434 (GetCachedCDBObject(kIDNoisePad));
439 AliTRDCalROC *roc = calPad->GetCalROC(det);
444 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
445 (GetCachedCDBObject(kIDNoiseChamber));
450 return calChamber->GetValue(det) * roc->GetValue(col,row);
454 //_____________________________________________________________________________
455 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
458 // Returns the Vdrift calibration object for a given ROC
459 // containing one number per pad
462 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
463 (GetCachedCDBObject(kIDNoisePad));
468 AliTRDCalROC *roc = calPad->GetCalROC(det);
478 //_____________________________________________________________________________
479 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
482 // Returns the Vdrift calibration object
483 // containing one number per detector
486 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
487 (GetCachedCDBObject(kIDNoiseChamber));
497 //_____________________________________________________________________________
498 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
501 // Returns the drift velocity for the given pad.
504 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
505 (GetCachedCDBObject(kIDVdriftPad));
510 AliTRDCalROC *roc = calPad->GetCalROC(det);
515 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
516 (GetCachedCDBObject(kIDVdriftChamber));
521 return calChamber->GetValue(det) * roc->GetValue(col,row);
525 //_____________________________________________________________________________
526 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
529 // Returns the Vdrift calibration object for a given ROC
530 // containing one number per pad
533 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
534 (GetCachedCDBObject(kIDVdriftPad));
539 AliTRDCalROC *roc = calPad->GetCalROC(det);
549 //_____________________________________________________________________________
550 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
553 // Returns the Vdrift calibration object
554 // containing one number per detector
557 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
558 (GetCachedCDBObject(kIDVdriftChamber));
568 //_____________________________________________________________________________
569 TObjArray * AliTRDcalibDB::GetPHQ()
572 //return PHQ calibration object
574 TObjArray *arr = (TObjArray *) (GetCachedCDBObject(kIDPHQ));
578 //_____________________________________________________________________________
579 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
582 // Returns the average drift velocity for the given detector
585 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
586 (GetCachedCDBObject(kIDVdriftChamber));
591 return calDet->GetValue(det);
594 //_____________________________________________________________________________
595 const AliTRDCalDet *AliTRDcalibDB::GetExBDet()
598 // Returns the exB calibration object
599 // containing one number per detector
602 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> (GetCachedCDBObject(kIDExBChamber));
604 Double_t meanexb = 100.0;
605 if (calChamber) meanexb = calChamber->GetMean();
606 //printf("mean %f\n",meanexb);
608 if ((!calChamber) || (meanexb > 70.0)) {
610 const AliTRDCalDet *calChambervdrift = dynamic_cast<const AliTRDCalDet *>
611 (GetCachedCDBObject(kIDVdriftChamber));
612 if (!calChambervdrift) {
616 AliTRDCalDet *calDetExB = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
617 for(Int_t k = 0; k < 540; k++){
618 calDetExB->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(calChambervdrift->GetValue(k)));
623 else return calChamber;
626 //_____________________________________________________________________________
627 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
630 // Returns t0 for the given pad.
633 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
634 (GetCachedCDBObject(kIDT0Pad));
639 AliTRDCalROC *roc = calPad->GetCalROC(det);
644 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
645 (GetCachedCDBObject(kIDT0Chamber));
650 return calChamber->GetValue(det) + roc->GetValue(col,row);
654 //_____________________________________________________________________________
655 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
658 // Returns the t0 calibration object for a given ROC
659 // containing one number per pad
662 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
663 (GetCachedCDBObject(kIDT0Pad));
668 AliTRDCalROC *roc = calPad->GetCalROC(det);
678 //_____________________________________________________________________________
679 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
682 // Returns the t0 calibration object
683 // containing one number per detector
686 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
687 (GetCachedCDBObject(kIDT0Chamber));
697 //_____________________________________________________________________________
698 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
701 // Returns the average t0 for the given detector
704 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
705 (GetCachedCDBObject(kIDT0Pad));
710 AliTRDCalROC *roc = calPad->GetCalROC(det);
715 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
716 (GetCachedCDBObject(kIDT0Chamber));
722 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
723 sum += roc->GetValue(channel);
725 sum /= roc->GetNchannels();
726 sum += calDet->GetValue(det);
731 //_____________________________________________________________________________
732 AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det)
735 // Returns the online gain factor table for a given ROC.
738 if (!HasOnlineFilterGain()) {
742 const AliTRDCalOnlineGainTable *calOnline
743 = dynamic_cast<const AliTRDCalOnlineGainTable *>
744 (GetCachedCDBObject(kIDOnlineGainFactor));
749 return calOnline->GetGainTableROC(det);
753 //_____________________________________________________________________________
754 Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row)
757 // Returns the online gain factor for the given pad.
760 if (!HasOnlineFilterGain()) {
764 const AliTRDCalOnlineGainTable *calOnline
765 = dynamic_cast<const AliTRDCalOnlineGainTable *>
766 (GetCachedCDBObject(kIDOnlineGainFactor));
771 return calOnline->GetGainCorrectionFactor(det,row,col);
775 //_____________________________________________________________________________
776 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
779 // Returns the gain factor calibration object for a given ROC
782 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
783 (GetCachedCDBObject(kIDGainFactorPad));
788 AliTRDCalROC *roc = calPad->GetCalROC(det);
798 //_____________________________________________________________________________
799 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
802 // Returns the gain factor for the given pad.
805 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
806 (GetCachedCDBObject(kIDGainFactorPad));
811 AliTRDCalROC *roc = calPad->GetCalROC(det);
816 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
817 (GetCachedCDBObject(kIDGainFactorChamber));
822 return calChamber->GetValue(det) * roc->GetValue(col,row);
826 //_____________________________________________________________________________
827 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
830 // Returns the gain factor calibration object
831 // containing one number per detector
834 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
835 (GetCachedCDBObject(kIDGainFactorChamber));
845 //_____________________________________________________________________________
846 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
849 // Returns the average gain factor for the given detector
852 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
853 (GetCachedCDBObject(kIDGainFactorChamber));
858 return calDet->GetValue(det);
862 //_____________________________________________________________________________
863 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
866 // Returns the PRF calibration object for a given ROC
867 // containing one number per pad
870 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
871 (GetCachedCDBObject(kIDPRFWidth));
876 AliTRDCalROC *roc = calPad->GetCalROC(det);
886 //_____________________________________________________________________________
887 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
890 // Returns the PRF width for the given pad.
893 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
894 (GetCachedCDBObject(kIDPRFWidth));
899 AliTRDCalROC *roc = calPad->GetCalROC(det);
904 return roc->GetValue(col,row);
908 //_____________________________________________________________________________
909 Int_t AliTRDcalibDB::ExtractTimeBinsFromString(TString tbstr)
911 // default value - has not been set
914 // Check if there is any content in the string first
915 if (tbstr.Length() == 0) {
916 AliError("Parameter for number of timebins is empty!");
920 // Check if we have the correct config parameter
921 TString tbident = "tb";
922 TString tbsubstr = tbstr(0,2);
923 if (!tbsubstr.EqualTo(tbident)) {
924 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
929 // check if there is more than a number
930 if (!tbstr.IsDigit()) {
931 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
939 //_____________________________________________________________________________
940 Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
943 // Returns number of time bins from the DCS
946 // Get the corresponding parameter
947 TString cfgstr = "", cfgname = "";
948 GetGlobalConfiguration(cfgname);
949 GetDCSConfigParOption(cfgname, kTimebin, 0, cfgstr);
951 return ExtractTimeBinsFromString(cfgstr);
955 //_____________________________________________________________________________
956 void AliTRDcalibDB::GetFilterType(TString &filterType)
959 // Returns the filter type
962 TString cfgname = "";
963 GetGlobalConfiguration(cfgname);
964 GetDCSConfigParOption(cfgname, kFltrSet, 0, filterType);
968 //_____________________________________________________________________________
969 Int_t AliTRDcalibDB::GetOnlineGainTableID()
972 // Get the gain table ID from the DCS
975 if (fOnlineGainTableID > 0) {
976 return fOnlineGainTableID;
979 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
984 Int_t esor = 0; // Take SOR
985 Int_t calver = 0; // Check CalDCS version
986 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
987 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
991 // No data for old DCS object available, anyway
995 else if (calver == 2) {
998 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
1003 TString tableName = "";
1004 for (Int_t i = 0; i < 540; i++) {
1005 const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0);
1006 tableName = calDCSFEEv2->GetGainTableName();
1007 if (tableName.Length() > 0) {
1011 if (tableName.CompareTo("Krypton_2011-01") == 0) {
1012 fOnlineGainTableID = 1;
1013 return fOnlineGainTableID;
1015 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0) {
1016 fOnlineGainTableID = 2;
1017 return fOnlineGainTableID;
1019 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2011-01") == 0) {
1020 fOnlineGainTableID = 3;
1021 return fOnlineGainTableID;
1023 if (tableName.CompareTo("Krypton_2011-02") == 0) {
1024 fOnlineGainTableID = 4;
1025 return fOnlineGainTableID;
1027 if (tableName.CompareTo("Krypton_2011-03") == 0) {
1028 fOnlineGainTableID = 5;
1029 return fOnlineGainTableID;
1031 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2012-01") == 0) {
1032 fOnlineGainTableID = 6;
1033 return fOnlineGainTableID;
1035 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2012-01") == 0) {
1036 fOnlineGainTableID = 7;
1037 return fOnlineGainTableID;
1039 if (tableName.CompareTo("Krypton_2011-03") == 0) {
1040 fOnlineGainTableID = 8;
1041 return fOnlineGainTableID;
1047 AliError("NO DCS/DCSv2 OCDB entry found!");
1056 //_____________________________________________________________________________
1057 void AliTRDcalibDB::GetGlobalConfiguration(TString &config)
1060 // Get Configuration from the DCS
1063 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1065 AliError("No DCS CDB Object available!");
1070 Int_t idSOR = 0, idEOR=1; // The index of SOR and EOR
1071 Bool_t hasSOR = (dcsArr->At(idSOR));
1072 Bool_t hasEOR = (dcsArr->At(idEOR));
1073 TString cfgSOR = "", cfgEOR = ""; // The configuration at SOR/EOR
1075 // The SOR object is mandatory
1077 AliError("NO SOR object found in CDB file!");
1081 if (!hasEOR) AliWarning("NO EOR object found in CDB file!");
1083 // Check CalDCS version
1085 if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCS")) calver = 1;
1086 else if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1088 // Get the configuration strings
1091 const AliTRDCalDCS *calSOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idSOR));
1092 cfgSOR = calSOR->GetGlobalConfigName();
1094 const AliTRDCalDCS *calEOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idEOR));
1095 cfgEOR = calEOR->GetGlobalConfigName();
1098 else if (calver == 2) {
1100 const AliTRDCalDCSv2 *calv2SOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idSOR));
1101 cfgSOR = calv2SOR->GetGlobalConfigName();
1103 const AliTRDCalDCSv2 *calv2EOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idEOR));
1104 cfgEOR = calv2EOR->GetGlobalConfigName();
1108 AliError("NO DCS/DCSv2 OCDB entry found!");
1113 // If there is no EOR entry, return the SOR value
1114 if (!hasEOR || cfgEOR.Length()==0) {
1119 // Check if the configuration is the same for both
1120 if (cfgSOR.EqualTo(cfgEOR)) {
1125 // When both SOR and EOR have an entry but are different, the config is not defined
1126 AliError("Inconsistent configuration at start and end of run found!");
1132 //_____________________________________________________________________________
1133 void AliTRDcalibDB::GetGlobalConfigurationVersion(TString &version)
1136 // Get Version of Configuration from the DCS
1139 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1145 Int_t esor = 0; // Take SOR
1146 Int_t calver = 0; // Check CalDCS version
1147 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
1148 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1153 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
1158 version = calDCS->GetGlobalConfigVersion();
1161 else if (calver == 2) {
1164 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
1169 version = calDCSv2->GetGlobalConfigVersion();
1174 AliError("NO DCS/DCSv2 OCDB entry found!");
1180 //_____________________________________________________________________________
1181 Int_t AliTRDcalibDB::GetNumberOfParsDCS(TString cname)
1183 // Get the number of configuration parameters from the DCS config
1185 TString cdelim = "_";
1186 TObjArray *carr = cname.Tokenize(cdelim);
1187 return carr->GetEntries() - 1; // -1 for the "cf"
1191 //_____________________________________________________________________________
1192 Int_t AliTRDcalibDB::GetNumberOfOptsDCS(TString cname, Int_t cfgType)
1194 // Get the number of options of a given configuration parameter from DCS
1196 TString cdelim = "_";
1197 TString odelim = "-";
1199 TObjArray *carr = cname.Tokenize(cdelim);
1200 Int_t nconfig = carr->GetEntries();
1203 if ((nconfig == 0) || ((nconfig-1) < cfgType)) {
1204 AliError("Not enough parameters in DCS configuration name!");
1208 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1209 TObjArray *oarr = fullcfg.Tokenize(odelim);
1210 return oarr->GetEntries() -1; // -1 for the parameter name
1214 //_____________________________________________________________________________
1215 void AliTRDcalibDB::GetDCSConfigParOption(TString cname, Int_t cfgType, Int_t option, TString &cfgo)
1218 // Get a configuration (see enum in header file) or the options of a configuration
1219 // option == 0 returns the configuration itself
1220 // option > 0 returns the optional parameter Nr. (option) of the configuration (cfgType)
1223 // define the delimiters
1224 TString cdelim = "_";
1225 TString odelim = "-";
1227 TObjArray *carr = cname.Tokenize(cdelim);
1228 Int_t nconfig = carr->GetEntries();
1232 AliError("DCS configuration name empty!");
1235 } else if ((nconfig-1) < cfgType) {
1236 AliError("Not enough parameters in DCS configuration name!");
1241 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1242 TObjArray *oarr = fullcfg.Tokenize(odelim);
1243 Int_t noptions = oarr->GetEntries();
1246 if ((noptions-1) < option) {
1247 AliError("Not enough options in DCS configuration name!");
1252 cfgo = ((TObjString*)oarr->At(option))->GetString();
1257 //_____________________________________________________________________________
1258 Bool_t AliTRDcalibDB::HasOnlineFilterPedestal()
1261 // Checks whether pedestal filter was applied online
1264 TString filterconfig;
1265 GetFilterType(filterconfig);
1267 return filterconfig.Contains("p");
1271 //_____________________________________________________________________________
1272 Bool_t AliTRDcalibDB::HasOnlineFilterGain()
1275 // Checks whether online gain filter was applied
1278 TString filterconfig;
1279 GetFilterType(filterconfig);
1281 return filterconfig.Contains("g");
1285 //_____________________________________________________________________________
1286 Bool_t AliTRDcalibDB::HasOnlineTailCancellation()
1289 // Checks whether online tail cancellation was applied
1292 TString filterconfig;
1293 GetFilterType(filterconfig);
1295 return filterconfig.Contains("t");
1299 //_____________________________________________________________________________
1300 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
1303 // Returns the status of the given pad
1306 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1307 (GetCachedCDBObject(kIDPadStatus));
1312 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1317 return roc->GetStatus(col,row);
1321 //_____________________________________________________________________________
1322 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
1325 // Returns the pad status calibration object for a given ROC
1328 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1329 (GetCachedCDBObject(kIDPadStatus));
1334 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1344 //_____________________________________________________________________________
1345 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
1348 // Returns the status of the given chamber
1351 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
1352 (GetCachedCDBObject(kIDChamberStatus));
1357 return cal->GetStatus(det);
1361 //_____________________________________________________________________________
1362 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
1365 // Returns the TRD reconstruction parameters from the OCDB
1368 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
1369 if (!recos) return 0x0;
1371 // calculate entry based on event type info
1372 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
1374 return (AliTRDrecoParam *) recos->UncheckedAt(n);
1378 //_____________________________________________________________________________
1379 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
1382 // Returns status, see name of functions for details ;-)
1385 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1386 (GetCachedCDBObject(kIDPadStatus));
1391 return cal->IsMasked(det,col,row);
1395 //_____________________________________________________________________________
1396 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
1399 // Returns status, see name of functions for details ;-)
1402 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1403 (GetCachedCDBObject(kIDPadStatus));
1408 return cal->IsBridgedLeft(det,col,row);
1412 //_____________________________________________________________________________
1413 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
1416 // Returns status, see name of functions for details ;-)
1419 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1420 (GetCachedCDBObject(kIDPadStatus));
1425 return cal->IsBridgedRight(det,col,row);
1429 //_____________________________________________________________________________
1430 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
1433 // Returns status, see name of functions for details ;-)
1436 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1437 (GetCachedCDBObject(kIDPadStatus));
1442 return cal->IsNotConnected(det,col,row);
1446 //_____________________________________________________________________________
1447 Bool_t AliTRDcalibDB::IsChamberGood(Int_t det)
1450 // Returns status, see name of functions for details ;-)
1453 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1454 (GetCachedCDBObject(kIDChamberStatus));
1459 return cal->IsGood(det);
1463 //_____________________________________________________________________________
1464 Bool_t AliTRDcalibDB::IsChamberNoData(Int_t det)
1467 // Returns status, see name of functions for details ;-)
1470 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1471 (GetCachedCDBObject(kIDChamberStatus));
1476 return cal->IsNoData(det);
1480 //_____________________________________________________________________________
1481 Bool_t AliTRDcalibDB::IsHalfChamberNoData(Int_t det, Int_t side)
1484 // Returns status, see name of functions for details ;-)
1487 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1488 (GetCachedCDBObject(kIDChamberStatus));
1493 return side > 0 ? cal->IsNoDataSideB(det) : cal->IsNoDataSideA(det);
1497 //_____________________________________________________________________________
1498 Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det)
1501 // Returns status, see name of functions for details ;-)
1504 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1505 (GetCachedCDBObject(kIDChamberStatus));
1510 return cal->IsBadCalibrated(det);
1514 //_____________________________________________________________________________
1515 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
1518 // Returns the object storing the distributions for PID with likelihood
1522 case AliTRDpidUtil::kLQ:
1523 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
1524 case AliTRDpidUtil::kNN:
1525 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
1526 case AliTRDpidUtil::kESD:
1527 return 0x0; // To avoid compiler warnings
1534 //_____________________________________________________________________________
1535 AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method)
1538 // Returns the PID response object for 1D-LQ
1541 if (!fPIDResponse) {
1543 fPIDResponse = new AliTRDPIDResponse;
1545 // Load Reference Histos from OCDB
1546 fPIDResponse->SetPIDmethod(method);
1547 const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
1549 TIter refs(references);
1550 TObject *obj = NULL;
1551 AliTRDPIDReference *ref = NULL;
1552 Bool_t hasReference = kFALSE;
1553 while ((obj = refs())){
1554 if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
1555 //fPIDResponse->Load(ref);
1556 hasReference = kTRUE;
1561 if (!hasReference) {
1562 AliError("Reference histograms not found in the OCDB");
1567 return fPIDResponse;
1571 //_____________________________________________________________________________
1572 const AliTRDCalTrkAttach* AliTRDcalibDB::GetAttachObject()
1575 // Returns the object storing likelihood distributions for cluster to track attachment
1578 return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach));
1582 //_____________________________________________________________________________
1583 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
1586 // Returns the object storing the monitoring data
1589 return dynamic_cast<const AliTRDCalMonitoring *>
1590 (GetCachedCDBObject(kIDMonitoringData));
1594 //_____________________________________________________________________________
1595 void AliTRDcalibDB::SamplePRF()
1598 // Samples the pad response function (should maybe go somewhere else ...)
1601 const Int_t kPRFbin = 61;
1603 Float_t prf[kNlayer][kPRFbin] = {
1604 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
1605 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1606 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1607 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1608 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1609 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1610 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1611 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1612 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1613 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1614 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1615 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1616 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1617 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1618 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1620 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1621 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1622 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1623 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1624 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1625 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1626 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1627 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1628 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1629 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1630 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1631 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1632 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1633 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1634 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1636 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1637 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1638 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1639 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1640 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1641 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1642 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1643 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1644 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1645 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1646 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1647 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1648 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1649 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1650 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1652 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1653 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1654 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1655 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1656 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1657 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1658 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1659 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1660 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1661 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1662 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1663 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1664 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1665 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1666 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1668 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1669 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1670 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1671 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1672 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1673 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1674 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1675 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1676 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1677 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1678 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1679 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1680 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1681 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1682 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1684 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1685 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1686 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1687 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1688 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1689 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1690 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1691 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1692 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1693 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1694 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1695 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1696 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1697 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1698 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1701 // More sampling precision with linear interpolation
1704 Float_t pad[kPRFbin];
1705 Int_t sPRFbin = kPRFbin;
1706 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1707 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1708 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1711 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1712 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1714 if (fPRFsmp) delete [] fPRFsmp;
1715 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1721 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1723 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1725 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1729 diff = bin - pad[ipos2++];
1730 } while ((diff > 0) && (ipos2 < kPRFbin));
1731 if (ipos2 == kPRFbin) {
1732 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1734 else if (ipos2 == 1) {
1735 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1739 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1741 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1742 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1751 //_____________________________________________________________________________
1752 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1753 , Int_t layer, Double_t *pad) const
1756 // Applies the pad response
1757 // So far this is the fixed parametrization and should be replaced by
1758 // something dependent on calibration values
1761 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1762 Int_t iOff = layer * fPRFbin;
1764 Int_t iBin0 = iBin - fPRFpad + iOff;
1765 Int_t iBin1 = iBin + iOff;
1766 Int_t iBin2 = iBin + fPRFpad + iOff;
1771 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1774 pad[0] = signal * fPRFsmp[iBin0];
1776 pad[1] = signal * fPRFsmp[iBin1];
1777 if (iBin2 < (fPRFbin*kNlayer)) {
1778 pad[2] = signal * fPRFsmp[iBin2];
1793 AliTRDtrapConfig* AliTRDcalibDB::GetTrapConfig()
1795 // return an existing TRAPconfig or load it from the OCDB
1796 // in case of failure, a default TRAPconfig is created
1801 if ((fTrapConfigName.Length() <= 0) || (fTrapConfigVersion.Length() <= 0)) {
1802 // query the configuration to be used
1804 this->GetGlobalConfiguration(configName);
1805 TString configVersion;
1806 this->GetGlobalConfigurationVersion(configVersion);
1809 // try to load the requested configuration
1810 this->LoadTrapConfig(fTrapConfigName, fTrapConfigVersion);
1812 // if we still don't have a valid TRAPconfig, create a default one
1814 AliWarning("Falling back to default configuration");
1815 fTrapConfig = new AliTRDtrapConfig("default", "default TRAP configuration");
1816 AliTRDtrapConfigHandler cfgHandler(fTrapConfig);
1818 cfgHandler.LoadConfig();
1821 AliInfo(Form("using TRAPconfig \"%s\"", fTrapConfig->GetTitle()));
1828 AliTRDtrapConfig* AliTRDcalibDB::LoadTrapConfig(const TString &name, const TString &version)
1830 // try to load the specified configuration from the OCDB
1831 // if it fails, or it does not exist, return null
1833 AliInfo(Form("looking for TRAPconfig \"%s.%s\"", name.Data(), version.Data()));
1835 const AliTRDCalTrapConfig *caltrap = dynamic_cast<const AliTRDCalTrapConfig*> (GetCachedCDBObject(kIDTrapConfig));
1838 TString configName(name);
1839 configName.Append(".");
1840 configName.Append(version);
1841 fTrapConfig = caltrap->Get(configName);
1845 AliError("No TRAPconfig entry found!");