From 56178ff4c184f3671d36cf3a94bfce9131b8d85a Mon Sep 17 00:00:00 2001 From: cblume Date: Mon, 19 Feb 2007 15:56:43 +0000 Subject: [PATCH] Optimize database access in clusterizer --- TRD/AliTRDcalibDB.cxx | 91 ++++++++++++++++++++++++++++++++++++- TRD/AliTRDcalibDB.h | 51 ++++++++++++--------- TRD/AliTRDclusterizerV1.cxx | 31 ++++++++++--- 3 files changed, 144 insertions(+), 29 deletions(-) diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index d326fe11a88..4ba0cc23694 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -403,6 +403,49 @@ Float_t AliTRDcalibDB::GetT0(Int_t det, Int_t col, Int_t 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; + } + +} + //_____________________________________________________________________________ Float_t AliTRDcalibDB::GetT0Average(Int_t det) { @@ -450,8 +493,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)); @@ -463,6 +507,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) { @@ -876,6 +963,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)); diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h index 25e256cc78f..8f7f72c7eea 100644 --- a/TRD/AliTRDcalibDB.h +++ b/TRD/AliTRDcalibDB.h @@ -17,6 +17,8 @@ class AliCDBEntry; class AliTRDCalPIDLQ; class AliTRDCalMonitoring; +class AliTRDCalROC; +class AliTRDCalDet; class AliTRDcalibDB : public TObject { @@ -27,41 +29,46 @@ class AliTRDcalibDB : public TObject { , kNsect = 18 , kNdet = 540 }; - static AliTRDcalibDB *Instance(); - static void Terminate(); + static AliTRDcalibDB *Instance(); + static void Terminate(); - void SetRun(Long64_t run); - Long64_t GetRun() { return fRun; } + void SetRun(Long64_t run); + Long64_t GetRun() { return fRun; } - Float_t GetVdrift(Int_t det, Int_t col, Int_t row); - Float_t GetVdriftAverage(Int_t det); + Float_t GetVdrift(Int_t det, Int_t col, Int_t row); + Float_t GetVdriftAverage(Int_t det); - Float_t GetT0(Int_t det, Int_t col, Int_t row); - Float_t GetT0Average(Int_t det); + Float_t GetT0(Int_t det, Int_t col, Int_t row); + Float_t GetT0Average(Int_t det); + AliTRDCalROC *GetT0ROC(Int_t det); + const AliTRDCalDet *GetT0Det(); - Float_t GetGainFactor(Int_t det, Int_t col, Int_t row); - Float_t GetGainFactorAverage(Int_t det); + Float_t GetGainFactor(Int_t det, Int_t col, Int_t row); + Float_t GetGainFactorAverage(Int_t det); + AliTRDCalROC *GetGainFactorROC(Int_t det); + const AliTRDCalDet *GetGainFactorDet(); - Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row); + Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row); - Int_t GetNumberOfTimeBins(); + Int_t GetNumberOfTimeBins(); - Char_t GetPadStatus(Int_t det, Int_t col, Int_t row); - Char_t GetChamberStatus(Int_t det); + Char_t GetPadStatus(Int_t det, Int_t col, Int_t row); + Char_t GetChamberStatus(Int_t det); - Bool_t IsPadMasked(Int_t det, Int_t col, Int_t row); - Bool_t IsPadBridgedLeft(Int_t det, Int_t col, Int_t row); - Bool_t IsPadBridgedRight(Int_t det, Int_t col, Int_t row); + Bool_t IsPadMasked(Int_t det, Int_t col, Int_t row); + Bool_t IsPadBridgedLeft(Int_t det, Int_t col, Int_t row); + Bool_t IsPadBridgedRight(Int_t det, Int_t col, Int_t row); - Bool_t IsChamberInstalled(Int_t det); - Bool_t IsChamberMasked(Int_t det); + Bool_t IsChamberInstalled(Int_t det); + Bool_t IsChamberMasked(Int_t det); const AliTRDCalMonitoring *GetMonitoringObject(); const AliTRDCalPIDLQ *GetPIDLQObject(); // Related functions, these depend on calibration data - static Float_t GetOmegaTau(Float_t vdrift, Float_t bz); - Int_t PadResponse(Double_t signal, Double_t dist, Int_t plane, Double_t *pad) const; + static Float_t GetOmegaTau(Float_t vdrift, Float_t bz); + Int_t PadResponse(Double_t signal, Double_t dist + , Int_t plane, Double_t *pad) const; protected: @@ -83,7 +90,7 @@ class AliTRDcalibDB : public TObject { , kIDChamberStatus , kIDPadStatus }; // IDs of cached objects - const TObject* GetCachedCDBObject(Int_t id); + const TObject *GetCachedCDBObject(Int_t id); void Invalidate(); void SamplePRF(); diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index 3afe67b4b81..3badfb2fb84 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -45,6 +45,9 @@ #include "AliTRDCommonParam.h" #include "AliTRDcluster.h" +#include "Cal/AliTRDCalROC.h" +#include "Cal/AliTRDCalDet.h" + ClassImp(AliTRDclusterizerV1) //_____________________________________________________________________________ @@ -209,6 +212,9 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Threshold value for the digit signal Float_t sigThresh = recParam->GetClusSigThresh(); + // Detector wise calibration object for t0 + const AliTRDCalDet *calT0Det = calibration->GetT0Det(); + // Iteration limit for unfolding procedure const Float_t kEpsilon = 0.01; const Int_t kNclus = 3; @@ -261,6 +267,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters() AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham); + // Calibration object with pad wise values for t0 + AliTRDCalROC *calT0ROC = calibration->GetT0ROC(idet); + // Calibration value for chamber wise t0 + Float_t calT0DetValue = calT0Det->GetValue(idet); + Int_t nClusters = 0; Int_t nClusters2pad = 0; Int_t nClusters3pad = 0; @@ -452,8 +463,9 @@ Bool_t AliTRDclusterizerV1::MakeClusters() // Calculate the position and the error // - // Correct for t0 - Int_t clusterTimeBin = TMath::Nint(time - calibration->GetT0(idet,col,row)); + // Correct for t0 (sum of chamber and pad wise values !!!) + Float_t calT0ROCValue = calT0ROC->GetValue(col,row); + Int_t clusterTimeBin = TMath::Nint(time - (calT0DetValue + calT0ROCValue)); Double_t colSize = padPlane->GetColSize(col); Double_t rowSize = padPlane->GetRowSize(row); @@ -684,18 +696,25 @@ void AliTRDclusterizerV1::Transform(AliTRDdataArrayI *digitsIn AliDebug(1,Form("Tail cancellation (nExp = %d) for detector %d.\n" ,recParam->GetTCnexp(),idet)); + // Calibration object with chamber wise values for the gain factor + const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet(); + // Calibration object with pad wise values for the gain factor + AliTRDCalROC *calGainFactorROC = calibration->GetGainFactorROC(idet); + // Calibration value for chamber wise gain factors + Float_t calGainFactorDetValue = calGainFactorDet->GetValue(idet); + for (iRow = 0; iRow < nRowMax; iRow++ ) { for (iCol = 0; iCol < nColMax; iCol++ ) { + Float_t calGainFactorROCValue = calGainFactorROC->GetValue(iCol,iRow); + Double_t gain = calGainFactorDetValue + * calGainFactorROCValue; + for (iTime = 0; iTime < nTimeTotal; iTime++) { // // Add gain // - Double_t gain = calibration->GetGainFactor(idet,iCol,iRow); - if (gain == 0.0) { - AliError("Not a valid gain\n"); - } inADC[iTime] = digitsIn->GetDataUnchecked(iRow,iCol,iTime); inADC[iTime] /= gain; outADC[iTime] = inADC[iTime]; -- 2.43.0