]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDrawStream.h
Fixes in EINCLUDE
[u/mrichter/AliRoot.git] / TRD / AliTRDrawStream.h
index bd9d71d52ff55bdb866549ecd02808f41d7fe3ed..c078f91150caef7876297d33ac03b3d4280c6f21 100644 (file)
 #ifndef ALITRDRAWSTREAM_H
 #define ALITRDRAWSTREAM_H
 
-#include "TObject.h"
-#include "TClonesArray.h"
 #include "TTree.h"
-
 #include "AliLog.h"
+#include "TClonesArray.h"
 
+class TObject;
 class TObjArray;
 class TString;
 class TBranch;
@@ -55,7 +54,7 @@ class AliTRDrawStream : public TObject
   Bool_t NextDDL();
   Int_t NextChamber(AliTRDdigitsManager *digMgr);
   Int_t NextChamber(AliTRDdigitsManager *digMgr,
-                     UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */) { AliError("Deprecated, use NextChamber(AliTRDdigitsManger*) instead!"); return NextChamber(digMgr); }
+                     UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */) { AliError("Deprecated, use NextChamber(AliTRDdigitsManger*) instead!"); return NextChamber(digMgr); }
 
   Bool_t ConnectTracklets(TTree *trklTree);
 
@@ -68,7 +67,7 @@ class AliTRDrawStream : public TObject
   enum ErrorCode_t {
     kUnknown = 0,
     kLinkMonitor,
-    kPtrgCntMismatch,
+    kEvCntMismatch,
     kNonTrdEq,
     kStackHeaderInvalid,
     kInvalidDetector,
@@ -84,6 +83,8 @@ class AliTRDrawStream : public TObject
     kAdcDataAbort,
     kAdcChannelsMiss,
     kMissMcmHeaders,
+    kMissTpData,
+    kCRCmismatch,
     kLastErrorCode
   };
 
@@ -155,24 +156,27 @@ class AliTRDrawStream : public TObject
     ClassDef(AliTRDrawStats, 1);
   };
 
-  AliTRDrawStats fStats;            // event statistics, clearing must be done by the user
-
   AliTRDrawStats* GetStats() { return &fStats; }
   Int_t GetEventSize(Int_t sector)  const { return fStats.fStatsSector[sector].fBytes; }
   Int_t GetNTracklets(Int_t sector) const { return fStats.fStatsSector[sector].fNTracklets; }
   Int_t GetNMCMs(Int_t sector)      const { return fStats.fStatsSector[sector].fNMCMs; }
   Int_t GetNChannels(Int_t sector)  const { return fStats.fStatsSector[sector].fNChannels; }
 
+  ULong64_t GetTrkFlags(Int_t sector, Int_t stack) const { return fCurrTrkFlags[sector*fgkNstacks + stack]; }
+  UInt_t GetTriggerFlags(Int_t sector) const { return fCurrTrgFlags[sector]; }
+
   // raw data dumping
   void SetDumpMCM(Int_t det, Int_t rob, Int_t mcm, Bool_t dump = kTRUE);
 
   Bool_t IsDumping() const { return (fNDumpMCMs > 0); }
   Bool_t DumpingMCM(Int_t det, Int_t rob, Int_t mcm) const;
 
-  TString DumpRaw(TString title, UInt_t *start, Int_t length, UInt_t endmarker = 0xffffffff);
+  TString DumpRaw(TString title, const UInt_t *start, Int_t length, UInt_t endmarker = 0xffffffff);
   TString DumpMcmHeader(TString title, UInt_t word);
   TString DumpAdcMask(TString title, UInt_t word);
 
+  static void SortTracklets(TClonesArray *trklArray, TList &sortedTracklets, Int_t *indices);
+
   // temporary: allow to change expected readout order
   static void SetMCMReadoutPos(Int_t mcm, Int_t pos) { if (mcm > -1 && mcm < 16) fgMcmOrder[mcm] = pos; }
   static void SetROBReadoutPos(Int_t robpair, Int_t pos) { if (robpair > -1 && robpair < 4) fgMcmOrder[robpair] = pos; }
@@ -193,6 +197,7 @@ class AliTRDrawStream : public TObject
   Int_t ReadZSData();
   Int_t ReadNonZSData();
 
+  Int_t SeekNextStack();
   Int_t SeekNextLink();
 
   // MCM header decoding
