]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSRawStreamSDD.cxx
Fixing local structure disabled word, which had an incorrect value.
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSDD.cxx
index f8b202a185bb0412525139137a975d0b35b792ef..379153fadd8193dd46ca55b69e1b468e0ee965fd 100644 (file)
@@ -22,6 +22,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSRawStreamSDD.h"
+#include "AliITSRawStreamSDDCompressed.h"
 #include "AliRawReader.h"
 #include "AliLog.h"
 
@@ -85,6 +86,39 @@ AliITSRawStreamSDD::~AliITSRawStreamSDD(){
   if(fDDLModuleMap) delete fDDLModuleMap;
 }
 //______________________________________________________________________
+UChar_t AliITSRawStreamSDD::ReadBlockAttributes(AliRawReader* rawReader){
+  // reads block attribuited from CDH
+  UChar_t *data;
+  rawReader->Reset();
+  rawReader->Select("ITSSDD");
+  do{
+    if(!rawReader->ReadNextData(data)) return 0x0;
+  }while(rawReader->GetDataSize()==0);
+  UChar_t attr=rawReader->GetBlockAttributes();
+  return attr;
+}
+//______________________________________________________________________
+AliITSRawStream* AliITSRawStreamSDD::CreateRawStreamSDD(AliRawReader* rawReader, UChar_t attributes){
+  // instantiates the proper raw stream from block attributes value
+
+  Int_t rawFormat=(attributes&0xE0)>>5;  
+  rawReader->Reset();
+  AliITSRawStream* inputSDD;
+  if(rawFormat==0){
+    inputSDD=new AliITSRawStreamSDDCompressed(rawReader);
+    inputSDD->SetADCEncoded(kTRUE);
+  }else{
+    inputSDD=new AliITSRawStreamSDD(rawReader);
+  }
+  return inputSDD;
+}
+//______________________________________________________________________
+AliITSRawStream* AliITSRawStreamSDD::CreateRawStreamSDD(AliRawReader* rawReader){
+  // reads the data format from CDH and instantiates the proper raw stream
+  UChar_t attr=ReadBlockAttributes(rawReader);
+  return CreateRawStreamSDD(rawReader,attr);
+}
+//______________________________________________________________________
 UInt_t AliITSRawStreamSDD::ReadBits()
 {
 // read bits from the given channel
@@ -102,10 +136,13 @@ Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const
   if ((value & 0x80) == 0) {
     return value & 0x7f;
   } else if ((value & 0x40) == 0) {
+    if(value&1) return 0x080 + ((value & 0x3f) << 1);
     return 0x081 + ((value & 0x3f) << 1);
   } else if ((value & 0x20) == 0) {
+    if(value&1) return 0x103 + ((value & 0x1f) << 3);
     return 0x104 + ((value & 0x1f) << 3);
   } else {
+    if(value&1) return 0x207 + ((value & 0x1f) << 4);
     return 0x208 + ((value & 0x1f) << 4);
   }