]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCDigitReaderRaw.h
implemented TPCDigitDump and AltroChannelSelector
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCDigitReaderRaw.h
index e8ed992489844f8b2f715fb84c61927928f68f0a..db881be8aff2ef86179fd4835a2390c04cba0c39 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "TObject.h"
 
-#if defined(HAVE_TPC_MAPPING)
 #include "AliHLTTPCDigitReader.h"
 #include "AliHLTDataTypes.h"
 
@@ -67,17 +66,13 @@ public:
    *  - 5: As 1, but RCU trailer is 2 32 bit words.
    */
   AliHLTTPCDigitReaderRaw( unsigned formatVersion );
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTTPCDigitReaderRaw(const AliHLTTPCDigitReaderRaw&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTTPCDigitReaderRaw& operator=(const AliHLTTPCDigitReaderRaw&);
   /** destructor */
   virtual ~AliHLTTPCDigitReaderRaw();
     
   /**
    * Init the reader with a data block.
    * The function fetches the first and last row for the readout partition
-   * from @ref AliHLTTransform.
+   * from @ref AliHLTTPCTransform.
    * @param ptr     pointer to data buffer
    * @param size    size of the data buffer
    * @param patch   patch (readout partition) number within the slice
@@ -102,12 +97,21 @@ public:
   int InitBlock(void* ptr,unsigned long size,Int_t firstrow,Int_t lastrow, Int_t patch, Int_t slice);
 
   // Deliver values sorted for format 0, otherwise pass through to corresponding *Real* method
-  virtual bool Next();
+  virtual bool NextSignal();
   virtual int GetRow();
   virtual int GetPad();
   virtual int GetSignal();
   virtual int GetTime();
 
+  /**
+   * Get pointer and size of the data of the current ALTRO channel.
+   * @param pTgt        target to receive the pointer to the buffer
+   * @param hwAddress   target to receive the hardware address
+   * @return size of the buffer set to pTgt in bytes on success, 
+   *         neg error code if failed
+   */
+  int GetAltroChannelRawData(void* &pTgt, AliHLTUInt16_t &hwAddress);
+
   bool Verify( bool verify )
   {
     bool old = fVerify;
@@ -120,36 +124,58 @@ public:
     return fVerify;
   }
 
+  //
   // Deliver values unsorted
-    bool RealNext();
-    int GetRealRow();
-    int GetRealPad();
-    int GetRealSignal();
-    int GetRealTime();
-
+  //
+  /** unsorted next value */
+  bool RealNext();
+  /** row of current value */
+  int GetRealRow() const;
+  /** pad of current value */
+  int GetRealPad() const;
+  /** signal of current value */
+  int GetRealSignal();
+  /** time of current value */
+  int GetRealTime() const;
+
+  //
   // Low level methods for accessing the data
-    AliHLTUInt32_t GetRCUTrailer( unsigned offset=0 );
-    bool NextAltroBlock();
-    AliHLTUInt32_t GetAltroBlockHWaddr();
-    unsigned GetAltroBlock10BitWordCnt();
-    AliHLTUInt64_t GetAltroBlock40BitWord( unsigned long ndx ); // ndx counts from end, 0 is last
-    AliHLTUInt16_t GetAltroBlock10BitWord( unsigned long ndx );
-    AliHLTUInt16_t GetAltroBlockReal10BitWord( unsigned long ndx );
+  //
+  /** get rcu trailer word of the raw data */
+  AliHLTUInt32_t GetRCUTrailer( unsigned offset=0 ) const;
+
+  /** move to next altro block and set internal variables */
+  bool NextAltroBlock();
+
+  /** hardware address of the current altro block */
+  AliHLTUInt32_t GetAltroBlockHWaddr() const;
+
+  /** get no of 10bit words in the current altro block */
+  unsigned GetAltroBlock10BitWordCnt() const;
+
+  /** ndx counts from end, 0 is last */
+  AliHLTUInt64_t GetAltroBlock40BitWord( unsigned long ndx ) const;
+
+  /** ndx counts from end, 0 is last */
+  AliHLTUInt16_t GetAltroBlock10BitWord( unsigned long ndx );
+
+  /** ndx counts from end, 0 is last */
+  AliHLTUInt16_t GetAltroBlockReal10BitWord( unsigned long ndx );
 
     unsigned GetAltroBlockPositionBytes() const
        {return fAltroBlockPositionBytes;}
     unsigned GetAltroBlockLengthBytes() const
        {return fAltroBlockLengthBytes;}
 
-    // Return length of trailing RCU data block in bytes
+    /** Return length of trailing RCU data block in bytes */
     unsigned GetRCUDataBlockLength() const;
     unsigned GetCommonDataHeaderSize() const;
        
     Bool_t ApplyMapping();
 
-  Int_t GetRow( unsigned patch, unsigned hw_addr );
-  Int_t GetPad( unsigned patch, unsigned hw_addr );
-  unsigned GetMaxHWA( unsigned patch );
+  Int_t GetRow( unsigned patch, unsigned hwAddr );
+  Int_t GetPad( unsigned patch, unsigned hwAddr );
+  unsigned GetMaxHWA( unsigned patch ) const;
 
   /**
    * This function decodes the rawreadermode set in HLT***Components
@@ -176,72 +202,123 @@ public:
 
 protected:
 
-    AliHLTUInt8_t* fBuffer;
-    unsigned long fBufferSize;
+  /** the raw data buffer (external buffer) */
+  AliHLTUInt8_t* fBuffer;                                          //! transient
+  /** size of the raw data buffer */
+  unsigned long fBufferSize;                                       // see above
     /*
     Int_t fFirstRow;
     Int_t fLastRow;
     */
-    Int_t fPatch;
-    Int_t fSlice;
-    Int_t fRow;
-    Int_t fPad;
 
-    unsigned fAltroBlockPositionBytes;
-    unsigned fAltroBlockLengthBytes;
+  /** patch (readout partition) specification of the raw data buffer */
+  Int_t fPatch;                                                    // see above
 
-    AliHLTUInt16_t fAltroBlockHWAddress;
-    AliHLTUInt16_t fAltroBlock10BitWordCnt;
-    AliHLTUInt16_t fAltroBlock10BitFillWordCnt;
+  /** slice (sector) specification of the raw data buffer */
+  Int_t fSlice;                                                    // see above
 
-    unsigned fDataFormatVersion;
+  /** the current row no */
+  Int_t fRow;                                                      // see above
 
-    unsigned fBunchPosition;
-    unsigned fBunchTimebinStart;
-    unsigned fBunchLength;
-    unsigned fWordInBunch;
+  /** the current pad no */
+  Int_t fPad;                                                      // see above
 
-  bool fVerify;
 
-private:
-    static Int_t fMapping_0[3200][2];
-    static Int_t fMapping_1[3584][2];
-    static Int_t fMapping_2[3200][2];
-    static Int_t fMapping_3[3328][2];
-    static Int_t fMapping_4[3328][2];
-    static Int_t fMapping_5[3328][2];
+  /** position of the current ALTRO block*/
+  unsigned fAltroBlockPositionBytes;                               // see above
 
-    static unsigned fMaxHWA[6];
+  /** length of the current ALTRO block*/
+  unsigned fAltroBlockLengthBytes;                                 // see above
+  
+  /** hardware of the current ALTRO block*/
+  AliHLTUInt16_t fAltroBlockHWAddress;                             // see above
 
-  // For reordering
-    Int_t fCurrentRow;
-    Int_t fCurrentPad;
-    Int_t fCurrentBin;
-    Int_t fRowOffset;
-    Int_t fNRows;
+  /** no of 10 bit words in the current ALTRO block*/
+  AliHLTUInt16_t fAltroBlock10BitWordCnt;                          // see above
 
-    Int_t fNMaxRows;
-    Int_t fNMaxPads;
-    Int_t fNTimeBins;
+  /** no of additional 10 bit fill words in the current ALTRO block*/
+  AliHLTUInt16_t fAltroBlock10BitFillWordCnt;                      // see above
 
-    Int_t *fData;
+  /** version of data format */
+  unsigned fDataFormatVersion;                                     // see above
 
+  /** position of the current bunch of timebins */  
+  unsigned fBunchPosition;                                         // see above
+  /** first timebin of current bunch */  
+  unsigned fBunchTimebinStart;                                     // see above
+  /** length of current bunch */  
+  unsigned fBunchLength;                                           // see above
+  /** word counter in bunch */  
+  unsigned fWordInBunch;                                           // see above
 
-  ClassDef(AliHLTTPCDigitReaderRaw, 0)
-    
-};
+  /** verify the consistency of the Altro blocks */
+  bool fVerify;                                                    // see above
 