@@ -215,11 +220,11 @@ class AliTRDrawStream : public TObject
   Int_t CouldBeADCmask(UInt_t adcmask) const { return ((0xf & adcmask) == 0xc && (0x3 & adcmask >> 30) == 0x1); }
 
   // error message generation
-  void EquipmentError(ErrorCode_t err = kUnknown, const char *const msg = "", ...);
-  void StackError    (ErrorCode_t err = kUnknown, const char *const msg = "", ...);
-  void LinkError     (ErrorCode_t err = kUnknown, const char *const msg = "", ...);
-  void ROBError      (ErrorCode_t err = kUnknown, const char *const msg = "", ...);
-  void MCMError      (ErrorCode_t err = kUnknown, const char *const msg = "", ...);
+  void EquipmentError(ErrorCode_t err = kUnknown, const char *const msg = " ", ...);
+  void StackError    (ErrorCode_t err = kUnknown, const char *const msg = " ", ...);
+  void LinkError     (ErrorCode_t err = kUnknown, const char *const msg = " ", ...);
+  void ROBError      (ErrorCode_t err = kUnknown, const char *const msg = " ", ...);
+  void MCMError      (ErrorCode_t err = kUnknown, const char *const msg = " ", ...);
   void StoreErrorTree() { fErrors->Fill(); }
   void StoreErrorArray() { new ((*fMarkers)[fMarkers->GetEntriesFast()]) AliTRDrawStreamError(fLastError); }
   void ForgetError() { return; }
@@ -239,6 +244,8 @@ class AliTRDrawStream : public TObject
   UInt_t fErrorFlags;                           // error flags used to steer subsequent reading
   char   fErrorBuffer[100];                     // buffer for error message
 
+  AliTRDrawStats fStats;            // event statistics, clearing must be done by the user
+
   UInt_t *fPayloadStart;                        // pointer to start of data payload
   UInt_t *fPayloadCurr;                         // pointer to current reading position in the payload
   Int_t   fPayloadSize;                         // size of the payload (in UInt_t words)
@@ -249,6 +256,7 @@ class AliTRDrawStream : public TObject
   static const Int_t fgkNtriggers;              // number of triggers in data stream
   static const UInt_t fgkDataEndmarker;         // data endmarker
   static const UInt_t fgkTrackletEndmarker;     // tracklet endmarker
+  static const UInt_t fgkStackEndmarker[];      // stack endmarker (used from version 0xd on)
   static       Int_t fgMcmOrder [];             // expected readout order of the MCMs
   static       Int_t fgRobOrder [];             // expected readout order of the ROBs
 
@@ -274,6 +282,7 @@ class AliTRDrawStream : public TObject
   UInt_t fCurrTrgHeaderAvail;                  // current trigger information availability
   UInt_t fCurrTrgHeaderReadout;                 // current readout mode for the trigger headers
   UInt_t fCurrTrkHeaderAvail;                  // current tracking information availability
+  UInt_t fCurrStackEndmarkerAvail;              // current stack endmarker availability
   UInt_t fCurrEvType;                          // current event type
   UInt_t fCurrTriggerEnable;                    // current trigger enable
   UInt_t fCurrTriggerFired;                     // current trigger fired
@@ -284,10 +293,12 @@ class AliTRDrawStream : public TObject
   // Tracking header
   UInt_t *fCurrTrkHeaderIndexWord;              // current tracking header index word
   UInt_t *fCurrTrkHeaderSize;                   // current tracking header index word
+  ULong64_t *fCurrTrkFlags;                     // current tracking done flags
 
   // Trigger header
   UInt_t *fCurrTrgHeaderIndexWord;              // current tracking header index word
   UInt_t *fCurrTrgHeaderSize;                   // current tracking header index word
+  UInt_t *fCurrTrgFlags;                       // current trigger flags of all sectors
 
   // Stack header
   UInt_t *fCurrStackIndexWord;                 // current stack index words
@@ -302,6 +313,12 @@ class AliTRDrawStream : public TObject
   UInt_t *fCurrLinkDataTypeFlags;              // current link data flags
   UInt_t *fCurrLinkDebugFlags;                 // current link debug flags
 
+  // CRC checks from trailer
+  Char_t fCurrMatchFlagsSRAM;
+  Char_t fCurrMatchFlagsPostBP;
+  UInt_t fCurrChecksumStack[5];
+  UInt_t fCurrChecksumSIU;
+
   // HC information
   Int_t fCurrSpecial;                          // current value of the special flag
   Int_t fCurrMajor;                            // current major version