Modifs to have 8 bit ADC values in the compressed format of SDD raw data (F. Prino)
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Sep 2008 23:31:42 +0000 (23:31 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Sep 2008 23:31:42 +0000 (23:31 +0000)
ITS/AliITSClusterFinderV2SDD.cxx
ITS/AliITSCompressRawDataSDD.cxx
ITS/AliITSDDLRawData.cxx
ITS/AliITSRawStream.h
ITS/AliITSRawStreamSDD.cxx
ITS/AliITSRawStreamSDD.h
ITS/AliITSRawStreamSDDCompressed.cxx
ITS/AliITSRawStreamSDDCompressed.h

index 2974037e55c55af843807dfe20dbb0a5fe7e01cc..28b20a366f4b8ad2beafc5dec13327272e2c9d5e 100644 (file)
@@ -329,8 +329,8 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input,
       continue;
     }
 
-    Int_t iCarlos =((AliITSRawStreamSDD*)input)->GetCarlosId();
-    Int_t iSide = ((AliITSRawStreamSDD*)input)->GetChannel();
+    Int_t iCarlos =input->GetCarlosId();
+    Int_t iSide = input->GetChannel();
     Int_t iHybrid=iCarlos*2+iSide;
     if (input->IsCompletedModule()) {
       // when all data from a module was read, search for clusters
index feae4b41903e50dd9523c574b2af07f565eb1aac..513741a33533ac261ac06a6b81ff2d373f288193 100644 (file)
@@ -121,19 +121,14 @@ void AliITSCompressRawDataSDD::Compress(){
     rd->Reset();
 
     AliITSRawStreamSDD s(rd);
+    s.SetDecompressAmbra(kFALSE);
     while(s.Next()){
-      if(rd->GetDDLID()!=oldddl){
-       word=8<<28;
-       word+=rd->GetDDLID();
-       fprintf(outtxt,"%08X\n",word);
-       oldddl=rd->GetDDLID();
-      }
       if(s.IsCompletedModule()==kFALSE){
        word=s.GetCarlosId()<<27;
        word+=s.GetChannel()<<26;
        word+=s.GetCoord1()<<18;
        word+=s.GetCoord2()<<10;
-       word+=s.GetSignal();
+       word+=s.GetEightBitSignal();
        fprintf(outtxt,"%08X\n",word);
       }
       if(s.IsCompletedModule()==kTRUE){
@@ -156,6 +151,7 @@ UInt_t AliITSCompressRawDataSDD::CompressEvent(UChar_t* inputPtr){
   siz+=32;
   UInt_t word=0;
   AliITSRawStreamSDD s(fRawReader);
+  s.SetDecompressAmbra(kFALSE);
   Int_t mask1=0xFF000000;
   Int_t mask2=0x00FF0000;
   Int_t mask3=0x0000FF00;
@@ -166,7 +162,7 @@ UInt_t AliITSCompressRawDataSDD::CompressEvent(UChar_t* inputPtr){
       word+=s.GetChannel()<<26;
       word+=s.GetCoord1()<<18;
       word+=s.GetCoord2()<<10;
-      word+=s.GetSignal();
+      word+=s.GetEightBitSignal();
       if(siz+4<fSizeInMemory){
        *(fPointerToData)=(word&mask1)>>24;
        ++fPointerToData;
index 42025756ba26582d44d8cd7347a53b1808304e5f..9cde520cbf4d0375011431eb9dccea2a3236248f 100644 (file)
@@ -140,7 +140,7 @@ void AliITSDDLRawData::GetDigitsSDDCompressed(TClonesArray *ITSdigits, Int_t mod
       digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
       Int_t iz=digs->GetCoord1();  // Anode
       Int_t ix=digs->GetCoord2();  // Time
-      Int_t is=digs->GetSignal();  // ADC Signal - 10 bit
+      Int_t is=digs->GetCompressedSignal();  // ADC Signal - 8 bit
       dataWord=mod<<27;
       Int_t sid=0;
       if(iz>=256){
index b4e5bc72f0b07d22e22b643065d2bbc4306f0e86..112c93d44b98771930cefb1595770083d9218449 100644 (file)
@@ -40,6 +40,14 @@ class AliITSRawStream: public TObject {
     virtual void     SetZeroSuppLowThreshold(Int_t /*iMod*/, Int_t /*iSid*/, Int_t /*th*/) {
       AliError("This method must be implemented in a derived class");
     };
+    virtual Int_t     GetCarlosId() const {
+      AliError("This method must be implemented in a derived class");
+      return -1;
+    };
+    virtual Int_t     GetChannel() const {
+      AliError("This method must be implemented in a derived class");
+      return -1;
+    };
 
 
   protected :
index 6015a34f1f42809d51b31864181ab59b61f925fe..6cca48d4525382c3cb4695159685b86c73a227f9 100644 (file)
@@ -38,7 +38,9 @@ fEventId(0),
 fCarlosId(-1),
 fChannel(0),
 fJitter(0),
-fResetSkip(0)
+fResetSkip(0),
+fEightBitSignal(0),
+fDecompressAmbra(kTRUE)
 {
 // create an object to read ITS SDD raw digits
   fDDLModuleMap=new AliITSDDLModuleMapSDD();
@@ -66,7 +68,9 @@ fEventId(0),
 fCarlosId(-1),
 fChannel(0),
 fJitter(0),
-fResetSkip(0)
+fResetSkip(0),
+fEightBitSignal(0),
+fDecompressAmbra(kTRUE)
 {
   // copy constructor
   AliError("Copy constructor should not be used.");
@@ -197,7 +201,8 @@ Bool_t AliITSRawStreamSDD::Next()
          fTimeBin[fCarlosId][fChannel] = 0;
          fAnode[fCarlosId][fChannel]++;
        } else {                                   // ADC signal data
-         fSignal = DecompAmbra(data + (1 << fChannelCode[fCarlosId][fChannel]) + fLowThresholdArray[fModuleID-kSPDModules][fChannel]);
+         fEightBitSignal=data + (1 << fChannelCode[fCarlosId][fChannel]);
+         if(fDecompressAmbra) fSignal = DecompAmbra(fEightBitSignal + fLowThresholdArray[fModuleID-kSPDModules][fChannel]);
          fCoord1 = fAnode[fCarlosId][fChannel];
          fCoord2 = fTimeBin[fCarlosId][fChannel];
          fTimeBin[fCarlosId][fChannel]++;
index b42ba6e0f0dcf10eb64142bfde0a5b239d10f3cc..7ef3a0b9d4f4ff61a663b0da8762a8454d5fe07c 100644 (file)
@@ -29,10 +29,14 @@ class AliITSRawStreamSDD: public AliITSRawStream {
     virtual Int_t    GetAnode() const {return fCoord1;}
     virtual Int_t    GetTime() const {return fCoord2;}
     virtual Int_t    GetChannel() const {return fChannel;}
+    virtual Int_t    GetEightBitSignal() const {return fEightBitSignal;}
     virtual Int_t    ReadJitter() const {return 0;}
     virtual Int_t    GetCarlosId() const {return fCarlosId;}
     virtual Int_t    GetEventId() const {return fEventId;}
 
+    virtual void     SetDecompressAmbra(Bool_t deco=kTRUE){
+      fDecompressAmbra=deco;
+    }
     virtual void SetDDLModuleMap(AliITSDDLModuleMapSDD* ddlsdd){fDDLModuleMap->SetDDLMap(ddlsdd);}
     virtual void     SetLowCarlosThreshold(Int_t th, Int_t i)
       {fLowThreshold[i]=th;}
@@ -81,7 +85,10 @@ class AliITSRawStreamSDD: public AliITSRawStream {
     UInt_t           fIFifoWord[kFifoWords];     // FIFO words
     Int_t            fICountFoot[kModulesPerDDL]; // counter for carlos footer words
     Int_t            fResetSkip;     //if it is 0, the ResetSkip Funcion is called
-    ClassDef(AliITSRawStreamSDD, 11) // class for reading ITS SDD raw digits
+    Int_t            fEightBitSignal;    // signal at 8 bit
+    Bool_t           fDecompressAmbra; //flag to switch off decompression
+
+    ClassDef(AliITSRawStreamSDD, 12) // class for reading ITS SDD raw digits
 };
 
 #endif
index 89ef17e69bffa6a5fb97f3cbf2317b5d9124362b..11bf8ac23806fe4869ccfae6083509bc38063c8d 100644 (file)
@@ -120,6 +120,22 @@ AliITSRawStreamSDDCompressed::~AliITSRawStreamSDDCompressed(){
 }
 
 
+//______________________________________________________________________
+Int_t AliITSRawStreamSDDCompressed::DecompAmbra(Int_t value) const
+{
+  // AMBRA decompression (from 8 to 10 bit)
+  
+  if ((value & 0x80) == 0) {
+    return value & 0x7f;
+  } else if ((value & 0x40) == 0) {
+    return 0x081 + ((value & 0x3f) << 1);
+  } else if ((value & 0x20) == 0) {
+    return 0x104 + ((value & 0x1f) << 3);
+  } else {
+    return 0x208 + ((value & 0x1f) << 4);
+  }
+  
+}
 //______________________________________________________________________
 Bool_t AliITSRawStreamSDDCompressed::Next()
 {
@@ -156,8 +172,9 @@ Bool_t AliITSRawStreamSDDCompressed::Next()
       fChannel=(fData&maskSide)>>26;
       fCoord1=(fData&maskAnode)>>18;
       fCoord2=(fData&maskTb)>>10;
-      fSignal=fData&maskADC;
-      fSignal+=fLowThresholdArray[fModuleID-kSPDModules][fChannel];
+      Int_t sig8bit=fData&maskADC;
+      sig8bit+=fLowThresholdArray[fModuleID-kSPDModules][fChannel];
+      fSignal=DecompAmbra(sig8bit);
       fCompletedModule=kFALSE;
       return kTRUE;
     }
index 1914fba6a018c742cb86f81bd083b4dbe7d26bc1..9e09868046d4aff1d92ec11bc15de6bb8e443dcf 100644 (file)
@@ -52,7 +52,7 @@ class AliITSRawStreamSDDCompressed: public AliITSRawStream {
     };
   protected:
 
-
+    virtual Int_t    DecompAmbra(Int_t value) const;
     AliITSDDLModuleMapSDD* fDDLModuleMap; // mapping DDL/module -> module number 
     UInt_t           fData;         // data read for file
     Int_t            fCarlosId;     // carlos ID