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 */
8 ///////////////////////////////////////////////////////////////////////////////
10 /// This class provides access to ITS SPD digits in raw data.
12 ///////////////////////////////////////////////////////////////////////////////
14 #include "AliITSRawStream.h"
17 class AliITSRawStreamSPD: public AliITSRawStream {
19 AliITSRawStreamSPD(AliRawReader* rawReader);
20 virtual ~AliITSRawStreamSPD() {};
22 virtual Bool_t Next();
23 virtual Bool_t ReadCalibHeader();
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;};
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;};
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];}
40 Bool_t GetHalfStavePresent(UInt_t hs);
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;
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,
73 kHalfStaveStatusErr = 8
77 static const Int_t fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL]; // mapping DDL/module -> module number
79 Bool_t ReadNextShort();
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
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)
98 ClassDef(AliITSRawStreamSPD, 0) // class for reading ITS SPD raw digits