From: cblume Date: Fri, 28 Mar 2008 17:27:42 +0000 (+0000) Subject: Digits marked according to pad status X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=fa7427d0b1effe949ec3c0d8f987f1a563517a6a;p=u%2Fmrichter%2FAliRoot.git Digits marked according to pad status --- diff --git a/TRD/AliTRDcalibDB.cxx b/TRD/AliTRDcalibDB.cxx index ec78921b0ac..e7a45c1136a 100644 --- a/TRD/AliTRDcalibDB.cxx +++ b/TRD/AliTRDcalibDB.cxx @@ -787,6 +787,22 @@ Bool_t AliTRDcalibDB::IsPadBridgedRight(Int_t det, Int_t col, Int_t row) } +//_____________________________________________________________________________ +Bool_t AliTRDcalibDB::IsPadNotConnected(Int_t det, Int_t col, Int_t row) +{ + // + // Returns status, see name of functions for details ;-) + // + const AliTRDCalPadStatus * cal = dynamic_cast + (GetCachedCDBObject(kIDPadStatus)); + if (!cal) { + return -1; + } + + return cal->IsNotConnected(det,col,row); + +} + //_____________________________________________________________________________ Bool_t AliTRDcalibDB::IsChamberInstalled(Int_t det) { diff --git a/TRD/AliTRDcalibDB.h b/TRD/AliTRDcalibDB.h index 84ec825f98c..8ef6345c098 100644 --- a/TRD/AliTRDcalibDB.h +++ b/TRD/AliTRDcalibDB.h @@ -54,6 +54,11 @@ class AliTRDcalibDB : public TObject { AliTRDCalROC *GetPRFROC(Int_t det); Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row); + Float_t* GetSampledPRF() { return fPRFsmp; }; + Int_t GetPRFbin() { return fPRFbin; }; + Float_t GetPRFlo() { return fPRFlo; }; + Float_t GetPRFhi() { return fPRFhi; }; + Int_t GetNumberOfTimeBins(); Char_t GetPadStatus(Int_t det, Int_t col, Int_t row); @@ -64,6 +69,7 @@ class AliTRDcalibDB : public TObject { 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 IsPadNotConnected(Int_t det, Int_t col, Int_t row); Bool_t IsChamberInstalled(Int_t det); Bool_t IsChamberMasked(Int_t det); diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index c332b650002..15b379718a2 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -579,6 +579,23 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader) } +//_____________________________________________________________________________ +UChar_t AliTRDclusterizer::GetStatus(Short_t &signal) +{ + UChar_t status = 0; + // check if pad is masked + if(signal>0 && TESTBIT(signal, 10)){ + CLRBIT(signal, 10); + for(int ibit=0; ibit<4; ibit++){ + if(TESTBIT(signal, 11+ibit)){ + SETBIT(status, ibit); + CLRBIT(signal, 11+ibit); + } + } + } + return status; +} + //_____________________________________________________________________________ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) { @@ -659,6 +676,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) UShort_t volid = AliGeomManager::LayerToVolUID(ilayer,imodule); Int_t nColMax = digitsIn->GetNcol(); + Int_t nRowMax = digitsIn->GetNrow(); Int_t nTimeTotal = digitsIn->GetNtime(); // Detector wise calibration object for the gain factors @@ -668,14 +686,10 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) // Calibration value for chamber wise gain factor Float_t calGainFactorDetValue = calGainFactorDet->GetValue(idet); - // Calibration object with the pad status information - AliTRDCalSingleChamberStatus *calPadStatusROC = calibration->GetPadStatusROC(idet); - Int_t nClusters = 0; - AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow() - ,digitsIn->GetNcol() - ,digitsIn->GetNtime()); + AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(nRowMax, nColMax, nTimeTotal); + AliTRDdataArrayS padStatus(nRowMax, nColMax, nTimeTotal); ResetHelperIndexes(indexesIn); @@ -694,37 +708,65 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) Int_t time = 0; Int_t iPad = 0; + UChar_t status[3], ipos; + Short_t signal; fIndexesOut->ResetCounters(); - while (fIndexesOut->NextRCTbinIndex(row, col, time)) - { - - Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time)); - - // Look for the maximum - if (signalM >= maxThresh) - { - - if (col + 1 >= nColMax || col-1 < 0) - continue; - - Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); - Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); - - if ((TMath::Abs(signalL) <= signalM) && - (TMath::Abs(signalR) < signalM)) - { - if ((TMath::Abs(signalL) >= sigThresh) || - (TMath::Abs(signalR) >= sigThresh)) - { - // Maximum found, mark the position by a negative signal - digitsOut->SetDataUnchecked(row,col,time,-signalM); - fIndexesMaxima->AddIndexTBin(row,col,time); + while (fIndexesOut->NextRCTbinIndex(row, col, time)){ + Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time)); + signal = digitsIn->GetDataUnchecked(row,col,time); + status[1] = GetStatus(signal); + ipos = status[1] ? 2 : 0; + + // Look for the maximum + if (signalM >= maxThresh) { + if (col + 1 >= nColMax || col-1 < 0) continue; + + Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); + signal = digitsIn->GetDataUnchecked(row,col+1,time); + status[0] = GetStatus(signal); + ipos += status[0] ? 1 : 0; + + Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); + signal = digitsIn->GetDataUnchecked(row,col-1,time); + status[2] = GetStatus(signal); + ipos += status[0] ? 4 : 0; + + // reject candidates with more than 1 problematic pad + if(ipos == 3 || ipos > 4) continue; + + if(!status[1]){ // good central pad + if(!ipos){ // all pads are OK + if ((signalL <= signalM) && (signalR < signalM)) { + if ((signalL >= sigThresh) || (signalR >= sigThresh)) { + // Maximum found, mark the position by a negative signal + digitsOut->SetDataUnchecked(row,col,time,-signalM); + fIndexesMaxima->AddIndexTBin(row,col,time); + padStatus.SetDataUnchecked(row, col, time, ipos); + } + } + } else { // one of the neighbouring pads are bad + if(status[0] && signalR < signalM && signalR >= sigThresh){ + digitsOut->SetDataUnchecked(row,col,time,-signalM); + digitsOut->SetDataUnchecked(row, col, time+1, 0.); + fIndexesMaxima->AddIndexTBin(row,col,time); + padStatus.SetDataUnchecked(row, col, time, ipos); + } else if(status[2] && signalL <= signalM && signalL >= sigThresh){ + digitsOut->SetDataUnchecked(row,col,time,-signalM); + digitsOut->SetDataUnchecked(row, col, time-1, 0.); + fIndexesMaxima->AddIndexTBin(row,col,time); + padStatus.SetDataUnchecked(row, col, time, ipos); + } + } + } else { // wrong maximum pad + if ((signalL >= sigThresh) || (signalR >= sigThresh)) { + // Maximum found, mark the position by a negative signal + digitsOut->SetDataUnchecked(row,col,time,-maxThresh); + fIndexesMaxima->AddIndexTBin(row,col,time); + padStatus.SetDataUnchecked(row, col, time, ipos); + } + } } - } - } - - } // The index to the first cluster of a given ROC Int_t firstClusterROC = -1; @@ -854,7 +896,6 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) // Store the amplitudes of the pads in the cluster for later analysis // and check whether one of these pads is masked in the database Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 }; - Bool_t hasMasked = kFALSE; for (Int_t jPad = col-3; jPad <= col+3; jPad++) { if ((jPad < 0) || @@ -863,25 +904,22 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) continue; } signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time))); - if (calPadStatusROC->IsMasked(jPad,row)) { - hasMasked = kTRUE; - } } // Transform the local cluster coordinates into calibrated // space point positions defined in the local tracking system. // Here the calibration for T0, Vdrift and ExB is applied as well. - Double_t clusterXYZ[6]; - clusterXYZ[0] = clusterPosCol; - clusterXYZ[1] = clusterSignal[0]; - clusterXYZ[2] = clusterSignal[1]; - clusterXYZ[3] = clusterSignal[2]; - clusterXYZ[4] = 0.0; - clusterXYZ[5] = 0.0; - Int_t clusterRCT[3]; - clusterRCT[0] = row; - clusterRCT[1] = col; - clusterRCT[2] = 0; + Double_t clusterXYZ[6]; + clusterXYZ[0] = clusterPosCol; + clusterXYZ[1] = clusterSignal[0]; + clusterXYZ[2] = clusterSignal[1]; + clusterXYZ[3] = clusterSignal[2]; + clusterXYZ[4] = 0.0; + clusterXYZ[5] = 0.0; + Int_t clusterRCT[3]; + clusterRCT[0] = row; + clusterRCT[1] = col; + clusterRCT[2] = 0; Bool_t out = kTRUE; if (fTransform->Transform(clusterXYZ, clusterRCT, ((UInt_t) time), out, 0)) { @@ -911,8 +949,12 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det) ,clusterPosCol ,volid); cluster->SetInChamber(!out); - cluster->SetMaskedPad(hasMasked); - + if(padStatus.GetDataUnchecked(row, col, time)){ + cluster->SetMaskedPad(kTRUE); + //cluster->SetPadMasked(center/side); + //cluster->SetPadMaskedStatus(status); + } + // Temporarily store the row, column and time bin of the center pad // Used to later on assign the track indices cluster->SetLabel( row,0); diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index 280f515ffee..27f58b4d1c7 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -65,6 +65,8 @@ class AliTRDclusterizer : public TNamed { return fAddLabels; } // should we assign labels to clusters virtual void SetRawVersion(Int_t iver) { fRawVersion = iver; } // set the expected raw data version + static UChar_t GetStatus(Short_t &signal); + protected: void DeConvExp(Double_t *source, Double_t *target diff --git a/TRD/AliTRDrawStreamTB.cxx b/TRD/AliTRDrawStreamTB.cxx index 37d5cd0cb52..b46a8688633 100644 --- a/TRD/AliTRDrawStreamTB.cxx +++ b/TRD/AliTRDrawStreamTB.cxx @@ -1,4 +1,4 @@ -/************************************************************************** +#/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * @@ -41,6 +41,8 @@ #include "AliTRDSignalIndex.h" #include "AliTRDReconstructor.h" #include "AliTRDrecoParam.h" +#include "AliTRDcalibDB.h" +#include "Cal/AliTRDCalPadStatus.h" #include "AliLog.h" #include "AliRawReader.h" @@ -653,6 +655,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager) // Return value is the detector number // + AliTRDcalibDB *cal = AliTRDcalibDB::Instance(); AliTRDdataArrayS *digits = 0; AliTRDdataArrayI *track0 = 0; AliTRDdataArrayI *track1 = 0; @@ -707,6 +710,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager) // Add a container for the digits of this detector digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det); + if (digitsManager->UsesDictionaries()) { track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0); @@ -752,13 +756,49 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager) if (indexes->IsAllocated() == kFALSE) indexes->Allocate(rowMax, colMax, ntbins); } - + + Char_t padStatus = cal->GetPadStatus(det, GetCol(), GetRow()); + // ntimebins data are ready to read for (it = 0; it < GetNumberOfTimeBins(); it++) { if ((GetSignals()[it] - adcBaseline) > 0) { - digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline); + Short_t sigvalue = GetSignals()[it] - adcBaseline; + // Masking Pads in the signal + // Coding: + // Any Corruption: Bit 10 set 1 + // Noisy: Bit 11: 0, Bit 12: 0 + // Not Connected: Bit 11: 1, Bit 12: 0 + // Bridged: Bit 11: 0, Bit 12: 1 resp. Bit 11: 1, Bit 12: 1 + switch(padStatus) + { + case AliTRDCalPadStatus::kMasked: + SETBIT(sigvalue, 10); + CLRBIT(sigvalue, 11); + CLRBIT(sigvalue, 12); + break; + case AliTRDCalPadStatus::kNotConnected: + SETBIT(sigvalue, 10); + SETBIT(sigvalue, 11); + CLRBIT(sigvalue, 12); + break; + case AliTRDCalPadStatus::kPadBridgedLeft: + SETBIT(sigvalue, 10); + CLRBIT(sigvalue, 11); + SETBIT(sigvalue, 12); + break; + case AliTRDCalPadStatus::kPadBridgedRight: + SETBIT(sigvalue, 10); + SETBIT(sigvalue, 11); + SETBIT(sigvalue, 12); + default: + // No corruption + CLRBIT(sigvalue, 10); + CLRBIT(sigvalue, 11); + CLRBIT(sigvalue, 12); + } + digits->SetDataUnchecked(GetRow(), GetCol(), it, sigvalue); indexes->AddIndexTBin(GetRow(), GetCol(), it); if (digitsManager->UsesDictionaries()) diff --git a/TRD/Cal/AliTRDCalPadStatus.h b/TRD/Cal/AliTRDCalPadStatus.h index 83b15756f80..c34fc8c19ab 100644 --- a/TRD/Cal/AliTRDCalPadStatus.h +++ b/TRD/Cal/AliTRDCalPadStatus.h @@ -14,13 +14,15 @@ #include "TNamed.h" class AliTRDCalSingleChamberStatus; +class TH1F; +class TH2F; class AliTRDCalPadStatus : public TNamed { public: enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; - enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8, kReadSecond = 16 }; + enum { kMasked = 2, kPadBridgedLeft = 4, kPadBridgedRight = 8, kReadSecond = 16 , kNotConnected = 32}; AliTRDCalPadStatus(); AliTRDCalPadStatus(const Text_t* name, const Text_t* title); @@ -38,6 +40,8 @@ class AliTRDCalPadStatus : public TNamed { { return CheckStatus(d, col, row, kPadBridgedRight); }; Bool_t IsReadSecond(Int_t d, Int_t col, Int_t row) const { return CheckStatus(d, col, row, kReadSecond); }; + Bool_t IsNotConnected(Int_t d, Int_t col, Int_t row) const + { return CheckStatus(d, col, row, kNotConnected); }; Bool_t CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const; AliTRDCalSingleChamberStatus *GetCalROC(Int_t d) const { return fROC[d]; }; diff --git a/TRD/Cal/AliTRDCalSingleChamberStatus.h b/TRD/Cal/AliTRDCalSingleChamberStatus.h index 79e985cbe96..4f3ff8c1999 100644 --- a/TRD/Cal/AliTRDCalSingleChamberStatus.h +++ b/TRD/Cal/AliTRDCalSingleChamberStatus.h @@ -21,7 +21,9 @@ class AliTRDCalSingleChamberStatus : public TObject { enum { kMasked = 2 , kPadBridgedLeft = 4 , kPadBridgedRight = 8 - , kReadSecond = 16 }; + , kReadSecond = 16 + , kNotConnected = 32 +}; AliTRDCalSingleChamberStatus(); AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols); @@ -34,7 +36,9 @@ class AliTRDCalSingleChamberStatus : public TObject { Bool_t IsMasked(Int_t col, Int_t row) const { return ((GetStatus(col,row) & kMasked) ? kTRUE : kFALSE); }; - + Bool_t IsBridgedLeft(Int_t col, Int_t row) const { return ((GetStatus(col, row) & kPadBridgedLeft) ? kTRUE : kFALSE); }; + Bool_t IsBridgedRight(Int_t col, Int_t row) const { return ((GetStatus(col, row) & kPadBridgedRight) ? kTRUE : kFALSE); }; + Bool_t IsNotConnected(Int_t col, Int_t row) const { return ((GetStatus(col, row) & kNotConnected) ? kTRUE : kFALSE); }; Int_t GetNrows() const { return fNrows; }; Int_t GetNcols() const { return fNcols; };