]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliAltroRawStream.h
Finally we have the new RCU trailer decoding code. Now it should be propagated to...
[u/mrichter/AliRoot.git] / RAW / AliAltroRawStream.h
index 0a61be05c96bf55e86517949926d087fa9ffad14..979cd5e5889593885e17f3107b17f3ed91caef1e 100644 (file)
@@ -9,7 +9,7 @@
 ///
 /// This is a base class for reading raw data digits in Altro format
 /// The class is able to read both old and new RCU trailer formats
-/// One can switch between formats using fIsOldRCUFormat flag.
+/// Switch between formats is done automatically using the last payload word.
 /// In case the Common Data Header is 7 32-bit words long, one
 /// can use the fIsShortDataHeader flag.
 ///
@@ -50,11 +50,34 @@ class AliAltroRawStream: public TObject {
     Bool_t  GetRCUTrailerData(UChar_t*& data) const;              // Provide a pointer to RCU trailer
     Int_t   GetRCUTrailerSize() const { return fRCUTrailerSize; } // Provide size of RCU trailer
 
+    // RCU trailer related getters
+    UInt_t  GetFECERRA() const { return fFECERRA; }
+    UInt_t  GetFECERRB() const { return fFECERRB; }
+    UShort_t GetERRREG2() const { return fERRREG2; }
+    UShort_t GetActiveFECsA() const { return fActiveFECsA; }
+    UShort_t GetActiveFECsB() const { return fActiveFECsB; }
+
+    UChar_t GetBaselineCorr() const { return fAltroCFG1 & 0xF; }
+    UChar_t GetNPresamples() const  { return (fAltroCFG1 >> 4) & 0x3; }
+    UChar_t GetNPostsamples() const { return (fAltroCFG1 >> 6) & 0xF; }
+    Bool_t  GetSecondBaselineCorr() const { return (fAltroCFG1 >> 10) & 0x1; }
+    UChar_t GetGlitchFilter() const { return (fAltroCFG1 >> 11) & 0x3; }
+    UChar_t GetNNonZSPostsamples() const { return (fAltroCFG1 >> 13) & 0x7; }
+    UChar_t GetNNonZSPresamples() const  { return (fAltroCFG1 >> 16) & 0x3; }
+    Bool_t  GetZeroSupp() const          { return (fAltroCFG1 >> 18) & 0x1; }
+    
+    Bool_t   GetNAltroBuffers() const     { return (fAltroCFG2 >> 24) & 0x1; }
+    UChar_t  GetNPretriggerSamples() const{ return (fAltroCFG2 >> 20) & 0xF; }
+    UShort_t GetNSamplesPerCh() const     { return (fAltroCFG2 >> 10) & 0x3FF; }
+    Bool_t   GetSparseRO() const          { return (fAltroCFG2 >> 9) & 0x1; }
+    UChar_t  GetSamplingFq() const        { return (fAltroCFG2 >> 5) & 0xF; }
+    UChar_t  GetL1Phase() const           { return fAltroCFG2 & 0x1F; }
+    void     PrintRCUTrailer() const;
     void SelectRawData(Int_t detId);                           // Select raw data for specific detector id
     void SelectRawData(const char *detName);                   // Select raw data for specific detector name
 
     void  SetNoAltroMapping(Bool_t flag) { fNoAltroMapping = flag; }  // Specify whenever to use or not the altro mapping
-    void  SetOldRCUFormat(Bool_t flag)   { fIsOldRCUFormat = flag; }  // Specify whenever to use or not the old RCU trailer format
     void  SetShortDataHeader(Bool_t flag) { fIsShortDataHeader = flag; } // Specify whenever to assume or not a short CDH format
 
     void PrintDebug() const; // Print debug information in case of decoding errors
@@ -67,17 +90,18 @@ class AliAltroRawStream: public TObject {
       kTimeBinReadErr = 4,
       kAmplitudeReadErr = 5,
       k32bitWordReadErr = 6,
-      kBadAltroMapping = 7
+      kBadAltroMapping = 7,
+      kRCUTrailerErr = 8
     };
 
-  protected:
-    AliAltroRawStream(const AliAltroRawStream& stream);
     AliAltroRawStream& operator = (const AliAltroRawStream& stream);
+    AliAltroRawStream(const AliAltroRawStream& stream);
+
+  protected:
 
     Bool_t           fNoAltroMapping;  // temporary flag in case of no altro mapping is provided
     Short_t          fSegmentation[3]; // temporary container for the dummy trailer, to be removed
 
-    Bool_t           fIsOldRCUFormat;  // flag used to select between old and new RCU trailer format
     Bool_t           fIsShortDataHeader; // flag used to select between normal and short CDH format
 
   private :
@@ -89,6 +113,7 @@ class AliAltroRawStream: public TObject {
     void             ReadAmplitude();
     Int_t            GetPosition();
     UInt_t           Get32bitWord(Int_t &index);
+    Int_t            ReadRCUTrailer(Int_t &index, Int_t trailerSize);
 
     Int_t            fDDLNumber;    // index of current DDL number
     Int_t            fPrevDDLNumber;// index of previous DDL number
@@ -113,6 +138,15 @@ class AliAltroRawStream: public TObject {
     UChar_t*         fRCUTrailerData; // pointer to RCU trailer data
     Int_t            fRCUTrailerSize; // size of RCU trailer data in bytes
 
+    // RCU trailer contents
+    UInt_t           fFECERRA;      // contains errors related to ALTROBUS transactions
+    UInt_t           fFECERRB;      // contains errors related to ALTROBUS transactions
+    UShort_t         fERRREG2;      // contains errors related to ALTROBUS transactions or trailer of ALTRO channel block
+    UShort_t         fActiveFECsA;  // bit pattern of active FECs in branch A
+    UShort_t         fActiveFECsB;  // bit pattern of active FECs in branch B
+    UInt_t           fAltroCFG1;    // ALTROCFG1 register
+    UInt_t           fAltroCFG2;    // ALTROCFG2 and ALTROIF registers
+
     ClassDef(AliAltroRawStream, 0)  // base class for reading Altro raw digits
 };