]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSRawStreamSPD.h
New macros for SDD QA. Improved version of SDD raw streamer (P. Cerello)
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSPD.h
1 #ifndef ALIITSRAWSTREAMSPD_H
2 #define ALIITSRAWSTREAMSPD_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 SPD digits in raw data.
11 ///
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include "AliITSRawStream.h"
15
16
17 class AliITSRawStreamSPD: public AliITSRawStream {
18   public :
19     AliITSRawStreamSPD(AliRawReader* rawReader);
20     virtual ~AliITSRawStreamSPD() {};
21
22     virtual Bool_t   Next();
23     virtual Bool_t   ReadCalibHeader();
24
25     // the 2 methods below are equivalent to AliITSRawStream::GetCoord1 and GetCoord2
26     // together with the AliITSRawStream::GetModuleID these are the "offline" coordinates
27     Int_t    GetColumn() const {return fCoord1;};
28     Int_t    GetRow() const {return fCoord2;};
29
30     // together with the AliRawReader::GetDDLID() these are the "online" coordinates
31     UShort_t GetHalfStaveNr() const {return fHalfStaveNr;}
32     UShort_t GetChipAddr() const {return fChipAddr;}
33     Int_t    GetChipCol() const {return fCol;};
34     Int_t    GetChipRow() const {return fRow;};
35
36     // module mapping
37     static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule) {return fgkDDLModuleMap[iDDL][iModule];}
38     static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iHS, UInt_t iChip) {return fgkDDLModuleMap[iDDL][iHS*2+iChip/5];}
39
40     Bool_t GetHalfStavePresent(UInt_t hs);
41
42     // use the methods below to extract the information from the calibration header
43     UInt_t GetHrouterNr() const {return (fCalHeadWord[0] & 0x0000003f);}
44     Bool_t GetHhalfStaveScanned(UInt_t hs) const;
45     UInt_t GetHtype() const {return (Int_t)((fCalHeadWord[1]) & 0x000000ff);}
46     Bool_t GetHdataFormat() const {return (Bool_t)(((fCalHeadWord[1]) & 0x00000100)>>8);}
47     UInt_t GetHtriggers() const {return fCalHeadWord[2];}
48     Bool_t GetHchipPresent(UInt_t hs, UInt_t chip) const;
49     UInt_t GetHdacStart() const {return ((fCalHeadWord[5]>>24) & 0x000000ff);}
50     UInt_t GetHdacEnd() const {return ((fCalHeadWord[5]>>16) & 0x000000ff);}
51     UInt_t GetHdacStep() const {return ((fCalHeadWord[5]>>8) & 0x000000ff);}
52     UInt_t GetHdacId() const {return ((fCalHeadWord[5]) & 0x000000ff);}
53     UInt_t GetHrowStart() const {return (UInt_t) ((fCalHeadWord[6]>>24) & 0x000000ff);}
54     UInt_t GetHrowEnd() const {return (UInt_t) ((fCalHeadWord[6]>>16) & 0x000000ff);}
55     UInt_t GetHrowValue() const {return (UInt_t) ((fCalHeadWord[6]>> 8) & 0x000000ff);}
56     UInt_t GetHdacValue() const {return (Int_t) ((fCalHeadWord[6]) & 0x000000ff);}
57     UInt_t GetHdacHigh(UInt_t hs) const;
58     UInt_t GetHdacLow(UInt_t hs) const;
59     UInt_t GetHTPAmp(UInt_t hs) const;
60     Bool_t GetHminTHchipPresent(UInt_t chip) const;
61
62     enum {kDDLsNumber = 20};      // number of DDLs in SPD
63     enum {kModulesPerDDL = 12};   // number of modules in each DDL
64     enum {kCalHeadLenMax = 16};   // maximum number of calib header words
65     enum ESPDRawStreamError {
66       kCalHeaderLengthErr = 1,
67       kDDLNumberErr = 2,
68       kEventNumberErr = 3,
69       kChipAddrErr = 4,
70       kStaveNumberErr = 5,
71       kNumbHitsErr = 6,
72       kWrongWordErr = 7,
73       kHalfStaveStatusErr = 8
74     };
75
76   private :
77     static const Int_t fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL];  // mapping DDL/module -> module number
78
79     Bool_t           ReadNextShort();
80     Bool_t           ReadNextInt();
81     void             NewEvent();
82
83     Int_t            fEventNumber;                 // chip event counter
84     UShort_t         fChipAddr;                    // chip nr
85     UShort_t         fHalfStaveNr;                 // half stave nr
86     UInt_t           fCol;                         // chip column nr
87     UInt_t           fRow;                         // chip row nr
88     UInt_t           fCalHeadWord[kCalHeadLenMax]; // calibration header words
89
90     UShort_t         fData;            // 16 bit data word read
91     UInt_t           fOffset;          // offset for cell column
92     UInt_t           fHitCount;        // counter of hits
93     UChar_t          fDataChar1, fDataChar2, fDataChar3, fDataChar4; // temps part of a 32bit word
94     Bool_t           fFirstWord;       // keeps track of which of the two 16bit words out of the 32bit word to read when ReadNextShort is called
95     Bool_t           fCalHeadRead[20];             // calibration header read flags (reset at new event)
96     UInt_t           fPrevEventId;                 // previous event id (needed to know if there is a new event)
97
98     ClassDef(AliITSRawStreamSPD, 0) // class for reading ITS SPD raw digits
99 };
100
101 #endif