-#else
-// add a dummy class to make CINT happy
-class AliHLTTPCDigitReaderRaw : public AliHLTLogging{
-public:
-  AliHLTTPCDigitReaderRaw()
-  {
-    HLTFatal("AliHLTTPCDigitReaderRaw not build");
-  }
+private:
+  /** copy constructor prohibited */
+  AliHLTTPCDigitReaderRaw(const AliHLTTPCDigitReaderRaw& src);
+  /** assignment operator prohibited */
+  AliHLTTPCDigitReaderRaw& operator=(const AliHLTTPCDigitReaderRaw& src);
+  /** number of patches */ 
+  static const Int_t fgkNofPatches=6;                              // see above
+  /** dimension of each mapping array */ 
+  static const Int_t fgkMappingDimension=2;                        // see above
+
+  /** size of mapping arrays */
+  static const Int_t fgkMapping0Size=3200;                         // see above
+  /** size of mapping array for patch 1 */
+  static const Int_t fgkMapping1Size=3584;                         // see above
+  /** size of mapping array for patch 2 */
+  static const Int_t fgkMapping2Size=3200;                         // see above
+  /** size of mapping array for patch 3 */
+  static const Int_t fgkMapping3Size=3328;                         // see above
+  /** size of mapping array for patch 4 */
+  static const Int_t fgkMapping4Size=3328;                         // see above
+  /** size of mapping array for patch 5 */
+  static const Int_t fgkMapping5Size=3328;                         // see above
+
+  /** mapping array for patch 0 */
+  static Int_t fgMapping0[fgkMapping0Size][fgkMappingDimension];   // see above
+  /** mapping array for patch 1 */
+  static Int_t fgMapping1[fgkMapping1Size][fgkMappingDimension];   // see above
+  /** mapping array for patch 2 */
+  static Int_t fgMapping2[fgkMapping2Size][fgkMappingDimension];   // see above
+  /** mapping array for patch 3 */
+  static Int_t fgMapping3[fgkMapping3Size][fgkMappingDimension];   // see above
+  /** mapping array for patch 4 */
+  static Int_t fgMapping4[fgkMapping4Size][fgkMappingDimension];   // see above
+  /** mapping array for patch 5 */
+  static Int_t fgMapping5[fgkMapping5Size][fgkMappingDimension];   // see above
+
+  static unsigned fgMaxHWA[fgkNofPatches];                         // see above
+
+  // For reordering
+  /** current row */
+  Int_t fCurrentRow;                                               // see above
+  /** current pad */
+  Int_t fCurrentPad;                                               // see above
+  /** current bin */
+  Int_t fCurrentBin;                                               // see above
+  /** ofsset of the first row */
+  Int_t fRowOffset;                                                // see above
+  /** nimber of rows */
+  Int_t fNRows;                                                    // see above
+  
+  /** max number of rows */
+  Int_t fNMaxRows;                                                 // see above
+  /** max number of pads */
+  Int_t fNMaxPads;                                                 // see above
+  /** number of time bins */
+  Int_t fNTimeBins;                                                // see above
+
+  Int_t *fData;                                                    //! transient
+
+  /** indicate a virgin object and throw the warnig only once */
+  Int_t fMapErrThrown;                                             //! transient 
+
+  ClassDef(AliHLTTPCDigitReaderRaw, 1)
+    
 };
-#endif //#if defined(HAVE_TPC_MAPPING)
 
 #endif
-