]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Next iteration on encoded pad status
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Mar 2008 15:08:30 +0000 (15:08 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 31 Mar 2008 15:08:30 +0000 (15:08 +0000)
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h
TRD/AliTRDdataArrayDigits.cxx [new file with mode: 0644]
TRD/AliTRDdataArrayDigits.h [new file with mode: 0644]
TRD/AliTRDdataArrayS.h
TRD/AliTRDrawStreamTB.cxx
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

index 15b379718a2022f6c21f0fb16bfe451c2c7cbecb..f4564080d99f0b48bbacba4b654dce59d5fc7f22 100644 (file)
@@ -41,6 +41,7 @@
 #include "AliTRDdataArrayF.h"
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdataArrayS.h"
+#include "AliTRDdataArrayDigits.h"
 #include "AliTRDdigitsManager.h"
 #include "AliTRDrawData.h"
 #include "AliTRDcalibDB.h"
@@ -474,7 +475,7 @@ Bool_t AliTRDclusterizer::MakeClusters()
   for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
     {
 
-      AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) fDigitsManager->GetDigits(i);      
+      AliTRDdataArrayDigits *digitsIn = (AliTRDdataArrayDigits*) fDigitsManager->GetDigits(i);      
       // This is to take care of switched off super modules
       if (!digitsIn->HasData()) 
         {
@@ -606,7 +607,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   // Get the digits
   //   digits should be expanded beforehand!
   //   digitsIn->Expand();
-  AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) fDigitsManager->GetDigits(det);      
+  AliTRDdataArrayDigits *digitsIn = (AliTRDdataArrayDigits *) fDigitsManager->GetDigits(det);      
 
   // This is to take care of switched off super modules
   if (!digitsIn->HasData()) 
@@ -714,7 +715,7 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   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);
+               status[1] = digitsIn->GetPadStatus(row, col, time);
                ipos = status[1] ? 2 : 0;
 
                // Look for the maximum
@@ -723,12 +724,12 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
 
                        Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time));
                        signal = digitsIn->GetDataUnchecked(row,col+1,time);
-                       status[0] = GetStatus(signal);
+                       status[0] = digitsIn->GetPadStatus(row,col+1,time);
                        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);
+                       status[2] = digitsIn->GetPadStatus(row, col-1, time);
                        ipos += status[0] ? 4 : 0;
 
                        // reject candidates with more than 1 problematic pad
@@ -1141,7 +1142,7 @@ Double_t AliTRDclusterizer::Unfold(Double_t eps, Int_t plane, Double_t *padSigna
 }
 
 //_____________________________________________________________________________
