]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawStreamSDD.h
Fixing the decoding of regional header bits.
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSDD.h
1 #ifndef ALIITSRAWSTREAMSDD_H
2 #define ALIITSRAWSTREAMSDD_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 ///
10 /// This class provides access to ITS SDD digits in raw data 
11 /// (default=simulated data).
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliITSRawStream.h"
15 #include "AliITSDDLModuleMapSDD.h"
16
17 class AliRawReader;
18
19
20 class AliITSRawStreamSDD: public AliITSRawStream {
21   public :
22     AliITSRawStreamSDD(AliRawReader* rawReader);
23     AliITSRawStreamSDD(const AliITSRawStreamSDD& rs);
24     AliITSRawStreamSDD& operator=(const AliITSRawStreamSDD& rs);
25     virtual ~AliITSRawStreamSDD();
26
27     virtual Bool_t   Next();
28
29     virtual Int_t    GetAnode() const {return fCoord1;}
30     virtual Int_t    GetTime() const {return fCoord2;}
31     virtual Int_t    GetChannel() const {return fChannel;}
32     virtual Int_t    ReadJitter() const {return 0;}
33     virtual Int_t    GetCarlosId() const {return fCarlosId;}
34     virtual Int_t    GetEventId() const {return fEventId;}
35
36     virtual void SetDDLModuleMap(AliITSDDLModuleMapSDD* ddlsdd){fDDLModuleMap->SetDDLMap(ddlsdd);}
37     virtual void     SetLowCarlosThreshold(Int_t th, Int_t i)
38       {fLowThreshold[i]=th;}
39     virtual void     SetZeroSuppLowThreshold(Int_t iMod, Int_t iSid, Int_t th) 
40       {fLowThresholdArray[iMod][iSid]=th;}
41     virtual void     SetNCarlos(Int_t nC=12){fNCarlos=nC;}
42     Int_t   GetModuleNumber(UInt_t iDDL, UInt_t iModule) const {
43       return fDDLModuleMap->GetModuleNumber(iDDL,iModule);
44     }
45     virtual void     Reset(); 
46
47     enum {kSDDModules = 260};      // number of SDD modules
48     enum {kSPDModules = 240};      // number of SPD modules (used as offset)
49     enum {kDDLsNumber = 24};       // number of DDLs in SDD
50     enum {kModulesPerDDL = 12};    // number of modules in each DDL 
51     enum {kCarlosWords = 12};      // number of FIFOCARLOS Words
52     enum {kFifoWords =  4};        // number of FIFO Words
53     enum ESDDRawStreamError { 
54       kDataError = 1,
55       kDataFormatErr = 2
56     };
57   protected:
58     virtual Bool_t   SkipHeaderWord(); 
59     virtual UInt_t   ReadBits();
60     virtual Int_t    DecompAmbra(Int_t value) const;
61
62     static const UInt_t fgkCodeLength[8]; //code length
63
64     AliITSDDLModuleMapSDD* fDDLModuleMap; // mapping DDL/module -> module number 
65     UInt_t           fData;         // data read for file
66     Int_t            fSkip[kDDLsNumber];// obsolete -- needed to compile AliITSRawStreamSDDv2
67     Int_t            fEventId;      // event ID from header
68     Int_t            fCarlosId;     // carlos ID
69     Int_t            fChannel;      // current channel
70     Int_t            fJitter;          // jitter between L0 and pascal stop (x25ns)
71     ULong64_t        fChannelData[kModulesPerDDL][2];// packed data for the 2 channels
72     UInt_t           fLastBit[kModulesPerDDL][2];    // last filled bit in fChannelData
73     UInt_t           fChannelCode[kModulesPerDDL][2];// current channel code
74     Bool_t           fReadCode[kModulesPerDDL][2];   // next bits are code or data
75     UInt_t           fReadBits[kModulesPerDDL][2];   // number of bits to read
76     Int_t            fLowThresholdArray[kSDDModules][2]; // array with low thresholds for all modules
77     Int_t            fLowThreshold[2];    // obsolete -- needed to compile AliITSRawStreamSDDv2
78     Int_t            fNCarlos;         // number of Carlos 
79     Int_t            fNfifo[kFifoWords];  // FIFO number
80     Int_t            fTimeBin[kModulesPerDDL][2];  // current timebin [ncarlos][nchannels]
81     Int_t            fAnode[kModulesPerDDL][2]; // current anode [ncarlos][nchannels]
82     Int_t            fDDL;        //current ddl number
83     UInt_t           fICarlosWord[kCarlosWords]; // Carlos words
84     UInt_t           fIFifoWord[kFifoWords];     // FIFO words
85     Int_t            fICountFoot[kModulesPerDDL]; // counter for carlos footer words
86     Int_t            fEndWords;      //number of 3f1f1f1f
87     Int_t            fResetSkip;     //if it is 0, the ResetSkip Funcion is called
88     ClassDef(AliITSRawStreamSDD, 8) // class for reading ITS SDD raw digits
89 };
90
91 #endif