X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDcalibDB.cxx;h=6d047c89d624f68ffb7186f03e775849c1d9f9e5;hb=eecc22a3a65b8daa9e61c0d4efba3bd5d6ae3ad8;hp=102721da5e56d5a614b06d136caf2be2cc4789f5;hpb=4806f526811a1438d9ce0a7620b178b430950bdf;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index 102721da5e5..6d047c89d62 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -28,6 +28,7 @@ // // /////////////////////////////////////////////////////////////////////////////// +#include #include #include "AliCDBManager.h" @@ -43,12 +44,10 @@ #include "Cal/AliTRDCalROC.h" #include "Cal/AliTRDCalPad.h" #include "Cal/AliTRDCalDet.h" -#include "Cal/AliTRDCalGlobals.h" -#include "Cal/AliTRDCalPIDLQ.h" +#include "Cal/AliTRDCalFEE.h" +#include "Cal/AliTRDCalPID.h" #include "Cal/AliTRDCalMonitoring.h" -#include "Cal/AliTRDCalSuperModuleStatus.h" #include "Cal/AliTRDCalChamberStatus.h" -#include "Cal/AliTRDCalMCMStatus.h" #include "Cal/AliTRDCalPadStatus.h" #include "Cal/AliTRDCalSingleChamberStatus.h" @@ -122,7 +121,7 @@ AliTRDcalibDB::AliTRDcalibDB() // Create the sampled PRF SamplePRF(); - + } //_____________________________________________________________________________ @@ -231,15 +230,9 @@ const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id) break; // Status values - case kIDSuperModuleStatus : - return CacheCDBEntry(kIDSuperModuleStatus ,"TRD/Calib/SuperModuleStatus"); - break; case kIDChamberStatus : return CacheCDBEntry(kIDChamberStatus ,"TRD/Calib/ChamberStatus"); break; - case kIDMCMStatus : - return CacheCDBEntry(kIDMCMStatus ,"TRD/Calib/MCMStatus"); - break; case kIDPadStatus : return CacheCDBEntry(kIDPadStatus ,"TRD/Calib/PadStatus"); break; @@ -248,9 +241,11 @@ const TObject *AliTRDcalibDB::GetCachedCDBObject(Int_t id) case kIDMonitoringData : return CacheCDBEntry(kIDMonitoringData ,"TRD/Calib/MonitoringData"); break; - case kIDGlobals : - return CacheCDBEntry(kIDGlobals ,"TRD/Calib/Globals"); + case kIDFEE : + return CacheCDBEntry(kIDFEE ,"TRD/Calib/FEE"); break; + case kIDPIDNN : + return CacheCDBEntry(kIDPIDNN ,"TRD/Calib/PIDNN"); case kIDPIDLQ : return CacheCDBEntry(kIDPIDLQ ,"TRD/Calib/PIDLQ"); break; @@ -270,7 +265,7 @@ AliCDBEntry *AliTRDcalibDB::GetCDBEntry(const char *cdbPath) AliCDBEntry *entry = AliCDBManager::Instance()->Get(cdbPath,fRun); if (!entry) { - AliError(Form("Failed to get entry: %s",cdbPath)); + AliFatal(Form("Failed to get entry: %s",cdbPath)); return 0; } @@ -324,7 +319,8 @@ void AliTRDcalibDB::Invalidate() for (Int_t i = 0; i < kCDBCacheSize; ++i) { if (fCDBEntries[i]) { if (AliCDBManager::Instance()->GetCacheFlag() == kFALSE) { - if ((fCDBEntries[i]->IsOwner() == kFALSE) && fCDBCache[i]) { + if ((fCDBEntries[i]->IsOwner() == kFALSE) && + (fCDBCache[i])) { delete fCDBCache[i]; } delete fCDBEntries[i]; @@ -363,6 +359,49 @@ Float_t AliTRDcalibDB::GetVdrift(Int_t det, Int_t col, Int_t row) return calChamber->GetValue(det) * roc->GetValue(col,row); } + +//_____________________________________________________________________________ +AliTRDCalROC *AliTRDcalibDB::GetVdriftROC(Int_t det) +{ + // + // Returns the Vdrift calibration object for a given ROC + // containing one number per pad + // + + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDVdriftPad)); + if (!calPad) { + return 0; + } + + AliTRDCalROC *roc = calPad->GetCalROC(det); + if (!roc) { + return 0; + } + else { + return roc; + } + +} + +//_____________________________________________________________________________ +const AliTRDCalDet *AliTRDcalibDB::GetVdriftDet() +{ + // + // Returns the Vdrift calibration object + // containing one number per detector + // + + const AliTRDCalDet *calChamber = dynamic_cast + (GetCachedCDBObject(kIDVdriftChamber)); + if (!calChamber) { + return 0; + } + else { + return calChamber; + } + +} //_____________________________________________________________________________ Float_t AliTRDcalibDB::GetVdriftAverage(Int_t det) @@ -388,24 +427,67 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t row) // Returns t0 for the given pad. // - const AliTRDCalPad *calPad = dynamic_cast - (GetCachedCDBObject(kIDT0Pad)); + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDT0Pad)); if (!calPad) { return -1; } - AliTRDCalROC *roc = calPad->GetCalROC(det); + AliTRDCalROC *roc = calPad->GetCalROC(det); if (!roc) { return -1; } - const AliTRDCalDet *calChamber = dynamic_cast - (GetCachedCDBObject(kIDT0Chamber)); + const AliTRDCalDet *calChamber = dynamic_cast + (GetCachedCDBObject(kIDT0Chamber)); if (!calChamber) { return -1; } - return calChamber->GetValue(det) * roc->GetValue(col,row); + return calChamber->GetValue(det) + roc->GetValue(col,row); + +} + +//_____________________________________________________________________________ +AliTRDCalROC *AliTRDcalibDB::GetT0ROC(Int_t det) +{ + // + // Returns the t0 calibration object for a given ROC + // containing one number per pad + // + + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDT0Pad)); + if (!calPad) { + return 0; + } + + AliTRDCalROC *roc = calPad->GetCalROC(det); + if (!roc) { + return 0; + } + else { + return roc; + } + +} + +//_____________________________________________________________________________ +const AliTRDCalDet *AliTRDcalibDB::GetT0Det() +{ + // + // Returns the t0 calibration object + // containing one number per detector + // + + const AliTRDCalDet *calChamber = dynamic_cast + (GetCachedCDBObject(kIDT0Chamber)); + if (!calChamber) { + return 0; + } + else { + return calChamber; + } } @@ -416,13 +498,29 @@ Float_t AliTRDcalibDB::GetT0Average(Int_t det) // Returns the average t0 for the given detector // + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDT0Pad)); + if (!calPad) { + return -1; + } + + AliTRDCalROC *roc = calPad->GetCalROC(det); + if (!roc) { + return -1; + } + const AliTRDCalDet *calDet = dynamic_cast (GetCachedCDBObject(kIDT0Chamber)); if (!calDet) { return -1; } - return calDet->GetValue(det); + Double_t mean = 0.0; + for (Int_t channel = 0; channel < roc->GetNchannels(); ++channel) { + mean += (calDet->GetValue(det) + roc->GetValue(channel)) / roc->GetNchannels(); + } + + return mean; } @@ -440,8 +538,9 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) } AliTRDCalROC *roc = calPad->GetCalROC(det); - if (!roc) + if (!roc) { return -1; + } const AliTRDCalDet *calChamber = dynamic_cast (GetCachedCDBObject(kIDGainFactorChamber)); @@ -453,6 +552,49 @@ Float_t AliTRDcalibDB::GetGainFactor(Int_t det, Int_t col, Int_t row) } +//_____________________________________________________________________________ +AliTRDCalROC *AliTRDcalibDB::GetGainFactorROC(Int_t det) +{ + // + // Returns the gain factor calibration object for a given ROC + // containing one number per pad + // + + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDGainFactorPad)); + if (!calPad) { + return 0; + } + + AliTRDCalROC *roc = calPad->GetCalROC(det); + if (!roc) { + return 0; + } + else { + return roc; + } + +} + +//_____________________________________________________________________________ +const AliTRDCalDet *AliTRDcalibDB::GetGainFactorDet() +{ + // + // Returns the gain factor calibration object + // containing one number per detector + // + + const AliTRDCalDet *calChamber = dynamic_cast + (GetCachedCDBObject(kIDGainFactorChamber)); + if (!calChamber) { + return 0; + } + else { + return calChamber; + } + +} + //_____________________________________________________________________________ Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) { @@ -471,41 +613,48 @@ Float_t AliTRDcalibDB::GetGainFactorAverage(Int_t det) } //_____________________________________________________________________________ -Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) +AliTRDCalROC *AliTRDcalibDB::GetPRFROC(Int_t det) { // - // Returns the PRF width for the given pad. + // Returns the PRF calibration object for a given ROC + // containing one number per pad // - const AliTRDCalPad *calPad = dynamic_cast - (GetCachedCDBObject(kIDPRFWidth)); + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDPRFWidth)); if (!calPad) { - return -1; + return 0; } - AliTRDCalROC *roc = calPad->GetCalROC(det); + AliTRDCalROC *roc = calPad->GetCalROC(det); if (!roc) { - return -1; + return 0; + } + else { + return roc; } - - return roc->GetValue(col,row); } //_____________________________________________________________________________ -Float_t AliTRDcalibDB::GetSamplingFrequency() +Float_t AliTRDcalibDB::GetPRFWidth(Int_t det, Int_t col, Int_t row) { // - // Returns the sampling frequency of the TRD read-out. + // Returns the PRF width for the given pad. // - const AliTRDCalGlobals *calGlobal = dynamic_cast - (GetCachedCDBObject(kIDGlobals)); - if (!calGlobal) { - return -1; - } + const AliTRDCalPad *calPad = dynamic_cast + (GetCachedCDBObject(kIDPRFWidth)); + if (!calPad) { + return -1; + } + + AliTRDCalROC *roc = calPad->GetCalROC(det); + if (!roc) { + return -1; + } - return calGlobal->GetSamplingFrequency(); + return roc->GetValue(col,row); } @@ -516,13 +665,13 @@ Int_t AliTRDcalibDB::GetNumberOfTimeBins() // Returns the number of time bins which are read-out. // - const AliTRDCalGlobals *calGlobal = dynamic_cast - (GetCachedCDBObject(kIDGlobals)); - if (!calGlobal) { + const AliTRDCalFEE *calFEE = dynamic_cast + (GetCachedCDBObject(kIDFEE)); + if (!calFEE) { return -1; } - return calGlobal->GetNumberOfTimeBins(); + return calFEE->GetNumberOfTimeBins(); } @@ -533,8 +682,8 @@ Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) // Returns the status of the given pad // - const AliTRDCalPadStatus *cal = dynamic_cast - (GetCachedCDBObject(kIDPadStatus)); + const AliTRDCalPadStatus *cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); if (!cal) { return -1; } @@ -548,23 +697,6 @@ Char_t AliTRDcalibDB::GetPadStatus(Int_t det, Int_t col, Int_t row) } -//_____________________________________________________________________________ -Char_t AliTRDcalibDB::GetMCMStatus(Int_t det, Int_t col, Int_t row) -{ - // - // Returns the status of the given MCM - // - - const AliTRDCalMCMStatus *cal = dynamic_cast - (GetCachedCDBObject(kIDMCMStatus)); - if (!cal) { - return -1; - } - - return cal->GetStatus(det,col,row); - -} - //_____________________________________________________________________________ Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) { @@ -582,23 +714,6 @@ Char_t AliTRDcalibDB::GetChamberStatus(Int_t det) } -//_____________________________________________________________________________ -Char_t AliTRDcalibDB::GetSuperModuleStatus(Int_t sm) -{ - // - // Returns the status of the given chamber - // - - const AliTRDCalSuperModuleStatus *cal = dynamic_cast - (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) { - return -1; - } - - return cal->GetStatus(sm); - -} - //_____________________________________________________________________________ Bool_t AliTRDcalibDB::IsPadMasked(Int_t det, Int_t col, Int_t row) { @@ -650,23 +765,6 @@ Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) } -//_____________________________________________________________________________ -Bool_t AliTRDcalibDB::IsMCMMasked(Int_t det, Int_t col, Int_t row) -{ - // - // Returns status, see name of functions for details ;-) - // - - const AliTRDCalMCMStatus * cal = dynamic_cast - (GetCachedCDBObject(kIDMCMStatus)); - if (!cal) { - return -1; - } - - return cal->IsMasked(det,col,row); - -} - //_____________________________________________________________________________ Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det) { @@ -702,58 +800,32 @@ Bool_t AliTRDcalibDB::IsChamberMasked(Int_t det) } //_____________________________________________________________________________ -Bool_t AliTRDcalibDB::IsSuperModuleInstalled(Int_t det) +const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(const Int_t method) { // - // Returns status, see name of functions for details ;-) - // - - const AliTRDCalSuperModuleStatus * cal = dynamic_cast - (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) { - return -1; - } - - return cal->IsInstalled(det); - -} - -//_____________________________________________________________________________ -Bool_t AliTRDcalibDB::IsSuperModuleMasked(Int_t det) -{ - // - // Returns status, see name of functions for details ;-) + // Returns the object storing the distributions for PID with likelihood // - const AliTRDCalSuperModuleStatus * cal = dynamic_cast - (GetCachedCDBObject(kIDSuperModuleStatus)); - if (!cal) { - return -1; + switch(method) { + case 0: return dynamic_cast + (GetCachedCDBObject(kIDPIDNN)); + case 1: return dynamic_cast + (GetCachedCDBObject(kIDPIDLQ)); } - return cal->IsMasked(det); - -} - -//_____________________________________________________________________________ -const AliTRDCalPIDLQ* AliTRDcalibDB::GetPIDLQObject() -{ - // - // Returns the object storing the distributions for PID with likelihood - // - - return dynamic_cast (GetCachedCDBObject(kIDPIDLQ)); + return 0; } //_____________________________________________________________________________ -const AliTRDCalMonitoring* AliTRDcalibDB::GetMonitoringObject() +const AliTRDCalMonitoring *AliTRDcalibDB::GetMonitoringObject() { // // Returns the object storing the monitoring data // - return dynamic_cast (GetCachedCDBObject(kIDMonitoringData)); + return dynamic_cast + (GetCachedCDBObject(kIDMonitoringData)); } @@ -966,6 +1038,8 @@ Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist { // // Applies the pad response + // So far this is the fixed parametrization and should be replaced by + // something dependent on calibration values // Int_t iBin = ((Int_t) (( - dist - fPRFlo) / fPRFwid)); @@ -998,4 +1072,3 @@ Int_t AliTRDcalibDB::PadResponse(Double_t signal, Double_t dist } } -