-void AliTRDclusterizer::TailCancelation(AliTRDdataArrayS *digitsIn
+void AliTRDclusterizer::TailCancelation(AliTRDdataArrayDigits *digitsIn
                                      , AliTRDdataArrayF *digitsOut
                                      , AliTRDSignalIndex *indexesIn
                                      , AliTRDSignalIndex *indexesOut
index 27f58b4d1c70b12456f96f1053c8ef9d89dcebdc..995e5c8385ad7327f75dce351cf896d586ca6981 100644 (file)
@@ -23,6 +23,7 @@ class AliRawReader;
 class AliTRD;
 class AliTRDcluster;
 class AliTRDdataArrayS;
+class AliTRDdataArrayDigits;
 class AliTRDdataArrayF;
 class AliTRDdigitsManager;
 class AliTRDSignalIndex;
@@ -71,7 +72,7 @@ class AliTRDclusterizer : public TNamed {
 
           void     DeConvExp(Double_t *source, Double_t *target
                            , Int_t nTimeTotal, Int_t nexp);
-         void     TailCancelation(AliTRDdataArrayS *digitsIn
+         void     TailCancelation(AliTRDdataArrayDigits *digitsIn
                                  , AliTRDdataArrayF *digitsOut 
                                  , AliTRDSignalIndex *indexesIn
                                 , AliTRDSignalIndex *indexesOut
diff --git a/TRD/AliTRDdataArrayDigits.cxx b/TRD/AliTRDdataArrayDigits.cxx
new file mode 100644 (file)
index 0000000..2a66659
--- /dev/null
@@ -0,0 +1,217 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: AliTRDdataArrayDigits.cxx,v 1.17 2006/08/28 14:37:05 cblume Exp $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// Container for TRD signals type of short taking pad masking into account   //
+//                                                                           //
+// Author:                                                                   // 
+//   Markus Fasel (markus.fasel@web.de)                                      //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+
+#include "AliLog.h"
+#include "AliTRDarrayS.h"
+#include "Cal/AliTRDCalPadStatus.h"
+
+#include "AliTRDdataArrayDigits.h"
+
+ClassImp(AliTRDdataArrayDigits)
+
+//_____________________________________________________________________________
+AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime)
+                      :AliTRDdataArrayS(nrow, ncol, ntime)
+{
+  //
+  // Constructor
+  //
+}
+
+//_____________________________________________________________________________
+Short_t AliTRDdataArrayDigits::GetDataUnchecked(Int_t row, Int_t col, Int_t time) const
+{
+  // 
+  // Get the pad status without boundary checking
+  // (taking pad maskng into account)
+  //
+  Short_t value = GetDataFast(GetIdx1Unchecked(row,col),time);
+  // Be aware of Manipulations introduced by pad masking in the RawReader
+  // Only output the manipulated Value
+  CLRBIT(value, 10);
+  CLRBIT(value, 11);
+  CLRBIT(value, 12);
+  return value;
+}
+
+//_____________________________________________________________________________
+Short_t AliTRDdataArrayDigits::GetData(Int_t row, Int_t col, Int_t time) const
+{
+  //
+  // Get the pad signal
+  // (taking pad masking into account)
+  if ((row >= 0) && (col >= 0) && (time >= 0)) {
+    Int_t idx1 = GetIdx1(row,col);
+    if ((idx1 >= 0) && (time < fNdim2)) {
+      Short_t value = 0;
+      if (fBufType == 0)
+       {
+         value = GetDataFast(idx1,time);
+       }
+      if (fBufType == 1) 
+       {
+         value = GetData1(idx1,time);
+       }
+      // Awareness of the bit masking
+      CLRBIT(value, 10);
+      CLRBIT(value, 11);
+      CLRBIT(value, 12);
+      return value;
+    }
+    else {
+      if (idx1 >= 0) {
+        AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)"
+                     ,time,fNdim2,this));
+      }
+    }
+  }
+
+  return -1;
+}
+
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayDigits::GetOverThreshold(Short_t threshold)
+{
+  // 
+  // Returns the number of entries over threshold
+  // (taking pad masking into account)
+  //
+  if ((fElements == 0) || (fElements->GetSize() <= 0))
+    return 0;
+  Int_t over = 0;
+  Short_t value = 0;
+
+  for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
+    if ((fCurrentIdx1 < 0) || (fCurrentIdx1 >= fNdim1)) continue;
+    if ((fCurrentIdx2 < 0) || (fCurrentIdx2 >= fNdim2)) continue;
+    value = fElements->At(fCurrentIndex);
+    CLRBIT(value, 10);
+    CLRBIT(value, 11);
+    CLRBIT(value, 12);
+    if (value > threshold) over++;
+  }
+
+  return over;
+
+}
+
+//_____________________________________________________________________________
+UChar_t AliTRDdataArrayDigits::GetPadStatus(Int_t row, Int_t col, Int_t time) const
+{
+  // 
+  // Returns the pad status stored in the pad signal
+  //
+  // Output is a UChar_t value
+  // Status Codes:
+  //               Noisy Masking:           2
+  //               Bridged Left Masking     8
+  //               Bridged Right Masking    8
+  //               Not Connected Masking    32
+  //
+  UChar_t padstatus = 0;
+  Short_t signal = GetDataFast(GetIdx1Unchecked(row,col),time);
+  if(signal > 0 && TESTBIT(signal, 10)){
+    if(TESTBIT(signal, 11))
+      if(TESTBIT(signal, 12))
+       padstatus = AliTRDCalPadStatus::kPadBridgedRight;
+      else
+       padstatus = AliTRDCalPadStatus::kNotConnected;
+    else
+      if(TESTBIT(signal, 12))
+       padstatus = AliTRDCalPadStatus::kPadBridgedLeft;
+      else
+       padstatus = AliTRDCalPadStatus::kMasked;
+  }
+  return padstatus;
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayDigits::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t status)
+{
+  //
+  // Setting the pad status into the signal using the Bits 10 to 14 
+  // (currently used: 10 to 12)
+  //
+  // Input codes (Unsigned char):
+  //               Noisy Masking:           2
+  //               Bridged Left Masking     8
+  //               Bridged Right Masking    8
+  //               Not Connected Masking    32
+  //
+  // Status codes: Any masking:             Bit 10(1)
+  //               Noisy masking:           Bit 11(0), Bit 12(0)
+  //               No Connection masking:   Bit 11(1), Bit 12(0)
+  //               Bridged Left masking:    Bit 11(0), Bit 12(1)
+  //               Bridged Right masking:   Bit 11(1), Bit 12(1)
+  // 
+  Short_t signal = GetDataFast(GetIdx1Unchecked(col, row), time);
+  // only set the Pad Status if the signal is > 0
+  if(signal > 0){
+    switch(status)
+      {
+      case AliTRDCalPadStatus::kMasked:
+       SETBIT(signal, 10);
+       CLRBIT(signal, 11);
+       CLRBIT(signal, 12);
+       break;
+      case AliTRDCalPadStatus::kNotConnected:
+       SETBIT(signal, 10);
+       SETBIT(signal, 11);
+       CLRBIT(signal, 12);
+      break;
+      case AliTRDCalPadStatus::kPadBridgedLeft:
+       SETBIT(signal, 10);
+       CLRBIT(signal, 11);
+       SETBIT(signal, 12);
+       break;
+      case AliTRDCalPadStatus::kPadBridgedRight:
+       SETBIT(signal, 10);
+       SETBIT(signal, 11);
+       SETBIT(signal, 12);
+      default:
+       CLRBIT(signal, 10);
+       CLRBIT(signal, 11);
+       CLRBIT(signal, 12);
+      }
+    SetDataUnchecked(row, col, time, signal);
+  }
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayDigits::IsPadCorrupted(Int_t row, Int_t col, Int_t time)
+{
+  // 
+  // Checks if the pad has any masking as corrupted (Bit 10 in signal set)
+  //
+  Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time);
+  return (signal > 0 && TESTBIT(signal, 10)) ? kTRUE : kFALSE;
+}
+
diff --git a/TRD/AliTRDdataArrayDigits.h b/TRD/AliTRDdataArrayDigits.h
new file mode 100644 (file)
index 0000000..0e361ee
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ALITRDDATAARRAYDIGITS_H
+#define ALITRDDATAARRAYDIGITS_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTRDdataArrayDigits.h,v Exp $ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// Container for TRD signals type of short taking pad masking into account   //
+//                                                                           //
+// Author:                                                                   // 
+//   Markus Fasel (markus.fasel@web.de)                                      //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDdataArrayS.h"
+
+class AliTRDdataArrayDigits : public AliTRDdataArrayS
+{
+
+ public:
+
+  AliTRDdataArrayDigits(){};
+  AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime);
+  virtual ~AliTRDdataArrayDigits(){};
+
+  virtual Short_t GetDataUnchecked(Int_t row, Int_t col, Int_t time) const;
+  virtual Short_t GetData(Int_t row, Int_t col, Int_t time) const;
+  virtual Int_t   GetOverThreshold(Short_t threshold);  
+          UChar_t GetPadStatus(Int_t row, Int_t col, Int_t time) const;
+          void    SetPadStatus(Int_t col, Int_t row, Int_t time, UChar_t status);
+          Bool_t  IsPadCorrupted(Int_t row, Int_t col, Int_t time);
+
+  ClassDef(AliTRDdataArrayDigits, 1) // Container for TRD signals type of short taking pad masking into account
+};
+#endif
index af637eac91540cbe95b6ca5ebe0ee5ba0de7d0b9..d445f4ac841d6caafecf2c64a829148f87f64909 100644 (file)
@@ -44,7 +44,7 @@ class AliTRDdataArrayS : public AliTRDdataArray {
   virtual void    SetThreshold(Short_t threshold) { fThreshold = threshold; };
 
   virtual Short_t GetData(Int_t row, Int_t col, Int_t time) const;
-          Short_t GetDataUnchecked(Int_t row, Int_t col, Int_t time) const
+  virtual Short_t GetDataUnchecked(Int_t row, Int_t col, Int_t time) const
                                  { return GetDataFast(GetIdx1Unchecked(row,col),time); };
 
   virtual Short_t GetThreshold() const            { return fThreshold;      };
@@ -76,5 +76,3 @@ class AliTRDdataArrayS : public AliTRDdataArray {
 };
  
 #endif
-
-
index b46a8688633d1cd9adf3b39f6eaae69f656da6b2..3a4129ce1c91ea1234fbf8c7d489390323ab5d96 100644 (file)
@@ -38,6 +38,7 @@
 #include "AliTRDdigitsManager.h"
 #include "AliTRDdataArrayS.h"
 #include "AliTRDdataArrayI.h"
+#include "AliTRDdataArrayDigits.h"
 #include "AliTRDSignalIndex.h"
 #include "AliTRDReconstructor.h"
 #include "AliTRDrecoParam.h"
@@ -656,7 +657,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
   //
 
   AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
-  AliTRDdataArrayS *digits = 0;
+  AliTRDdataArrayDigits *digits = 0;
   AliTRDdataArrayI *track0 = 0;
   AliTRDdataArrayI *track1 = 0;
   AliTRDdataArrayI *track2 = 0; 
@@ -709,7 +710,7 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
            }
 
          // Add a container for the digits of this detector
