]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | class 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 | ||
53ae21ce | 36 | // module mapping |
6727e2db | 37 | static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule); |
38 | static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iHS, UInt_t iChip) | |
39 | {return GetOfflineModuleFromOnline(iDDL,iHS,iChip);} | |
40 | ||
41 | // coordinate conversions: | |
42 | static Bool_t OfflineToOnline(UInt_t module, UInt_t colM, UInt_t RowM, UInt_t& eq, UInt_t& hs, UInt_t& chip, UInt_t& col, UInt_t& row); | |
43 | static Bool_t OnlineToOffline(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row, UInt_t& module, UInt_t& colM, UInt_t& rowM); | |
44 | // coordinate conversions - offline->online | |
45 | static UInt_t GetOnlineEqIdFromOffline(UInt_t module); | |
46 | static UInt_t GetOnlineHSFromOffline(UInt_t module); | |
47 | static UInt_t GetOnlineChipFromOffline(UInt_t module, UInt_t colM); | |
48 | static UInt_t GetOnlineColFromOffline(UInt_t module, UInt_t colM); | |
49 | static UInt_t GetOnlineRowFromOffline(UInt_t module, UInt_t rowM); | |
50 | // coordinate conversions - online->offline | |
51 | static UInt_t GetOfflineModuleFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip); | |
52 | static UInt_t GetOfflineColFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col); | |
53 | static UInt_t GetOfflineRowFromOnline(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t row); | |
54 | ||
53ae21ce | 55 | |
c42b9ed0 | 56 | Bool_t GetHalfStavePresent(UInt_t hs); |
57 | ||
58 | // use the methods below to extract the information from the calibration header | |
59 | UInt_t GetHrouterNr() const {return (fCalHeadWord[0] & 0x0000003f);} | |
60 | Bool_t GetHhalfStaveScanned(UInt_t hs) const; | |
61 | UInt_t GetHtype() const {return (Int_t)((fCalHeadWord[1]) & 0x000000ff);} | |
62 | Bool_t GetHdataFormat() const {return (Bool_t)(((fCalHeadWord[1]) & 0x00000100)>>8);} | |
63 | UInt_t GetHtriggers() const {return fCalHeadWord[2];} | |
64 | Bool_t GetHchipPresent(UInt_t hs, UInt_t chip) const; | |
65 | UInt_t GetHdacStart() const {return ((fCalHeadWord[5]>>24) & 0x000000ff);} | |
66 | UInt_t GetHdacEnd() const {return ((fCalHeadWord[5]>>16) & 0x000000ff);} | |
67 | UInt_t GetHdacStep() const {return ((fCalHeadWord[5]>>8) & 0x000000ff);} | |
68 | UInt_t GetHdacId() const {return ((fCalHeadWord[5]) & 0x000000ff);} | |
69 | UInt_t GetHrowStart() const {return (UInt_t) ((fCalHeadWord[6]>>24) & 0x000000ff);} | |
70 | UInt_t GetHrowEnd() const {return (UInt_t) ((fCalHeadWord[6]>>16) & 0x000000ff);} | |
71 | UInt_t GetHrowValue() const {return (UInt_t) ((fCalHeadWord[6]>> 8) & 0x000000ff);} | |
72 | UInt_t GetHdacValue() const {return (Int_t) ((fCalHeadWord[6]) & 0x000000ff);} | |
73 | UInt_t GetHdacHigh(UInt_t hs) const; | |
74 | UInt_t GetHdacLow(UInt_t hs) const; | |
75 | UInt_t GetHTPAmp(UInt_t hs) const; | |
1fd93b67 | 76 | Bool_t GetHminTHchipPresent(UInt_t chip) const; |
2906f4c2 | 77 | |
2906f4c2 | 78 | enum {kDDLsNumber = 20}; // number of DDLs in SPD |
79 | enum {kModulesPerDDL = 12}; // number of modules in each DDL | |
c42b9ed0 | 80 | enum {kCalHeadLenMax = 16}; // maximum number of calib header words |
d9edae7b | 81 | enum ESPDRawStreamError { |
82 | kCalHeaderLengthErr = 1, | |
83 | kDDLNumberErr = 2, | |
84 | kEventNumberErr = 3, | |
85 | kChipAddrErr = 4, | |
86 | kStaveNumberErr = 5, | |
87 | kNumbHitsErr = 6, | |
88 | kWrongWordErr = 7, | |
89 | kHalfStaveStatusErr = 8 | |
90 | }; | |
2906f4c2 | 91 | |
92 | private : | |
93 | static const Int_t fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL]; // mapping DDL/module -> module number | |
94 | ||
c42b9ed0 | 95 | Bool_t ReadNextShort(); |
96 | Bool_t ReadNextInt(); | |
97 | void NewEvent(); | |
98 | ||
99 | Int_t fEventNumber; // chip event counter | |
100 | UShort_t fChipAddr; // chip nr | |
101 | UShort_t fHalfStaveNr; // half stave nr | |
102 | UInt_t fCol; // chip column nr | |
103 | UInt_t fRow; // chip row nr | |
104 | UInt_t fCalHeadWord[kCalHeadLenMax]; // calibration header words | |
2906f4c2 | 105 | |
c42b9ed0 | 106 | UShort_t fData; // 16 bit data word read |
107 | UInt_t fOffset; // offset for cell column | |
108 | UInt_t fHitCount; // counter of hits | |
72600597 | 109 | UChar_t fDataChar1, fDataChar2, fDataChar3, fDataChar4; // temps part of a 32bit word |
c42b9ed0 | 110 | Bool_t fFirstWord; // keeps track of which of the two 16bit words out of the 32bit word to read when ReadNextShort is called |
111 | Bool_t fCalHeadRead[20]; // calibration header read flags (reset at new event) | |
112 | UInt_t fPrevEventId; // previous event id (needed to know if there is a new event) | |
72600597 | 113 | |
2906f4c2 | 114 | ClassDef(AliITSRawStreamSPD, 0) // class for reading ITS SPD raw digits |
115 | }; | |
116 | ||
117 | #endif |