]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawStreamSPD.h
SPD DA: updates from H. Tydesjo
[u/mrichter/AliRoot.git] / ITS / AliITSRawStreamSPD.h
CommitLineData
2906f4c2 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
17class AliITSRawStreamSPD: public AliITSRawStream {
18 public :
19 AliITSRawStreamSPD(AliRawReader* rawReader);
20 virtual ~AliITSRawStreamSPD() {};
21
22 virtual Bool_t Next();
c42b9ed0 23 virtual Bool_t ReadCalibHeader();
2906f4c2 24
c42b9ed0 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, iModule = halfStaveNr*2+chipAddr/5
37 static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule) {return fgkDDLModuleMap[iDDL][iModule];}
38
39 Bool_t GetHalfStavePresent(UInt_t hs);
40
41 // use the methods below to extract the information from the calibration header
42 UInt_t GetHrouterNr() const {return (fCalHeadWord[0] & 0x0000003f);}
43 Bool_t GetHhalfStaveScanned(UInt_t hs) const;
44 UInt_t GetHtype() const {return (Int_t)((fCalHeadWord[1]) & 0x000000ff);}
45 Bool_t GetHdataFormat() const {return (Bool_t)(((fCalHeadWord[1]) & 0x00000100)>>8);}
46 UInt_t GetHtriggers() const {return fCalHeadWord[2];}
47 Bool_t GetHchipPresent(UInt_t hs, UInt_t chip) const;
48 UInt_t GetHdacStart() const {return ((fCalHeadWord[5]>>24) & 0x000000ff);}
49 UInt_t GetHdacEnd() const {return ((fCalHeadWord[5]>>16) & 0x000000ff);}
50 UInt_t GetHdacStep() const {return ((fCalHeadWord[5]>>8) & 0x000000ff);}
51 UInt_t GetHdacId() const {return ((fCalHeadWord[5]) & 0x000000ff);}
52 UInt_t GetHrowStart() const {return (UInt_t) ((fCalHeadWord[6]>>24) & 0x000000ff);}
53 UInt_t GetHrowEnd() const {return (UInt_t) ((fCalHeadWord[6]>>16) & 0x000000ff);}
54 UInt_t GetHrowValue() const {return (UInt_t) ((fCalHeadWord[6]>> 8) & 0x000000ff);}
55 UInt_t GetHdacValue() const {return (Int_t) ((fCalHeadWord[6]) & 0x000000ff);}
56 UInt_t GetHdacHigh(UInt_t hs) const;
57 UInt_t GetHdacLow(UInt_t hs) const;
58 UInt_t GetHTPAmp(UInt_t hs) const;
1fd93b67 59 Bool_t GetHminTHchipPresent(UInt_t chip) const;
2906f4c2 60
2906f4c2 61 enum {kDDLsNumber = 20}; // number of DDLs in SPD
62 enum {kModulesPerDDL = 12}; // number of modules in each DDL
c42b9ed0 63 enum {kCalHeadLenMax = 16}; // maximum number of calib header words
d9edae7b 64 enum ESPDRawStreamError {
65 kCalHeaderLengthErr = 1,
66 kDDLNumberErr = 2,
67 kEventNumberErr = 3,
68 kChipAddrErr = 4,
69 kStaveNumberErr = 5,
70 kNumbHitsErr = 6,
71 kWrongWordErr = 7,
72 kHalfStaveStatusErr = 8
73 };
2906f4c2 74
75 private :
76 static const Int_t fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL]; // mapping DDL/module -> module number
77
c42b9ed0 78 Bool_t ReadNextShort();
79 Bool_t ReadNextInt();
80 void NewEvent();
81
82 Int_t fEventNumber; // chip event counter
83 UShort_t fChipAddr; // chip nr
84 UShort_t fHalfStaveNr; // half stave nr
85 UInt_t fCol; // chip column nr
86 UInt_t fRow; // chip row nr
87 UInt_t fCalHeadWord[kCalHeadLenMax]; // calibration header words
2906f4c2 88
c42b9ed0 89 UShort_t fData; // 16 bit data word read
90 UInt_t fOffset; // offset for cell column
91 UInt_t fHitCount; // counter of hits
72600597 92 UChar_t fDataChar1, fDataChar2, fDataChar3, fDataChar4; // temps part of a 32bit word
c42b9ed0 93 Bool_t fFirstWord; // keeps track of which of the two 16bit words out of the 32bit word to read when ReadNextShort is called
94 Bool_t fCalHeadRead[20]; // calibration header read flags (reset at new event)
95 UInt_t fPrevEventId; // previous event id (needed to know if there is a new event)
72600597 96
2906f4c2 97 ClassDef(AliITSRawStreamSPD, 0) // class for reading ITS SPD raw digits
98};
99
100#endif