-         digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
+         digits = (AliTRDdataArrayDigits *) digitsManager->GetDigits(det);
 
           if (digitsManager->UsesDictionaries()) 
             {
@@ -764,42 +765,9 @@ AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
        {
          if ((GetSignals()[it] - adcBaseline) > 0)
            {
-             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);
-             
+             digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline);
+             digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
+                     
              indexes->AddIndexTBin(GetRow(), GetCol(), it);
               if (digitsManager->UsesDictionaries()) 
                 {
index b428a037d13bb1e8e3f9cbdbcbac999944888b4a..ac453f0ef3bc07574b13d7a26f8d9bf8d6871466 100644 (file)
@@ -18,6 +18,7 @@
 #pragma link C++ class  AliTRDdataArray+;
 #pragma link C++ class  AliTRDdataArrayI+;
 #pragma link C++ class  AliTRDdataArrayS+;
+#pragma link C++ class  AliTRDdataArrayDigits+;
 #pragma link C++ class  AliTRDdataArrayF+;
 #pragma link C++ class  AliTRDSignalIndex+;
 
index 0b44d38c797be4a7e69e26159bec25ea9f15f92c..0207d82c3ea714b3c7081ada9d4d1be6b911098d 100644 (file)
@@ -6,6 +6,7 @@ SRCS= AliTRDarrayI.cxx \
       AliTRDdataArrayI.cxx \
       AliTRDdataArrayS.cxx \
       AliTRDdataArrayF.cxx \
+      AliTRDdataArrayDigits.cxx \
       AliTRDsegmentArray.cxx \
       AliTRDSignalIndex.cxx \
       AliTRDgeometry.cxx \