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");
287 case kIDNoiseChamber :
288 return CacheCDBEntry(kIDNoiseChamber ,"TRD/Calib/DetNoise");
291 return CacheCDBEntry(kIDNoisePad ,"TRD/Calib/PadNoise");
294 // Parameters defined per pad
296 return CacheCDBEntry(kIDPRFWidth ,"TRD/Calib/PRFWidth");
300 case kIDChamberStatus :
301 return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus");
304 return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus");
308 case kIDMonitoringData :
309 return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData");
312 return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE");
315 return CacheCDBEntry(kIDFEE ,"TRD/Calib/TrapConfig");
318 return CacheCDBEntry(kIDDCS ,"TRD/Calib/DCS");
321 return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN");
324 return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ");
327 return CacheCDBEntry(kIDPIDLQ1D ,"TRD/Calib/PIDLQ1D");
330 return CacheCDBEntry(kIDRecoParam ,"TRD/Calib/RecoParam");
333 return CacheCDBEntry(kIDAttach ,"TRD/Calib/TrkAttach");
336 return CacheCDBEntry(kIDPHQ ,"TRD/Calib/PHQ");
344 //_____________________________________________________________________________
345 AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath)
348 // Retrieves an entry with path <cdbPath> from the CDB.
351 AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun);
353 AliError(Form("Failed to get entry: %s",cdbPath));
361 //_____________________________________________________________________________
362 const TObject *AliTRDcalibDB::CacheCDBEntry(Int_t id, const char *cdbPath)
365 // Caches the entry <id> with cdb path <cdbPath>
368 if (!fCDBCache[id]) {
369 fCDBEntries[id] = GetCDBEntry(cdbPath);
370 if (fCDBEntries[id]) {
371 fCDBCache[id] = fCDBEntries[id]->GetObject();
375 return fCDBCache[id];
379 //_____________________________________________________________________________
380 void AliTRDcalibDB::SetRun(Long64_t run)
383 // Sets current run number. Calibration data is read from the corresponding file.
384 // When the run number changes the caching is invalidated.
397 //_____________________________________________________________________________
398 void AliTRDcalibDB::Invalidate()
401 // Invalidates cache (when run number is changed).
404 for (Int_t i = 0; i < kCDBCacheSize; ++i) {
405 if (fCDBEntries[i]) {
406 if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) {
407 if ((fCDBEntries[i]->IsOwner() == kFALSE) &&
411 delete fCDBEntries[i];
418 fOnlineGainTableID = 0;
422 //_____________________________________________________________________________
423 Float_t AliTRDcalibDB::GetNoise(Int_t det, Int_t col, Int_t row)
426 // Returns the noise level in ADC counts for the given pad.
429 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
430 (GetCachedCDBObject(kIDNoisePad));
435 AliTRDCalROC *roc = calPad->GetCalROC(det);
440 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
441 (GetCachedCDBObject(kIDNoiseChamber));
446 return calChamber->GetValue(det) * roc->GetValue(col,row);
450 //_____________________________________________________________________________
451 AliTRDCalROC *AliTRDcalibDB::GetNoiseROC(Int_t det)
454 // Returns the Vdrift calibration object for a given ROC
455 // containing one number per pad
458 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
459 (GetCachedCDBObject(kIDNoisePad));
464 AliTRDCalROC *roc = calPad->GetCalROC(det);
474 //_____________________________________________________________________________
475 const AliTRDCalDet *AliTRDcalibDB::GetNoiseDet()
478 // Returns the Vdrift calibration object
479 // containing one number per detector
482 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
483 (GetCachedCDBObject(kIDNoiseChamber));
493 //_____________________________________________________________________________
494 Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row)
497 // Returns the drift velocity for the given pad.
500 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
501 (GetCachedCDBObject(kIDVdriftPad));
506 AliTRDCalROC *roc = calPad->GetCalROC(det);
511 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
512 (GetCachedCDBObject(kIDVdriftChamber));
517 return calChamber->GetValue(det) * roc->GetValue(col,row);
521 //_____________________________________________________________________________
522 AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det)
525 // Returns the Vdrift calibration object for a given ROC
526 // containing one number per pad
529 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
530 (GetCachedCDBObject(kIDVdriftPad));
535 AliTRDCalROC *roc = calPad->GetCalROC(det);
545 //_____________________________________________________________________________
546 const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet()
549 // Returns the Vdrift calibration object
550 // containing one number per detector
553 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
554 (GetCachedCDBObject(kIDVdriftChamber));
564 //_____________________________________________________________________________
565 TObjArray * AliTRDcalibDB::GetPHQ()
568 //return PHQ calibration object
570 TObjArray *arr = (TObjArray *) (GetCachedCDBObject(kIDPHQ));
574 //_____________________________________________________________________________
575 Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det)
578 // Returns the average drift velocity for the given detector
581 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
582 (GetCachedCDBObject(kIDVdriftChamber));
587 return calDet->GetValue(det);
590 //_____________________________________________________________________________
591 const AliTRDCalDet *AliTRDcalibDB::GetExBDet()
594 // Returns the exB calibration object
595 // containing one number per detector
598 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *> (GetCachedCDBObject(kIDExBChamber));
600 Double_t meanexb = 100.0;
601 if (calChamber) meanexb = calChamber->GetMean();
602 //printf("mean %f\n",meanexb);
604 if ((!calChamber) || (meanexb > 70.0)) {
606 const AliTRDCalDet *calChambervdrift = dynamic_cast<const AliTRDCalDet *>
607 (GetCachedCDBObject(kIDVdriftChamber));
608 if (!calChambervdrift) {
612 AliTRDCalDet *calDetExB = new AliTRDCalDet("lorentz angle tan","lorentz angle tan (detector value)");
613 for(Int_t k = 0; k < 540; k++){
614 calDetExB->SetValue(k,AliTRDCommonParam::Instance()->GetOmegaTau(calChambervdrift->GetValue(k)));
619 else return calChamber;
622 //_____________________________________________________________________________
623 Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row)
626 // Returns t0 for the given pad.
629 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
630 (GetCachedCDBObject(kIDT0Pad));
635 AliTRDCalROC *roc = calPad->GetCalROC(det);
640 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
641 (GetCachedCDBObject(kIDT0Chamber));
646 return calChamber->GetValue(det) + roc->GetValue(col,row);
650 //_____________________________________________________________________________
651 AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det)
654 // Returns the t0 calibration object for a given ROC
655 // containing one number per pad
658 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
659 (GetCachedCDBObject(kIDT0Pad));
664 AliTRDCalROC *roc = calPad->GetCalROC(det);
674 //_____________________________________________________________________________
675 const AliTRDCalDet *AliTRDcalibDB::GetT0Det()
678 // Returns the t0 calibration object
679 // containing one number per detector
682 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
683 (GetCachedCDBObject(kIDT0Chamber));
693 //_____________________________________________________________________________
694 Float_t AliTRDcalibDB::GetT0Average(Int_t det)
697 // Returns the average t0 for the given detector
700 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
701 (GetCachedCDBObject(kIDT0Pad));
706 AliTRDCalROC *roc = calPad->GetCalROC(det);
711 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
712 (GetCachedCDBObject(kIDT0Chamber));
718 for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) {
719 sum += roc->GetValue(channel);
721 sum /= roc->GetNchannels();
722 sum += calDet->GetValue(det);
727 //_____________________________________________________________________________
728 AliTRDCalOnlineGainTableROC* AliTRDcalibDB::GetOnlineGainTableROC(Int_t det)
731 // Returns the online gain factor table for a given ROC.
734 if (!HasOnlineFilterGain()) {
738 const AliTRDCalOnlineGainTable *calOnline
739 = dynamic_cast<const AliTRDCalOnlineGainTable *>
740 (GetCachedCDBObject(kIDOnlineGainFactor));
745 return calOnline->GetGainTableROC(det);
749 //_____________________________________________________________________________
750 Float_t AliTRDcalibDB::GetOnlineGainFactor(Int_t det, Int_t col, Int_t row)
753 // Returns the online gain factor for the given pad.
756 if (!HasOnlineFilterGain()) {
760 const AliTRDCalOnlineGainTable *calOnline
761 = dynamic_cast<const AliTRDCalOnlineGainTable *>
762 (GetCachedCDBObject(kIDOnlineGainFactor));
767 return calOnline->GetGainCorrectionFactor(det,row,col);
771 //_____________________________________________________________________________
772 AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det)
775 // Returns the gain factor calibration object for a given ROC
778 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
779 (GetCachedCDBObject(kIDGainFactorPad));
784 AliTRDCalROC *roc = calPad->GetCalROC(det);
794 //_____________________________________________________________________________
795 Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row)
798 // Returns the gain factor for the given pad.
801 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
802 (GetCachedCDBObject(kIDGainFactorPad));
807 AliTRDCalROC *roc = calPad->GetCalROC(det);
812 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
813 (GetCachedCDBObject(kIDGainFactorChamber));
818 return calChamber->GetValue(det) * roc->GetValue(col,row);
822 //_____________________________________________________________________________
823 const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet()
826 // Returns the gain factor calibration object
827 // containing one number per detector
830 const AliTRDCalDet *calChamber = dynamic_cast<const AliTRDCalDet *>
831 (GetCachedCDBObject(kIDGainFactorChamber));
841 //_____________________________________________________________________________
842 Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det)
845 // Returns the average gain factor for the given detector
848 const AliTRDCalDet *calDet = dynamic_cast<const AliTRDCalDet *>
849 (GetCachedCDBObject(kIDGainFactorChamber));
854 return calDet->GetValue(det);
858 //_____________________________________________________________________________
859 AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det)
862 // Returns the PRF calibration object for a given ROC
863 // containing one number per pad
866 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
867 (GetCachedCDBObject(kIDPRFWidth));
872 AliTRDCalROC *roc = calPad->GetCalROC(det);
882 //_____________________________________________________________________________
883 Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row)
886 // Returns the PRF width for the given pad.
889 const AliTRDCalPad *calPad = dynamic_cast<const AliTRDCalPad *>
890 (GetCachedCDBObject(kIDPRFWidth));
895 AliTRDCalROC *roc = calPad->GetCalROC(det);
900 return roc->GetValue(col,row);
904 //_____________________________________________________________________________
905 Int_t AliTRDcalibDB::ExtractTimeBinsFromString(TString tbstr)
907 // default value - has not been set
910 // Check if there is any content in the string first
911 if (tbstr.Length() == 0) {
912 AliError("Parameter for number of timebins is empty!");
916 // Check if we have the correct config parameter
917 TString tbident = "tb";
918 TString tbsubstr = tbstr(0,2);
919 if (!tbsubstr.EqualTo(tbident)) {
920 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
925 // check if there is more than a number
926 if (!tbstr.IsDigit()) {
927 AliError(Form("Parameter for number of timebins is corrupted (%s)!", tbstr.Data()));
935 //_____________________________________________________________________________
936 Int_t AliTRDcalibDB::GetNumberOfTimeBinsDCS()
939 // Returns number of time bins from the DCS
942 // Get the corresponding parameter
943 TString cfgstr = "", cfgname = "";
944 GetGlobalConfiguration(cfgname);
945 GetDCSConfigParOption(cfgname, kTimebin, 0, cfgstr);
947 return ExtractTimeBinsFromString(cfgstr);
951 //_____________________________________________________________________________
952 void AliTRDcalibDB::GetFilterType(TString &filterType)
955 // Returns the filter type
958 TString cfgname = "";
959 GetGlobalConfiguration(cfgname);
960 GetDCSConfigParOption(cfgname, kFltrSet, 0, filterType);
964 //_____________________________________________________________________________
965 Int_t AliTRDcalibDB::GetOnlineGainTableID()
968 // Get the gain table ID from the DCS
971 if (fOnlineGainTableID > 0) {
972 return fOnlineGainTableID;
975 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
980 Int_t esor = 0; // Take SOR
981 Int_t calver = 0; // Check CalDCS version
982 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
983 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
987 // No data for old DCS object available, anyway
991 else if (calver == 2) {
994 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
999 TString tableName = "";
1000 for (Int_t i = 0; i < 540; i++) {
1001 const AliTRDCalDCSFEEv2 *calDCSFEEv2 = calDCSv2->GetCalDCSFEEObj(0);
1002 tableName = calDCSFEEv2->GetGainTableName();
1003 if (tableName.Length() > 0) {
1007 if (tableName.CompareTo("Krypton_2011-01") == 0) {
1008 fOnlineGainTableID = 1;
1009 return fOnlineGainTableID;
1011 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2011-01") == 0) {
1012 fOnlineGainTableID = 2;
1013 return fOnlineGainTableID;
1015 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2011-01") == 0) {
1016 fOnlineGainTableID = 3;
1017 return fOnlineGainTableID;
1019 if (tableName.CompareTo("Krypton_2011-02") == 0) {
1020 fOnlineGainTableID = 4;
1021 return fOnlineGainTableID;
1023 if (tableName.CompareTo("Krypton_2011-03") == 0) {
1024 fOnlineGainTableID = 5;
1025 return fOnlineGainTableID;
1027 if (tableName.CompareTo("Gaintbl_Uniform_FGAN0_2012-01") == 0) {
1028 fOnlineGainTableID = 6;
1029 return fOnlineGainTableID;
1031 if (tableName.CompareTo("Gaintbl_Uniform_FGAN8_2012-01") == 0) {
1032 fOnlineGainTableID = 7;
1033 return fOnlineGainTableID;
1039 AliError("NO DCS/DCSv2 OCDB entry found!");
1048 //_____________________________________________________________________________
1049 void AliTRDcalibDB::GetGlobalConfiguration(TString &config)
1052 // Get Configuration from the DCS
1055 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1057 AliError("No DCS CDB Object available!");
1062 Int_t idSOR = 0, idEOR=1; // The index of SOR and EOR
1063 Bool_t hasSOR = (dcsArr->At(idSOR));
1064 Bool_t hasEOR = (dcsArr->At(idEOR));
1065 TString cfgSOR = "", cfgEOR = ""; // The configuration at SOR/EOR
1067 // The SOR object is mandatory
1069 AliError("NO SOR object found in CDB file!");
1073 if (!hasEOR) AliWarning("NO EOR object found in CDB file!");
1075 // Check CalDCS version
1077 if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCS")) calver = 1;
1078 else if (!strcmp(dcsArr->At(idSOR)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1080 // Get the configuration strings
1083 const AliTRDCalDCS *calSOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idSOR));
1084 cfgSOR = calSOR->GetGlobalConfigName();
1086 const AliTRDCalDCS *calEOR = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(idEOR));
1087 cfgEOR = calEOR->GetGlobalConfigName();
1090 else if (calver == 2) {
1092 const AliTRDCalDCSv2 *calv2SOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idSOR));
1093 cfgSOR = calv2SOR->GetGlobalConfigName();
1095 const AliTRDCalDCSv2 *calv2EOR = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(idEOR));
1096 cfgEOR = calv2EOR->GetGlobalConfigName();
1100 AliError("NO DCS/DCSv2 OCDB entry found!");
1105 // If there is no EOR entry, return the SOR value
1106 if (!hasEOR || cfgEOR.Length()==0) {
1111 // Check if the configuration is the same for both
1112 if (cfgSOR.EqualTo(cfgEOR)) {
1117 // When both SOR and EOR have an entry but are different, the config is not defined
1118 AliError("Inconsistent configuration at start and end of run found!");
1124 //_____________________________________________________________________________
1125 void AliTRDcalibDB::GetGlobalConfigurationVersion(TString &version)
1128 // Get Version of Configuration from the DCS
1131 const TObjArray *dcsArr = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDDCS));
1137 Int_t esor = 0; // Take SOR
1138 Int_t calver = 0; // Check CalDCS version
1139 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCS")) calver = 1;
1140 if (!strcmp(dcsArr->At(0)->ClassName(),"AliTRDCalDCSv2")) calver = 2;
1145 const AliTRDCalDCS *calDCS = dynamic_cast<const AliTRDCalDCS *>(dcsArr->At(esor));
1150 version = calDCS->GetGlobalConfigVersion();
1153 else if (calver == 2) {
1156 const AliTRDCalDCSv2 *calDCSv2 = dynamic_cast<const AliTRDCalDCSv2 *>(dcsArr->At(esor));
1161 version = calDCSv2->GetGlobalConfigVersion();
1166 AliError("NO DCS/DCSv2 OCDB entry found!");
1172 //_____________________________________________________________________________
1173 Int_t AliTRDcalibDB::GetNumberOfParsDCS(TString cname)
1175 // Get the number of configuration parameters from the DCS config
1177 TString cdelim = "_";
1178 TObjArray *carr = cname.Tokenize(cdelim);
1179 return carr->GetEntries() - 1; // -1 for the "cf"
1183 //_____________________________________________________________________________
1184 Int_t AliTRDcalibDB::GetNumberOfOptsDCS(TString cname, Int_t cfgType)
1186 // Get the number of options of a given configuration parameter from DCS
1188 TString cdelim = "_";
1189 TString odelim = "-";
1191 TObjArray *carr = cname.Tokenize(cdelim);
1192 Int_t nconfig = carr->GetEntries();
1195 if ((nconfig == 0) || ((nconfig-1) < cfgType)) {
1196 AliError("Not enough parameters in DCS configuration name!");
1200 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1201 TObjArray *oarr = fullcfg.Tokenize(odelim);
1202 return oarr->GetEntries() -1; // -1 for the parameter name
1206 //_____________________________________________________________________________
1207 void AliTRDcalibDB::GetDCSConfigParOption(TString cname, Int_t cfgType, Int_t option, TString &cfgo)
1210 // Get a configuration (see enum in header file) or the options of a configuration
1211 // option == 0 returns the configuration itself
1212 // option > 0 returns the optional parameter Nr. (option) of the configuration (cfgType)
1215 // define the delimiters
1216 TString cdelim = "_";
1217 TString odelim = "-";
1219 TObjArray *carr = cname.Tokenize(cdelim);
1220 Int_t nconfig = carr->GetEntries();
1224 AliError("DCS configuration name empty!");
1227 } else if ((nconfig-1) < cfgType) {
1228 AliError("Not enough parameters in DCS configuration name!");
1233 TString fullcfg = ((TObjString*)carr->At(cfgType))->GetString();
1234 TObjArray *oarr = fullcfg.Tokenize(odelim);
1235 Int_t noptions = oarr->GetEntries();
1238 if ((noptions-1) < option) {
1239 AliError("Not enough options in DCS configuration name!");
1244 cfgo = ((TObjString*)oarr->At(option))->GetString();
1249 //_____________________________________________________________________________
1250 Bool_t AliTRDcalibDB::HasOnlineFilterPedestal()
1253 // Checks whether pedestal filter was applied online
1256 TString filterconfig;
1257 GetFilterType(filterconfig);
1259 return filterconfig.Contains("p");
1263 //_____________________________________________________________________________
1264 Bool_t AliTRDcalibDB::HasOnlineFilterGain()
1267 // Checks whether online gain filter was applied
1270 TString filterconfig;
1271 GetFilterType(filterconfig);
1273 return filterconfig.Contains("g");
1277 //_____________________________________________________________________________
1278 Bool_t AliTRDcalibDB::HasOnlineTailCancellation()
1281 // Checks whether online tail cancellation was applied
1284 TString filterconfig;
1285 GetFilterType(filterconfig);
1287 return filterconfig.Contains("t");
1291 //_____________________________________________________________________________
1292 Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row)
1295 // Returns the status of the given pad
1298 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1299 (GetCachedCDBObject(kIDPadStatus));
1304 const AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1309 return roc->GetStatus(col,row);
1313 //_____________________________________________________________________________
1314 AliTRDCalSingleChamberStatus* AliTRDcalibDB::GetPadStatusROC(Int_t det)
1317 // Returns the pad status calibration object for a given ROC
1320 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1321 (GetCachedCDBObject(kIDPadStatus));
1326 AliTRDCalSingleChamberStatus *roc = cal->GetCalROC(det);
1336 //_____________________________________________________________________________
1337 Char_t AliTRDcalibDB::GetChamberStatus(Int_t det)
1340 // Returns the status of the given chamber
1343 const AliTRDCalChamberStatus *cal = dynamic_cast<const AliTRDCalChamberStatus *>
1344 (GetCachedCDBObject(kIDChamberStatus));
1349 return cal->GetStatus(det);
1353 //_____________________________________________________________________________
1354 AliTRDrecoParam* AliTRDcalibDB::GetRecoParam(Int_t */*eventtype*/)
1357 // Returns the TRD reconstruction parameters from the OCDB
1360 const TClonesArray *recos = dynamic_cast<const TClonesArray*>(GetCachedCDBObject(kIDRecoParam));
1361 if (!recos) return 0x0;
1363 // calculate entry based on event type info
1364 Int_t n = 0; //f(eventtype[0], eventtype[1], ....)
1366 return (AliTRDrecoParam *) recos->UncheckedAt(n);
1370 //_____________________________________________________________________________
1371 Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row)
1374 // Returns status, see name of functions for details ;-)
1377 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1378 (GetCachedCDBObject(kIDPadStatus));
1383 return cal->IsMasked(det,col,row);
1387 //_____________________________________________________________________________
1388 Bool_t AliTRDcalibDB::IsPadBridgedLeft(Int_t det, Int_t col, Int_t row)
1391 // Returns status, see name of functions for details ;-)
1394 const AliTRDCalPadStatus *cal = dynamic_cast<const AliTRDCalPadStatus *>
1395 (GetCachedCDBObject(kIDPadStatus));
1400 return cal->IsBridgedLeft(det,col,row);
1404 //_____________________________________________________________________________
1405 Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row)
1408 // Returns status, see name of functions for details ;-)
1411 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1412 (GetCachedCDBObject(kIDPadStatus));
1417 return cal->IsBridgedRight(det,col,row);
1421 //_____________________________________________________________________________
1422 Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row)
1425 // Returns status, see name of functions for details ;-)
1428 const AliTRDCalPadStatus * cal = dynamic_cast<const AliTRDCalPadStatus *>
1429 (GetCachedCDBObject(kIDPadStatus));
1434 return cal->IsNotConnected(det,col,row);
1438 //_____________________________________________________________________________
1439 Bool_t AliTRDcalibDB::IsChamberGood(Int_t det)
1442 // Returns status, see name of functions for details ;-)
1445 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1446 (GetCachedCDBObject(kIDChamberStatus));
1451 return cal->IsGood(det);
1455 //_____________________________________________________________________________
1456 Bool_t AliTRDcalibDB::IsChamberNoData(Int_t det)
1459 // Returns status, see name of functions for details ;-)
1462 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1463 (GetCachedCDBObject(kIDChamberStatus));
1468 return cal->IsNoData(det);
1472 //_____________________________________________________________________________
1473 Bool_t AliTRDcalibDB::IsHalfChamberNoData(Int_t det, Int_t side)
1476 // Returns status, see name of functions for details ;-)
1479 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1480 (GetCachedCDBObject(kIDChamberStatus));
1485 return side > 0 ? cal->IsNoDataSideB(det) : cal->IsNoDataSideA(det);
1489 //_____________________________________________________________________________
1490 Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det)
1493 // Returns status, see name of functions for details ;-)
1496 const AliTRDCalChamberStatus * cal = dynamic_cast<const AliTRDCalChamberStatus *>
1497 (GetCachedCDBObject(kIDChamberStatus));
1502 return cal->IsBadCalibrated(det);
1506 //_____________________________________________________________________________
1507 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
1510 // Returns the object storing the distributions for PID with likelihood
1514 case AliTRDpidUtil::kLQ:
1515 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
1516 case AliTRDpidUtil::kNN:
1517 return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
1518 case AliTRDpidUtil::kESD:
1519 return 0x0; // To avoid compiler warnings
1526 //_____________________________________________________________________________
1527 AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method)
1530 // Returns the PID response object for 1D-LQ
1533 if (!fPIDResponse) {
1535 fPIDResponse = new AliTRDPIDResponse;
1537 // Load Reference Histos from OCDB
1538 fPIDResponse->SetPIDmethod(method);
1539 const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
1541 TIter refs(references);
1542 TObject *obj = NULL;
1543 AliTRDPIDReference *ref = NULL;
1544 Bool_t hasReference = kFALSE;
1545 while ((obj = refs())){
1546 if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
1547 //fPIDResponse->Load(ref);
1548 hasReference = kTRUE;
1553 if (!hasReference) {
1554 AliError("Reference histograms not found in the OCDB");
1559 return fPIDResponse;
1563 //_____________________________________________________________________________
1564 const AliTRDCalTrkAttach* AliTRDcalibDB::GetAttachObject()
1567 // Returns the object storing likelihood distributions for cluster to track attachment
1570 return dynamic_cast<const AliTRDCalTrkAttach*>(GetCachedCDBObject(kIDAttach));
1574 //_____________________________________________________________________________
1575 const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject()
1578 // Returns the object storing the monitoring data
1581 return dynamic_cast<const AliTRDCalMonitoring *>
1582 (GetCachedCDBObject(kIDMonitoringData));
1586 //_____________________________________________________________________________
1587 void AliTRDcalibDB::SamplePRF()
1590 // Samples the pad response function (should maybe go somewhere else ...)
1593 const Int_t kPRFbin = 61;
1595 Float_t prf[kNlayer][kPRFbin] = {
1596 {2.9037e-02, 3.3608e-02, 3.9020e-02, 4.5292e-02,
1597 5.2694e-02, 6.1362e-02, 7.1461e-02, 8.3362e-02,
1598 9.7063e-02, 1.1307e-01, 1.3140e-01, 1.5235e-01,
1599 1.7623e-01, 2.0290e-01, 2.3294e-01, 2.6586e-01,
1600 3.0177e-01, 3.4028e-01, 3.8077e-01, 4.2267e-01,
1601 4.6493e-01, 5.0657e-01, 5.4655e-01, 5.8397e-01,
1602 6.1767e-01, 6.4744e-01, 6.7212e-01, 6.9188e-01,
1603 7.0627e-01, 7.1499e-01, 7.1851e-01, 7.1499e-01,
1604 7.0627e-01, 6.9188e-01, 6.7212e-01, 6.4744e-01,
1605 6.1767e-01, 5.8397e-01, 5.4655e-01, 5.0657e-01,
1606 4.6493e-01, 4.2267e-01, 3.8077e-01, 3.4028e-01,
1607 3.0177e-01, 2.6586e-01, 2.3294e-01, 2.0290e-01,
1608 1.7623e-01, 1.5235e-01, 1.3140e-01, 1.1307e-01,
1609 9.7063e-02, 8.3362e-02, 7.1461e-02, 6.1362e-02,
1610 5.2694e-02, 4.5292e-02, 3.9020e-02, 3.3608e-02,
1612 {2.5478e-02, 2.9695e-02, 3.4655e-02, 4.0454e-02,
1613 4.7342e-02, 5.5487e-02, 6.5038e-02, 7.6378e-02,
1614 8.9696e-02, 1.0516e-01, 1.2327e-01, 1.4415e-01,
1615 1.6794e-01, 1.9516e-01, 2.2573e-01, 2.5959e-01,
1616 2.9694e-01, 3.3719e-01, 3.7978e-01, 4.2407e-01,
1617 4.6889e-01, 5.1322e-01, 5.5569e-01, 5.9535e-01,
1618 6.3141e-01, 6.6259e-01, 6.8882e-01, 7.0983e-01,
1619 7.2471e-01, 7.3398e-01, 7.3761e-01, 7.3398e-01,
1620 7.2471e-01, 7.0983e-01, 6.8882e-01, 6.6259e-01,
1621 6.3141e-01, 5.9535e-01, 5.5569e-01, 5.1322e-01,
1622 4.6889e-01, 4.2407e-01, 3.7978e-01, 3.3719e-01,
1623 2.9694e-01, 2.5959e-01, 2.2573e-01, 1.9516e-01,
1624 1.6794e-01, 1.4415e-01, 1.2327e-01, 1.0516e-01,
1625 8.9696e-02, 7.6378e-02, 6.5038e-02, 5.5487e-02,
1626 4.7342e-02, 4.0454e-02, 3.4655e-02, 2.9695e-02,
1628 {2.2363e-02, 2.6233e-02, 3.0782e-02, 3.6140e-02,
1629 4.2535e-02, 5.0157e-02, 5.9197e-02, 6.9900e-02,
1630 8.2707e-02, 9.7811e-02, 1.1548e-01, 1.3601e-01,
1631 1.5998e-01, 1.8739e-01, 2.1840e-01, 2.5318e-01,
1632 2.9182e-01, 3.3373e-01, 3.7837e-01, 4.2498e-01,
1633 4.7235e-01, 5.1918e-01, 5.6426e-01, 6.0621e-01,
1634 6.4399e-01, 6.7700e-01, 7.0472e-01, 7.2637e-01,
1635 7.4206e-01, 7.5179e-01, 7.5551e-01, 7.5179e-01,
1636 7.4206e-01, 7.2637e-01, 7.0472e-01, 6.7700e-01,
1637 6.4399e-01, 6.0621e-01, 5.6426e-01, 5.1918e-01,
1638 4.7235e-01, 4.2498e-01, 3.7837e-01, 3.3373e-01,
1639 2.9182e-01, 2.5318e-01, 2.1840e-01, 1.8739e-01,
1640 1.5998e-01, 1.3601e-01, 1.1548e-01, 9.7811e-02,
1641 8.2707e-02, 6.9900e-02, 5.9197e-02, 5.0157e-02,
1642 4.2535e-02, 3.6140e-02, 3.0782e-02, 2.6233e-02,
1644 {1.9635e-02, 2.3167e-02, 2.7343e-02, 3.2293e-02,
1645 3.8224e-02, 4.5335e-02, 5.3849e-02, 6.4039e-02,
1646 7.6210e-02, 9.0739e-02, 1.0805e-01, 1.2841e-01,
1647 1.5216e-01, 1.7960e-01, 2.1099e-01, 2.4671e-01,
1648 2.8647e-01, 3.2996e-01, 3.7660e-01, 4.2547e-01,
1649 4.7536e-01, 5.2473e-01, 5.7215e-01, 6.1632e-01,
1650 6.5616e-01, 6.9075e-01, 7.1939e-01, 7.4199e-01,
1651 7.5838e-01, 7.6848e-01, 7.7227e-01, 7.6848e-01,
1652 7.5838e-01, 7.4199e-01, 7.1939e-01, 6.9075e-01,
1653 6.5616e-01, 6.1632e-01, 5.7215e-01, 5.2473e-01,
1654 4.7536e-01, 4.2547e-01, 3.7660e-01, 3.2996e-01,
1655 2.8647e-01, 2.4671e-01, 2.1099e-01, 1.7960e-01,
1656 1.5216e-01, 1.2841e-01, 1.0805e-01, 9.0739e-02,
1657 7.6210e-02, 6.4039e-02, 5.3849e-02, 4.5335e-02,
1658 3.8224e-02, 3.2293e-02, 2.7343e-02, 2.3167e-02,
1660 {1.7224e-02, 2.0450e-02, 2.4286e-02, 2.8860e-02,
1661 3.4357e-02, 4.0979e-02, 4.8966e-02, 5.8612e-02,
1662 7.0253e-02, 8.4257e-02, 1.0102e-01, 1.2094e-01,
1663 1.4442e-01, 1.7196e-01, 2.0381e-01, 2.4013e-01,
1664 2.8093e-01, 3.2594e-01, 3.7450e-01, 4.2563e-01,
1665 4.7796e-01, 5.2991e-01, 5.7974e-01, 6.2599e-01,
1666 6.6750e-01, 7.0344e-01, 7.3329e-01, 7.5676e-01,
1667 7.7371e-01, 7.8410e-01, 7.8793e-01, 7.8410e-01,
1668 7.7371e-01, 7.5676e-01, 7.3329e-01, 7.0344e-01,
1669 6.6750e-01, 6.2599e-01, 5.7974e-01, 5.2991e-01,
1670 4.7796e-01, 4.2563e-01, 3.7450e-01, 3.2594e-01,
1671 2.8093e-01, 2.4013e-01, 2.0381e-01, 1.7196e-01,
1672 1.4442e-01, 1.2094e-01, 1.0102e-01, 8.4257e-02,
1673 7.0253e-02, 5.8612e-02, 4.8966e-02, 4.0979e-02,
1674 3.4357e-02, 2.8860e-02, 2.4286e-02, 2.0450e-02,
1676 {1.5096e-02, 1.8041e-02, 2.1566e-02, 2.5793e-02,
1677 3.0886e-02, 3.7044e-02, 4.4515e-02, 5.3604e-02,
1678 6.4668e-02, 7.8109e-02, 9.4364e-02, 1.1389e-01,
1679 1.3716e-01, 1.6461e-01, 1.9663e-01, 2.3350e-01,
1680 2.7527e-01, 3.2170e-01, 3.7214e-01, 4.2549e-01,
1681 4.8024e-01, 5.3460e-01, 5.8677e-01, 6.3512e-01,
1682 6.7838e-01, 7.1569e-01, 7.4655e-01, 7.7071e-01,
1683 7.8810e-01, 7.9871e-01, 8.0255e-01, 7.9871e-01,
1684 7.8810e-01, 7.7071e-01, 7.4655e-01, 7.1569e-01,
1685 6.7838e-01, 6.3512e-01, 5.8677e-01, 5.3460e-01,
1686 4.8024e-01, 4.2549e-01, 3.7214e-01, 3.2170e-01,
1687 2.7527e-01, 2.3350e-01, 1.9663e-01, 1.6461e-01,
1688 1.3716e-01, 1.1389e-01, 9.4364e-02, 7.8109e-02,
1689 6.4668e-02, 5.3604e-02, 4.4515e-02, 3.7044e-02,
1690 3.0886e-02, 2.5793e-02, 2.1566e-02, 1.8041e-02,
1693 // More sampling precision with linear interpolation
1696 Float_t pad[kPRFbin];
1697 Int_t sPRFbin = kPRFbin;
1698 Float_t sPRFwid = (fPRFhi - fPRFlo) / ((Float_t) sPRFbin);
1699 for (Int_t iPad = 0; iPad < sPRFbin; iPad++) {
1700 pad[iPad] = ((Float_t) iPad + 0.5) * sPRFwid + fPRFlo;
1703 fPRFwid = (fPRFhi - fPRFlo) / ((Float_t) fPRFbin);
1704 fPRFpad = ((Int_t) (1.0 / fPRFwid));
1706 if (fPRFsmp) delete [] fPRFsmp;
1707 fPRFsmp = new Float_t[kNlayer*fPRFbin];
1713 for (Int_t iLayer = 0; iLayer < kNlayer; iLayer++) {
1715 for (Int_t iBin = 0; iBin < fPRFbin; iBin++) {
1717 Float_t bin = (((Float_t) iBin) + 0.5) * fPRFwid + fPRFlo;
1721 diff = bin - pad[ipos2++];
1722 } while ((diff > 0) && (ipos2 < kPRFbin));
1723 if (ipos2 == kPRFbin) {
1724 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1726 else if (ipos2 == 1) {
1727 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2-1];
1731 if (ipos2 >= kPRFbin) ipos2 = kPRFbin - 1;
1733 fPRFsmp[iLayer*fPRFbin+iBin] = prf[iLayer][ipos2]
1734 + diff * (prf[iLayer][ipos2] - prf[iLayer][ipos1])
1743 //_____________________________________________________________________________
1744 Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist
1745 , Int_t layer, Double_t *pad) const
1748 // Applies the pad response
1749 // So far this is the fixed parametrization and should be replaced by
1750 // something dependent on calibration values
1753 Int_t iBin = ((Int_t) ((-dist - fPRFlo) / fPRFwid));
1754 Int_t iOff = layer * fPRFbin;
1756 Int_t iBin0 = iBin - fPRFpad + iOff;
1757 Int_t iBin1 = iBin + iOff;
1758 Int_t iBin2 = iBin + fPRFpad + iOff;
1763 if ((iBin1 >= 0) && (iBin1 < (fPRFbin*kNlayer))) {
1766 pad[0] = signal * fPRFsmp[iBin0];
1768 pad[1] = signal * fPRFsmp[iBin1];
1769 if (iBin2 < (fPRFbin*kNlayer)) {
1770 pad[2] = signal * fPRFsmp[iBin2];
1785 AliTRDtrapConfig* AliTRDcalibDB::GetTrapConfig()
1787 // return an existing TRAPconfig or load it from the OCDB
1788 // in case of failure, a default TRAPconfig is created
1793 if ((fTrapConfigName.Length() <= 0) || (fTrapConfigVersion.Length() <= 0)) {
1794 // query the configuration to be used
1796 this->GetGlobalConfiguration(configName);
1797 TString configVersion;
1798 this->GetGlobalConfigurationVersion(configVersion);
1801 // try to load the requested configuration
1802 this->LoadTrapConfig(fTrapConfigName, fTrapConfigVersion);
1804 // if we still don't have a valid TRAPconfig, create a default one
1806 AliWarning("Falling back to default configuration");
1807 fTrapConfig = new AliTRDtrapConfig("default", "default TRAP configuration");
1808 AliTRDtrapConfigHandler cfgHandler(fTrapConfig);
1810 cfgHandler.LoadConfig();
1813 AliInfo(Form("using TRAPconfig \"%s\"", fTrapConfig->GetTitle()));
1820 AliTRDtrapConfig* AliTRDcalibDB::LoadTrapConfig(const TString &name, const TString &version)
1822 // try to load the specified configuration from the OCDB
1823 // if it fails, or it does not exist, return null
1825 AliInfo(Form("looking for TRAPconfig \"%s.%s\"", name.Data(), version.Data()));
1827 const AliTRDCalTrapConfig *caltrap = dynamic_cast<const AliTRDCalTrapConfig*> (GetCachedCDBObject(kIDTrapConfig));
1830 TString configName(name);
1831 configName.Append(".");
1832 configName.Append(version);
1833 fTrapConfig = caltrap->Get(configName);
1837 AliError("No TRAPconfig entry found!");