]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliAltroRawStream.h
Removing AliFatal from the altro decoding class. Decoding errors are now stored in...
[u/mrichter/AliRoot.git] / RAW / AliAltroRawStream.h
index ff9663d4a9ebe2de3e41cd52c2a4fa62cdbb14d8..0a61be05c96bf55e86517949926d087fa9ffad14 100644 (file)
@@ -8,6 +8,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///
 /// 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.
+/// In case the Common Data Header is 7 32-bit words long, one
+/// can use the fIsShortDataHeader flag.
 ///
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -23,25 +27,48 @@ class AliAltroRawStream: public TObject {
     virtual void             Reset();
     virtual Bool_t           Next();
 
-    inline Int_t GetDDLNumber()  const { return fDDLNumber; }  // Provide current DDL number
-    inline Int_t GetPrevDDLNumber() const { return fPrevDDLNumber; }// Provide previous DDL number
-    inline Bool_t  IsNewDDLNumber() const {return (fDDLNumber != fPrevDDLNumber);};
-    inline Int_t GetRCUId()      const { return fRCUId; }      // Provide current RCU identifier
-    inline Int_t GetPrevRCUId()  const { return fPrevRCUId; }  // Provide previous RCU identifier
-    inline Bool_t  IsNewRCUId() const {return (fRCUId != fPrevRCUId);};
-    inline Int_t GetHWAddress()  const { return fHWAddress; }  // Provide current hardware address
-    inline Int_t GetPrevHWAddress() const { return fPrevHWAddress; }  // Provide previous hardware address
-    inline Bool_t  IsNewHWAddress() const {return (fHWAddress != fPrevHWAddress) || IsNewDDLNumber();};
-    inline Int_t GetTime()       const { return fTime; }       // Provide index of current time bin
-    inline Int_t GetPrevTime()   const { return fPrevTime; }   // Provide index of previous time bin
-    inline Bool_t  IsNewTime()   const {return (fTime != fPrevTime) || IsNewHWAddress();};
-    inline Int_t GetSignal()     const { return fSignal; }     // Provide signal in ADC counts
-    inline Int_t GetTimeLength() const { return fTimeBunch; }  // Provide total length of current time bunch
-
-           Bool_t  GetRCUTrailerData(UChar_t*& data) const;              // Provide a pointer to RCU trailer
-    inline Int_t   GetRCUTrailerSize() const { return fRCUTrailerSize; } // Provide size of RCU trailer
+    Int_t GetDDLNumber()  const { return fDDLNumber; }  // Provide current DDL number
+    Int_t GetPrevDDLNumber() const { return fPrevDDLNumber; }// Provide previous DDL number
+    Bool_t  IsNewDDLNumber() const {return (fDDLNumber != fPrevDDLNumber);};
+    Int_t GetRCUId()      const { return fRCUId; }      // Provide current RCU identifier
+    Int_t GetPrevRCUId()  const { return fPrevRCUId; }  // Provide previous RCU identifier
+    Bool_t  IsNewRCUId() const {return (fRCUId != fPrevRCUId);};
+    Int_t GetHWAddress()  const { return fHWAddress; }  // Provide current hardware address
+    Int_t GetPrevHWAddress() const { return fPrevHWAddress; }  // Provide previous hardware address
+    Bool_t  IsNewHWAddress() const {return (fHWAddress != fPrevHWAddress) || IsNewDDLNumber();};
+    Int_t GetTime()       const { return fTime; }       // Provide index of current time bin
+    Int_t GetPrevTime()   const { return fPrevTime; }   // Provide index of previous time bin
+    Bool_t  IsNewTime()   const {return (fTime != fPrevTime) || IsNewHWAddress();};
+    Int_t GetSignal()     const { return fSignal; }     // Provide signal in ADC counts
+    Int_t GetTimeLength() const { return fTimeBunch; }  // Provide total length of current time bunch
+
+    Int_t GetBranch()     const; // Provide the branch index for the current hardware address
+    Int_t GetFEC()        const; // Provide the front-end card index for the current hardware address
+    Int_t GetAltro()      const; // Provide the altro chip index for the current hardware address
+    Int_t GetChannel()    const; // Provide the channel index for the current hardware address
+
+    Bool_t  GetRCUTrailerData(UChar_t*& data) const;              // Provide a pointer to RCU trailer
+    Int_t   GetRCUTrailerSize() const { return fRCUTrailerSize; } // Provide size of RCU trailer
 
     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
+    void AddMappingErrorLog(const char *message = NULL);
+
+    enum EAltroRawStreamError {
+      kRCUTrailerSizeErr = 1,
+      kAltroTrailerErr = 2,
+      kBunchLengthReadErr = 3,
+      kTimeBinReadErr = 4,
+      kAmplitudeReadErr = 5,
+      k32bitWordReadErr = 6,
+      kBadAltroMapping = 7
+    };
 
   protected:
     AliAltroRawStream(const AliAltroRawStream& stream);
@@ -50,6 +77,9 @@ class AliAltroRawStream: public TObject {
     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 :
 
     UShort_t         GetNextWord();